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 |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 361 | #define _loop0_128_type 1283 |
| 362 | #define _loop0_129_type 1284 |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 363 | #define _tmp_130_type 1285 |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 364 | #define _tmp_131_type 1286 |
| 365 | #define _loop0_132_type 1287 |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 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 |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 379 | #define _tmp_146_type 1301 |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 380 | #define _tmp_147_type 1302 |
| 381 | #define _tmp_148_type 1303 |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 382 | #define _loop1_149_type 1304 |
| 383 | #define _tmp_150_type 1305 |
| 384 | #define _tmp_151_type 1306 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 385 | |
| 386 | static mod_ty file_rule(Parser *p); |
| 387 | static mod_ty interactive_rule(Parser *p); |
| 388 | static mod_ty eval_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 389 | static mod_ty func_type_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 390 | static expr_ty fstring_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 391 | static asdl_seq* type_expressions_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 392 | static asdl_seq* statements_rule(Parser *p); |
| 393 | static asdl_seq* statement_rule(Parser *p); |
| 394 | static asdl_seq* statement_newline_rule(Parser *p); |
| 395 | static asdl_seq* simple_stmt_rule(Parser *p); |
| 396 | static stmt_ty small_stmt_rule(Parser *p); |
| 397 | static stmt_ty compound_stmt_rule(Parser *p); |
Lysandros Nikolaou | 999ec9a | 2020-05-06 21:11:04 +0300 | [diff] [blame] | 398 | static stmt_ty assignment_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 399 | static AugOperator* augassign_rule(Parser *p); |
| 400 | static stmt_ty global_stmt_rule(Parser *p); |
| 401 | static stmt_ty nonlocal_stmt_rule(Parser *p); |
| 402 | static stmt_ty yield_stmt_rule(Parser *p); |
| 403 | static stmt_ty assert_stmt_rule(Parser *p); |
| 404 | static stmt_ty del_stmt_rule(Parser *p); |
| 405 | static stmt_ty import_stmt_rule(Parser *p); |
| 406 | static stmt_ty import_name_rule(Parser *p); |
| 407 | static stmt_ty import_from_rule(Parser *p); |
| 408 | static asdl_seq* import_from_targets_rule(Parser *p); |
| 409 | static asdl_seq* import_from_as_names_rule(Parser *p); |
| 410 | static alias_ty import_from_as_name_rule(Parser *p); |
| 411 | static asdl_seq* dotted_as_names_rule(Parser *p); |
| 412 | static alias_ty dotted_as_name_rule(Parser *p); |
| 413 | static expr_ty dotted_name_rule(Parser *p); |
| 414 | static stmt_ty if_stmt_rule(Parser *p); |
| 415 | static stmt_ty elif_stmt_rule(Parser *p); |
| 416 | static asdl_seq* else_block_rule(Parser *p); |
| 417 | static stmt_ty while_stmt_rule(Parser *p); |
| 418 | static stmt_ty for_stmt_rule(Parser *p); |
| 419 | static stmt_ty with_stmt_rule(Parser *p); |
| 420 | static withitem_ty with_item_rule(Parser *p); |
| 421 | static stmt_ty try_stmt_rule(Parser *p); |
| 422 | static excepthandler_ty except_block_rule(Parser *p); |
| 423 | static asdl_seq* finally_block_rule(Parser *p); |
| 424 | static stmt_ty return_stmt_rule(Parser *p); |
| 425 | static stmt_ty raise_stmt_rule(Parser *p); |
| 426 | static stmt_ty function_def_rule(Parser *p); |
| 427 | static stmt_ty function_def_raw_rule(Parser *p); |
Pablo Galindo | d955241 | 2020-05-01 16:32:09 +0100 | [diff] [blame] | 428 | static Token* func_type_comment_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 429 | static arguments_ty params_rule(Parser *p); |
| 430 | static arguments_ty parameters_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 431 | static asdl_seq* slash_no_default_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 432 | static SlashWithDefault* slash_with_default_rule(Parser *p); |
| 433 | static StarEtc* star_etc_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 434 | static arg_ty kwds_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 435 | static arg_ty param_no_default_rule(Parser *p); |
| 436 | static NameDefaultPair* param_with_default_rule(Parser *p); |
| 437 | static NameDefaultPair* param_maybe_default_rule(Parser *p); |
| 438 | static arg_ty param_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 439 | static expr_ty annotation_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 440 | static expr_ty default_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 441 | static asdl_seq* decorators_rule(Parser *p); |
| 442 | static stmt_ty class_def_rule(Parser *p); |
| 443 | static stmt_ty class_def_raw_rule(Parser *p); |
| 444 | static asdl_seq* block_rule(Parser *p); |
| 445 | static asdl_seq* expressions_list_rule(Parser *p); |
| 446 | static expr_ty star_expressions_rule(Parser *p); |
| 447 | static expr_ty star_expression_rule(Parser *p); |
| 448 | static asdl_seq* star_named_expressions_rule(Parser *p); |
| 449 | static expr_ty star_named_expression_rule(Parser *p); |
| 450 | static expr_ty named_expression_rule(Parser *p); |
| 451 | static expr_ty annotated_rhs_rule(Parser *p); |
| 452 | static expr_ty expressions_rule(Parser *p); |
| 453 | static expr_ty expression_rule(Parser *p); |
| 454 | static expr_ty lambdef_rule(Parser *p); |
| 455 | static arguments_ty lambda_parameters_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 456 | static asdl_seq* lambda_slash_no_default_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 457 | static SlashWithDefault* lambda_slash_with_default_rule(Parser *p); |
| 458 | static StarEtc* lambda_star_etc_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 459 | static arg_ty lambda_kwds_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 460 | static arg_ty lambda_param_no_default_rule(Parser *p); |
| 461 | static NameDefaultPair* lambda_param_with_default_rule(Parser *p); |
| 462 | static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p); |
| 463 | static arg_ty lambda_param_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 464 | static expr_ty disjunction_rule(Parser *p); |
| 465 | static expr_ty conjunction_rule(Parser *p); |
| 466 | static expr_ty inversion_rule(Parser *p); |
| 467 | static expr_ty comparison_rule(Parser *p); |
| 468 | static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p); |
| 469 | static CmpopExprPair* eq_bitwise_or_rule(Parser *p); |
| 470 | static CmpopExprPair* noteq_bitwise_or_rule(Parser *p); |
| 471 | static CmpopExprPair* lte_bitwise_or_rule(Parser *p); |
| 472 | static CmpopExprPair* lt_bitwise_or_rule(Parser *p); |
| 473 | static CmpopExprPair* gte_bitwise_or_rule(Parser *p); |
| 474 | static CmpopExprPair* gt_bitwise_or_rule(Parser *p); |
| 475 | static CmpopExprPair* notin_bitwise_or_rule(Parser *p); |
| 476 | static CmpopExprPair* in_bitwise_or_rule(Parser *p); |
| 477 | static CmpopExprPair* isnot_bitwise_or_rule(Parser *p); |
| 478 | static CmpopExprPair* is_bitwise_or_rule(Parser *p); |
| 479 | static expr_ty bitwise_or_rule(Parser *p); |
| 480 | static expr_ty bitwise_xor_rule(Parser *p); |
| 481 | static expr_ty bitwise_and_rule(Parser *p); |
| 482 | static expr_ty shift_expr_rule(Parser *p); |
| 483 | static expr_ty sum_rule(Parser *p); |
| 484 | static expr_ty term_rule(Parser *p); |
| 485 | static expr_ty factor_rule(Parser *p); |
| 486 | static expr_ty power_rule(Parser *p); |
| 487 | static expr_ty await_primary_rule(Parser *p); |
| 488 | static expr_ty primary_rule(Parser *p); |
| 489 | static expr_ty slices_rule(Parser *p); |
| 490 | static expr_ty slice_rule(Parser *p); |
| 491 | static expr_ty atom_rule(Parser *p); |
| 492 | static expr_ty strings_rule(Parser *p); |
| 493 | static expr_ty list_rule(Parser *p); |
| 494 | static expr_ty listcomp_rule(Parser *p); |
| 495 | static expr_ty tuple_rule(Parser *p); |
| 496 | static expr_ty group_rule(Parser *p); |
| 497 | static expr_ty genexp_rule(Parser *p); |
| 498 | static expr_ty set_rule(Parser *p); |
| 499 | static expr_ty setcomp_rule(Parser *p); |
| 500 | static expr_ty dict_rule(Parser *p); |
| 501 | static expr_ty dictcomp_rule(Parser *p); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 502 | static asdl_seq* double_starred_kvpairs_rule(Parser *p); |
| 503 | static KeyValuePair* double_starred_kvpair_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 504 | static KeyValuePair* kvpair_rule(Parser *p); |
| 505 | static asdl_seq* for_if_clauses_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 506 | static comprehension_ty for_if_clause_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 507 | static expr_ty yield_expr_rule(Parser *p); |
| 508 | static expr_ty arguments_rule(Parser *p); |
| 509 | static expr_ty args_rule(Parser *p); |
| 510 | static asdl_seq* kwargs_rule(Parser *p); |
| 511 | static expr_ty starred_expression_rule(Parser *p); |
| 512 | static KeywordOrStarred* kwarg_or_starred_rule(Parser *p); |
| 513 | static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p); |
| 514 | static expr_ty star_targets_rule(Parser *p); |
| 515 | static asdl_seq* star_targets_seq_rule(Parser *p); |
| 516 | static expr_ty star_target_rule(Parser *p); |
| 517 | static expr_ty star_atom_rule(Parser *p); |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 518 | static expr_ty single_target_rule(Parser *p); |
| 519 | static expr_ty single_subscript_attribute_target_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 520 | static asdl_seq* del_targets_rule(Parser *p); |
| 521 | static expr_ty del_target_rule(Parser *p); |
| 522 | static expr_ty del_t_atom_rule(Parser *p); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 523 | static void *del_target_end_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 524 | static asdl_seq* targets_rule(Parser *p); |
| 525 | static expr_ty target_rule(Parser *p); |
| 526 | static expr_ty t_primary_rule(Parser *p); |
| 527 | static void *t_lookahead_rule(Parser *p); |
| 528 | static expr_ty t_atom_rule(Parser *p); |
| 529 | static void *incorrect_arguments_rule(Parser *p); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 530 | static void *invalid_kwarg_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 531 | static void *invalid_named_expression_rule(Parser *p); |
| 532 | static void *invalid_assignment_rule(Parser *p); |
| 533 | static void *invalid_block_rule(Parser *p); |
| 534 | static void *invalid_comprehension_rule(Parser *p); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 535 | static void *invalid_dict_comprehension_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 536 | static void *invalid_parameters_rule(Parser *p); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 537 | static void *invalid_star_etc_rule(Parser *p); |
| 538 | static void *invalid_lambda_star_etc_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 539 | static void *invalid_double_type_comments_rule(Parser *p); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 540 | static void *invalid_del_target_rule(Parser *p); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 541 | static void *invalid_import_from_targets_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 542 | static asdl_seq *_loop0_1_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 543 | static asdl_seq *_loop0_2_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 544 | static asdl_seq *_loop0_4_rule(Parser *p); |
| 545 | static asdl_seq *_gather_3_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 546 | static asdl_seq *_loop0_6_rule(Parser *p); |
| 547 | static asdl_seq *_gather_5_rule(Parser *p); |
| 548 | static asdl_seq *_loop0_8_rule(Parser *p); |
| 549 | static asdl_seq *_gather_7_rule(Parser *p); |
| 550 | static asdl_seq *_loop0_10_rule(Parser *p); |
| 551 | static asdl_seq *_gather_9_rule(Parser *p); |
| 552 | static asdl_seq *_loop1_11_rule(Parser *p); |
| 553 | static asdl_seq *_loop0_13_rule(Parser *p); |
| 554 | static asdl_seq *_gather_12_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 555 | static void *_tmp_14_rule(Parser *p); |
| 556 | static void *_tmp_15_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 557 | static void *_tmp_16_rule(Parser *p); |
| 558 | static void *_tmp_17_rule(Parser *p); |
| 559 | static void *_tmp_18_rule(Parser *p); |
| 560 | static void *_tmp_19_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 561 | static void *_tmp_20_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 562 | static void *_tmp_21_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 563 | static asdl_seq *_loop1_22_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 564 | static void *_tmp_23_rule(Parser *p); |
| 565 | static void *_tmp_24_rule(Parser *p); |
| 566 | static asdl_seq *_loop0_26_rule(Parser *p); |
| 567 | static asdl_seq *_gather_25_rule(Parser *p); |
| 568 | static asdl_seq *_loop0_28_rule(Parser *p); |
| 569 | static asdl_seq *_gather_27_rule(Parser *p); |
| 570 | static void *_tmp_29_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 571 | static asdl_seq *_loop0_30_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 572 | static asdl_seq *_loop1_31_rule(Parser *p); |
| 573 | static asdl_seq *_loop0_33_rule(Parser *p); |
| 574 | static asdl_seq *_gather_32_rule(Parser *p); |
| 575 | static void *_tmp_34_rule(Parser *p); |
| 576 | static asdl_seq *_loop0_36_rule(Parser *p); |
| 577 | static asdl_seq *_gather_35_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 578 | static void *_tmp_37_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 579 | static asdl_seq *_loop0_39_rule(Parser *p); |
| 580 | static asdl_seq *_gather_38_rule(Parser *p); |
| 581 | static asdl_seq *_loop0_41_rule(Parser *p); |
| 582 | static asdl_seq *_gather_40_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 583 | static asdl_seq *_loop0_43_rule(Parser *p); |
| 584 | static asdl_seq *_gather_42_rule(Parser *p); |
| 585 | static asdl_seq *_loop0_45_rule(Parser *p); |
| 586 | static asdl_seq *_gather_44_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 587 | static void *_tmp_46_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 588 | static asdl_seq *_loop1_47_rule(Parser *p); |
| 589 | static void *_tmp_48_rule(Parser *p); |
| 590 | static void *_tmp_49_rule(Parser *p); |
| 591 | static void *_tmp_50_rule(Parser *p); |
| 592 | static void *_tmp_51_rule(Parser *p); |
| 593 | static void *_tmp_52_rule(Parser *p); |
| 594 | static asdl_seq *_loop0_53_rule(Parser *p); |
| 595 | static asdl_seq *_loop0_54_rule(Parser *p); |
| 596 | static asdl_seq *_loop0_55_rule(Parser *p); |
| 597 | static asdl_seq *_loop1_56_rule(Parser *p); |
| 598 | static asdl_seq *_loop0_57_rule(Parser *p); |
| 599 | static asdl_seq *_loop1_58_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 600 | static asdl_seq *_loop1_59_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 601 | static asdl_seq *_loop1_60_rule(Parser *p); |
| 602 | static asdl_seq *_loop0_61_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 603 | static asdl_seq *_loop1_62_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 604 | static asdl_seq *_loop0_63_rule(Parser *p); |
| 605 | static asdl_seq *_loop1_64_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 606 | static asdl_seq *_loop0_65_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 607 | static asdl_seq *_loop1_66_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 608 | static asdl_seq *_loop1_67_rule(Parser *p); |
| 609 | static void *_tmp_68_rule(Parser *p); |
| 610 | static asdl_seq *_loop0_70_rule(Parser *p); |
| 611 | static asdl_seq *_gather_69_rule(Parser *p); |
| 612 | static asdl_seq *_loop1_71_rule(Parser *p); |
| 613 | static asdl_seq *_loop0_73_rule(Parser *p); |
| 614 | static asdl_seq *_gather_72_rule(Parser *p); |
| 615 | static asdl_seq *_loop1_74_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 616 | static asdl_seq *_loop0_75_rule(Parser *p); |
| 617 | static asdl_seq *_loop0_76_rule(Parser *p); |
| 618 | static asdl_seq *_loop0_77_rule(Parser *p); |
| 619 | static asdl_seq *_loop1_78_rule(Parser *p); |
| 620 | static asdl_seq *_loop0_79_rule(Parser *p); |
| 621 | static asdl_seq *_loop1_80_rule(Parser *p); |
| 622 | static asdl_seq *_loop1_81_rule(Parser *p); |
| 623 | static asdl_seq *_loop1_82_rule(Parser *p); |
| 624 | static asdl_seq *_loop0_83_rule(Parser *p); |
| 625 | static asdl_seq *_loop1_84_rule(Parser *p); |
| 626 | static asdl_seq *_loop0_85_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 627 | static asdl_seq *_loop1_86_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 628 | static asdl_seq *_loop0_87_rule(Parser *p); |
| 629 | static asdl_seq *_loop1_88_rule(Parser *p); |
| 630 | static asdl_seq *_loop1_89_rule(Parser *p); |
| 631 | static asdl_seq *_loop1_90_rule(Parser *p); |
| 632 | static asdl_seq *_loop1_91_rule(Parser *p); |
| 633 | static void *_tmp_92_rule(Parser *p); |
| 634 | static asdl_seq *_loop0_94_rule(Parser *p); |
| 635 | static asdl_seq *_gather_93_rule(Parser *p); |
| 636 | static void *_tmp_95_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 637 | static void *_tmp_96_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 638 | static void *_tmp_97_rule(Parser *p); |
| 639 | static void *_tmp_98_rule(Parser *p); |
| 640 | static asdl_seq *_loop1_99_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 641 | static void *_tmp_100_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 642 | static void *_tmp_101_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 643 | static asdl_seq *_loop0_103_rule(Parser *p); |
| 644 | static asdl_seq *_gather_102_rule(Parser *p); |
| 645 | static asdl_seq *_loop1_104_rule(Parser *p); |
| 646 | static asdl_seq *_loop0_105_rule(Parser *p); |
| 647 | static asdl_seq *_loop0_106_rule(Parser *p); |
| 648 | static void *_tmp_107_rule(Parser *p); |
| 649 | static void *_tmp_108_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 650 | static asdl_seq *_loop0_110_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 651 | static asdl_seq *_gather_109_rule(Parser *p); |
| 652 | static asdl_seq *_loop0_112_rule(Parser *p); |
| 653 | static asdl_seq *_gather_111_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 654 | static asdl_seq *_loop0_114_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 655 | static asdl_seq *_gather_113_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 656 | static asdl_seq *_loop0_116_rule(Parser *p); |
| 657 | static asdl_seq *_gather_115_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 658 | static asdl_seq *_loop0_117_rule(Parser *p); |
| 659 | static asdl_seq *_loop0_119_rule(Parser *p); |
| 660 | static asdl_seq *_gather_118_rule(Parser *p); |
| 661 | static void *_tmp_120_rule(Parser *p); |
| 662 | static asdl_seq *_loop0_122_rule(Parser *p); |
| 663 | static asdl_seq *_gather_121_rule(Parser *p); |
| 664 | static asdl_seq *_loop0_124_rule(Parser *p); |
| 665 | static asdl_seq *_gather_123_rule(Parser *p); |
| 666 | static void *_tmp_125_rule(Parser *p); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 667 | static asdl_seq *_loop0_126_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 668 | static void *_tmp_127_rule(Parser *p); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 669 | static asdl_seq *_loop0_128_rule(Parser *p); |
| 670 | static asdl_seq *_loop0_129_rule(Parser *p); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 671 | static void *_tmp_130_rule(Parser *p); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 672 | static void *_tmp_131_rule(Parser *p); |
| 673 | static asdl_seq *_loop0_132_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 674 | static void *_tmp_133_rule(Parser *p); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 675 | static void *_tmp_134_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 676 | static void *_tmp_135_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 677 | static void *_tmp_136_rule(Parser *p); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 678 | static void *_tmp_137_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 679 | static void *_tmp_138_rule(Parser *p); |
| 680 | static void *_tmp_139_rule(Parser *p); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 681 | static void *_tmp_140_rule(Parser *p); |
| 682 | static void *_tmp_141_rule(Parser *p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 683 | static void *_tmp_142_rule(Parser *p); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 684 | static void *_tmp_143_rule(Parser *p); |
| 685 | static void *_tmp_144_rule(Parser *p); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 686 | static void *_tmp_145_rule(Parser *p); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 687 | static void *_tmp_146_rule(Parser *p); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 688 | static void *_tmp_147_rule(Parser *p); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 689 | static void *_tmp_148_rule(Parser *p); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 690 | static asdl_seq *_loop1_149_rule(Parser *p); |
| 691 | static void *_tmp_150_rule(Parser *p); |
| 692 | static void *_tmp_151_rule(Parser *p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 693 | |
| 694 | |
| 695 | // file: statements? $ |
| 696 | static mod_ty |
| 697 | file_rule(Parser *p) |
| 698 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 699 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 700 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 701 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 702 | return NULL; |
| 703 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 704 | mod_ty _res = NULL; |
| 705 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 706 | { // statements? $ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 707 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 708 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 709 | return NULL; |
| 710 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 711 | 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] | 712 | void *a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 713 | Token * endmarker_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 714 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 715 | (a = statements_rule(p), 1) // statements? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 716 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 717 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 718 | ) |
| 719 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 720 | 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] | 721 | _res = _PyPegen_make_module ( p , a ); |
| 722 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 723 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 724 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 725 | return NULL; |
| 726 | } |
| 727 | goto done; |
| 728 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 729 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 730 | D(fprintf(stderr, "%*c%s file[%d-%d]: %s failed!\n", p->level, ' ', |
| 731 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statements? $")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 732 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 733 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 734 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 735 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 736 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | // interactive: statement_newline |
| 740 | static mod_ty |
| 741 | interactive_rule(Parser *p) |
| 742 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 743 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 744 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 745 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 746 | return NULL; |
| 747 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 748 | mod_ty _res = NULL; |
| 749 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 750 | { // statement_newline |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 751 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 752 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 753 | return NULL; |
| 754 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 755 | 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] | 756 | asdl_seq* a; |
| 757 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 758 | (a = statement_newline_rule(p)) // statement_newline |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 759 | ) |
| 760 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 761 | 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] | 762 | _res = Interactive ( a , p -> arena ); |
| 763 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 764 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 765 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 766 | return NULL; |
| 767 | } |
| 768 | goto done; |
| 769 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 770 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 771 | D(fprintf(stderr, "%*c%s interactive[%d-%d]: %s failed!\n", p->level, ' ', |
| 772 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement_newline")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 773 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 774 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 775 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 776 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 777 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 778 | } |
| 779 | |
| 780 | // eval: expressions NEWLINE* $ |
| 781 | static mod_ty |
| 782 | eval_rule(Parser *p) |
| 783 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 784 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 785 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 786 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 787 | return NULL; |
| 788 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 789 | mod_ty _res = NULL; |
| 790 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 791 | { // expressions NEWLINE* $ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 792 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 793 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 794 | return NULL; |
| 795 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 796 | 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] | 797 | asdl_seq * _loop0_1_var; |
| 798 | expr_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 799 | Token * endmarker_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 800 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 801 | (a = expressions_rule(p)) // expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 802 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 803 | (_loop0_1_var = _loop0_1_rule(p)) // NEWLINE* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 804 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 805 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 806 | ) |
| 807 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 808 | 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] | 809 | _res = Expression ( a , p -> arena ); |
| 810 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 811 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 812 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 813 | return NULL; |
| 814 | } |
| 815 | goto done; |
| 816 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 817 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 818 | D(fprintf(stderr, "%*c%s eval[%d-%d]: %s failed!\n", p->level, ' ', |
| 819 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions NEWLINE* $")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 820 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 821 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 822 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 823 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 824 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 825 | } |
| 826 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 827 | // func_type: '(' type_expressions? ')' '->' expression NEWLINE* $ |
| 828 | static mod_ty |
| 829 | func_type_rule(Parser *p) |
| 830 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 831 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 832 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 833 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 834 | return NULL; |
| 835 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 836 | mod_ty _res = NULL; |
| 837 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 838 | { // '(' type_expressions? ')' '->' expression NEWLINE* $ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 839 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 840 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 841 | return NULL; |
| 842 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 843 | 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] | 844 | Token * _literal; |
| 845 | Token * _literal_1; |
| 846 | Token * _literal_2; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 847 | asdl_seq * _loop0_2_var; |
| 848 | void *a; |
| 849 | expr_ty b; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 850 | Token * endmarker_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 851 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 852 | (_literal = _PyPegen_expect_token(p, 7)) // 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 | (a = type_expressions_rule(p), 1) // type_expressions? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 855 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 856 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 857 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 858 | (_literal_2 = _PyPegen_expect_token(p, 51)) // token='->' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 859 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 860 | (b = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 861 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 862 | (_loop0_2_var = _loop0_2_rule(p)) // NEWLINE* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 863 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 864 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 865 | ) |
| 866 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 867 | 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] | 868 | _res = FunctionType ( a , b , p -> arena ); |
| 869 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 870 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 871 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 872 | return NULL; |
| 873 | } |
| 874 | goto done; |
| 875 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 876 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 877 | D(fprintf(stderr, "%*c%s func_type[%d-%d]: %s failed!\n", p->level, ' ', |
| 878 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' type_expressions? ')' '->' expression NEWLINE* $")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 879 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 880 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 881 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 882 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 883 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 884 | } |
| 885 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 886 | // fstring: star_expressions |
| 887 | static expr_ty |
| 888 | fstring_rule(Parser *p) |
| 889 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 890 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 891 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 892 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 893 | return NULL; |
| 894 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 895 | expr_ty _res = NULL; |
| 896 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 897 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 898 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 899 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 900 | return NULL; |
| 901 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 902 | 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] | 903 | expr_ty star_expressions_var; |
| 904 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 905 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 906 | ) |
| 907 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 908 | 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] | 909 | _res = star_expressions_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 910 | goto done; |
| 911 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 912 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 913 | D(fprintf(stderr, "%*c%s fstring[%d-%d]: %s failed!\n", p->level, ' ', |
| 914 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 915 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 916 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 917 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 918 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 919 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 920 | } |
| 921 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 922 | // type_expressions: |
| 923 | // | ','.expression+ ',' '*' expression ',' '**' expression |
| 924 | // | ','.expression+ ',' '*' expression |
| 925 | // | ','.expression+ ',' '**' expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 926 | // | '*' expression ',' '**' expression |
| 927 | // | '*' expression |
| 928 | // | '**' expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 929 | // | ','.expression+ |
| 930 | static asdl_seq* |
| 931 | type_expressions_rule(Parser *p) |
| 932 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 933 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 934 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 935 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 936 | return NULL; |
| 937 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 938 | asdl_seq* _res = NULL; |
| 939 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 940 | { // ','.expression+ ',' '*' expression ',' '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 941 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 942 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 943 | return NULL; |
| 944 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 945 | 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] | 946 | Token * _literal; |
| 947 | Token * _literal_1; |
| 948 | Token * _literal_2; |
| 949 | Token * _literal_3; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 950 | asdl_seq * a; |
| 951 | expr_ty b; |
| 952 | expr_ty c; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 953 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 954 | (a = _gather_3_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 = _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_1 = _PyPegen_expect_token(p, 16)) // 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 | (b = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 961 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 962 | (_literal_2 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 963 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 964 | (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 965 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 966 | (c = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 967 | ) |
| 968 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 969 | 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] | 970 | _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c ); |
| 971 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 972 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 973 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 974 | return NULL; |
| 975 | } |
| 976 | goto done; |
| 977 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 978 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 979 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 980 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 981 | } |
| 982 | { // ','.expression+ ',' '*' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 983 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 984 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 985 | return NULL; |
| 986 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 987 | 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] | 988 | Token * _literal; |
| 989 | Token * _literal_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 990 | asdl_seq * a; |
| 991 | expr_ty b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 992 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 993 | (a = _gather_5_rule(p)) // ','.expression+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 994 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 995 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 996 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 997 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 998 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 999 | (b = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1000 | ) |
| 1001 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1002 | 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] | 1003 | _res = _PyPegen_seq_append_to_end ( p , a , b ); |
| 1004 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1005 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1006 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1007 | return NULL; |
| 1008 | } |
| 1009 | goto done; |
| 1010 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1011 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1012 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1013 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1014 | } |
| 1015 | { // ','.expression+ ',' '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1016 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1017 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1018 | return NULL; |
| 1019 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1020 | 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] | 1021 | Token * _literal; |
| 1022 | Token * _literal_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1023 | asdl_seq * a; |
| 1024 | expr_ty b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1025 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1026 | (a = _gather_7_rule(p)) // ','.expression+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1027 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1028 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1029 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1030 | (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1031 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1032 | (b = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1033 | ) |
| 1034 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1035 | 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] | 1036 | _res = _PyPegen_seq_append_to_end ( p , a , b ); |
| 1037 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1038 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1039 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1040 | return NULL; |
| 1041 | } |
| 1042 | goto done; |
| 1043 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1044 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1045 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1046 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1047 | } |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1048 | { // '*' expression ',' '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1049 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1050 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1051 | return NULL; |
| 1052 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1053 | 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] | 1054 | Token * _literal; |
| 1055 | Token * _literal_1; |
| 1056 | Token * _literal_2; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1057 | expr_ty a; |
| 1058 | expr_ty b; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1059 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1060 | (_literal = _PyPegen_expect_token(p, 16)) // 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 | (a = expression_rule(p)) // expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1063 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1064 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1065 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1066 | (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**' |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1067 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1068 | (b = expression_rule(p)) // expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1069 | ) |
| 1070 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1071 | 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] | 1072 | _res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b ); |
| 1073 | if (_res == NULL && PyErr_Occurred()) { |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1074 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1075 | D(p->level--); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1076 | return NULL; |
| 1077 | } |
| 1078 | goto done; |
| 1079 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1080 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1081 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1082 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression")); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1083 | } |
| 1084 | { // '*' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1085 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1086 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1087 | return NULL; |
| 1088 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1089 | 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] | 1090 | Token * _literal; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1091 | expr_ty a; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1092 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1093 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1094 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1095 | (a = expression_rule(p)) // expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1096 | ) |
| 1097 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1098 | 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] | 1099 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1100 | if (_res == NULL && PyErr_Occurred()) { |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1101 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1102 | D(p->level--); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1103 | return NULL; |
| 1104 | } |
| 1105 | goto done; |
| 1106 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1107 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1108 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1109 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1110 | } |
| 1111 | { // '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1112 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1113 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1114 | return NULL; |
| 1115 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1116 | 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] | 1117 | Token * _literal; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1118 | expr_ty a; |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1119 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1120 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1121 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1122 | (a = expression_rule(p)) // expression |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1123 | ) |
| 1124 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1125 | 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] | 1126 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1127 | if (_res == NULL && PyErr_Occurred()) { |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1128 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1129 | D(p->level--); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1130 | return NULL; |
| 1131 | } |
| 1132 | goto done; |
| 1133 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1134 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1135 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1136 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
Shantanu | 603d354 | 2020-05-03 22:08:14 -0700 | [diff] [blame] | 1137 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1138 | { // ','.expression+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1139 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1140 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1141 | return NULL; |
| 1142 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1143 | 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] | 1144 | asdl_seq * _gather_9_var; |
| 1145 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1146 | (_gather_9_var = _gather_9_rule(p)) // ','.expression+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1147 | ) |
| 1148 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1149 | 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] | 1150 | _res = _gather_9_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1151 | goto done; |
| 1152 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1153 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1154 | D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 1155 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1156 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1157 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1158 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1159 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1160 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1161 | } |
| 1162 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1163 | // statements: statement+ |
| 1164 | static asdl_seq* |
| 1165 | statements_rule(Parser *p) |
| 1166 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1167 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1168 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1169 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1170 | return NULL; |
| 1171 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1172 | asdl_seq* _res = NULL; |
| 1173 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1174 | { // statement+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1175 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1176 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1177 | return NULL; |
| 1178 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1179 | 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] | 1180 | asdl_seq * a; |
| 1181 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1182 | (a = _loop1_11_rule(p)) // statement+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1183 | ) |
| 1184 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1185 | 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] | 1186 | _res = _PyPegen_seq_flatten ( p , a ); |
| 1187 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1188 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1189 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1190 | return NULL; |
| 1191 | } |
| 1192 | goto done; |
| 1193 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1194 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1195 | D(fprintf(stderr, "%*c%s statements[%d-%d]: %s failed!\n", p->level, ' ', |
| 1196 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1197 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1198 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1199 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1200 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1201 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1202 | } |
| 1203 | |
| 1204 | // statement: compound_stmt | simple_stmt |
| 1205 | static asdl_seq* |
| 1206 | statement_rule(Parser *p) |
| 1207 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1208 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1209 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1210 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1211 | return NULL; |
| 1212 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1213 | asdl_seq* _res = NULL; |
| 1214 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1215 | { // compound_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1216 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1217 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1218 | return NULL; |
| 1219 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1220 | 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] | 1221 | stmt_ty a; |
| 1222 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1223 | (a = compound_stmt_rule(p)) // compound_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1224 | ) |
| 1225 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1226 | 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] | 1227 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1228 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1229 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1230 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1231 | return NULL; |
| 1232 | } |
| 1233 | goto done; |
| 1234 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1235 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1236 | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', |
| 1237 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1238 | } |
| 1239 | { // simple_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1240 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1241 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1242 | return NULL; |
| 1243 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1244 | 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] | 1245 | asdl_seq* simple_stmt_var; |
| 1246 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1247 | (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1248 | ) |
| 1249 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1250 | 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] | 1251 | _res = simple_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1252 | goto done; |
| 1253 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1254 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1255 | D(fprintf(stderr, "%*c%s statement[%d-%d]: %s failed!\n", p->level, ' ', |
| 1256 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1257 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1258 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1259 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1260 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1261 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1262 | } |
| 1263 | |
| 1264 | // statement_newline: compound_stmt NEWLINE | simple_stmt | NEWLINE | $ |
| 1265 | static asdl_seq* |
| 1266 | statement_newline_rule(Parser *p) |
| 1267 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1268 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1269 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1270 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1271 | return NULL; |
| 1272 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1273 | asdl_seq* _res = NULL; |
| 1274 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1275 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 1276 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1277 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1278 | return NULL; |
| 1279 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1280 | int _start_lineno = p->tokens[_mark]->lineno; |
| 1281 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 1282 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 1283 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1284 | { // compound_stmt NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1285 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1286 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1287 | return NULL; |
| 1288 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1289 | 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] | 1290 | stmt_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 1291 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1292 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1293 | (a = compound_stmt_rule(p)) // compound_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1294 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1295 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1296 | ) |
| 1297 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1298 | 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] | 1299 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1300 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1301 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1302 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1303 | return NULL; |
| 1304 | } |
| 1305 | goto done; |
| 1306 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1307 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1308 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1309 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compound_stmt NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1310 | } |
| 1311 | { // simple_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1312 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1313 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1314 | return NULL; |
| 1315 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1316 | 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] | 1317 | asdl_seq* simple_stmt_var; |
| 1318 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1319 | (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1320 | ) |
| 1321 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1322 | 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] | 1323 | _res = simple_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1324 | goto done; |
| 1325 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1326 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1327 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1328 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1329 | } |
| 1330 | { // NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1331 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1332 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1333 | return NULL; |
| 1334 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1335 | 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] | 1336 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1337 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1338 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1339 | ) |
| 1340 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1341 | 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] | 1342 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1343 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1344 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1345 | return NULL; |
| 1346 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1347 | int _end_lineno = _token->end_lineno; |
| 1348 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1349 | int _end_col_offset = _token->end_col_offset; |
| 1350 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1351 | _res = _PyPegen_singleton_seq ( p , CHECK ( _Py_Pass ( EXTRA ) ) ); |
| 1352 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1353 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1354 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1355 | return NULL; |
| 1356 | } |
| 1357 | goto done; |
| 1358 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1359 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1360 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1361 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1362 | } |
| 1363 | { // $ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1364 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1365 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1366 | return NULL; |
| 1367 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1368 | 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] | 1369 | Token * endmarker_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1370 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1371 | (endmarker_var = _PyPegen_expect_token(p, ENDMARKER)) // token='ENDMARKER' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1372 | ) |
| 1373 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1374 | 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] | 1375 | _res = _PyPegen_interactive_exit ( p ); |
| 1376 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1377 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1378 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1379 | return NULL; |
| 1380 | } |
| 1381 | goto done; |
| 1382 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1383 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1384 | D(fprintf(stderr, "%*c%s statement_newline[%d-%d]: %s failed!\n", p->level, ' ', |
| 1385 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "$")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1386 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1387 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1388 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1389 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1390 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1391 | } |
| 1392 | |
| 1393 | // simple_stmt: small_stmt !';' NEWLINE | ';'.small_stmt+ ';'? NEWLINE |
| 1394 | static asdl_seq* |
| 1395 | simple_stmt_rule(Parser *p) |
| 1396 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1397 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1398 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1399 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1400 | return NULL; |
| 1401 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1402 | asdl_seq* _res = NULL; |
| 1403 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1404 | { // small_stmt !';' NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1405 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1406 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1407 | return NULL; |
| 1408 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1409 | 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] | 1410 | stmt_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 1411 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1412 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1413 | (a = small_stmt_rule(p)) // small_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1414 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1415 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 13) // token=';' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1416 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1417 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1418 | ) |
| 1419 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1420 | 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] | 1421 | _res = _PyPegen_singleton_seq ( p , a ); |
| 1422 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1423 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1424 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1425 | return NULL; |
| 1426 | } |
| 1427 | goto done; |
| 1428 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1429 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1430 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1431 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt !';' NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1432 | } |
| 1433 | { // ';'.small_stmt+ ';'? NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1434 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1435 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1436 | return NULL; |
| 1437 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1438 | 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] | 1439 | void *_opt_var; |
| 1440 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1441 | asdl_seq * a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 1442 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1443 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1444 | (a = _gather_12_rule(p)) // ';'.small_stmt+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1445 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1446 | (_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1447 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1448 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1449 | ) |
| 1450 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1451 | 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] | 1452 | _res = a; |
| 1453 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1454 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1455 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1456 | return NULL; |
| 1457 | } |
| 1458 | goto done; |
| 1459 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1460 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1461 | D(fprintf(stderr, "%*c%s simple_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1462 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'.small_stmt+ ';'? NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1463 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1464 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1465 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1466 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1467 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1468 | } |
| 1469 | |
| 1470 | // small_stmt: |
| 1471 | // | assignment |
| 1472 | // | star_expressions |
| 1473 | // | &'return' return_stmt |
| 1474 | // | &('import' | 'from') import_stmt |
| 1475 | // | &'raise' raise_stmt |
| 1476 | // | 'pass' |
| 1477 | // | &'del' del_stmt |
| 1478 | // | &'yield' yield_stmt |
| 1479 | // | &'assert' assert_stmt |
| 1480 | // | 'break' |
| 1481 | // | 'continue' |
| 1482 | // | &'global' global_stmt |
| 1483 | // | &'nonlocal' nonlocal_stmt |
| 1484 | static stmt_ty |
| 1485 | small_stmt_rule(Parser *p) |
| 1486 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1487 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1488 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1489 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1490 | return NULL; |
| 1491 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1492 | stmt_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1493 | if (_PyPegen_is_memoized(p, small_stmt_type, &_res)) { |
| 1494 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1495 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1496 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1497 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1498 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 1499 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1500 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1501 | return NULL; |
| 1502 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1503 | int _start_lineno = p->tokens[_mark]->lineno; |
| 1504 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 1505 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 1506 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1507 | { // assignment |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1508 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1509 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1510 | return NULL; |
| 1511 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1512 | 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] | 1513 | stmt_ty assignment_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1514 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1515 | (assignment_var = assignment_rule(p)) // assignment |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1516 | ) |
| 1517 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1518 | 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] | 1519 | _res = assignment_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1520 | goto done; |
| 1521 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1522 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1523 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1524 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1525 | } |
| 1526 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1527 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1528 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1529 | return NULL; |
| 1530 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1531 | 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] | 1532 | expr_ty e; |
| 1533 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1534 | (e = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1535 | ) |
| 1536 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1537 | 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] | 1538 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1539 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1540 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1541 | return NULL; |
| 1542 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1543 | int _end_lineno = _token->end_lineno; |
| 1544 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1545 | int _end_col_offset = _token->end_col_offset; |
| 1546 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1547 | _res = _Py_Expr ( e , EXTRA ); |
| 1548 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1549 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1550 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1551 | return NULL; |
| 1552 | } |
| 1553 | goto done; |
| 1554 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1555 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1556 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1557 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1558 | } |
| 1559 | { // &'return' return_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1560 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1561 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1562 | return NULL; |
| 1563 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1564 | 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] | 1565 | stmt_ty return_stmt_var; |
| 1566 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1567 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 500) // token='return' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1568 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1569 | (return_stmt_var = return_stmt_rule(p)) // return_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1570 | ) |
| 1571 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1572 | 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] | 1573 | _res = return_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1574 | goto done; |
| 1575 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1576 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1577 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1578 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'return' return_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1579 | } |
| 1580 | { // &('import' | 'from') import_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1581 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1582 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1583 | return NULL; |
| 1584 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1585 | 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] | 1586 | stmt_ty import_stmt_var; |
| 1587 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1588 | _PyPegen_lookahead(1, _tmp_14_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1589 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1590 | (import_stmt_var = import_stmt_rule(p)) // import_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1591 | ) |
| 1592 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1593 | 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] | 1594 | _res = import_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1595 | goto done; |
| 1596 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1597 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1598 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1599 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('import' | 'from') import_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1600 | } |
| 1601 | { // &'raise' raise_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1602 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1603 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1604 | return NULL; |
| 1605 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1606 | 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] | 1607 | stmt_ty raise_stmt_var; |
| 1608 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1609 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 501) // token='raise' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1610 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1611 | (raise_stmt_var = raise_stmt_rule(p)) // raise_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1612 | ) |
| 1613 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1614 | 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] | 1615 | _res = raise_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1616 | goto done; |
| 1617 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1618 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1619 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1620 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'raise' raise_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1621 | } |
| 1622 | { // 'pass' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1623 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1624 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1625 | return NULL; |
| 1626 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1627 | 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] | 1628 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1629 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1630 | (_keyword = _PyPegen_expect_token(p, 502)) // token='pass' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1631 | ) |
| 1632 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1633 | 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] | 1634 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1635 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1636 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1637 | return NULL; |
| 1638 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1639 | int _end_lineno = _token->end_lineno; |
| 1640 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1641 | int _end_col_offset = _token->end_col_offset; |
| 1642 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1643 | _res = _Py_Pass ( EXTRA ); |
| 1644 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1645 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1646 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1647 | return NULL; |
| 1648 | } |
| 1649 | goto done; |
| 1650 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1651 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1652 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1653 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'pass'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1654 | } |
| 1655 | { // &'del' del_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1656 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1657 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1658 | return NULL; |
| 1659 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1660 | 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] | 1661 | stmt_ty del_stmt_var; |
| 1662 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1663 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 503) // token='del' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1664 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1665 | (del_stmt_var = del_stmt_rule(p)) // del_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1666 | ) |
| 1667 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1668 | 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] | 1669 | _res = del_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1670 | goto done; |
| 1671 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1672 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1673 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1674 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'del' del_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1675 | } |
| 1676 | { // &'yield' yield_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1677 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1678 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1679 | return NULL; |
| 1680 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1681 | 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] | 1682 | stmt_ty yield_stmt_var; |
| 1683 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1684 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 504) // token='yield' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1685 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1686 | (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1687 | ) |
| 1688 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1689 | 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] | 1690 | _res = yield_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1691 | goto done; |
| 1692 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1693 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1694 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1695 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'yield' yield_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1696 | } |
| 1697 | { // &'assert' assert_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1698 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1699 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1700 | return NULL; |
| 1701 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1702 | 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] | 1703 | stmt_ty assert_stmt_var; |
| 1704 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1705 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 505) // token='assert' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1706 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1707 | (assert_stmt_var = assert_stmt_rule(p)) // assert_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1708 | ) |
| 1709 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1710 | 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] | 1711 | _res = assert_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1712 | goto done; |
| 1713 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1714 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1715 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1716 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'assert' assert_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1717 | } |
| 1718 | { // 'break' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1719 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1720 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1721 | return NULL; |
| 1722 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1723 | 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] | 1724 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1725 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1726 | (_keyword = _PyPegen_expect_token(p, 506)) // token='break' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1727 | ) |
| 1728 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1729 | 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] | 1730 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1731 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1732 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1733 | return NULL; |
| 1734 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1735 | int _end_lineno = _token->end_lineno; |
| 1736 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1737 | int _end_col_offset = _token->end_col_offset; |
| 1738 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1739 | _res = _Py_Break ( EXTRA ); |
| 1740 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1741 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1742 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1743 | return NULL; |
| 1744 | } |
| 1745 | goto done; |
| 1746 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1747 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1748 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1749 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'break'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1750 | } |
| 1751 | { // 'continue' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1752 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1753 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1754 | return NULL; |
| 1755 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1756 | 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] | 1757 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1758 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1759 | (_keyword = _PyPegen_expect_token(p, 507)) // token='continue' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1760 | ) |
| 1761 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1762 | 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] | 1763 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 1764 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1765 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1766 | return NULL; |
| 1767 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1768 | int _end_lineno = _token->end_lineno; |
| 1769 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 1770 | int _end_col_offset = _token->end_col_offset; |
| 1771 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 1772 | _res = _Py_Continue ( EXTRA ); |
| 1773 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1774 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1775 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1776 | return NULL; |
| 1777 | } |
| 1778 | goto done; |
| 1779 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1780 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1781 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1782 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'continue'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1783 | } |
| 1784 | { // &'global' global_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1785 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1786 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1787 | return NULL; |
| 1788 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1789 | 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] | 1790 | stmt_ty global_stmt_var; |
| 1791 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1792 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 508) // token='global' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1793 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1794 | (global_stmt_var = global_stmt_rule(p)) // global_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1795 | ) |
| 1796 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1797 | 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] | 1798 | _res = global_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1799 | goto done; |
| 1800 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1801 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1802 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1803 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'global' global_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1804 | } |
| 1805 | { // &'nonlocal' nonlocal_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1806 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1807 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1808 | return NULL; |
| 1809 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1810 | 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] | 1811 | stmt_ty nonlocal_stmt_var; |
| 1812 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1813 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 509) // token='nonlocal' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1814 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1815 | (nonlocal_stmt_var = nonlocal_stmt_rule(p)) // nonlocal_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1816 | ) |
| 1817 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1818 | 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] | 1819 | _res = nonlocal_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1820 | goto done; |
| 1821 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1822 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1823 | D(fprintf(stderr, "%*c%s small_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1824 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'nonlocal' nonlocal_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1825 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1826 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1827 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1828 | _PyPegen_insert_memo(p, _mark, small_stmt_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1829 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1830 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1831 | } |
| 1832 | |
| 1833 | // compound_stmt: |
| 1834 | // | &('def' | '@' | ASYNC) function_def |
| 1835 | // | &'if' if_stmt |
| 1836 | // | &('class' | '@') class_def |
| 1837 | // | &('with' | ASYNC) with_stmt |
| 1838 | // | &('for' | ASYNC) for_stmt |
| 1839 | // | &'try' try_stmt |
| 1840 | // | &'while' while_stmt |
| 1841 | static stmt_ty |
| 1842 | compound_stmt_rule(Parser *p) |
| 1843 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1844 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1845 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1846 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1847 | return NULL; |
| 1848 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1849 | stmt_ty _res = NULL; |
| 1850 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1851 | { // &('def' | '@' | ASYNC) function_def |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1852 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1853 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1854 | return NULL; |
| 1855 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1856 | 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] | 1857 | stmt_ty function_def_var; |
| 1858 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1859 | _PyPegen_lookahead(1, _tmp_15_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1860 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1861 | (function_def_var = function_def_rule(p)) // function_def |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1862 | ) |
| 1863 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1864 | 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] | 1865 | _res = function_def_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1866 | goto done; |
| 1867 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1868 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1869 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1870 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('def' | '@' | ASYNC) function_def")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1871 | } |
| 1872 | { // &'if' if_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1873 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1874 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1875 | return NULL; |
| 1876 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1877 | 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] | 1878 | stmt_ty if_stmt_var; |
| 1879 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1880 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 510) // token='if' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1881 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1882 | (if_stmt_var = if_stmt_rule(p)) // if_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1883 | ) |
| 1884 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1885 | 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] | 1886 | _res = if_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1887 | goto done; |
| 1888 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1889 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1890 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1891 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'if' if_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1892 | } |
| 1893 | { // &('class' | '@') class_def |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1894 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1895 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1896 | return NULL; |
| 1897 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1898 | 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] | 1899 | stmt_ty class_def_var; |
| 1900 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1901 | _PyPegen_lookahead(1, _tmp_16_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1902 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1903 | (class_def_var = class_def_rule(p)) // class_def |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1904 | ) |
| 1905 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1906 | 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] | 1907 | _res = class_def_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1908 | goto done; |
| 1909 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1910 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1911 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1912 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('class' | '@') class_def")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1913 | } |
| 1914 | { // &('with' | ASYNC) with_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1915 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1916 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1917 | return NULL; |
| 1918 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1919 | 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] | 1920 | stmt_ty with_stmt_var; |
| 1921 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1922 | _PyPegen_lookahead(1, _tmp_17_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1923 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1924 | (with_stmt_var = with_stmt_rule(p)) // with_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1925 | ) |
| 1926 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1927 | 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] | 1928 | _res = with_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1929 | goto done; |
| 1930 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1931 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1932 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1933 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('with' | ASYNC) with_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1934 | } |
| 1935 | { // &('for' | ASYNC) for_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1936 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1937 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1938 | return NULL; |
| 1939 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1940 | 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] | 1941 | stmt_ty for_stmt_var; |
| 1942 | if ( |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 1943 | _PyPegen_lookahead(1, _tmp_18_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1944 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1945 | (for_stmt_var = for_stmt_rule(p)) // for_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1946 | ) |
| 1947 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1948 | 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] | 1949 | _res = for_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1950 | goto done; |
| 1951 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1952 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1953 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1954 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&('for' | ASYNC) for_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1955 | } |
| 1956 | { // &'try' try_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1957 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1958 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1959 | return NULL; |
| 1960 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1961 | 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] | 1962 | stmt_ty try_stmt_var; |
| 1963 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1964 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 511) // token='try' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1965 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1966 | (try_stmt_var = try_stmt_rule(p)) // try_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1967 | ) |
| 1968 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1969 | 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] | 1970 | _res = try_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1971 | goto done; |
| 1972 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1973 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1974 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1975 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'try' try_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1976 | } |
| 1977 | { // &'while' while_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1978 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1979 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 1980 | return NULL; |
| 1981 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1982 | 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] | 1983 | stmt_ty while_stmt_var; |
| 1984 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1985 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 512) // token='while' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1986 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 1987 | (while_stmt_var = while_stmt_rule(p)) // while_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1988 | ) |
| 1989 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1990 | 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] | 1991 | _res = while_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1992 | goto done; |
| 1993 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1994 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 1995 | D(fprintf(stderr, "%*c%s compound_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 1996 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'while' while_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1997 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 1998 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 1999 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2000 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2001 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2002 | } |
| 2003 | |
| 2004 | // assignment: |
| 2005 | // | NAME ':' expression ['=' annotated_rhs] |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2006 | // | ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 2007 | // | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT? |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2008 | // | single_target augassign (yield_expr | star_expressions) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2009 | // | invalid_assignment |
Lysandros Nikolaou | 999ec9a | 2020-05-06 21:11:04 +0300 | [diff] [blame] | 2010 | static stmt_ty |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2011 | assignment_rule(Parser *p) |
| 2012 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2013 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2014 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2015 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2016 | return NULL; |
| 2017 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2018 | stmt_ty _res = NULL; |
| 2019 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2020 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2021 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2022 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2023 | return NULL; |
| 2024 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2025 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2026 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2027 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2028 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2029 | { // NAME ':' expression ['=' annotated_rhs] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2030 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2031 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2032 | return NULL; |
| 2033 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2034 | 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] | 2035 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2036 | expr_ty a; |
| 2037 | expr_ty b; |
| 2038 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2039 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2040 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2041 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2042 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2043 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2044 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2045 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2046 | (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2047 | ) |
| 2048 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2049 | 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] | 2050 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2051 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2052 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2053 | return NULL; |
| 2054 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2055 | int _end_lineno = _token->end_lineno; |
| 2056 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2057 | int _end_col_offset = _token->end_col_offset; |
| 2058 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2059 | _res = CHECK_VERSION ( 6 , "Variable annotation syntax is" , _Py_AnnAssign ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , c , 1 , EXTRA ) ); |
| 2060 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2061 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2062 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2063 | return NULL; |
| 2064 | } |
| 2065 | goto done; |
| 2066 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2067 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2068 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2069 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2070 | } |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2071 | { // ('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2072 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2073 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2074 | return NULL; |
| 2075 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2076 | 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] | 2077 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2078 | void *a; |
| 2079 | expr_ty b; |
| 2080 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2081 | if ( |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2082 | (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2083 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2084 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2085 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2086 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2087 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2088 | (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2089 | ) |
| 2090 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2091 | 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] | 2092 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2093 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2094 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2095 | return NULL; |
| 2096 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2097 | int _end_lineno = _token->end_lineno; |
| 2098 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2099 | int _end_col_offset = _token->end_col_offset; |
| 2100 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2101 | _res = CHECK_VERSION ( 6 , "Variable annotations syntax is" , _Py_AnnAssign ( a , b , c , 0 , EXTRA ) ); |
| 2102 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2103 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2104 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2105 | return NULL; |
| 2106 | } |
| 2107 | goto done; |
| 2108 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2109 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2110 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2111 | 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] | 2112 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 2113 | { // ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2114 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2115 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2116 | return NULL; |
| 2117 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 2118 | 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] | 2119 | asdl_seq * a; |
| 2120 | void *b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 2121 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2122 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2123 | (a = _loop1_22_rule(p)) // ((star_targets '='))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2124 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2125 | (b = _tmp_23_rule(p)) // yield_expr | star_expressions |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 2126 | && |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 2127 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' |
| 2128 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2129 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2130 | ) |
| 2131 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 2132 | 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] | 2133 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2134 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2135 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2136 | return NULL; |
| 2137 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2138 | int _end_lineno = _token->end_lineno; |
| 2139 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2140 | int _end_col_offset = _token->end_col_offset; |
| 2141 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2142 | _res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 2143 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2144 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2145 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2146 | return NULL; |
| 2147 | } |
| 2148 | goto done; |
| 2149 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2150 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2151 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 2152 | 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] | 2153 | } |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2154 | { // single_target augassign (yield_expr | star_expressions) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2155 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2156 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2157 | return NULL; |
| 2158 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2159 | 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] | 2160 | expr_ty a; |
| 2161 | AugOperator* b; |
| 2162 | void *c; |
| 2163 | if ( |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 2164 | (a = single_target_rule(p)) // single_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2165 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2166 | (b = augassign_rule(p)) // augassign |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2167 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2168 | (c = _tmp_24_rule(p)) // yield_expr | star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2169 | ) |
| 2170 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2171 | 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] | 2172 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2173 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2174 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2175 | return NULL; |
| 2176 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2177 | int _end_lineno = _token->end_lineno; |
| 2178 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2179 | int _end_col_offset = _token->end_col_offset; |
| 2180 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2181 | _res = _Py_AugAssign ( a , b -> kind , c , EXTRA ); |
| 2182 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2183 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2184 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2185 | return NULL; |
| 2186 | } |
| 2187 | goto done; |
| 2188 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2189 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2190 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2191 | 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] | 2192 | } |
| 2193 | { // invalid_assignment |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2194 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2195 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2196 | return NULL; |
| 2197 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2198 | 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] | 2199 | void *invalid_assignment_var; |
| 2200 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2201 | (invalid_assignment_var = invalid_assignment_rule(p)) // invalid_assignment |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2202 | ) |
| 2203 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2204 | 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] | 2205 | _res = invalid_assignment_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2206 | goto done; |
| 2207 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2208 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2209 | D(fprintf(stderr, "%*c%s assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 2210 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_assignment")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2211 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2212 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2213 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2214 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2215 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2216 | } |
| 2217 | |
| 2218 | // augassign: |
| 2219 | // | '+=' |
| 2220 | // | '-=' |
| 2221 | // | '*=' |
| 2222 | // | '@=' |
| 2223 | // | '/=' |
| 2224 | // | '%=' |
| 2225 | // | '&=' |
| 2226 | // | '|=' |
| 2227 | // | '^=' |
| 2228 | // | '<<=' |
| 2229 | // | '>>=' |
| 2230 | // | '**=' |
| 2231 | // | '//=' |
| 2232 | static AugOperator* |
| 2233 | augassign_rule(Parser *p) |
| 2234 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2235 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2236 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2237 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2238 | return NULL; |
| 2239 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2240 | AugOperator* _res = NULL; |
| 2241 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2242 | { // '+=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2243 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2244 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2245 | return NULL; |
| 2246 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2247 | 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] | 2248 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2249 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2250 | (_literal = _PyPegen_expect_token(p, 36)) // token='+=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2251 | ) |
| 2252 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2253 | 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] | 2254 | _res = _PyPegen_augoperator ( p , Add ); |
| 2255 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2256 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2257 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2258 | return NULL; |
| 2259 | } |
| 2260 | goto done; |
| 2261 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2262 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2263 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2264 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2265 | } |
| 2266 | { // '-=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2267 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2268 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2269 | return NULL; |
| 2270 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2271 | 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] | 2272 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2273 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2274 | (_literal = _PyPegen_expect_token(p, 37)) // token='-=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2275 | ) |
| 2276 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2277 | 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] | 2278 | _res = _PyPegen_augoperator ( p , Sub ); |
| 2279 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2280 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2281 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2282 | return NULL; |
| 2283 | } |
| 2284 | goto done; |
| 2285 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2286 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2287 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2288 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2289 | } |
| 2290 | { // '*=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2291 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2292 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2293 | return NULL; |
| 2294 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2295 | 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] | 2296 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2297 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2298 | (_literal = _PyPegen_expect_token(p, 38)) // token='*=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2299 | ) |
| 2300 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2301 | 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] | 2302 | _res = _PyPegen_augoperator ( p , Mult ); |
| 2303 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2304 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2305 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2306 | return NULL; |
| 2307 | } |
| 2308 | goto done; |
| 2309 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2310 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2311 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2312 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2313 | } |
| 2314 | { // '@=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2315 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2316 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2317 | return NULL; |
| 2318 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2319 | 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] | 2320 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2321 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2322 | (_literal = _PyPegen_expect_token(p, 50)) // token='@=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2323 | ) |
| 2324 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2325 | 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] | 2326 | _res = CHECK_VERSION ( 5 , "The '@' operator is" , _PyPegen_augoperator ( p , MatMult ) ); |
| 2327 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2328 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2329 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2330 | return NULL; |
| 2331 | } |
| 2332 | goto done; |
| 2333 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2334 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2335 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2336 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2337 | } |
| 2338 | { // '/=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2339 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2340 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2341 | return NULL; |
| 2342 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2343 | 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] | 2344 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2345 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2346 | (_literal = _PyPegen_expect_token(p, 39)) // token='/=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2347 | ) |
| 2348 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2349 | 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] | 2350 | _res = _PyPegen_augoperator ( p , Div ); |
| 2351 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2352 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2353 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2354 | return NULL; |
| 2355 | } |
| 2356 | goto done; |
| 2357 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2358 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2359 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2360 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'/='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2361 | } |
| 2362 | { // '%=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2363 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2364 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2365 | return NULL; |
| 2366 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2367 | 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] | 2368 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2369 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2370 | (_literal = _PyPegen_expect_token(p, 40)) // token='%=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2371 | ) |
| 2372 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2373 | 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] | 2374 | _res = _PyPegen_augoperator ( p , Mod ); |
| 2375 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2376 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2377 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2378 | return NULL; |
| 2379 | } |
| 2380 | goto done; |
| 2381 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2382 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2383 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2384 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'%='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2385 | } |
| 2386 | { // '&=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2387 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2388 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2389 | return NULL; |
| 2390 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2391 | 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] | 2392 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2393 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2394 | (_literal = _PyPegen_expect_token(p, 41)) // token='&=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2395 | ) |
| 2396 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2397 | 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] | 2398 | _res = _PyPegen_augoperator ( p , BitAnd ); |
| 2399 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2400 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2401 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2402 | return NULL; |
| 2403 | } |
| 2404 | goto done; |
| 2405 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2406 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2407 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2408 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'&='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2409 | } |
| 2410 | { // '|=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2411 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2412 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2413 | return NULL; |
| 2414 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2415 | 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] | 2416 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2417 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2418 | (_literal = _PyPegen_expect_token(p, 42)) // token='|=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2419 | ) |
| 2420 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2421 | 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] | 2422 | _res = _PyPegen_augoperator ( p , BitOr ); |
| 2423 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2424 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2425 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2426 | return NULL; |
| 2427 | } |
| 2428 | goto done; |
| 2429 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2430 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2431 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2432 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2433 | } |
| 2434 | { // '^=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2435 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2436 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2437 | return NULL; |
| 2438 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2439 | 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] | 2440 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2441 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2442 | (_literal = _PyPegen_expect_token(p, 43)) // token='^=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2443 | ) |
| 2444 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2445 | 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] | 2446 | _res = _PyPegen_augoperator ( p , BitXor ); |
| 2447 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2448 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2449 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2450 | return NULL; |
| 2451 | } |
| 2452 | goto done; |
| 2453 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2454 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2455 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2456 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'^='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2457 | } |
| 2458 | { // '<<=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2459 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2460 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2461 | return NULL; |
| 2462 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2463 | 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] | 2464 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2465 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2466 | (_literal = _PyPegen_expect_token(p, 44)) // token='<<=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2467 | ) |
| 2468 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2469 | 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] | 2470 | _res = _PyPegen_augoperator ( p , LShift ); |
| 2471 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2472 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2473 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2474 | return NULL; |
| 2475 | } |
| 2476 | goto done; |
| 2477 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2478 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2479 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2480 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<<='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2481 | } |
| 2482 | { // '>>=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2483 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2484 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2485 | return NULL; |
| 2486 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2487 | 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] | 2488 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2489 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2490 | (_literal = _PyPegen_expect_token(p, 45)) // token='>>=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2491 | ) |
| 2492 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2493 | 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] | 2494 | _res = _PyPegen_augoperator ( p , RShift ); |
| 2495 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2496 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2497 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2498 | return NULL; |
| 2499 | } |
| 2500 | goto done; |
| 2501 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2502 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2503 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2504 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>>='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2505 | } |
| 2506 | { // '**=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2507 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2508 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2509 | return NULL; |
| 2510 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2511 | 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] | 2512 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2513 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2514 | (_literal = _PyPegen_expect_token(p, 46)) // token='**=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2515 | ) |
| 2516 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2517 | 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] | 2518 | _res = _PyPegen_augoperator ( p , Pow ); |
| 2519 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2520 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2521 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2522 | return NULL; |
| 2523 | } |
| 2524 | goto done; |
| 2525 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2526 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2527 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2528 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2529 | } |
| 2530 | { // '//=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2531 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2532 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2533 | return NULL; |
| 2534 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2535 | 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] | 2536 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2537 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2538 | (_literal = _PyPegen_expect_token(p, 48)) // token='//=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2539 | ) |
| 2540 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2541 | 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] | 2542 | _res = _PyPegen_augoperator ( p , FloorDiv ); |
| 2543 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2544 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2545 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2546 | return NULL; |
| 2547 | } |
| 2548 | goto done; |
| 2549 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2550 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2551 | D(fprintf(stderr, "%*c%s augassign[%d-%d]: %s failed!\n", p->level, ' ', |
| 2552 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'//='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2553 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2554 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2555 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2556 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2557 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2558 | } |
| 2559 | |
| 2560 | // global_stmt: 'global' ','.NAME+ |
| 2561 | static stmt_ty |
| 2562 | global_stmt_rule(Parser *p) |
| 2563 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2564 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2565 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2566 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2567 | return NULL; |
| 2568 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2569 | stmt_ty _res = NULL; |
| 2570 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2571 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2572 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2573 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2574 | return NULL; |
| 2575 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2576 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2577 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2578 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2579 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2580 | { // 'global' ','.NAME+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2581 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2582 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2583 | return NULL; |
| 2584 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2585 | 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] | 2586 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2587 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2588 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2589 | (_keyword = _PyPegen_expect_token(p, 508)) // token='global' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2590 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2591 | (a = _gather_25_rule(p)) // ','.NAME+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2592 | ) |
| 2593 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2594 | 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] | 2595 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2596 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2597 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2598 | return NULL; |
| 2599 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2600 | int _end_lineno = _token->end_lineno; |
| 2601 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2602 | int _end_col_offset = _token->end_col_offset; |
| 2603 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2604 | _res = _Py_Global ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
| 2605 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2606 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2607 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2608 | return NULL; |
| 2609 | } |
| 2610 | goto done; |
| 2611 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2612 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2613 | D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2614 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2615 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2616 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2617 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2618 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2619 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2620 | } |
| 2621 | |
| 2622 | // nonlocal_stmt: 'nonlocal' ','.NAME+ |
| 2623 | static stmt_ty |
| 2624 | nonlocal_stmt_rule(Parser *p) |
| 2625 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2626 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2627 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2628 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2629 | return NULL; |
| 2630 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2631 | stmt_ty _res = NULL; |
| 2632 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2633 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2634 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2635 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2636 | return NULL; |
| 2637 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2638 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2639 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2640 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2641 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2642 | { // 'nonlocal' ','.NAME+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2643 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2644 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2645 | return NULL; |
| 2646 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2647 | 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] | 2648 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2649 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2650 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2651 | (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2652 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2653 | (a = _gather_27_rule(p)) // ','.NAME+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2654 | ) |
| 2655 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2656 | 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] | 2657 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2658 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2659 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2660 | return NULL; |
| 2661 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2662 | int _end_lineno = _token->end_lineno; |
| 2663 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2664 | int _end_col_offset = _token->end_col_offset; |
| 2665 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2666 | _res = _Py_Nonlocal ( CHECK ( _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA ); |
| 2667 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2668 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2669 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2670 | return NULL; |
| 2671 | } |
| 2672 | goto done; |
| 2673 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2674 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2675 | D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2676 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2677 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2678 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2679 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2680 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2681 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2682 | } |
| 2683 | |
| 2684 | // yield_stmt: yield_expr |
| 2685 | static stmt_ty |
| 2686 | yield_stmt_rule(Parser *p) |
| 2687 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2688 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2689 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2690 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2691 | return NULL; |
| 2692 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2693 | stmt_ty _res = NULL; |
| 2694 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2695 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2696 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2697 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2698 | return NULL; |
| 2699 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2700 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2701 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2702 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2703 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2704 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2705 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2706 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2707 | return NULL; |
| 2708 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2709 | 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] | 2710 | expr_ty y; |
| 2711 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2712 | (y = yield_expr_rule(p)) // yield_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2713 | ) |
| 2714 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2715 | 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] | 2716 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2717 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2718 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2719 | return NULL; |
| 2720 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2721 | int _end_lineno = _token->end_lineno; |
| 2722 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2723 | int _end_col_offset = _token->end_col_offset; |
| 2724 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2725 | _res = _Py_Expr ( y , EXTRA ); |
| 2726 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2727 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2728 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2729 | return NULL; |
| 2730 | } |
| 2731 | goto done; |
| 2732 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2733 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2734 | D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2735 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2736 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2737 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2738 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2739 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2740 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2741 | } |
| 2742 | |
| 2743 | // assert_stmt: 'assert' expression [',' expression] |
| 2744 | static stmt_ty |
| 2745 | assert_stmt_rule(Parser *p) |
| 2746 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2747 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2748 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2749 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2750 | return NULL; |
| 2751 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2752 | stmt_ty _res = NULL; |
| 2753 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2754 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2755 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2756 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2757 | return NULL; |
| 2758 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2759 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2760 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2761 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2762 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2763 | { // 'assert' expression [',' expression] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2764 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2765 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2766 | return NULL; |
| 2767 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2768 | 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] | 2769 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2770 | expr_ty a; |
| 2771 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2772 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2773 | (_keyword = _PyPegen_expect_token(p, 505)) // token='assert' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2774 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2775 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2776 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2777 | (b = _tmp_29_rule(p), 1) // [',' expression] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2778 | ) |
| 2779 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2780 | 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] | 2781 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2782 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2783 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2784 | return NULL; |
| 2785 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2786 | int _end_lineno = _token->end_lineno; |
| 2787 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2788 | int _end_col_offset = _token->end_col_offset; |
| 2789 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2790 | _res = _Py_Assert ( a , b , EXTRA ); |
| 2791 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2792 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2793 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2794 | return NULL; |
| 2795 | } |
| 2796 | goto done; |
| 2797 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2798 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2799 | D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2800 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2801 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2802 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2803 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2804 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2805 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2806 | } |
| 2807 | |
| 2808 | // del_stmt: 'del' del_targets |
| 2809 | static stmt_ty |
| 2810 | del_stmt_rule(Parser *p) |
| 2811 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2812 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2813 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2814 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2815 | return NULL; |
| 2816 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2817 | stmt_ty _res = NULL; |
| 2818 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2819 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2820 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2821 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2822 | return NULL; |
| 2823 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2824 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2825 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2826 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2827 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2828 | { // 'del' del_targets |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2829 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2830 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2831 | return NULL; |
| 2832 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2833 | 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] | 2834 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2835 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2836 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2837 | (_keyword = _PyPegen_expect_token(p, 503)) // token='del' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2838 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2839 | (a = del_targets_rule(p)) // del_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2840 | ) |
| 2841 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2842 | 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] | 2843 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2844 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2845 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2846 | return NULL; |
| 2847 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2848 | int _end_lineno = _token->end_lineno; |
| 2849 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2850 | int _end_col_offset = _token->end_col_offset; |
| 2851 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2852 | _res = _Py_Delete ( a , EXTRA ); |
| 2853 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2854 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2855 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2856 | return NULL; |
| 2857 | } |
| 2858 | goto done; |
| 2859 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2860 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2861 | D(fprintf(stderr, "%*c%s del_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2862 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'del' del_targets")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2863 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2864 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2865 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2866 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2867 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2868 | } |
| 2869 | |
| 2870 | // import_stmt: import_name | import_from |
| 2871 | static stmt_ty |
| 2872 | import_stmt_rule(Parser *p) |
| 2873 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2874 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2875 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2876 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2877 | return NULL; |
| 2878 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2879 | stmt_ty _res = NULL; |
| 2880 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2881 | { // import_name |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2882 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2883 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2884 | return NULL; |
| 2885 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2886 | 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] | 2887 | stmt_ty import_name_var; |
| 2888 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2889 | (import_name_var = import_name_rule(p)) // import_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2890 | ) |
| 2891 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2892 | 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] | 2893 | _res = import_name_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2894 | goto done; |
| 2895 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2896 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2897 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2898 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_name")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2899 | } |
| 2900 | { // import_from |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2901 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2902 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2903 | return NULL; |
| 2904 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2905 | 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] | 2906 | stmt_ty import_from_var; |
| 2907 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2908 | (import_from_var = import_from_rule(p)) // import_from |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2909 | ) |
| 2910 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2911 | 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] | 2912 | _res = import_from_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2913 | goto done; |
| 2914 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2915 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2916 | D(fprintf(stderr, "%*c%s import_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 2917 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2918 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2919 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2920 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2921 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2922 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2923 | } |
| 2924 | |
| 2925 | // import_name: 'import' dotted_as_names |
| 2926 | static stmt_ty |
| 2927 | import_name_rule(Parser *p) |
| 2928 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2929 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2930 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2931 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2932 | return NULL; |
| 2933 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2934 | stmt_ty _res = NULL; |
| 2935 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2936 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 2937 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2938 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2939 | return NULL; |
| 2940 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2941 | int _start_lineno = p->tokens[_mark]->lineno; |
| 2942 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 2943 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 2944 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2945 | { // 'import' dotted_as_names |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2946 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2947 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 2948 | return NULL; |
| 2949 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2950 | 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] | 2951 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2952 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2953 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2954 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2955 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 2956 | (a = dotted_as_names_rule(p)) // dotted_as_names |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2957 | ) |
| 2958 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2959 | 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] | 2960 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 2961 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2962 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2963 | return NULL; |
| 2964 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2965 | int _end_lineno = _token->end_lineno; |
| 2966 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 2967 | int _end_col_offset = _token->end_col_offset; |
| 2968 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 2969 | _res = _Py_Import ( a , EXTRA ); |
| 2970 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2971 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2972 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2973 | return NULL; |
| 2974 | } |
| 2975 | goto done; |
| 2976 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2977 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2978 | D(fprintf(stderr, "%*c%s import_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 2979 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import' dotted_as_names")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2980 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2981 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2982 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2983 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2984 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2985 | } |
| 2986 | |
| 2987 | // import_from: |
| 2988 | // | 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
| 2989 | // | 'from' (('.' | '...'))+ 'import' import_from_targets |
| 2990 | static stmt_ty |
| 2991 | import_from_rule(Parser *p) |
| 2992 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2993 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2994 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 2995 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 2996 | return NULL; |
| 2997 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 2998 | stmt_ty _res = NULL; |
| 2999 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3000 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3001 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3002 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3003 | return NULL; |
| 3004 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3005 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3006 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3007 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3008 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3009 | { // 'from' (('.' | '...'))* dotted_name 'import' import_from_targets |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3010 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3011 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3012 | return NULL; |
| 3013 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3014 | 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] | 3015 | Token * _keyword; |
| 3016 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3017 | asdl_seq * a; |
| 3018 | expr_ty b; |
| 3019 | asdl_seq* c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3020 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3021 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3022 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3023 | (a = _loop0_30_rule(p)) // (('.' | '...'))* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3024 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3025 | (b = dotted_name_rule(p)) // dotted_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3026 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3027 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3028 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3029 | (c = import_from_targets_rule(p)) // import_from_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3030 | ) |
| 3031 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3032 | 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] | 3033 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3034 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3035 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3036 | return NULL; |
| 3037 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3038 | int _end_lineno = _token->end_lineno; |
| 3039 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3040 | int _end_col_offset = _token->end_col_offset; |
| 3041 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3042 | _res = _Py_ImportFrom ( b -> v . Name . id , c , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
| 3043 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3044 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3045 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3046 | return NULL; |
| 3047 | } |
| 3048 | goto done; |
| 3049 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3050 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3051 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
| 3052 | 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] | 3053 | } |
| 3054 | { // 'from' (('.' | '...'))+ 'import' import_from_targets |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3055 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3056 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3057 | return NULL; |
| 3058 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3059 | 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] | 3060 | Token * _keyword; |
| 3061 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3062 | asdl_seq * a; |
| 3063 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3064 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3065 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3066 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3067 | (a = _loop1_31_rule(p)) // (('.' | '...'))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3068 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3069 | (_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3070 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3071 | (b = import_from_targets_rule(p)) // import_from_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3072 | ) |
| 3073 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3074 | 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] | 3075 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3076 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3077 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3078 | return NULL; |
| 3079 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3080 | int _end_lineno = _token->end_lineno; |
| 3081 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3082 | int _end_col_offset = _token->end_col_offset; |
| 3083 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3084 | _res = _Py_ImportFrom ( NULL , b , _PyPegen_seq_count_dots ( a ) , EXTRA ); |
| 3085 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3086 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3087 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3088 | return NULL; |
| 3089 | } |
| 3090 | goto done; |
| 3091 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3092 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3093 | D(fprintf(stderr, "%*c%s import_from[%d-%d]: %s failed!\n", p->level, ' ', |
| 3094 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' (('.' | '...'))+ 'import' import_from_targets")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3095 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3096 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3097 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3098 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3099 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3100 | } |
| 3101 | |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3102 | // import_from_targets: |
| 3103 | // | '(' import_from_as_names ','? ')' |
| 3104 | // | import_from_as_names !',' |
| 3105 | // | '*' |
| 3106 | // | invalid_import_from_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3107 | static asdl_seq* |
| 3108 | import_from_targets_rule(Parser *p) |
| 3109 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3110 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3111 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3112 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3113 | return NULL; |
| 3114 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3115 | asdl_seq* _res = NULL; |
| 3116 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3117 | { // '(' import_from_as_names ','? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3118 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3119 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3120 | return NULL; |
| 3121 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3122 | 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] | 3123 | Token * _literal; |
| 3124 | Token * _literal_1; |
| 3125 | void *_opt_var; |
| 3126 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3127 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3128 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3129 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3130 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3131 | (a = import_from_as_names_rule(p)) // import_from_as_names |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3132 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3133 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3134 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3135 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3136 | ) |
| 3137 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3138 | 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] | 3139 | _res = a; |
| 3140 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3141 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3142 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3143 | return NULL; |
| 3144 | } |
| 3145 | goto done; |
| 3146 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3147 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3148 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3149 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' import_from_as_names ','? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3150 | } |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3151 | { // import_from_as_names !',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3152 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3153 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3154 | return NULL; |
| 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\n", p->level, ' ', _mark, p->mark, "import_from_as_names !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3157 | asdl_seq* import_from_as_names_var; |
| 3158 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3159 | (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] | 3160 | && |
| 3161 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3162 | ) |
| 3163 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3164 | 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] | 3165 | _res = import_from_as_names_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3166 | goto done; |
| 3167 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3168 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3169 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3170 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3171 | } |
| 3172 | { // '*' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3173 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3174 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3175 | return NULL; |
| 3176 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3177 | 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] | 3178 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3179 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3180 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3181 | ) |
| 3182 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3183 | 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] | 3184 | _res = _PyPegen_singleton_seq ( p , CHECK ( _PyPegen_alias_for_star ( p ) ) ); |
| 3185 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3186 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3187 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3188 | return NULL; |
| 3189 | } |
| 3190 | goto done; |
| 3191 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3192 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3193 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3194 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3195 | } |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3196 | { // invalid_import_from_targets |
| 3197 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3198 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3199 | return NULL; |
| 3200 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3201 | 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] | 3202 | void *invalid_import_from_targets_var; |
| 3203 | if ( |
| 3204 | (invalid_import_from_targets_var = invalid_import_from_targets_rule(p)) // invalid_import_from_targets |
| 3205 | ) |
| 3206 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3207 | 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] | 3208 | _res = invalid_import_from_targets_var; |
| 3209 | goto done; |
| 3210 | } |
| 3211 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3212 | D(fprintf(stderr, "%*c%s import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 3213 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_import_from_targets")); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 3214 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3215 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3216 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3217 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3218 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3219 | } |
| 3220 | |
| 3221 | // import_from_as_names: ','.import_from_as_name+ |
| 3222 | static asdl_seq* |
| 3223 | import_from_as_names_rule(Parser *p) |
| 3224 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3225 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3226 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3227 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3228 | return NULL; |
| 3229 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3230 | asdl_seq* _res = NULL; |
| 3231 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3232 | { // ','.import_from_as_name+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3233 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3234 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3235 | return NULL; |
| 3236 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3237 | 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] | 3238 | asdl_seq * a; |
| 3239 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3240 | (a = _gather_32_rule(p)) // ','.import_from_as_name+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3241 | ) |
| 3242 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3243 | 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] | 3244 | _res = a; |
| 3245 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3246 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3247 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3248 | return NULL; |
| 3249 | } |
| 3250 | goto done; |
| 3251 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3252 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3253 | D(fprintf(stderr, "%*c%s import_from_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
| 3254 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.import_from_as_name+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3255 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3256 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3257 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3258 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3259 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3260 | } |
| 3261 | |
| 3262 | // import_from_as_name: NAME ['as' NAME] |
| 3263 | static alias_ty |
| 3264 | import_from_as_name_rule(Parser *p) |
| 3265 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3266 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3267 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3268 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3269 | return NULL; |
| 3270 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3271 | alias_ty _res = NULL; |
| 3272 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3273 | { // NAME ['as' NAME] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3274 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3275 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3276 | return NULL; |
| 3277 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3278 | 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] | 3279 | expr_ty a; |
| 3280 | void *b; |
| 3281 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3282 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3283 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3284 | (b = _tmp_34_rule(p), 1) // ['as' NAME] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3285 | ) |
| 3286 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3287 | 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] | 3288 | _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena ); |
| 3289 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3290 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3291 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3292 | return NULL; |
| 3293 | } |
| 3294 | goto done; |
| 3295 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3296 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3297 | D(fprintf(stderr, "%*c%s import_from_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3298 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ['as' NAME]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3299 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3300 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3301 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3302 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3303 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3304 | } |
| 3305 | |
| 3306 | // dotted_as_names: ','.dotted_as_name+ |
| 3307 | static asdl_seq* |
| 3308 | dotted_as_names_rule(Parser *p) |
| 3309 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3310 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3311 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3312 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3313 | return NULL; |
| 3314 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3315 | asdl_seq* _res = NULL; |
| 3316 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3317 | { // ','.dotted_as_name+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3318 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3319 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3320 | return NULL; |
| 3321 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3322 | 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] | 3323 | asdl_seq * a; |
| 3324 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3325 | (a = _gather_35_rule(p)) // ','.dotted_as_name+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3326 | ) |
| 3327 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3328 | 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] | 3329 | _res = a; |
| 3330 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3331 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3332 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3333 | return NULL; |
| 3334 | } |
| 3335 | goto done; |
| 3336 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3337 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3338 | D(fprintf(stderr, "%*c%s dotted_as_names[%d-%d]: %s failed!\n", p->level, ' ', |
| 3339 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.dotted_as_name+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3340 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3341 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3342 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3343 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3344 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3345 | } |
| 3346 | |
| 3347 | // dotted_as_name: dotted_name ['as' NAME] |
| 3348 | static alias_ty |
| 3349 | dotted_as_name_rule(Parser *p) |
| 3350 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3351 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3352 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3353 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3354 | return NULL; |
| 3355 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3356 | alias_ty _res = NULL; |
| 3357 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3358 | { // dotted_name ['as' NAME] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3359 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3360 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3361 | return NULL; |
| 3362 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3363 | 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] | 3364 | expr_ty a; |
| 3365 | void *b; |
| 3366 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3367 | (a = dotted_name_rule(p)) // dotted_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3368 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3369 | (b = _tmp_37_rule(p), 1) // ['as' NAME] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3370 | ) |
| 3371 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3372 | 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] | 3373 | _res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena ); |
| 3374 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3375 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3376 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3377 | return NULL; |
| 3378 | } |
| 3379 | goto done; |
| 3380 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3381 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3382 | D(fprintf(stderr, "%*c%s dotted_as_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3383 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name ['as' NAME]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3384 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3385 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3386 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3387 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3388 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3389 | } |
| 3390 | |
| 3391 | // Left-recursive |
| 3392 | // dotted_name: dotted_name '.' NAME | NAME |
| 3393 | static expr_ty dotted_name_raw(Parser *); |
| 3394 | static expr_ty |
| 3395 | dotted_name_rule(Parser *p) |
| 3396 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3397 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3398 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3399 | if (_PyPegen_is_memoized(p, dotted_name_type, &_res)) { |
| 3400 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3401 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3402 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3403 | int _mark = p->mark; |
| 3404 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3405 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3406 | int tmpvar_0 = _PyPegen_update_memo(p, _mark, dotted_name_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3407 | if (tmpvar_0) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3408 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3409 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3410 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3411 | p->mark = _mark; |
| 3412 | void *_raw = dotted_name_raw(p); |
| 3413 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3414 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3415 | _resmark = p->mark; |
| 3416 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3417 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3418 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3419 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3420 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3421 | } |
| 3422 | static expr_ty |
| 3423 | dotted_name_raw(Parser *p) |
| 3424 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3425 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3426 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3427 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3428 | return NULL; |
| 3429 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3430 | expr_ty _res = NULL; |
| 3431 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3432 | { // dotted_name '.' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3433 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3434 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3435 | return NULL; |
| 3436 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3437 | 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] | 3438 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3439 | expr_ty a; |
| 3440 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3441 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3442 | (a = dotted_name_rule(p)) // dotted_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3443 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3444 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3445 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3446 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3447 | ) |
| 3448 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3449 | 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] | 3450 | _res = _PyPegen_join_names_with_dot ( p , a , b ); |
| 3451 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3452 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3453 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3454 | return NULL; |
| 3455 | } |
| 3456 | goto done; |
| 3457 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3458 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3459 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3460 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_name '.' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3461 | } |
| 3462 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3463 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3464 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3465 | return NULL; |
| 3466 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3467 | 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] | 3468 | expr_ty name_var; |
| 3469 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3470 | (name_var = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3471 | ) |
| 3472 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3473 | 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] | 3474 | _res = name_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3475 | goto done; |
| 3476 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3477 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3478 | D(fprintf(stderr, "%*c%s dotted_name[%d-%d]: %s failed!\n", p->level, ' ', |
| 3479 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3480 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3481 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3482 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3483 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3484 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3485 | } |
| 3486 | |
| 3487 | // if_stmt: |
| 3488 | // | 'if' named_expression ':' block elif_stmt |
| 3489 | // | 'if' named_expression ':' block else_block? |
| 3490 | static stmt_ty |
| 3491 | if_stmt_rule(Parser *p) |
| 3492 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3493 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3494 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3495 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3496 | return NULL; |
| 3497 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3498 | stmt_ty _res = NULL; |
| 3499 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3500 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3501 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3502 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3503 | return NULL; |
| 3504 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3505 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3506 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3507 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3508 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3509 | { // 'if' named_expression ':' block elif_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3510 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3511 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3512 | return NULL; |
| 3513 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3514 | 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] | 3515 | Token * _keyword; |
| 3516 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3517 | expr_ty a; |
| 3518 | asdl_seq* b; |
| 3519 | stmt_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3520 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3521 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3522 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3523 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3524 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3525 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3526 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3527 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3528 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3529 | (c = elif_stmt_rule(p)) // elif_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3530 | ) |
| 3531 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3532 | 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] | 3533 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3534 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3535 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3536 | return NULL; |
| 3537 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3538 | int _end_lineno = _token->end_lineno; |
| 3539 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3540 | int _end_col_offset = _token->end_col_offset; |
| 3541 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3542 | _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
| 3543 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3544 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3545 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3546 | return NULL; |
| 3547 | } |
| 3548 | goto done; |
| 3549 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3550 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3551 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3552 | 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] | 3553 | } |
| 3554 | { // 'if' named_expression ':' block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3555 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3556 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3557 | return NULL; |
| 3558 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3559 | 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] | 3560 | Token * _keyword; |
| 3561 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3562 | expr_ty a; |
| 3563 | asdl_seq* b; |
| 3564 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3565 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3566 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3567 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3568 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3569 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3570 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3571 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3572 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3573 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3574 | (c = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3575 | ) |
| 3576 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3577 | 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] | 3578 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3579 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3580 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3581 | return NULL; |
| 3582 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3583 | int _end_lineno = _token->end_lineno; |
| 3584 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3585 | int _end_col_offset = _token->end_col_offset; |
| 3586 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3587 | _res = _Py_If ( a , b , c , EXTRA ); |
| 3588 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3589 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3590 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3591 | return NULL; |
| 3592 | } |
| 3593 | goto done; |
| 3594 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3595 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3596 | D(fprintf(stderr, "%*c%s if_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3597 | 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] | 3598 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3599 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3600 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3601 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3602 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3603 | } |
| 3604 | |
| 3605 | // elif_stmt: |
| 3606 | // | 'elif' named_expression ':' block elif_stmt |
| 3607 | // | 'elif' named_expression ':' block else_block? |
| 3608 | static stmt_ty |
| 3609 | elif_stmt_rule(Parser *p) |
| 3610 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3611 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3612 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3613 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3614 | return NULL; |
| 3615 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3616 | stmt_ty _res = NULL; |
| 3617 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3618 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3619 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3620 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3621 | return NULL; |
| 3622 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3623 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3624 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3625 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3626 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3627 | { // 'elif' named_expression ':' block elif_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3628 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3629 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3630 | return NULL; |
| 3631 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3632 | 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] | 3633 | Token * _keyword; |
| 3634 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3635 | expr_ty a; |
| 3636 | asdl_seq* b; |
| 3637 | stmt_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3638 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3639 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3640 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3641 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3642 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3643 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3644 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3645 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3646 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3647 | (c = elif_stmt_rule(p)) // elif_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3648 | ) |
| 3649 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3650 | 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] | 3651 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3652 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3653 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3654 | return NULL; |
| 3655 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3656 | int _end_lineno = _token->end_lineno; |
| 3657 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3658 | int _end_col_offset = _token->end_col_offset; |
| 3659 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3660 | _res = _Py_If ( a , b , CHECK ( _PyPegen_singleton_seq ( p , c ) ) , EXTRA ); |
| 3661 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3662 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3663 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3664 | return NULL; |
| 3665 | } |
| 3666 | goto done; |
| 3667 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3668 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3669 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3670 | 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] | 3671 | } |
| 3672 | { // 'elif' named_expression ':' block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3673 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3674 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3675 | return NULL; |
| 3676 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3677 | 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] | 3678 | Token * _keyword; |
| 3679 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3680 | expr_ty a; |
| 3681 | asdl_seq* b; |
| 3682 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3683 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3684 | (_keyword = _PyPegen_expect_token(p, 515)) // token='elif' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3685 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3686 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3687 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3688 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3689 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3690 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3691 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3692 | (c = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3693 | ) |
| 3694 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3695 | 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] | 3696 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3697 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3698 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3699 | return NULL; |
| 3700 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3701 | int _end_lineno = _token->end_lineno; |
| 3702 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3703 | int _end_col_offset = _token->end_col_offset; |
| 3704 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3705 | _res = _Py_If ( a , b , c , EXTRA ); |
| 3706 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3707 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3708 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3709 | return NULL; |
| 3710 | } |
| 3711 | goto done; |
| 3712 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3713 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3714 | D(fprintf(stderr, "%*c%s elif_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3715 | 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] | 3716 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3717 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3718 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3719 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3720 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3721 | } |
| 3722 | |
| 3723 | // else_block: 'else' ':' block |
| 3724 | static asdl_seq* |
| 3725 | else_block_rule(Parser *p) |
| 3726 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3727 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3728 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3729 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3730 | return NULL; |
| 3731 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3732 | asdl_seq* _res = NULL; |
| 3733 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3734 | { // 'else' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3735 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3736 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3737 | return NULL; |
| 3738 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3739 | 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] | 3740 | Token * _keyword; |
| 3741 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3742 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3743 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3744 | (_keyword = _PyPegen_expect_token(p, 516)) // token='else' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3745 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3746 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3747 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3748 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3749 | ) |
| 3750 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3751 | 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] | 3752 | _res = b; |
| 3753 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3754 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3755 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3756 | return NULL; |
| 3757 | } |
| 3758 | goto done; |
| 3759 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3760 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3761 | D(fprintf(stderr, "%*c%s else_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 3762 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3763 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3764 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3765 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3766 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3767 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3768 | } |
| 3769 | |
| 3770 | // while_stmt: 'while' named_expression ':' block else_block? |
| 3771 | static stmt_ty |
| 3772 | while_stmt_rule(Parser *p) |
| 3773 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3774 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3775 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3776 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3777 | return NULL; |
| 3778 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3779 | stmt_ty _res = NULL; |
| 3780 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3781 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3782 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3783 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3784 | return NULL; |
| 3785 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3786 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3787 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3788 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3789 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3790 | { // 'while' named_expression ':' block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3791 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3792 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3793 | return NULL; |
| 3794 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3795 | 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] | 3796 | Token * _keyword; |
| 3797 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3798 | expr_ty a; |
| 3799 | asdl_seq* b; |
| 3800 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3801 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3802 | (_keyword = _PyPegen_expect_token(p, 512)) // token='while' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3803 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3804 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3805 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3806 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3807 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3808 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3809 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3810 | (c = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3811 | ) |
| 3812 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3813 | 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] | 3814 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3815 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3816 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3817 | return NULL; |
| 3818 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3819 | int _end_lineno = _token->end_lineno; |
| 3820 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3821 | int _end_col_offset = _token->end_col_offset; |
| 3822 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3823 | _res = _Py_While ( a , b , c , EXTRA ); |
| 3824 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3825 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3826 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3827 | return NULL; |
| 3828 | } |
| 3829 | goto done; |
| 3830 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3831 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3832 | D(fprintf(stderr, "%*c%s while_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3833 | 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] | 3834 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3835 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3836 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3837 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3838 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3839 | } |
| 3840 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 3841 | // for_stmt: |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3842 | // | 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block? |
| 3843 | // | ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3844 | static stmt_ty |
| 3845 | for_stmt_rule(Parser *p) |
| 3846 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3847 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3848 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3849 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3850 | return NULL; |
| 3851 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3852 | stmt_ty _res = NULL; |
| 3853 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3854 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3855 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3856 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3857 | return NULL; |
| 3858 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3859 | int _start_lineno = p->tokens[_mark]->lineno; |
| 3860 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 3861 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 3862 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3863 | { // 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3864 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3865 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3866 | return NULL; |
| 3867 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3868 | 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] | 3869 | Token * _keyword; |
| 3870 | Token * _keyword_1; |
| 3871 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3872 | asdl_seq* b; |
| 3873 | void *el; |
| 3874 | expr_ty ex; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3875 | expr_ty t; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 3876 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3877 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3878 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
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 | (t = star_targets_rule(p)) // star_targets |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3881 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3882 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
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 | (ex = star_expressions_rule(p)) // star_expressions |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3885 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3886 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3887 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3888 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3889 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3890 | (b = block_rule(p)) // block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3891 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3892 | (el = else_block_rule(p), 1) // else_block? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3893 | ) |
| 3894 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3895 | 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] | 3896 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3897 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3898 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3899 | return NULL; |
| 3900 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3901 | int _end_lineno = _token->end_lineno; |
| 3902 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3903 | int _end_col_offset = _token->end_col_offset; |
| 3904 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3905 | _res = _Py_For ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 3906 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3907 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3908 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3909 | return NULL; |
| 3910 | } |
| 3911 | goto done; |
| 3912 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3913 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3914 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3915 | 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] | 3916 | } |
| 3917 | { // ASYNC 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3918 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3919 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 3920 | return NULL; |
| 3921 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3922 | 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] | 3923 | Token * _keyword; |
| 3924 | Token * _keyword_1; |
| 3925 | Token * _literal; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 3926 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3927 | asdl_seq* b; |
| 3928 | void *el; |
| 3929 | expr_ty ex; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3930 | expr_ty t; |
| 3931 | void *tc; |
| 3932 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3933 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
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 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
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 | (t = star_targets_rule(p)) // star_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3938 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3939 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
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 | (ex = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3942 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3943 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3944 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3945 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 3946 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3947 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3948 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 3949 | (el = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3950 | ) |
| 3951 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3952 | 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] | 3953 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 3954 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3955 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3956 | return NULL; |
| 3957 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3958 | int _end_lineno = _token->end_lineno; |
| 3959 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 3960 | int _end_col_offset = _token->end_col_offset; |
| 3961 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 3962 | _res = CHECK_VERSION ( 5 , "Async for loops are" , _Py_AsyncFor ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
| 3963 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3964 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3965 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3966 | return NULL; |
| 3967 | } |
| 3968 | goto done; |
| 3969 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3970 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3971 | D(fprintf(stderr, "%*c%s for_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 3972 | 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] | 3973 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3974 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3975 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3976 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3977 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3978 | } |
| 3979 | |
| 3980 | // with_stmt: |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 3981 | // | 'with' '(' ','.with_item+ ','? ')' ':' block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3982 | // | 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 3983 | // | ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 3984 | // | ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3985 | static stmt_ty |
| 3986 | with_stmt_rule(Parser *p) |
| 3987 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3988 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3989 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3990 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3991 | return NULL; |
| 3992 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 3993 | stmt_ty _res = NULL; |
| 3994 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3995 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 3996 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 3997 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 3998 | return NULL; |
| 3999 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4000 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4001 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4002 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4003 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 4004 | { // 'with' '(' ','.with_item+ ','? ')' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4005 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4006 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4007 | return NULL; |
| 4008 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4009 | 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] | 4010 | Token * _keyword; |
| 4011 | Token * _literal; |
| 4012 | Token * _literal_1; |
| 4013 | Token * _literal_2; |
| 4014 | void *_opt_var; |
| 4015 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4016 | asdl_seq * a; |
| 4017 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4018 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4019 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
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 = _PyPegen_expect_token(p, 7)) // 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 | (a = _gather_38_rule(p)) // ','.with_item+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4024 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4025 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 4026 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4027 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4028 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4029 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4030 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4031 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4032 | ) |
| 4033 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4034 | 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] | 4035 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4036 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4037 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4038 | return NULL; |
| 4039 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4040 | int _end_lineno = _token->end_lineno; |
| 4041 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4042 | int _end_col_offset = _token->end_col_offset; |
| 4043 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4044 | _res = _Py_With ( a , b , NULL , EXTRA ); |
| 4045 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4046 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4047 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4048 | return NULL; |
| 4049 | } |
| 4050 | goto done; |
| 4051 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4052 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4053 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4054 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with' '(' ','.with_item+ ','? ')' ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4055 | } |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4056 | { // 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4057 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4058 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4059 | return NULL; |
| 4060 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4061 | 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] | 4062 | Token * _keyword; |
| 4063 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4064 | asdl_seq * a; |
| 4065 | asdl_seq* b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4066 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4067 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4068 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4069 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4070 | (a = _gather_40_rule(p)) // ','.with_item+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4071 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4072 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4073 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4074 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4075 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4076 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4077 | ) |
| 4078 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4079 | 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] | 4080 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4081 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4082 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4083 | return NULL; |
| 4084 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4085 | int _end_lineno = _token->end_lineno; |
| 4086 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4087 | int _end_col_offset = _token->end_col_offset; |
| 4088 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4089 | _res = _Py_With ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 4090 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4091 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4092 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4093 | return NULL; |
| 4094 | } |
| 4095 | goto done; |
| 4096 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4097 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4098 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4099 | 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] | 4100 | } |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 4101 | { // ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4102 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4103 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4104 | return NULL; |
| 4105 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4106 | 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] | 4107 | Token * _keyword; |
| 4108 | Token * _literal; |
| 4109 | Token * _literal_1; |
| 4110 | Token * _literal_2; |
| 4111 | void *_opt_var; |
| 4112 | UNUSED(_opt_var); // Silence compiler warnings |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4113 | asdl_seq * a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 4114 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4115 | asdl_seq* b; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4116 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4117 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4118 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4119 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
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 = _PyPegen_expect_token(p, 7)) // 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 | (a = _gather_42_rule(p)) // ','.with_item+ |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4124 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4125 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | 99db2a1 | 2020-05-06 22:54:34 +0100 | [diff] [blame] | 4126 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4127 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4128 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4129 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4130 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4131 | (b = block_rule(p)) // block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4132 | ) |
| 4133 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4134 | 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] | 4135 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4136 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4137 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4138 | return NULL; |
| 4139 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4140 | int _end_lineno = _token->end_lineno; |
| 4141 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4142 | int _end_col_offset = _token->end_col_offset; |
| 4143 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4144 | _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NULL , EXTRA ) ); |
| 4145 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4146 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4147 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4148 | return NULL; |
| 4149 | } |
| 4150 | goto done; |
| 4151 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4152 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4153 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4154 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'with' '(' ','.with_item+ ','? ')' ':' block")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4155 | } |
| 4156 | { // ASYNC 'with' ','.with_item+ ':' TYPE_COMMENT? block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4157 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4158 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4159 | return NULL; |
| 4160 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4161 | 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] | 4162 | Token * _keyword; |
| 4163 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4164 | asdl_seq * a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 4165 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4166 | asdl_seq* b; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4167 | void *tc; |
| 4168 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4169 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4170 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4171 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4172 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4173 | (a = _gather_44_rule(p)) // ','.with_item+ |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4174 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4175 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4176 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4177 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4178 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4179 | (b = block_rule(p)) // block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4180 | ) |
| 4181 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4182 | 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] | 4183 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4184 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4185 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4186 | return NULL; |
| 4187 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4188 | int _end_lineno = _token->end_lineno; |
| 4189 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4190 | int _end_col_offset = _token->end_col_offset; |
| 4191 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4192 | _res = CHECK_VERSION ( 5 , "Async with statements are" , _Py_AsyncWith ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) ); |
| 4193 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4194 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4195 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4196 | return NULL; |
| 4197 | } |
| 4198 | goto done; |
| 4199 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4200 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4201 | D(fprintf(stderr, "%*c%s with_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4202 | 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] | 4203 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4204 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4205 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4206 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4207 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4208 | } |
| 4209 | |
| 4210 | // with_item: expression ['as' target] |
| 4211 | static withitem_ty |
| 4212 | with_item_rule(Parser *p) |
| 4213 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4214 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4215 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4216 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4217 | return NULL; |
| 4218 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4219 | withitem_ty _res = NULL; |
| 4220 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4221 | { // expression ['as' target] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4222 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4223 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4224 | return NULL; |
| 4225 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4226 | 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] | 4227 | expr_ty e; |
| 4228 | void *o; |
| 4229 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4230 | (e = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4231 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4232 | (o = _tmp_46_rule(p), 1) // ['as' target] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4233 | ) |
| 4234 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4235 | 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] | 4236 | _res = _Py_withitem ( e , o , p -> arena ); |
| 4237 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4238 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4239 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4240 | return NULL; |
| 4241 | } |
| 4242 | goto done; |
| 4243 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4244 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4245 | D(fprintf(stderr, "%*c%s with_item[%d-%d]: %s failed!\n", p->level, ' ', |
| 4246 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' target]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4247 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4248 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4249 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4250 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4251 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4252 | } |
| 4253 | |
| 4254 | // try_stmt: |
| 4255 | // | 'try' ':' block finally_block |
| 4256 | // | 'try' ':' block except_block+ else_block? finally_block? |
| 4257 | static stmt_ty |
| 4258 | try_stmt_rule(Parser *p) |
| 4259 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4260 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4261 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4262 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4263 | return NULL; |
| 4264 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4265 | stmt_ty _res = NULL; |
| 4266 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4267 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4268 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4269 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4270 | return NULL; |
| 4271 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4272 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4273 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4274 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4275 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4276 | { // 'try' ':' block finally_block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4277 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4278 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4279 | return NULL; |
| 4280 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4281 | 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] | 4282 | Token * _keyword; |
| 4283 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4284 | asdl_seq* b; |
| 4285 | asdl_seq* f; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4286 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4287 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4288 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4289 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4290 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4291 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4292 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4293 | (f = finally_block_rule(p)) // finally_block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4294 | ) |
| 4295 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4296 | 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] | 4297 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4298 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4299 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4300 | return NULL; |
| 4301 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4302 | int _end_lineno = _token->end_lineno; |
| 4303 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4304 | int _end_col_offset = _token->end_col_offset; |
| 4305 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4306 | _res = _Py_Try ( b , NULL , NULL , f , EXTRA ); |
| 4307 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4308 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4309 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4310 | return NULL; |
| 4311 | } |
| 4312 | goto done; |
| 4313 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4314 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4315 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4316 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block finally_block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4317 | } |
| 4318 | { // 'try' ':' block except_block+ else_block? finally_block? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4319 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4320 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4321 | return NULL; |
| 4322 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4323 | 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] | 4324 | Token * _keyword; |
| 4325 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4326 | asdl_seq* b; |
| 4327 | void *el; |
| 4328 | asdl_seq * ex; |
| 4329 | void *f; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4330 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4331 | (_keyword = _PyPegen_expect_token(p, 511)) // token='try' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4332 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4333 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4334 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4335 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4336 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4337 | (ex = _loop1_47_rule(p)) // except_block+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4338 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4339 | (el = else_block_rule(p), 1) // else_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4340 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4341 | (f = finally_block_rule(p), 1) // finally_block? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4342 | ) |
| 4343 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4344 | 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] | 4345 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4346 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4347 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4348 | return NULL; |
| 4349 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4350 | int _end_lineno = _token->end_lineno; |
| 4351 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4352 | int _end_col_offset = _token->end_col_offset; |
| 4353 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4354 | _res = _Py_Try ( b , ex , el , f , EXTRA ); |
| 4355 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4356 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4357 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4358 | return NULL; |
| 4359 | } |
| 4360 | goto done; |
| 4361 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4362 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4363 | D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4364 | 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] | 4365 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4366 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4367 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4368 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4369 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4370 | } |
| 4371 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 4372 | // except_block: 'except' expression ['as' NAME] ':' block | 'except' ':' block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4373 | static excepthandler_ty |
| 4374 | except_block_rule(Parser *p) |
| 4375 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4376 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4377 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4378 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4379 | return NULL; |
| 4380 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4381 | excepthandler_ty _res = NULL; |
| 4382 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4383 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4384 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4385 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4386 | return NULL; |
| 4387 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4388 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4389 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4390 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4391 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 4392 | { // 'except' expression ['as' NAME] ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4393 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4394 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4395 | return NULL; |
| 4396 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4397 | 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] | 4398 | Token * _keyword; |
| 4399 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4400 | asdl_seq* b; |
| 4401 | expr_ty e; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4402 | void *t; |
| 4403 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4404 | (_keyword = _PyPegen_expect_token(p, 520)) // token='except' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4405 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4406 | (e = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4407 | && |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 4408 | (t = _tmp_48_rule(p), 1) // ['as' NAME] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4409 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4410 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4411 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4412 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4413 | ) |
| 4414 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4415 | 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] | 4416 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4417 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4418 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4419 | return NULL; |
| 4420 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4421 | int _end_lineno = _token->end_lineno; |
| 4422 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4423 | int _end_col_offset = _token->end_col_offset; |
| 4424 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4425 | _res = _Py_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , b , EXTRA ); |
| 4426 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4427 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4428 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4429 | return NULL; |
| 4430 | } |
| 4431 | goto done; |
| 4432 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4433 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4434 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4435 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4436 | } |
| 4437 | { // 'except' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4438 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4439 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4440 | return NULL; |
| 4441 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4442 | 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] | 4443 | Token * _keyword; |
| 4444 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4445 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4446 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4447 | (_keyword = _PyPegen_expect_token(p, 520)) // token='except' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4448 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4449 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4450 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4451 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4452 | ) |
| 4453 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4454 | 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] | 4455 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4456 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4457 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4458 | return NULL; |
| 4459 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4460 | int _end_lineno = _token->end_lineno; |
| 4461 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4462 | int _end_col_offset = _token->end_col_offset; |
| 4463 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4464 | _res = _Py_ExceptHandler ( NULL , NULL , b , EXTRA ); |
| 4465 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4466 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4467 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4468 | return NULL; |
| 4469 | } |
| 4470 | goto done; |
| 4471 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4472 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4473 | D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4474 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4475 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4476 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4477 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4478 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4479 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4480 | } |
| 4481 | |
| 4482 | // finally_block: 'finally' ':' block |
| 4483 | static asdl_seq* |
| 4484 | finally_block_rule(Parser *p) |
| 4485 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4486 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4487 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4488 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4489 | return NULL; |
| 4490 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4491 | asdl_seq* _res = NULL; |
| 4492 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4493 | { // 'finally' ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4494 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4495 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4496 | return NULL; |
| 4497 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4498 | 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] | 4499 | Token * _keyword; |
| 4500 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4501 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4502 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4503 | (_keyword = _PyPegen_expect_token(p, 521)) // token='finally' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4504 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4505 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4506 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4507 | (a = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4508 | ) |
| 4509 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4510 | 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] | 4511 | _res = a; |
| 4512 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4513 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4514 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4515 | return NULL; |
| 4516 | } |
| 4517 | goto done; |
| 4518 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4519 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4520 | D(fprintf(stderr, "%*c%s finally_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 4521 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4522 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4523 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4524 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4525 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4526 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4527 | } |
| 4528 | |
| 4529 | // return_stmt: 'return' star_expressions? |
| 4530 | static stmt_ty |
| 4531 | return_stmt_rule(Parser *p) |
| 4532 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4533 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4534 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4535 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4536 | return NULL; |
| 4537 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4538 | stmt_ty _res = NULL; |
| 4539 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4540 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4541 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4542 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4543 | return NULL; |
| 4544 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4545 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4546 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4547 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4548 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4549 | { // 'return' star_expressions? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4550 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4551 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4552 | return NULL; |
| 4553 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4554 | 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] | 4555 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4556 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4557 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4558 | (_keyword = _PyPegen_expect_token(p, 500)) // token='return' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4559 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4560 | (a = star_expressions_rule(p), 1) // star_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4561 | ) |
| 4562 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4563 | 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] | 4564 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4565 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4566 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4567 | return NULL; |
| 4568 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4569 | int _end_lineno = _token->end_lineno; |
| 4570 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4571 | int _end_col_offset = _token->end_col_offset; |
| 4572 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4573 | _res = _Py_Return ( a , EXTRA ); |
| 4574 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4575 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4576 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4577 | return NULL; |
| 4578 | } |
| 4579 | goto done; |
| 4580 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4581 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4582 | D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4583 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4584 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4585 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4586 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4587 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4588 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4589 | } |
| 4590 | |
| 4591 | // raise_stmt: 'raise' expression ['from' expression] | 'raise' |
| 4592 | static stmt_ty |
| 4593 | raise_stmt_rule(Parser *p) |
| 4594 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4595 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4596 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4597 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4598 | return NULL; |
| 4599 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4600 | stmt_ty _res = NULL; |
| 4601 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4602 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4603 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4604 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4605 | return NULL; |
| 4606 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4607 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4608 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4609 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4610 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4611 | { // 'raise' expression ['from' expression] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4612 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4613 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4614 | return NULL; |
| 4615 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4616 | 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] | 4617 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4618 | expr_ty a; |
| 4619 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4620 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4621 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4622 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4623 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4624 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4625 | (b = _tmp_49_rule(p), 1) // ['from' expression] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4626 | ) |
| 4627 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4628 | 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] | 4629 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4630 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4631 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4632 | return NULL; |
| 4633 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4634 | int _end_lineno = _token->end_lineno; |
| 4635 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4636 | int _end_col_offset = _token->end_col_offset; |
| 4637 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4638 | _res = _Py_Raise ( a , b , EXTRA ); |
| 4639 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4640 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4641 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4642 | return NULL; |
| 4643 | } |
| 4644 | goto done; |
| 4645 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4646 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4647 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4648 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4649 | } |
| 4650 | { // 'raise' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4651 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4652 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4653 | return NULL; |
| 4654 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4655 | 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] | 4656 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4657 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4658 | (_keyword = _PyPegen_expect_token(p, 501)) // token='raise' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4659 | ) |
| 4660 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4661 | 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] | 4662 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4663 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4664 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4665 | return NULL; |
| 4666 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4667 | int _end_lineno = _token->end_lineno; |
| 4668 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4669 | int _end_col_offset = _token->end_col_offset; |
| 4670 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4671 | _res = _Py_Raise ( NULL , NULL , EXTRA ); |
| 4672 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4673 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4674 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4675 | return NULL; |
| 4676 | } |
| 4677 | goto done; |
| 4678 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4679 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4680 | D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ', |
| 4681 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4682 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4683 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4684 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4685 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4686 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4687 | } |
| 4688 | |
| 4689 | // function_def: decorators function_def_raw | function_def_raw |
| 4690 | static stmt_ty |
| 4691 | function_def_rule(Parser *p) |
| 4692 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4693 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4694 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4695 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4696 | return NULL; |
| 4697 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4698 | stmt_ty _res = NULL; |
| 4699 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4700 | { // decorators function_def_raw |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4701 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4702 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4703 | return NULL; |
| 4704 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4705 | 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] | 4706 | asdl_seq* d; |
| 4707 | stmt_ty f; |
| 4708 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4709 | (d = decorators_rule(p)) // decorators |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4710 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4711 | (f = function_def_raw_rule(p)) // function_def_raw |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4712 | ) |
| 4713 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4714 | 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] | 4715 | _res = _PyPegen_function_def_decorators ( p , d , f ); |
| 4716 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4717 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4718 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4719 | return NULL; |
| 4720 | } |
| 4721 | goto done; |
| 4722 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4723 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4724 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 4725 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4726 | } |
| 4727 | { // function_def_raw |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4728 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4729 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4730 | return NULL; |
| 4731 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4732 | 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] | 4733 | stmt_ty function_def_raw_var; |
| 4734 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4735 | (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4736 | ) |
| 4737 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4738 | 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] | 4739 | _res = function_def_raw_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4740 | goto done; |
| 4741 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4742 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4743 | D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 4744 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4745 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4746 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4747 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4748 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4749 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4750 | } |
| 4751 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4752 | // function_def_raw: |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4753 | // | 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block |
| 4754 | // | ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4755 | static stmt_ty |
| 4756 | function_def_raw_rule(Parser *p) |
| 4757 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4758 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4759 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4760 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4761 | return NULL; |
| 4762 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4763 | stmt_ty _res = NULL; |
| 4764 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4765 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 4766 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4767 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4768 | return NULL; |
| 4769 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4770 | int _start_lineno = p->tokens[_mark]->lineno; |
| 4771 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 4772 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 4773 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4774 | { // 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4775 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4776 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4777 | return NULL; |
| 4778 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4779 | 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] | 4780 | Token * _keyword; |
| 4781 | Token * _literal; |
| 4782 | Token * _literal_1; |
| 4783 | Token * _literal_2; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4784 | void *a; |
| 4785 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4786 | expr_ty n; |
| 4787 | void *params; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4788 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4789 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4790 | (_keyword = _PyPegen_expect_token(p, 522)) // token='def' |
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 | (n = _PyPegen_name_token(p)) // NAME |
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 = _PyPegen_expect_token(p, 7)) // 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 | (params = params_rule(p), 1) // params? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4797 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4798 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4799 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4800 | (a = _tmp_50_rule(p), 1) // ['->' expression] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4801 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4802 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4803 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4804 | (tc = func_type_comment_rule(p), 1) // func_type_comment? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4805 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4806 | (b = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4807 | ) |
| 4808 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4809 | 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] | 4810 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4811 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4812 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4813 | return NULL; |
| 4814 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4815 | int _end_lineno = _token->end_lineno; |
| 4816 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4817 | int _end_col_offset = _token->end_col_offset; |
| 4818 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4819 | _res = _Py_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ); |
| 4820 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4821 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4822 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4823 | return NULL; |
| 4824 | } |
| 4825 | goto done; |
| 4826 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4827 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4828 | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
| 4829 | 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] | 4830 | } |
| 4831 | { // ASYNC 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4832 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4833 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4834 | return NULL; |
| 4835 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4836 | 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] | 4837 | Token * _keyword; |
| 4838 | Token * _literal; |
| 4839 | Token * _literal_1; |
| 4840 | Token * _literal_2; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4841 | void *a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 4842 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4843 | asdl_seq* b; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4844 | expr_ty n; |
| 4845 | void *params; |
| 4846 | void *tc; |
| 4847 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4848 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
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 | (_keyword = _PyPegen_expect_token(p, 522)) // token='def' |
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 | (n = _PyPegen_name_token(p)) // NAME |
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 = _PyPegen_expect_token(p, 7)) // 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 | (params = params_rule(p), 1) // params? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4857 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4858 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4859 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4860 | (a = _tmp_51_rule(p), 1) // ['->' expression] |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4861 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4862 | (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4863 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4864 | (tc = func_type_comment_rule(p), 1) // func_type_comment? |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4865 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4866 | (b = block_rule(p)) // block |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4867 | ) |
| 4868 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4869 | 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] | 4870 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 4871 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4872 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4873 | return NULL; |
| 4874 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4875 | int _end_lineno = _token->end_lineno; |
| 4876 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 4877 | int _end_col_offset = _token->end_col_offset; |
| 4878 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 4879 | _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 ) ); |
| 4880 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4881 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4882 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4883 | return NULL; |
| 4884 | } |
| 4885 | goto done; |
| 4886 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4887 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4888 | D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
| 4889 | 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] | 4890 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4891 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4892 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4893 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4894 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4895 | } |
| 4896 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4897 | // func_type_comment: |
| 4898 | // | NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
| 4899 | // | invalid_double_type_comments |
| 4900 | // | TYPE_COMMENT |
Pablo Galindo | d955241 | 2020-05-01 16:32:09 +0100 | [diff] [blame] | 4901 | static Token* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4902 | func_type_comment_rule(Parser *p) |
| 4903 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4904 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4905 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4906 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4907 | return NULL; |
| 4908 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4909 | Token* _res = NULL; |
| 4910 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4911 | { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4912 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4913 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4914 | return NULL; |
| 4915 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4916 | 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] | 4917 | Token * newline_var; |
| 4918 | Token * t; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4919 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4920 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4921 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4922 | (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4923 | && |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 4924 | _PyPegen_lookahead(1, _tmp_52_rule, p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4925 | ) |
| 4926 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4927 | 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] | 4928 | _res = t; |
| 4929 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4930 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4931 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4932 | return NULL; |
| 4933 | } |
| 4934 | goto done; |
| 4935 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4936 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4937 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 4938 | 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] | 4939 | } |
| 4940 | { // invalid_double_type_comments |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4941 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4942 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4943 | return NULL; |
| 4944 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4945 | 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] | 4946 | void *invalid_double_type_comments_var; |
| 4947 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4948 | (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] | 4949 | ) |
| 4950 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4951 | 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] | 4952 | _res = invalid_double_type_comments_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4953 | goto done; |
| 4954 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4955 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4956 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 4957 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4958 | } |
| 4959 | { // TYPE_COMMENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4960 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4961 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4962 | return NULL; |
| 4963 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4964 | 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] | 4965 | Token * type_comment_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4966 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 4967 | (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] | 4968 | ) |
| 4969 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4970 | 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] | 4971 | _res = type_comment_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4972 | goto done; |
| 4973 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4974 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4975 | D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ', |
| 4976 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4977 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4978 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4979 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4980 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4981 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 4982 | } |
| 4983 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4984 | // params: invalid_parameters | parameters |
| 4985 | static arguments_ty |
| 4986 | params_rule(Parser *p) |
| 4987 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4988 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4989 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4990 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4991 | return NULL; |
| 4992 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 4993 | arguments_ty _res = NULL; |
| 4994 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 4995 | { // invalid_parameters |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4996 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 4997 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 4998 | return NULL; |
| 4999 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5000 | 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] | 5001 | void *invalid_parameters_var; |
| 5002 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5003 | (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5004 | ) |
| 5005 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5006 | 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] | 5007 | _res = invalid_parameters_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5008 | goto done; |
| 5009 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5010 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5011 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
| 5012 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5013 | } |
| 5014 | { // parameters |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5015 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5016 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5017 | return NULL; |
| 5018 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5019 | 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] | 5020 | arguments_ty parameters_var; |
| 5021 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5022 | (parameters_var = parameters_rule(p)) // parameters |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5023 | ) |
| 5024 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5025 | 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] | 5026 | _res = parameters_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5027 | goto done; |
| 5028 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5029 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5030 | D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ', |
| 5031 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5032 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5033 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5034 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5035 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5036 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5037 | } |
| 5038 | |
| 5039 | // parameters: |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5040 | // | slash_no_default param_no_default* param_with_default* star_etc? |
| 5041 | // | slash_with_default param_with_default* star_etc? |
| 5042 | // | param_no_default+ param_with_default* star_etc? |
| 5043 | // | param_with_default+ star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5044 | // | star_etc |
| 5045 | static arguments_ty |
| 5046 | parameters_rule(Parser *p) |
| 5047 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5048 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5049 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5050 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5051 | return NULL; |
| 5052 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5053 | arguments_ty _res = NULL; |
| 5054 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5055 | { // slash_no_default param_no_default* param_with_default* star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5056 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5057 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5058 | return NULL; |
| 5059 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5060 | 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] | 5061 | asdl_seq* a; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5062 | asdl_seq * b; |
| 5063 | asdl_seq * c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5064 | void *d; |
| 5065 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5066 | (a = slash_no_default_rule(p)) // slash_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5067 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5068 | (b = _loop0_53_rule(p)) // param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5069 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5070 | (c = _loop0_54_rule(p)) // param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5071 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5072 | (d = star_etc_rule(p), 1) // star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5073 | ) |
| 5074 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5075 | 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] | 5076 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
| 5077 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5078 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5079 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5080 | return NULL; |
| 5081 | } |
| 5082 | goto done; |
| 5083 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5084 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5085 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5086 | 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] | 5087 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5088 | { // slash_with_default param_with_default* star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5089 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5090 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5091 | return NULL; |
| 5092 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5093 | 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] | 5094 | SlashWithDefault* a; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5095 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5096 | void *c; |
| 5097 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5098 | (a = slash_with_default_rule(p)) // slash_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5099 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5100 | (b = _loop0_55_rule(p)) // param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5101 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5102 | (c = star_etc_rule(p), 1) // star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5103 | ) |
| 5104 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5105 | 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] | 5106 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
| 5107 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5108 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5109 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5110 | return NULL; |
| 5111 | } |
| 5112 | goto done; |
| 5113 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5114 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5115 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5116 | 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] | 5117 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5118 | { // param_no_default+ param_with_default* star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5119 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5120 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5121 | return NULL; |
| 5122 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5123 | 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] | 5124 | asdl_seq * a; |
| 5125 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5126 | void *c; |
| 5127 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5128 | (a = _loop1_56_rule(p)) // param_no_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5129 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5130 | (b = _loop0_57_rule(p)) // param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5131 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5132 | (c = star_etc_rule(p), 1) // star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5133 | ) |
| 5134 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5135 | 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] | 5136 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
| 5137 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5138 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5139 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5140 | return NULL; |
| 5141 | } |
| 5142 | goto done; |
| 5143 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5144 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5145 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5146 | 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] | 5147 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5148 | { // param_with_default+ star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5149 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5150 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5151 | return NULL; |
| 5152 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5153 | 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] | 5154 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5155 | void *b; |
| 5156 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5157 | (a = _loop1_58_rule(p)) // param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5158 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5159 | (b = star_etc_rule(p), 1) // star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5160 | ) |
| 5161 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5162 | 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] | 5163 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
| 5164 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5165 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5166 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5167 | return NULL; |
| 5168 | } |
| 5169 | goto done; |
| 5170 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5171 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5172 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5173 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5174 | } |
| 5175 | { // star_etc |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5176 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5177 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5178 | return NULL; |
| 5179 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5180 | 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] | 5181 | StarEtc* a; |
| 5182 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5183 | (a = star_etc_rule(p)) // star_etc |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5184 | ) |
| 5185 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5186 | 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] | 5187 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
| 5188 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5189 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5190 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5191 | return NULL; |
| 5192 | } |
| 5193 | goto done; |
| 5194 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5195 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5196 | D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 5197 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5198 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5199 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5200 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5201 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5202 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5203 | } |
| 5204 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5205 | // slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5206 | static asdl_seq* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5207 | slash_no_default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5208 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5209 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5210 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5211 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5212 | return NULL; |
| 5213 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5214 | asdl_seq* _res = NULL; |
| 5215 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5216 | { // param_no_default+ '/' ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5217 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5218 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5219 | return NULL; |
| 5220 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5221 | 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] | 5222 | Token * _literal; |
| 5223 | Token * _literal_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5224 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5225 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5226 | (a = _loop1_59_rule(p)) // param_no_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5227 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5228 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5229 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5230 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5231 | ) |
| 5232 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5233 | 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] | 5234 | _res = a; |
| 5235 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5236 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5237 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5238 | return NULL; |
| 5239 | } |
| 5240 | goto done; |
| 5241 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5242 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5243 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5244 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5245 | } |
| 5246 | { // param_no_default+ '/' &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5247 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5248 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5249 | return NULL; |
| 5250 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5251 | 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] | 5252 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5253 | asdl_seq * a; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5254 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5255 | (a = _loop1_60_rule(p)) // param_no_default+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5256 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5257 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5258 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5259 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5260 | ) |
| 5261 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5262 | 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] | 5263 | _res = a; |
| 5264 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5265 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5266 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5267 | return NULL; |
| 5268 | } |
| 5269 | goto done; |
| 5270 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5271 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5272 | D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5273 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5274 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5275 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5276 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5277 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5278 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5279 | } |
| 5280 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5281 | // slash_with_default: |
| 5282 | // | param_no_default* param_with_default+ '/' ',' |
| 5283 | // | param_no_default* param_with_default+ '/' &')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5284 | static SlashWithDefault* |
| 5285 | slash_with_default_rule(Parser *p) |
| 5286 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5287 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5288 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5289 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5290 | return NULL; |
| 5291 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5292 | SlashWithDefault* _res = NULL; |
| 5293 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5294 | { // param_no_default* param_with_default+ '/' ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5295 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5296 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5297 | return NULL; |
| 5298 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5299 | 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] | 5300 | Token * _literal; |
| 5301 | Token * _literal_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5302 | asdl_seq * a; |
| 5303 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5304 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5305 | (a = _loop0_61_rule(p)) // param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5306 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5307 | (b = _loop1_62_rule(p)) // param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5308 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5309 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5310 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5311 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5312 | ) |
| 5313 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5314 | 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] | 5315 | _res = _PyPegen_slash_with_default ( p , a , b ); |
| 5316 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5317 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5318 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5319 | return NULL; |
| 5320 | } |
| 5321 | goto done; |
| 5322 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5323 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5324 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5325 | 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] | 5326 | } |
| 5327 | { // param_no_default* param_with_default+ '/' &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5328 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5329 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5330 | return NULL; |
| 5331 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5332 | 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] | 5333 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5334 | asdl_seq * a; |
| 5335 | asdl_seq * b; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5336 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5337 | (a = _loop0_63_rule(p)) // param_no_default* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5338 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5339 | (b = _loop1_64_rule(p)) // param_with_default+ |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5340 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5341 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5342 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5343 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5344 | ) |
| 5345 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5346 | 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] | 5347 | _res = _PyPegen_slash_with_default ( p , a , b ); |
| 5348 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5349 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5350 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5351 | return NULL; |
| 5352 | } |
| 5353 | goto done; |
| 5354 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5355 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5356 | D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5357 | 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] | 5358 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5359 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5360 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5361 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5362 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5363 | } |
| 5364 | |
| 5365 | // star_etc: |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5366 | // | '*' param_no_default param_maybe_default* kwds? |
| 5367 | // | '*' ',' param_maybe_default+ kwds? |
| 5368 | // | kwds |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5369 | // | invalid_star_etc |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5370 | static StarEtc* |
| 5371 | star_etc_rule(Parser *p) |
| 5372 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5373 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5374 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5375 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5376 | return NULL; |
| 5377 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5378 | StarEtc* _res = NULL; |
| 5379 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5380 | { // '*' param_no_default param_maybe_default* kwds? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5381 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5382 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5383 | return NULL; |
| 5384 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5385 | 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] | 5386 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5387 | arg_ty a; |
| 5388 | asdl_seq * b; |
| 5389 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5390 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5391 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5392 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5393 | (a = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5394 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5395 | (b = _loop0_65_rule(p)) // param_maybe_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5396 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5397 | (c = kwds_rule(p), 1) // kwds? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5398 | ) |
| 5399 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5400 | 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] | 5401 | _res = _PyPegen_star_etc ( p , a , b , c ); |
| 5402 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5403 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5404 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5405 | return NULL; |
| 5406 | } |
| 5407 | goto done; |
| 5408 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5409 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5410 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 5411 | 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] | 5412 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5413 | { // '*' ',' param_maybe_default+ kwds? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5414 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5415 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5416 | return NULL; |
| 5417 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5418 | 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] | 5419 | Token * _literal; |
| 5420 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5421 | asdl_seq * b; |
| 5422 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5423 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5424 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5425 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5426 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5427 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5428 | (b = _loop1_66_rule(p)) // param_maybe_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5429 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5430 | (c = kwds_rule(p), 1) // kwds? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5431 | ) |
| 5432 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5433 | 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] | 5434 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
| 5435 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5436 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5437 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5438 | return NULL; |
| 5439 | } |
| 5440 | goto done; |
| 5441 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5442 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5443 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 5444 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5445 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5446 | { // kwds |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5447 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5448 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5449 | return NULL; |
| 5450 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5451 | 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] | 5452 | arg_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5453 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5454 | (a = kwds_rule(p)) // kwds |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5455 | ) |
| 5456 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5457 | 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] | 5458 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
| 5459 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5460 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5461 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5462 | return NULL; |
| 5463 | } |
| 5464 | goto done; |
| 5465 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5466 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5467 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 5468 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5469 | } |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5470 | { // invalid_star_etc |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5471 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5472 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5473 | return NULL; |
| 5474 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5475 | 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] | 5476 | void *invalid_star_etc_var; |
| 5477 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5478 | (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5479 | ) |
| 5480 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5481 | 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] | 5482 | _res = invalid_star_etc_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5483 | goto done; |
| 5484 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5485 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5486 | D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 5487 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 5488 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5489 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5490 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5491 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5492 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5493 | } |
| 5494 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5495 | // kwds: '**' param_no_default |
| 5496 | static arg_ty |
| 5497 | kwds_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5498 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5499 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5500 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5501 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5502 | return NULL; |
| 5503 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5504 | arg_ty _res = NULL; |
| 5505 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5506 | { // '**' param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5507 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5508 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5509 | return NULL; |
| 5510 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5511 | 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] | 5512 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5513 | arg_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5514 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5515 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5516 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5517 | (a = param_no_default_rule(p)) // param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5518 | ) |
| 5519 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5520 | 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] | 5521 | _res = a; |
| 5522 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5523 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5524 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5525 | return NULL; |
| 5526 | } |
| 5527 | goto done; |
| 5528 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5529 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5530 | D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ', |
| 5531 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5532 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5533 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5534 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5535 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5536 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5537 | } |
| 5538 | |
| 5539 | // param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')' |
| 5540 | static arg_ty |
| 5541 | param_no_default_rule(Parser *p) |
| 5542 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5543 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5544 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5545 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5546 | return NULL; |
| 5547 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5548 | arg_ty _res = NULL; |
| 5549 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5550 | { // param ',' TYPE_COMMENT? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5551 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5552 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5553 | return NULL; |
| 5554 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5555 | 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] | 5556 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5557 | arg_ty a; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5558 | void *tc; |
| 5559 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5560 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5561 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5562 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5563 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5564 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5565 | ) |
| 5566 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5567 | 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] | 5568 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
| 5569 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5570 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5571 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5572 | return NULL; |
| 5573 | } |
| 5574 | goto done; |
| 5575 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5576 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5577 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5578 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5579 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5580 | { // param TYPE_COMMENT? &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5581 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5582 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5583 | return NULL; |
| 5584 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5585 | 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] | 5586 | arg_ty a; |
| 5587 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5588 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5589 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5590 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5591 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5592 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5593 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5594 | ) |
| 5595 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5596 | 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] | 5597 | _res = _PyPegen_add_type_comment_to_arg ( p , a , tc ); |
| 5598 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5599 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5600 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5601 | return NULL; |
| 5602 | } |
| 5603 | goto done; |
| 5604 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5605 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5606 | D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5607 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5608 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5609 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5610 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5611 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5612 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5613 | } |
| 5614 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5615 | // param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5616 | static NameDefaultPair* |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5617 | param_with_default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5618 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5619 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5620 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5621 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5622 | return NULL; |
| 5623 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5624 | NameDefaultPair* _res = NULL; |
| 5625 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5626 | { // param default ',' TYPE_COMMENT? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5627 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5628 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5629 | return NULL; |
| 5630 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5631 | 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] | 5632 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5633 | arg_ty a; |
| 5634 | expr_ty c; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5635 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5636 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5637 | (a = param_rule(p)) // param |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5638 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5639 | (c = default_rule(p)) // default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5640 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5641 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5642 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5643 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5644 | ) |
| 5645 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5646 | 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] | 5647 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 5648 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5649 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5650 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5651 | return NULL; |
| 5652 | } |
| 5653 | goto done; |
| 5654 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5655 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5656 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5657 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5658 | } |
| 5659 | { // param default TYPE_COMMENT? &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5660 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5661 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5662 | return NULL; |
| 5663 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5664 | 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] | 5665 | arg_ty a; |
| 5666 | expr_ty c; |
| 5667 | void *tc; |
| 5668 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5669 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5670 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5671 | (c = default_rule(p)) // default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5672 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5673 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5674 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5675 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5676 | ) |
| 5677 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5678 | 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] | 5679 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 5680 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5681 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5682 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5683 | return NULL; |
| 5684 | } |
| 5685 | goto done; |
| 5686 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5687 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5688 | D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5689 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5690 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5691 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5692 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5693 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5694 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5695 | } |
| 5696 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5697 | // param_maybe_default: |
| 5698 | // | param default? ',' TYPE_COMMENT? |
| 5699 | // | param default? TYPE_COMMENT? &')' |
| 5700 | static NameDefaultPair* |
| 5701 | param_maybe_default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5702 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5703 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5704 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5705 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5706 | return NULL; |
| 5707 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5708 | NameDefaultPair* _res = NULL; |
| 5709 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5710 | { // param default? ',' TYPE_COMMENT? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5711 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5712 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5713 | return NULL; |
| 5714 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5715 | 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] | 5716 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5717 | arg_ty a; |
| 5718 | void *c; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5719 | void *tc; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5720 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5721 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5722 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5723 | (c = default_rule(p), 1) // default? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5724 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5725 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5726 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5727 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5728 | ) |
| 5729 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5730 | 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] | 5731 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 5732 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5733 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5734 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5735 | return NULL; |
| 5736 | } |
| 5737 | goto done; |
| 5738 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5739 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5740 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5741 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5742 | } |
| 5743 | { // param default? TYPE_COMMENT? &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5744 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5745 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5746 | return NULL; |
| 5747 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5748 | 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] | 5749 | arg_ty a; |
| 5750 | void *c; |
| 5751 | void *tc; |
| 5752 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5753 | (a = param_rule(p)) // param |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5754 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5755 | (c = default_rule(p), 1) // default? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5756 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5757 | (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT? |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5758 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5759 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5760 | ) |
| 5761 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5762 | 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] | 5763 | _res = _PyPegen_name_default_pair ( p , a , c , tc ); |
| 5764 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5765 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5766 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5767 | return NULL; |
| 5768 | } |
| 5769 | goto done; |
| 5770 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5771 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5772 | D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5773 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5774 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5775 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5776 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5777 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5778 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5779 | } |
| 5780 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5781 | // param: NAME annotation? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5782 | static arg_ty |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5783 | param_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5784 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5785 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5786 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5787 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5788 | return NULL; |
| 5789 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5790 | arg_ty _res = NULL; |
| 5791 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5792 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 5793 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5794 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5795 | return NULL; |
| 5796 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5797 | int _start_lineno = p->tokens[_mark]->lineno; |
| 5798 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 5799 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 5800 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5801 | { // NAME annotation? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5802 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5803 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5804 | return NULL; |
| 5805 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5806 | 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] | 5807 | expr_ty a; |
| 5808 | void *b; |
| 5809 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5810 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5811 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5812 | (b = annotation_rule(p), 1) // annotation? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5813 | ) |
| 5814 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5815 | 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] | 5816 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 5817 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5818 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5819 | return NULL; |
| 5820 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5821 | int _end_lineno = _token->end_lineno; |
| 5822 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 5823 | int _end_col_offset = _token->end_col_offset; |
| 5824 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 5825 | _res = _Py_arg ( a -> v . Name . id , b , NULL , EXTRA ); |
| 5826 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5827 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5828 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5829 | return NULL; |
| 5830 | } |
| 5831 | goto done; |
| 5832 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5833 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5834 | D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ', |
| 5835 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5836 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5837 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5838 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5839 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5840 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5841 | } |
| 5842 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5843 | // annotation: ':' expression |
| 5844 | static expr_ty |
| 5845 | annotation_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5846 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5847 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5848 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5849 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5850 | return NULL; |
| 5851 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5852 | expr_ty _res = NULL; |
| 5853 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5854 | { // ':' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5855 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5856 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5857 | return NULL; |
| 5858 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5859 | 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] | 5860 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5861 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5862 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5863 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5864 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5865 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5866 | ) |
| 5867 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5868 | 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] | 5869 | _res = a; |
| 5870 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5871 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5872 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5873 | return NULL; |
| 5874 | } |
| 5875 | goto done; |
| 5876 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5877 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5878 | D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ', |
| 5879 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5880 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5881 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5882 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5883 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5884 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5885 | } |
| 5886 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5887 | // default: '=' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5888 | static expr_ty |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5889 | default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5890 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5891 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5892 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5893 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5894 | return NULL; |
| 5895 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5896 | expr_ty _res = NULL; |
| 5897 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5898 | { // '=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5899 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5900 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5901 | return NULL; |
| 5902 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5903 | 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] | 5904 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5905 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5906 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5907 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5908 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5909 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5910 | ) |
| 5911 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5912 | 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] | 5913 | _res = a; |
| 5914 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5915 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5916 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 5917 | return NULL; |
| 5918 | } |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5919 | goto done; |
| 5920 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5921 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5922 | D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ', |
| 5923 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5924 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5925 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5926 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5927 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5928 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5929 | } |
| 5930 | |
| 5931 | // decorators: (('@' named_expression NEWLINE))+ |
| 5932 | static asdl_seq* |
| 5933 | decorators_rule(Parser *p) |
| 5934 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5935 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5936 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5937 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5938 | return NULL; |
| 5939 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5940 | asdl_seq* _res = NULL; |
| 5941 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5942 | { // (('@' named_expression NEWLINE))+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5943 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5944 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5945 | return NULL; |
| 5946 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5947 | 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] | 5948 | asdl_seq * a; |
| 5949 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5950 | (a = _loop1_67_rule(p)) // (('@' named_expression NEWLINE))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5951 | ) |
| 5952 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5953 | 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] | 5954 | _res = a; |
| 5955 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5956 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5957 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5958 | return NULL; |
| 5959 | } |
| 5960 | goto done; |
| 5961 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5962 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5963 | D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ', |
| 5964 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5965 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5966 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5967 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5968 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5969 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5970 | } |
| 5971 | |
| 5972 | // class_def: decorators class_def_raw | class_def_raw |
| 5973 | static stmt_ty |
| 5974 | class_def_rule(Parser *p) |
| 5975 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5976 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5977 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5978 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5979 | return NULL; |
| 5980 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 5981 | stmt_ty _res = NULL; |
| 5982 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5983 | { // decorators class_def_raw |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5984 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5985 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 5986 | return NULL; |
| 5987 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5988 | 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] | 5989 | asdl_seq* a; |
| 5990 | stmt_ty b; |
| 5991 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5992 | (a = decorators_rule(p)) // decorators |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5993 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 5994 | (b = class_def_raw_rule(p)) // class_def_raw |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 5995 | ) |
| 5996 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 5997 | 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] | 5998 | _res = _PyPegen_class_def_decorators ( p , a , b ); |
| 5999 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6000 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6001 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6002 | return NULL; |
| 6003 | } |
| 6004 | goto done; |
| 6005 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6006 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6007 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 6008 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6009 | } |
| 6010 | { // class_def_raw |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6011 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6012 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6013 | return NULL; |
| 6014 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6015 | 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] | 6016 | stmt_ty class_def_raw_var; |
| 6017 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6018 | (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6019 | ) |
| 6020 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6021 | 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] | 6022 | _res = class_def_raw_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6023 | goto done; |
| 6024 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6025 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6026 | D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ', |
| 6027 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6028 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6029 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6030 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6031 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6032 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6033 | } |
| 6034 | |
| 6035 | // class_def_raw: 'class' NAME ['(' arguments? ')'] ':' block |
| 6036 | static stmt_ty |
| 6037 | class_def_raw_rule(Parser *p) |
| 6038 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6039 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6040 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6041 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6042 | return NULL; |
| 6043 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6044 | stmt_ty _res = NULL; |
| 6045 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6046 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6047 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6048 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6049 | return NULL; |
| 6050 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6051 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6052 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6053 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6054 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6055 | { // 'class' NAME ['(' arguments? ')'] ':' block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6056 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6057 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6058 | return NULL; |
| 6059 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6060 | 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] | 6061 | Token * _keyword; |
| 6062 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6063 | expr_ty a; |
| 6064 | void *b; |
| 6065 | asdl_seq* c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6066 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6067 | (_keyword = _PyPegen_expect_token(p, 523)) // token='class' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6068 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6069 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6070 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6071 | (b = _tmp_68_rule(p), 1) // ['(' arguments? ')'] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6072 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6073 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6074 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6075 | (c = block_rule(p)) // block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6076 | ) |
| 6077 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6078 | 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] | 6079 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6080 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6081 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6082 | return NULL; |
| 6083 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6084 | int _end_lineno = _token->end_lineno; |
| 6085 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6086 | int _end_col_offset = _token->end_col_offset; |
| 6087 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6088 | _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 ); |
| 6089 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6090 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6091 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6092 | return NULL; |
| 6093 | } |
| 6094 | goto done; |
| 6095 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6096 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6097 | D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ', |
| 6098 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] ':' block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6099 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6100 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6101 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6102 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6103 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6104 | } |
| 6105 | |
| 6106 | // block: NEWLINE INDENT statements DEDENT | simple_stmt | invalid_block |
| 6107 | static asdl_seq* |
| 6108 | block_rule(Parser *p) |
| 6109 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6110 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6111 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6112 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6113 | return NULL; |
| 6114 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6115 | asdl_seq* _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6116 | if (_PyPegen_is_memoized(p, block_type, &_res)) { |
| 6117 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6118 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6119 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6120 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6121 | { // NEWLINE INDENT statements DEDENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6122 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6123 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6124 | return NULL; |
| 6125 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6126 | 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] | 6127 | asdl_seq* a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 6128 | Token * dedent_var; |
| 6129 | Token * indent_var; |
| 6130 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6131 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6132 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6133 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6134 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6135 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6136 | (a = statements_rule(p)) // statements |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6137 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6138 | (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6139 | ) |
| 6140 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6141 | 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] | 6142 | _res = a; |
| 6143 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6144 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6145 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6146 | return NULL; |
| 6147 | } |
| 6148 | goto done; |
| 6149 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6150 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6151 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 6152 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6153 | } |
| 6154 | { // simple_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6155 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6156 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6157 | return NULL; |
| 6158 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6159 | 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] | 6160 | asdl_seq* simple_stmt_var; |
| 6161 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6162 | (simple_stmt_var = simple_stmt_rule(p)) // simple_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6163 | ) |
| 6164 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6165 | 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] | 6166 | _res = simple_stmt_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6167 | goto done; |
| 6168 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6169 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6170 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 6171 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6172 | } |
| 6173 | { // invalid_block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6174 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6175 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6176 | return NULL; |
| 6177 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6178 | 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] | 6179 | void *invalid_block_var; |
| 6180 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6181 | (invalid_block_var = invalid_block_rule(p)) // invalid_block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6182 | ) |
| 6183 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6184 | 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] | 6185 | _res = invalid_block_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6186 | goto done; |
| 6187 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6188 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6189 | D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ', |
| 6190 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6191 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6192 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6193 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6194 | _PyPegen_insert_memo(p, _mark, block_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6195 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6196 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6197 | } |
| 6198 | |
| 6199 | // expressions_list: ','.star_expression+ ','? |
| 6200 | static asdl_seq* |
| 6201 | expressions_list_rule(Parser *p) |
| 6202 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6203 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6204 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6205 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6206 | return NULL; |
| 6207 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6208 | asdl_seq* _res = NULL; |
| 6209 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6210 | { // ','.star_expression+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6211 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6212 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6213 | return NULL; |
| 6214 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6215 | 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] | 6216 | void *_opt_var; |
| 6217 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6218 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6219 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6220 | (a = _gather_69_rule(p)) // ','.star_expression+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6221 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6222 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6223 | ) |
| 6224 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6225 | 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] | 6226 | _res = a; |
| 6227 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6228 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6229 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6230 | return NULL; |
| 6231 | } |
| 6232 | goto done; |
| 6233 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6234 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6235 | D(fprintf(stderr, "%*c%s expressions_list[%d-%d]: %s failed!\n", p->level, ' ', |
| 6236 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_expression+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6237 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6238 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6239 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6240 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6241 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6242 | } |
| 6243 | |
| 6244 | // star_expressions: |
| 6245 | // | star_expression ((',' star_expression))+ ','? |
| 6246 | // | star_expression ',' |
| 6247 | // | star_expression |
| 6248 | static expr_ty |
| 6249 | star_expressions_rule(Parser *p) |
| 6250 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6251 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6252 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6253 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6254 | return NULL; |
| 6255 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6256 | expr_ty _res = NULL; |
| 6257 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6258 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6259 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6260 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6261 | return NULL; |
| 6262 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6263 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6264 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6265 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6266 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6267 | { // star_expression ((',' star_expression))+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6268 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6269 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6270 | return NULL; |
| 6271 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6272 | 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] | 6273 | void *_opt_var; |
| 6274 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6275 | expr_ty a; |
| 6276 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6277 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6278 | (a = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6279 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6280 | (b = _loop1_71_rule(p)) // ((',' star_expression))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6281 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6282 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6283 | ) |
| 6284 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6285 | 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] | 6286 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6287 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6288 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6289 | return NULL; |
| 6290 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6291 | int _end_lineno = _token->end_lineno; |
| 6292 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6293 | int _end_col_offset = _token->end_col_offset; |
| 6294 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6295 | _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
| 6296 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6297 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6298 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6299 | return NULL; |
| 6300 | } |
| 6301 | goto done; |
| 6302 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6303 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6304 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6305 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ((',' star_expression))+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6306 | } |
| 6307 | { // star_expression ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6308 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6309 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6310 | return NULL; |
| 6311 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6312 | 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] | 6313 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6314 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6315 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6316 | (a = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6317 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6318 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6319 | ) |
| 6320 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6321 | 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] | 6322 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6323 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6324 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6325 | return NULL; |
| 6326 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6327 | int _end_lineno = _token->end_lineno; |
| 6328 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6329 | int _end_col_offset = _token->end_col_offset; |
| 6330 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6331 | _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
| 6332 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6333 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6334 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6335 | return NULL; |
| 6336 | } |
| 6337 | goto done; |
| 6338 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6339 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6340 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6341 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression ','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6342 | } |
| 6343 | { // star_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6344 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6345 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6346 | return NULL; |
| 6347 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6348 | 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] | 6349 | expr_ty star_expression_var; |
| 6350 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6351 | (star_expression_var = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6352 | ) |
| 6353 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6354 | 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] | 6355 | _res = star_expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6356 | goto done; |
| 6357 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6358 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6359 | D(fprintf(stderr, "%*c%s star_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6360 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6361 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6362 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6363 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6364 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6365 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6366 | } |
| 6367 | |
| 6368 | // star_expression: '*' bitwise_or | expression |
| 6369 | static expr_ty |
| 6370 | star_expression_rule(Parser *p) |
| 6371 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6372 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6373 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6374 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6375 | return NULL; |
| 6376 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6377 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6378 | if (_PyPegen_is_memoized(p, star_expression_type, &_res)) { |
| 6379 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6380 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6381 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6382 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6383 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6384 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6385 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6386 | return NULL; |
| 6387 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6388 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6389 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6390 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6391 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6392 | { // '*' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6393 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6394 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6395 | return NULL; |
| 6396 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6397 | 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] | 6398 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6399 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6400 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6401 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6402 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6403 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6404 | ) |
| 6405 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6406 | 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] | 6407 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6408 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6409 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6410 | return NULL; |
| 6411 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6412 | int _end_lineno = _token->end_lineno; |
| 6413 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6414 | int _end_col_offset = _token->end_col_offset; |
| 6415 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6416 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 6417 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6418 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6419 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6420 | return NULL; |
| 6421 | } |
| 6422 | goto done; |
| 6423 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6424 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6425 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6426 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6427 | } |
| 6428 | { // expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6429 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6430 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6431 | return NULL; |
| 6432 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6433 | 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] | 6434 | expr_ty expression_var; |
| 6435 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6436 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6437 | ) |
| 6438 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6439 | 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] | 6440 | _res = expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6441 | goto done; |
| 6442 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6443 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6444 | D(fprintf(stderr, "%*c%s star_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6445 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6446 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6447 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6448 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6449 | _PyPegen_insert_memo(p, _mark, star_expression_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6450 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6451 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6452 | } |
| 6453 | |
| 6454 | // star_named_expressions: ','.star_named_expression+ ','? |
| 6455 | static asdl_seq* |
| 6456 | star_named_expressions_rule(Parser *p) |
| 6457 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6458 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6459 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6460 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6461 | return NULL; |
| 6462 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6463 | asdl_seq* _res = NULL; |
| 6464 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6465 | { // ','.star_named_expression+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6466 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6467 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6468 | return NULL; |
| 6469 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6470 | 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] | 6471 | void *_opt_var; |
| 6472 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6473 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6474 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6475 | (a = _gather_72_rule(p)) // ','.star_named_expression+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6476 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6477 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6478 | ) |
| 6479 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6480 | 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] | 6481 | _res = a; |
| 6482 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6483 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6484 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6485 | return NULL; |
| 6486 | } |
| 6487 | goto done; |
| 6488 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6489 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6490 | D(fprintf(stderr, "%*c%s star_named_expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6491 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_named_expression+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6492 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6493 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6494 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6495 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6496 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6497 | } |
| 6498 | |
| 6499 | // star_named_expression: '*' bitwise_or | named_expression |
| 6500 | static expr_ty |
| 6501 | star_named_expression_rule(Parser *p) |
| 6502 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6503 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6504 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6505 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6506 | return NULL; |
| 6507 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6508 | expr_ty _res = NULL; |
| 6509 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6510 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6511 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6512 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6513 | return NULL; |
| 6514 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6515 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6516 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6517 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6518 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6519 | { // '*' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6520 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6521 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6522 | return NULL; |
| 6523 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6524 | 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] | 6525 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6526 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6527 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6528 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6529 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6530 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6531 | ) |
| 6532 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6533 | 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] | 6534 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6535 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6536 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6537 | return NULL; |
| 6538 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6539 | int _end_lineno = _token->end_lineno; |
| 6540 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6541 | int _end_col_offset = _token->end_col_offset; |
| 6542 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6543 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 6544 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6545 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6546 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6547 | return NULL; |
| 6548 | } |
| 6549 | goto done; |
| 6550 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6551 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6552 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6553 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6554 | } |
| 6555 | { // named_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6556 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6557 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6558 | return NULL; |
| 6559 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6560 | 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] | 6561 | expr_ty named_expression_var; |
| 6562 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6563 | (named_expression_var = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6564 | ) |
| 6565 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6566 | 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] | 6567 | _res = named_expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6568 | goto done; |
| 6569 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6570 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6571 | D(fprintf(stderr, "%*c%s star_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6572 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6573 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6574 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6575 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6576 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6577 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6578 | } |
| 6579 | |
| 6580 | // named_expression: NAME ':=' expression | expression !':=' | invalid_named_expression |
| 6581 | static expr_ty |
| 6582 | named_expression_rule(Parser *p) |
| 6583 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6584 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6585 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6586 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6587 | return NULL; |
| 6588 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6589 | expr_ty _res = NULL; |
| 6590 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6591 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6592 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6593 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6594 | return NULL; |
| 6595 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6596 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6597 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6598 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6599 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6600 | { // NAME ':=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6601 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6602 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6603 | return NULL; |
| 6604 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6605 | 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] | 6606 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6607 | expr_ty a; |
| 6608 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6609 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6610 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6611 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6612 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6613 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6614 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6615 | ) |
| 6616 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6617 | 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] | 6618 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6619 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6620 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6621 | return NULL; |
| 6622 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6623 | int _end_lineno = _token->end_lineno; |
| 6624 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6625 | int _end_col_offset = _token->end_col_offset; |
| 6626 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6627 | _res = _Py_NamedExpr ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , b , EXTRA ); |
| 6628 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6629 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6630 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6631 | return NULL; |
| 6632 | } |
| 6633 | goto done; |
| 6634 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6635 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6636 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6637 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME ':=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6638 | } |
| 6639 | { // expression !':=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6640 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6641 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6642 | return NULL; |
| 6643 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6644 | 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] | 6645 | expr_ty expression_var; |
| 6646 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6647 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6648 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6649 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6650 | ) |
| 6651 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6652 | 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] | 6653 | _res = expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6654 | goto done; |
| 6655 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6656 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6657 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6658 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6659 | } |
| 6660 | { // invalid_named_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6661 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6662 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6663 | return NULL; |
| 6664 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6665 | 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] | 6666 | void *invalid_named_expression_var; |
| 6667 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6668 | (invalid_named_expression_var = invalid_named_expression_rule(p)) // invalid_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6669 | ) |
| 6670 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6671 | 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] | 6672 | _res = invalid_named_expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6673 | goto done; |
| 6674 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6675 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6676 | D(fprintf(stderr, "%*c%s named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6677 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6678 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6679 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6680 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6681 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6682 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6683 | } |
| 6684 | |
| 6685 | // annotated_rhs: yield_expr | star_expressions |
| 6686 | static expr_ty |
| 6687 | annotated_rhs_rule(Parser *p) |
| 6688 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6689 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6690 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6691 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6692 | return NULL; |
| 6693 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6694 | expr_ty _res = NULL; |
| 6695 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6696 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6697 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6698 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6699 | return NULL; |
| 6700 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6701 | 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] | 6702 | expr_ty yield_expr_var; |
| 6703 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6704 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6705 | ) |
| 6706 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6707 | 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] | 6708 | _res = yield_expr_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6709 | goto done; |
| 6710 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6711 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6712 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
| 6713 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6714 | } |
| 6715 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6716 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6717 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6718 | return NULL; |
| 6719 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6720 | 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] | 6721 | expr_ty star_expressions_var; |
| 6722 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6723 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6724 | ) |
| 6725 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6726 | 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] | 6727 | _res = star_expressions_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6728 | goto done; |
| 6729 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6730 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6731 | D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ', |
| 6732 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6733 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6734 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6735 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6736 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6737 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6738 | } |
| 6739 | |
| 6740 | // expressions: expression ((',' expression))+ ','? | expression ',' | expression |
| 6741 | static expr_ty |
| 6742 | expressions_rule(Parser *p) |
| 6743 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6744 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6745 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6746 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6747 | return NULL; |
| 6748 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6749 | expr_ty _res = NULL; |
| 6750 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6751 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6752 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6753 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6754 | return NULL; |
| 6755 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6756 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6757 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6758 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6759 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6760 | { // expression ((',' expression))+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6761 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6762 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6763 | return NULL; |
| 6764 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6765 | 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] | 6766 | void *_opt_var; |
| 6767 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6768 | expr_ty a; |
| 6769 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6770 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6771 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6772 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6773 | (b = _loop1_74_rule(p)) // ((',' expression))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6774 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6775 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6776 | ) |
| 6777 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6778 | 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] | 6779 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6780 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6781 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6782 | return NULL; |
| 6783 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6784 | int _end_lineno = _token->end_lineno; |
| 6785 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6786 | int _end_col_offset = _token->end_col_offset; |
| 6787 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6788 | _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA ); |
| 6789 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6790 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6791 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6792 | return NULL; |
| 6793 | } |
| 6794 | goto done; |
| 6795 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6796 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6797 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6798 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6799 | } |
| 6800 | { // expression ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6801 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6802 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6803 | return NULL; |
| 6804 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6805 | 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] | 6806 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6807 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6808 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6809 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6810 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6811 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6812 | ) |
| 6813 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6814 | 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] | 6815 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6816 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6817 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6818 | return NULL; |
| 6819 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6820 | int _end_lineno = _token->end_lineno; |
| 6821 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6822 | int _end_col_offset = _token->end_col_offset; |
| 6823 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6824 | _res = _Py_Tuple ( CHECK ( _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA ); |
| 6825 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6826 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6827 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6828 | return NULL; |
| 6829 | } |
| 6830 | goto done; |
| 6831 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6832 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6833 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6834 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6835 | } |
| 6836 | { // expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6837 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6838 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6839 | return NULL; |
| 6840 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6841 | 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] | 6842 | expr_ty expression_var; |
| 6843 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6844 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6845 | ) |
| 6846 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6847 | 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] | 6848 | _res = expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6849 | goto done; |
| 6850 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6851 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6852 | D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ', |
| 6853 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6854 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6855 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6856 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6857 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6858 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6859 | } |
| 6860 | |
| 6861 | // expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef |
| 6862 | static expr_ty |
| 6863 | expression_rule(Parser *p) |
| 6864 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6865 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6866 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6867 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6868 | return NULL; |
| 6869 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6870 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6871 | if (_PyPegen_is_memoized(p, expression_type, &_res)) { |
| 6872 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6873 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6874 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6875 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6876 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6877 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6878 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6879 | return NULL; |
| 6880 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6881 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6882 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6883 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6884 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6885 | { // disjunction 'if' disjunction 'else' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6886 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6887 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6888 | return NULL; |
| 6889 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6890 | 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] | 6891 | Token * _keyword; |
| 6892 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6893 | expr_ty a; |
| 6894 | expr_ty b; |
| 6895 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6896 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6897 | (a = disjunction_rule(p)) // disjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6898 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6899 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6900 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6901 | (b = disjunction_rule(p)) // disjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6902 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6903 | (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6904 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6905 | (c = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6906 | ) |
| 6907 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6908 | 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] | 6909 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 6910 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6911 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6912 | return NULL; |
| 6913 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6914 | int _end_lineno = _token->end_lineno; |
| 6915 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 6916 | int _end_col_offset = _token->end_col_offset; |
| 6917 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 6918 | _res = _Py_IfExp ( b , a , c , EXTRA ); |
| 6919 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6920 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6921 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6922 | return NULL; |
| 6923 | } |
| 6924 | goto done; |
| 6925 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6926 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6927 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6928 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6929 | } |
| 6930 | { // disjunction |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6931 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6932 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6933 | return NULL; |
| 6934 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6935 | 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] | 6936 | expr_ty disjunction_var; |
| 6937 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6938 | (disjunction_var = disjunction_rule(p)) // disjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6939 | ) |
| 6940 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6941 | 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] | 6942 | _res = disjunction_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6943 | goto done; |
| 6944 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6945 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6946 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6947 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6948 | } |
| 6949 | { // lambdef |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6950 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6951 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6952 | return NULL; |
| 6953 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6954 | 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] | 6955 | expr_ty lambdef_var; |
| 6956 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 6957 | (lambdef_var = lambdef_rule(p)) // lambdef |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6958 | ) |
| 6959 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6960 | 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] | 6961 | _res = lambdef_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6962 | goto done; |
| 6963 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6964 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6965 | D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 6966 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6967 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6968 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6969 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6970 | _PyPegen_insert_memo(p, _mark, expression_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6971 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6972 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6973 | } |
| 6974 | |
| 6975 | // lambdef: 'lambda' lambda_parameters? ':' expression |
| 6976 | static expr_ty |
| 6977 | lambdef_rule(Parser *p) |
| 6978 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6979 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6980 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6981 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6982 | return NULL; |
| 6983 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6984 | expr_ty _res = NULL; |
| 6985 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6986 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 6987 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6988 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6989 | return NULL; |
| 6990 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 6991 | int _start_lineno = p->tokens[_mark]->lineno; |
| 6992 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 6993 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 6994 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 6995 | { // 'lambda' lambda_parameters? ':' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6996 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 6997 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 6998 | return NULL; |
| 6999 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7000 | 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] | 7001 | Token * _keyword; |
| 7002 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7003 | void *a; |
| 7004 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7005 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7006 | (_keyword = _PyPegen_expect_token(p, 524)) // token='lambda' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7007 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7008 | (a = lambda_parameters_rule(p), 1) // lambda_parameters? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7009 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7010 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7011 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7012 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7013 | ) |
| 7014 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7015 | 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] | 7016 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7017 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7018 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7019 | return NULL; |
| 7020 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7021 | int _end_lineno = _token->end_lineno; |
| 7022 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7023 | int _end_col_offset = _token->end_col_offset; |
| 7024 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7025 | _res = _Py_Lambda ( ( a ) ? a : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , EXTRA ); |
| 7026 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7027 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7028 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7029 | return NULL; |
| 7030 | } |
| 7031 | goto done; |
| 7032 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7033 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7034 | D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ', |
| 7035 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7036 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7037 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7038 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7039 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7040 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7041 | } |
| 7042 | |
| 7043 | // lambda_parameters: |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7044 | // | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? |
| 7045 | // | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
| 7046 | // | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
| 7047 | // | lambda_param_with_default+ lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7048 | // | lambda_star_etc |
| 7049 | static arguments_ty |
| 7050 | lambda_parameters_rule(Parser *p) |
| 7051 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7052 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7053 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7054 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7055 | return NULL; |
| 7056 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7057 | arguments_ty _res = NULL; |
| 7058 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7059 | { // 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] | 7060 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7061 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7062 | return NULL; |
| 7063 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7064 | 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] | 7065 | asdl_seq* a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7066 | asdl_seq * b; |
| 7067 | asdl_seq * c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7068 | void *d; |
| 7069 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7070 | (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7071 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7072 | (b = _loop0_75_rule(p)) // lambda_param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7073 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7074 | (c = _loop0_76_rule(p)) // lambda_param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7075 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7076 | (d = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7077 | ) |
| 7078 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7079 | 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] | 7080 | _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); |
| 7081 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7082 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7083 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7084 | return NULL; |
| 7085 | } |
| 7086 | goto done; |
| 7087 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7088 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7089 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7090 | 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] | 7091 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7092 | { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7093 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7094 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7095 | return NULL; |
| 7096 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7097 | 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] | 7098 | SlashWithDefault* a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7099 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7100 | void *c; |
| 7101 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7102 | (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7103 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7104 | (b = _loop0_77_rule(p)) // lambda_param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7105 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7106 | (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7107 | ) |
| 7108 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7109 | 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] | 7110 | _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); |
| 7111 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7112 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7113 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7114 | return NULL; |
| 7115 | } |
| 7116 | goto done; |
| 7117 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7118 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7119 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7120 | 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] | 7121 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7122 | { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7123 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7124 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7125 | return NULL; |
| 7126 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7127 | 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] | 7128 | asdl_seq * a; |
| 7129 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7130 | void *c; |
| 7131 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7132 | (a = _loop1_78_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7133 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7134 | (b = _loop0_79_rule(p)) // lambda_param_with_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7135 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7136 | (c = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7137 | ) |
| 7138 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7139 | 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] | 7140 | _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); |
| 7141 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7142 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7143 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7144 | return NULL; |
| 7145 | } |
| 7146 | goto done; |
| 7147 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7148 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7149 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7150 | 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] | 7151 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7152 | { // lambda_param_with_default+ lambda_star_etc? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7153 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7154 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7155 | return NULL; |
| 7156 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7157 | 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] | 7158 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7159 | void *b; |
| 7160 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7161 | (a = _loop1_80_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7162 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7163 | (b = lambda_star_etc_rule(p), 1) // lambda_star_etc? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7164 | ) |
| 7165 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7166 | 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] | 7167 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); |
| 7168 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7169 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7170 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7171 | return NULL; |
| 7172 | } |
| 7173 | goto done; |
| 7174 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7175 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7176 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7177 | 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] | 7178 | } |
| 7179 | { // lambda_star_etc |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7180 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7181 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7182 | return NULL; |
| 7183 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7184 | 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] | 7185 | StarEtc* a; |
| 7186 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7187 | (a = lambda_star_etc_rule(p)) // lambda_star_etc |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7188 | ) |
| 7189 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7190 | 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] | 7191 | _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a ); |
| 7192 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7193 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7194 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7195 | return NULL; |
| 7196 | } |
| 7197 | goto done; |
| 7198 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7199 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7200 | D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 7201 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7202 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7203 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7204 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7205 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7206 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7207 | } |
| 7208 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7209 | // lambda_slash_no_default: |
| 7210 | // | lambda_param_no_default+ '/' ',' |
| 7211 | // | lambda_param_no_default+ '/' &':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7212 | static asdl_seq* |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7213 | lambda_slash_no_default_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7214 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7215 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7216 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7217 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7218 | return NULL; |
| 7219 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7220 | asdl_seq* _res = NULL; |
| 7221 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7222 | { // lambda_param_no_default+ '/' ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7223 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7224 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7225 | return NULL; |
| 7226 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7227 | 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] | 7228 | Token * _literal; |
| 7229 | Token * _literal_1; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7230 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7231 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7232 | (a = _loop1_81_rule(p)) // lambda_param_no_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7233 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7234 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7235 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7236 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7237 | ) |
| 7238 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7239 | 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] | 7240 | _res = a; |
| 7241 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7242 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7243 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7244 | return NULL; |
| 7245 | } |
| 7246 | goto done; |
| 7247 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7248 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7249 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7250 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7251 | } |
| 7252 | { // lambda_param_no_default+ '/' &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7253 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7254 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7255 | return NULL; |
| 7256 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7257 | 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] | 7258 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7259 | asdl_seq * a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7260 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7261 | (a = _loop1_82_rule(p)) // lambda_param_no_default+ |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7262 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7263 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7264 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7265 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7266 | ) |
| 7267 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7268 | 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] | 7269 | _res = a; |
| 7270 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7271 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7272 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7273 | return NULL; |
| 7274 | } |
| 7275 | goto done; |
| 7276 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7277 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7278 | D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7279 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7280 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7281 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7282 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7283 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7284 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7285 | } |
| 7286 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7287 | // lambda_slash_with_default: |
| 7288 | // | lambda_param_no_default* lambda_param_with_default+ '/' ',' |
| 7289 | // | lambda_param_no_default* lambda_param_with_default+ '/' &':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7290 | static SlashWithDefault* |
| 7291 | lambda_slash_with_default_rule(Parser *p) |
| 7292 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7293 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7294 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7295 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7296 | return NULL; |
| 7297 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7298 | SlashWithDefault* _res = NULL; |
| 7299 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7300 | { // lambda_param_no_default* lambda_param_with_default+ '/' ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7301 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7302 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7303 | return NULL; |
| 7304 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7305 | 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] | 7306 | Token * _literal; |
| 7307 | Token * _literal_1; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7308 | asdl_seq * a; |
| 7309 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7310 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7311 | (a = _loop0_83_rule(p)) // lambda_param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7312 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7313 | (b = _loop1_84_rule(p)) // lambda_param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7314 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7315 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7316 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7317 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7318 | ) |
| 7319 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7320 | 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] | 7321 | _res = _PyPegen_slash_with_default ( p , a , b ); |
| 7322 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7323 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7324 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7325 | return NULL; |
| 7326 | } |
| 7327 | goto done; |
| 7328 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7329 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7330 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7331 | 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] | 7332 | } |
| 7333 | { // lambda_param_no_default* lambda_param_with_default+ '/' &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7334 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7335 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7336 | return NULL; |
| 7337 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7338 | 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] | 7339 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7340 | asdl_seq * a; |
| 7341 | asdl_seq * b; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7342 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7343 | (a = _loop0_85_rule(p)) // lambda_param_no_default* |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7344 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7345 | (b = _loop1_86_rule(p)) // lambda_param_with_default+ |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7346 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7347 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7348 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7349 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7350 | ) |
| 7351 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7352 | 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] | 7353 | _res = _PyPegen_slash_with_default ( p , a , b ); |
| 7354 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7355 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7356 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7357 | return NULL; |
| 7358 | } |
| 7359 | goto done; |
| 7360 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7361 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7362 | D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7363 | 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] | 7364 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7365 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7366 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7367 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7368 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7369 | } |
| 7370 | |
| 7371 | // lambda_star_etc: |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7372 | // | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
| 7373 | // | '*' ',' lambda_param_maybe_default+ lambda_kwds? |
| 7374 | // | lambda_kwds |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7375 | // | invalid_lambda_star_etc |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7376 | static StarEtc* |
| 7377 | lambda_star_etc_rule(Parser *p) |
| 7378 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7379 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7380 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7381 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7382 | return NULL; |
| 7383 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7384 | StarEtc* _res = NULL; |
| 7385 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7386 | { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7387 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7388 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7389 | return NULL; |
| 7390 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7391 | 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] | 7392 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7393 | arg_ty a; |
| 7394 | asdl_seq * b; |
| 7395 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7396 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7397 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7398 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7399 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7400 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7401 | (b = _loop0_87_rule(p)) // lambda_param_maybe_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7402 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7403 | (c = lambda_kwds_rule(p), 1) // lambda_kwds? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7404 | ) |
| 7405 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7406 | 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] | 7407 | _res = _PyPegen_star_etc ( p , a , b , c ); |
| 7408 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7409 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7410 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7411 | return NULL; |
| 7412 | } |
| 7413 | goto done; |
| 7414 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7415 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7416 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 7417 | 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] | 7418 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7419 | { // '*' ',' lambda_param_maybe_default+ lambda_kwds? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7420 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7421 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7422 | return NULL; |
| 7423 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7424 | 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] | 7425 | Token * _literal; |
| 7426 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7427 | asdl_seq * b; |
| 7428 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7429 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7430 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7431 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7432 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7433 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7434 | (b = _loop1_88_rule(p)) // lambda_param_maybe_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7435 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7436 | (c = lambda_kwds_rule(p), 1) // lambda_kwds? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7437 | ) |
| 7438 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7439 | 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] | 7440 | _res = _PyPegen_star_etc ( p , NULL , b , c ); |
| 7441 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7442 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7443 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7444 | return NULL; |
| 7445 | } |
| 7446 | goto done; |
| 7447 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7448 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7449 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 7450 | 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] | 7451 | } |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7452 | { // lambda_kwds |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7453 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7454 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7455 | return NULL; |
| 7456 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7457 | 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] | 7458 | arg_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7459 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7460 | (a = lambda_kwds_rule(p)) // lambda_kwds |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7461 | ) |
| 7462 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7463 | 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] | 7464 | _res = _PyPegen_star_etc ( p , NULL , NULL , a ); |
| 7465 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7466 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7467 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7468 | return NULL; |
| 7469 | } |
| 7470 | goto done; |
| 7471 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7472 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7473 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 7474 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7475 | } |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7476 | { // invalid_lambda_star_etc |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7477 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7478 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7479 | return NULL; |
| 7480 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7481 | 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] | 7482 | void *invalid_lambda_star_etc_var; |
| 7483 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7484 | (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] | 7485 | ) |
| 7486 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7487 | 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] | 7488 | _res = invalid_lambda_star_etc_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7489 | goto done; |
| 7490 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7491 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7492 | D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 7493 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 7494 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7495 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7496 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7497 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7498 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7499 | } |
| 7500 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7501 | // lambda_kwds: '**' lambda_param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7502 | static arg_ty |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7503 | lambda_kwds_rule(Parser *p) |
| 7504 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7505 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7506 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7507 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7508 | return NULL; |
| 7509 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7510 | arg_ty _res = NULL; |
| 7511 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7512 | { // '**' lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7513 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7514 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7515 | return NULL; |
| 7516 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7517 | 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] | 7518 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7519 | arg_ty a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7520 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7521 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7522 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7523 | (a = lambda_param_no_default_rule(p)) // lambda_param_no_default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7524 | ) |
| 7525 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7526 | 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] | 7527 | _res = a; |
| 7528 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7529 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7530 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7531 | return NULL; |
| 7532 | } |
| 7533 | goto done; |
| 7534 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7535 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7536 | D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ', |
| 7537 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7538 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7539 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7540 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7541 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7542 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7543 | } |
| 7544 | |
| 7545 | // lambda_param_no_default: lambda_param ',' | lambda_param &':' |
| 7546 | static arg_ty |
| 7547 | lambda_param_no_default_rule(Parser *p) |
| 7548 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7549 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7550 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7551 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7552 | return NULL; |
| 7553 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7554 | arg_ty _res = NULL; |
| 7555 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7556 | { // lambda_param ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7557 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7558 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7559 | return NULL; |
| 7560 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7561 | 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] | 7562 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7563 | arg_ty a; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7564 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7565 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7566 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7567 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7568 | ) |
| 7569 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7570 | 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] | 7571 | _res = a; |
| 7572 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7573 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7574 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7575 | return NULL; |
| 7576 | } |
| 7577 | goto done; |
| 7578 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7579 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7580 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7581 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7582 | } |
| 7583 | { // lambda_param &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7584 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7585 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7586 | return NULL; |
| 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\n", p->level, ' ', _mark, p->mark, "lambda_param &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7589 | arg_ty a; |
| 7590 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7591 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7592 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7593 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7594 | ) |
| 7595 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7596 | 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] | 7597 | _res = a; |
| 7598 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7599 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7600 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7601 | return NULL; |
| 7602 | } |
| 7603 | goto done; |
| 7604 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7605 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7606 | D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7607 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7608 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7609 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7610 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7611 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7612 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7613 | } |
| 7614 | |
| 7615 | // lambda_param_with_default: lambda_param default ',' | lambda_param default &':' |
| 7616 | static NameDefaultPair* |
| 7617 | lambda_param_with_default_rule(Parser *p) |
| 7618 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7619 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7620 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7621 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7622 | return NULL; |
| 7623 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7624 | NameDefaultPair* _res = NULL; |
| 7625 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7626 | { // lambda_param default ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7627 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7628 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7629 | return NULL; |
| 7630 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7631 | 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] | 7632 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7633 | arg_ty a; |
| 7634 | expr_ty c; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7635 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7636 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7637 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7638 | (c = default_rule(p)) // default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7639 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7640 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7641 | ) |
| 7642 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7643 | 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] | 7644 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 7645 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7646 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7647 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7648 | return NULL; |
| 7649 | } |
| 7650 | goto done; |
| 7651 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7652 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7653 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7654 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7655 | } |
| 7656 | { // lambda_param default &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7657 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7658 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7659 | return NULL; |
| 7660 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7661 | 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] | 7662 | arg_ty a; |
| 7663 | expr_ty c; |
| 7664 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7665 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7666 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7667 | (c = default_rule(p)) // default |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7668 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7669 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7670 | ) |
| 7671 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7672 | 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] | 7673 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 7674 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7675 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7676 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7677 | return NULL; |
| 7678 | } |
| 7679 | goto done; |
| 7680 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7681 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7682 | D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7683 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7684 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7685 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7686 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7687 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7688 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7689 | } |
| 7690 | |
| 7691 | // lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' |
| 7692 | static NameDefaultPair* |
| 7693 | lambda_param_maybe_default_rule(Parser *p) |
| 7694 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7695 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7696 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7697 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7698 | return NULL; |
| 7699 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7700 | NameDefaultPair* _res = NULL; |
| 7701 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7702 | { // lambda_param default? ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7703 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7704 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7705 | return NULL; |
| 7706 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7707 | 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] | 7708 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7709 | arg_ty a; |
| 7710 | void *c; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7711 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7712 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7713 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7714 | (c = default_rule(p), 1) // default? |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7715 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7716 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7717 | ) |
| 7718 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7719 | 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] | 7720 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 7721 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7722 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7723 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7724 | return NULL; |
| 7725 | } |
| 7726 | goto done; |
| 7727 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7728 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7729 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7730 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7731 | } |
| 7732 | { // lambda_param default? &':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7733 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7734 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7735 | return NULL; |
| 7736 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7737 | 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] | 7738 | arg_ty a; |
| 7739 | void *c; |
| 7740 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7741 | (a = lambda_param_rule(p)) // lambda_param |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7742 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7743 | (c = default_rule(p), 1) // default? |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7744 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7745 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7746 | ) |
| 7747 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7748 | 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] | 7749 | _res = _PyPegen_name_default_pair ( p , a , c , NULL ); |
| 7750 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7751 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7752 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7753 | return NULL; |
| 7754 | } |
| 7755 | goto done; |
| 7756 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7757 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7758 | D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ', |
| 7759 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7760 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7761 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7762 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7763 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7764 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 7765 | } |
| 7766 | |
| 7767 | // lambda_param: NAME |
| 7768 | static arg_ty |
| 7769 | lambda_param_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7770 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7771 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7772 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7773 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7774 | return NULL; |
| 7775 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7776 | arg_ty _res = NULL; |
| 7777 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7778 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7779 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7780 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7781 | return NULL; |
| 7782 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7783 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7784 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7785 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7786 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7787 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7788 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7789 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7790 | return NULL; |
| 7791 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7792 | 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] | 7793 | expr_ty a; |
| 7794 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7795 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7796 | ) |
| 7797 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7798 | 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] | 7799 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7800 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7801 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7802 | return NULL; |
| 7803 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7804 | int _end_lineno = _token->end_lineno; |
| 7805 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7806 | int _end_col_offset = _token->end_col_offset; |
| 7807 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7808 | _res = _Py_arg ( a -> v . Name . id , NULL , NULL , EXTRA ); |
| 7809 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7810 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7811 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7812 | return NULL; |
| 7813 | } |
| 7814 | goto done; |
| 7815 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7816 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7817 | D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ', |
| 7818 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7819 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7820 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7821 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7822 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7823 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7824 | } |
| 7825 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7826 | // disjunction: conjunction (('or' conjunction))+ | conjunction |
| 7827 | static expr_ty |
| 7828 | disjunction_rule(Parser *p) |
| 7829 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7830 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7831 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7832 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7833 | return NULL; |
| 7834 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7835 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7836 | if (_PyPegen_is_memoized(p, disjunction_type, &_res)) { |
| 7837 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7838 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7839 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7840 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7841 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7842 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7843 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7844 | return NULL; |
| 7845 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7846 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7847 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7848 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7849 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7850 | { // conjunction (('or' conjunction))+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7851 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7852 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7853 | return NULL; |
| 7854 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7855 | 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] | 7856 | expr_ty a; |
| 7857 | asdl_seq * b; |
| 7858 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7859 | (a = conjunction_rule(p)) // conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7860 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7861 | (b = _loop1_89_rule(p)) // (('or' conjunction))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7862 | ) |
| 7863 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7864 | 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] | 7865 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7866 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7867 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7868 | return NULL; |
| 7869 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7870 | int _end_lineno = _token->end_lineno; |
| 7871 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7872 | int _end_col_offset = _token->end_col_offset; |
| 7873 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7874 | _res = _Py_BoolOp ( Or , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
| 7875 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7876 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7877 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7878 | return NULL; |
| 7879 | } |
| 7880 | goto done; |
| 7881 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7882 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7883 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 7884 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction (('or' conjunction))+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7885 | } |
| 7886 | { // conjunction |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7887 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7888 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7889 | return NULL; |
| 7890 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7891 | 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] | 7892 | expr_ty conjunction_var; |
| 7893 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7894 | (conjunction_var = conjunction_rule(p)) // conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7895 | ) |
| 7896 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7897 | 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] | 7898 | _res = conjunction_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7899 | goto done; |
| 7900 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7901 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7902 | D(fprintf(stderr, "%*c%s disjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 7903 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "conjunction")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7904 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7905 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7906 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7907 | _PyPegen_insert_memo(p, _mark, disjunction_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7908 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7909 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7910 | } |
| 7911 | |
| 7912 | // conjunction: inversion (('and' inversion))+ | inversion |
| 7913 | static expr_ty |
| 7914 | conjunction_rule(Parser *p) |
| 7915 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7916 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7917 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7918 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7919 | return NULL; |
| 7920 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7921 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7922 | if (_PyPegen_is_memoized(p, conjunction_type, &_res)) { |
| 7923 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7924 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7925 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7926 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7927 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 7928 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7929 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7930 | return NULL; |
| 7931 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7932 | int _start_lineno = p->tokens[_mark]->lineno; |
| 7933 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 7934 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 7935 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7936 | { // inversion (('and' inversion))+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7937 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7938 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7939 | return NULL; |
| 7940 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7941 | 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] | 7942 | expr_ty a; |
| 7943 | asdl_seq * b; |
| 7944 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7945 | (a = inversion_rule(p)) // inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7946 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7947 | (b = _loop1_90_rule(p)) // (('and' inversion))+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7948 | ) |
| 7949 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7950 | 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] | 7951 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 7952 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7953 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7954 | return NULL; |
| 7955 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7956 | int _end_lineno = _token->end_lineno; |
| 7957 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 7958 | int _end_col_offset = _token->end_col_offset; |
| 7959 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 7960 | _res = _Py_BoolOp ( And , CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , EXTRA ); |
| 7961 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7962 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7963 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7964 | return NULL; |
| 7965 | } |
| 7966 | goto done; |
| 7967 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7968 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7969 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 7970 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion (('and' inversion))+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7971 | } |
| 7972 | { // inversion |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7973 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7974 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 7975 | return NULL; |
| 7976 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7977 | 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] | 7978 | expr_ty inversion_var; |
| 7979 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 7980 | (inversion_var = inversion_rule(p)) // inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7981 | ) |
| 7982 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7983 | 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] | 7984 | _res = inversion_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7985 | goto done; |
| 7986 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7987 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7988 | D(fprintf(stderr, "%*c%s conjunction[%d-%d]: %s failed!\n", p->level, ' ', |
| 7989 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "inversion")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7990 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7991 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7992 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7993 | _PyPegen_insert_memo(p, _mark, conjunction_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 7994 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 7995 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 7996 | } |
| 7997 | |
| 7998 | // inversion: 'not' inversion | comparison |
| 7999 | static expr_ty |
| 8000 | inversion_rule(Parser *p) |
| 8001 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8002 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8003 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8004 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8005 | return NULL; |
| 8006 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8007 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8008 | if (_PyPegen_is_memoized(p, inversion_type, &_res)) { |
| 8009 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8010 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8011 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8012 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8013 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8014 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8015 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8016 | return NULL; |
| 8017 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8018 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8019 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8020 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8021 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8022 | { // 'not' inversion |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8023 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8024 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8025 | return NULL; |
| 8026 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8027 | 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] | 8028 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8029 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8030 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8031 | (_keyword = _PyPegen_expect_token(p, 525)) // token='not' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8032 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8033 | (a = inversion_rule(p)) // inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8034 | ) |
| 8035 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8036 | 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] | 8037 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8038 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8039 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8040 | return NULL; |
| 8041 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8042 | int _end_lineno = _token->end_lineno; |
| 8043 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8044 | int _end_col_offset = _token->end_col_offset; |
| 8045 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8046 | _res = _Py_UnaryOp ( Not , a , EXTRA ); |
| 8047 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8048 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8049 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8050 | return NULL; |
| 8051 | } |
| 8052 | goto done; |
| 8053 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8054 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8055 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
| 8056 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' inversion")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8057 | } |
| 8058 | { // comparison |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8059 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8060 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8061 | return NULL; |
| 8062 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8063 | 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] | 8064 | expr_ty comparison_var; |
| 8065 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8066 | (comparison_var = comparison_rule(p)) // comparison |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8067 | ) |
| 8068 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8069 | 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] | 8070 | _res = comparison_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8071 | goto done; |
| 8072 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8073 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8074 | D(fprintf(stderr, "%*c%s inversion[%d-%d]: %s failed!\n", p->level, ' ', |
| 8075 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "comparison")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8076 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8077 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8078 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8079 | _PyPegen_insert_memo(p, _mark, inversion_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8080 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8081 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8082 | } |
| 8083 | |
| 8084 | // comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or |
| 8085 | static expr_ty |
| 8086 | comparison_rule(Parser *p) |
| 8087 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8088 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8089 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8090 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8091 | return NULL; |
| 8092 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8093 | expr_ty _res = NULL; |
| 8094 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8095 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8096 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8097 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8098 | return NULL; |
| 8099 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8100 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8101 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8102 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8103 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8104 | { // bitwise_or compare_op_bitwise_or_pair+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8105 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8106 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8107 | return NULL; |
| 8108 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8109 | 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] | 8110 | expr_ty a; |
| 8111 | asdl_seq * b; |
| 8112 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8113 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8114 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8115 | (b = _loop1_91_rule(p)) // compare_op_bitwise_or_pair+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8116 | ) |
| 8117 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8118 | 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] | 8119 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8120 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8121 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8122 | return NULL; |
| 8123 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8124 | int _end_lineno = _token->end_lineno; |
| 8125 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8126 | int _end_col_offset = _token->end_col_offset; |
| 8127 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8128 | _res = _Py_Compare ( a , CHECK ( _PyPegen_get_cmpops ( p , b ) ) , CHECK ( _PyPegen_get_exprs ( p , b ) ) , EXTRA ); |
| 8129 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8130 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8131 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8132 | return NULL; |
| 8133 | } |
| 8134 | goto done; |
| 8135 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8136 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8137 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
| 8138 | 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] | 8139 | } |
| 8140 | { // bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8141 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8142 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8143 | return NULL; |
| 8144 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8145 | 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] | 8146 | expr_ty bitwise_or_var; |
| 8147 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8148 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8149 | ) |
| 8150 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8151 | 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] | 8152 | _res = bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8153 | goto done; |
| 8154 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8155 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8156 | D(fprintf(stderr, "%*c%s comparison[%d-%d]: %s failed!\n", p->level, ' ', |
| 8157 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8158 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8159 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8160 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8161 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8162 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8163 | } |
| 8164 | |
| 8165 | // compare_op_bitwise_or_pair: |
| 8166 | // | eq_bitwise_or |
| 8167 | // | noteq_bitwise_or |
| 8168 | // | lte_bitwise_or |
| 8169 | // | lt_bitwise_or |
| 8170 | // | gte_bitwise_or |
| 8171 | // | gt_bitwise_or |
| 8172 | // | notin_bitwise_or |
| 8173 | // | in_bitwise_or |
| 8174 | // | isnot_bitwise_or |
| 8175 | // | is_bitwise_or |
| 8176 | static CmpopExprPair* |
| 8177 | compare_op_bitwise_or_pair_rule(Parser *p) |
| 8178 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8179 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8180 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8181 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8182 | return NULL; |
| 8183 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8184 | CmpopExprPair* _res = NULL; |
| 8185 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8186 | { // eq_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8187 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8188 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8189 | return NULL; |
| 8190 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8191 | 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] | 8192 | CmpopExprPair* eq_bitwise_or_var; |
| 8193 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8194 | (eq_bitwise_or_var = eq_bitwise_or_rule(p)) // eq_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8195 | ) |
| 8196 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8197 | 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] | 8198 | _res = eq_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8199 | goto done; |
| 8200 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8201 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8202 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8203 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "eq_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8204 | } |
| 8205 | { // noteq_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8206 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8207 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8208 | return NULL; |
| 8209 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8210 | 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] | 8211 | CmpopExprPair* noteq_bitwise_or_var; |
| 8212 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8213 | (noteq_bitwise_or_var = noteq_bitwise_or_rule(p)) // noteq_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8214 | ) |
| 8215 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8216 | 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] | 8217 | _res = noteq_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8218 | goto done; |
| 8219 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8220 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8221 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8222 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "noteq_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8223 | } |
| 8224 | { // lte_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8225 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8226 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8227 | return NULL; |
| 8228 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8229 | 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] | 8230 | CmpopExprPair* lte_bitwise_or_var; |
| 8231 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8232 | (lte_bitwise_or_var = lte_bitwise_or_rule(p)) // lte_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8233 | ) |
| 8234 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8235 | 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] | 8236 | _res = lte_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8237 | goto done; |
| 8238 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8239 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8240 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8241 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lte_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8242 | } |
| 8243 | { // lt_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8244 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8245 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8246 | return NULL; |
| 8247 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8248 | 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] | 8249 | CmpopExprPair* lt_bitwise_or_var; |
| 8250 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8251 | (lt_bitwise_or_var = lt_bitwise_or_rule(p)) // lt_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8252 | ) |
| 8253 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8254 | 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] | 8255 | _res = lt_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8256 | goto done; |
| 8257 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8258 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8259 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8260 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lt_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8261 | } |
| 8262 | { // gte_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8263 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8264 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8265 | return NULL; |
| 8266 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8267 | 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] | 8268 | CmpopExprPair* gte_bitwise_or_var; |
| 8269 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8270 | (gte_bitwise_or_var = gte_bitwise_or_rule(p)) // gte_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8271 | ) |
| 8272 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8273 | 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] | 8274 | _res = gte_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8275 | goto done; |
| 8276 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8277 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8278 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8279 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gte_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8280 | } |
| 8281 | { // gt_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8282 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8283 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8284 | return NULL; |
| 8285 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8286 | 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] | 8287 | CmpopExprPair* gt_bitwise_or_var; |
| 8288 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8289 | (gt_bitwise_or_var = gt_bitwise_or_rule(p)) // gt_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8290 | ) |
| 8291 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8292 | 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] | 8293 | _res = gt_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8294 | goto done; |
| 8295 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8296 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8297 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8298 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "gt_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8299 | } |
| 8300 | { // notin_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8301 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8302 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8303 | return NULL; |
| 8304 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8305 | 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] | 8306 | CmpopExprPair* notin_bitwise_or_var; |
| 8307 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8308 | (notin_bitwise_or_var = notin_bitwise_or_rule(p)) // notin_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8309 | ) |
| 8310 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8311 | 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] | 8312 | _res = notin_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8313 | goto done; |
| 8314 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8315 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8316 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8317 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "notin_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8318 | } |
| 8319 | { // in_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8320 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8321 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8322 | return NULL; |
| 8323 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8324 | 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] | 8325 | CmpopExprPair* in_bitwise_or_var; |
| 8326 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8327 | (in_bitwise_or_var = in_bitwise_or_rule(p)) // in_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8328 | ) |
| 8329 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8330 | 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] | 8331 | _res = in_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8332 | goto done; |
| 8333 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8334 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8335 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8336 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "in_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8337 | } |
| 8338 | { // isnot_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8339 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8340 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8341 | return NULL; |
| 8342 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8343 | 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] | 8344 | CmpopExprPair* isnot_bitwise_or_var; |
| 8345 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8346 | (isnot_bitwise_or_var = isnot_bitwise_or_rule(p)) // isnot_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8347 | ) |
| 8348 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8349 | 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] | 8350 | _res = isnot_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8351 | goto done; |
| 8352 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8353 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8354 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8355 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "isnot_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8356 | } |
| 8357 | { // is_bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8358 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8359 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8360 | return NULL; |
| 8361 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8362 | 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] | 8363 | CmpopExprPair* is_bitwise_or_var; |
| 8364 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8365 | (is_bitwise_or_var = is_bitwise_or_rule(p)) // is_bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8366 | ) |
| 8367 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8368 | 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] | 8369 | _res = is_bitwise_or_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8370 | goto done; |
| 8371 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8372 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8373 | D(fprintf(stderr, "%*c%s compare_op_bitwise_or_pair[%d-%d]: %s failed!\n", p->level, ' ', |
| 8374 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "is_bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8375 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8376 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8377 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8378 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8379 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8380 | } |
| 8381 | |
| 8382 | // eq_bitwise_or: '==' bitwise_or |
| 8383 | static CmpopExprPair* |
| 8384 | eq_bitwise_or_rule(Parser *p) |
| 8385 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8386 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8387 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8388 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8389 | return NULL; |
| 8390 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8391 | CmpopExprPair* _res = NULL; |
| 8392 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8393 | { // '==' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8394 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8395 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8396 | return NULL; |
| 8397 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8398 | 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] | 8399 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8400 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8401 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8402 | (_literal = _PyPegen_expect_token(p, 27)) // token='==' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8403 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8404 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8405 | ) |
| 8406 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8407 | 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] | 8408 | _res = _PyPegen_cmpop_expr_pair ( p , Eq , a ); |
| 8409 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8410 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8411 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8412 | return NULL; |
| 8413 | } |
| 8414 | goto done; |
| 8415 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8416 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8417 | D(fprintf(stderr, "%*c%s eq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8418 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'==' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8419 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8420 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8421 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8422 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8423 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8424 | } |
| 8425 | |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 8426 | // noteq_bitwise_or: ('!=') bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8427 | static CmpopExprPair* |
| 8428 | noteq_bitwise_or_rule(Parser *p) |
| 8429 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8430 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8431 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8432 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8433 | return NULL; |
| 8434 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8435 | CmpopExprPair* _res = NULL; |
| 8436 | int _mark = p->mark; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 8437 | { // ('!=') bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8438 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8439 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8440 | return NULL; |
| 8441 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8442 | 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] | 8443 | void *_tmp_92_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8444 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8445 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8446 | (_tmp_92_var = _tmp_92_rule(p)) // '!=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8447 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8448 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8449 | ) |
| 8450 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8451 | 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] | 8452 | _res = _PyPegen_cmpop_expr_pair ( p , NotEq , a ); |
| 8453 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8454 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8455 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8456 | return NULL; |
| 8457 | } |
| 8458 | goto done; |
| 8459 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8460 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8461 | D(fprintf(stderr, "%*c%s noteq_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8462 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('!=') bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8463 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8464 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8465 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8466 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8467 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8468 | } |
| 8469 | |
| 8470 | // lte_bitwise_or: '<=' bitwise_or |
| 8471 | static CmpopExprPair* |
| 8472 | lte_bitwise_or_rule(Parser *p) |
| 8473 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8474 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8475 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8476 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8477 | return NULL; |
| 8478 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8479 | CmpopExprPair* _res = NULL; |
| 8480 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8481 | { // '<=' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8482 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8483 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8484 | return NULL; |
| 8485 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8486 | 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] | 8487 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8488 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8489 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8490 | (_literal = _PyPegen_expect_token(p, 29)) // token='<=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8491 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8492 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8493 | ) |
| 8494 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8495 | 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] | 8496 | _res = _PyPegen_cmpop_expr_pair ( p , LtE , a ); |
| 8497 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8498 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8499 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8500 | return NULL; |
| 8501 | } |
| 8502 | goto done; |
| 8503 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8504 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8505 | D(fprintf(stderr, "%*c%s lte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8506 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<=' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8507 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8508 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8509 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8510 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8511 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8512 | } |
| 8513 | |
| 8514 | // lt_bitwise_or: '<' bitwise_or |
| 8515 | static CmpopExprPair* |
| 8516 | lt_bitwise_or_rule(Parser *p) |
| 8517 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8518 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8519 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8520 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8521 | return NULL; |
| 8522 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8523 | CmpopExprPair* _res = NULL; |
| 8524 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8525 | { // '<' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8526 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8527 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8528 | return NULL; |
| 8529 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8530 | 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] | 8531 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8532 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8533 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8534 | (_literal = _PyPegen_expect_token(p, 20)) // token='<' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8535 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8536 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8537 | ) |
| 8538 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8539 | 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] | 8540 | _res = _PyPegen_cmpop_expr_pair ( p , Lt , a ); |
| 8541 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8542 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8543 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8544 | return NULL; |
| 8545 | } |
| 8546 | goto done; |
| 8547 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8548 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8549 | D(fprintf(stderr, "%*c%s lt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8550 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'<' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8551 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8552 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8553 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8554 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8555 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8556 | } |
| 8557 | |
| 8558 | // gte_bitwise_or: '>=' bitwise_or |
| 8559 | static CmpopExprPair* |
| 8560 | gte_bitwise_or_rule(Parser *p) |
| 8561 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8562 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8563 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8564 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8565 | return NULL; |
| 8566 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8567 | CmpopExprPair* _res = NULL; |
| 8568 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8569 | { // '>=' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8570 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8571 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8572 | return NULL; |
| 8573 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8574 | 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] | 8575 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8576 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8577 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8578 | (_literal = _PyPegen_expect_token(p, 30)) // token='>=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8579 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8580 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8581 | ) |
| 8582 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8583 | 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] | 8584 | _res = _PyPegen_cmpop_expr_pair ( p , GtE , a ); |
| 8585 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8586 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8587 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8588 | return NULL; |
| 8589 | } |
| 8590 | goto done; |
| 8591 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8592 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8593 | D(fprintf(stderr, "%*c%s gte_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8594 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>=' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8595 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8596 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8597 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8598 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8599 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8600 | } |
| 8601 | |
| 8602 | // gt_bitwise_or: '>' bitwise_or |
| 8603 | static CmpopExprPair* |
| 8604 | gt_bitwise_or_rule(Parser *p) |
| 8605 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8606 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8607 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8608 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8609 | return NULL; |
| 8610 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8611 | CmpopExprPair* _res = NULL; |
| 8612 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8613 | { // '>' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8614 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8615 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8616 | return NULL; |
| 8617 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8618 | 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] | 8619 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8620 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8621 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8622 | (_literal = _PyPegen_expect_token(p, 21)) // token='>' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8623 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8624 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8625 | ) |
| 8626 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8627 | 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] | 8628 | _res = _PyPegen_cmpop_expr_pair ( p , Gt , a ); |
| 8629 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8630 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8631 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8632 | return NULL; |
| 8633 | } |
| 8634 | goto done; |
| 8635 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8636 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8637 | D(fprintf(stderr, "%*c%s gt_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8638 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'>' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8639 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8640 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8641 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8642 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8643 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8644 | } |
| 8645 | |
| 8646 | // notin_bitwise_or: 'not' 'in' bitwise_or |
| 8647 | static CmpopExprPair* |
| 8648 | notin_bitwise_or_rule(Parser *p) |
| 8649 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8650 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8651 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8652 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8653 | return NULL; |
| 8654 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8655 | CmpopExprPair* _res = NULL; |
| 8656 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8657 | { // 'not' 'in' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8658 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8659 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8660 | return NULL; |
| 8661 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8662 | 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] | 8663 | Token * _keyword; |
| 8664 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8665 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8666 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8667 | (_keyword = _PyPegen_expect_token(p, 525)) // token='not' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8668 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8669 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8670 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8671 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8672 | ) |
| 8673 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8674 | 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] | 8675 | _res = _PyPegen_cmpop_expr_pair ( p , NotIn , a ); |
| 8676 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8677 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8678 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8679 | return NULL; |
| 8680 | } |
| 8681 | goto done; |
| 8682 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8683 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8684 | D(fprintf(stderr, "%*c%s notin_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8685 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'not' 'in' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8686 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8687 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8688 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8689 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8690 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8691 | } |
| 8692 | |
| 8693 | // in_bitwise_or: 'in' bitwise_or |
| 8694 | static CmpopExprPair* |
| 8695 | in_bitwise_or_rule(Parser *p) |
| 8696 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8697 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8698 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8699 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8700 | return NULL; |
| 8701 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8702 | CmpopExprPair* _res = NULL; |
| 8703 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8704 | { // 'in' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8705 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8706 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8707 | return NULL; |
| 8708 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8709 | 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] | 8710 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8711 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8712 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8713 | (_keyword = _PyPegen_expect_token(p, 518)) // token='in' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8714 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8715 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8716 | ) |
| 8717 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8718 | 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] | 8719 | _res = _PyPegen_cmpop_expr_pair ( p , In , a ); |
| 8720 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8721 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8722 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8723 | return NULL; |
| 8724 | } |
| 8725 | goto done; |
| 8726 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8727 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8728 | D(fprintf(stderr, "%*c%s in_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8729 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'in' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8730 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8731 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8732 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8733 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8734 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8735 | } |
| 8736 | |
| 8737 | // isnot_bitwise_or: 'is' 'not' bitwise_or |
| 8738 | static CmpopExprPair* |
| 8739 | isnot_bitwise_or_rule(Parser *p) |
| 8740 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8741 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8742 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8743 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8744 | return NULL; |
| 8745 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8746 | CmpopExprPair* _res = NULL; |
| 8747 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8748 | { // 'is' 'not' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8749 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8750 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8751 | return NULL; |
| 8752 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8753 | 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] | 8754 | Token * _keyword; |
| 8755 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8756 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8757 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8758 | (_keyword = _PyPegen_expect_token(p, 526)) // token='is' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8759 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8760 | (_keyword_1 = _PyPegen_expect_token(p, 525)) // token='not' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8761 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8762 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8763 | ) |
| 8764 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8765 | 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] | 8766 | _res = _PyPegen_cmpop_expr_pair ( p , IsNot , a ); |
| 8767 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8768 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8769 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8770 | return NULL; |
| 8771 | } |
| 8772 | goto done; |
| 8773 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8774 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8775 | D(fprintf(stderr, "%*c%s isnot_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8776 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' 'not' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8777 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8778 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8779 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8780 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8781 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8782 | } |
| 8783 | |
| 8784 | // is_bitwise_or: 'is' bitwise_or |
| 8785 | static CmpopExprPair* |
| 8786 | is_bitwise_or_rule(Parser *p) |
| 8787 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8788 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8789 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8790 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8791 | return NULL; |
| 8792 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8793 | CmpopExprPair* _res = NULL; |
| 8794 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8795 | { // 'is' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8796 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8797 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8798 | return NULL; |
| 8799 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8800 | 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] | 8801 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8802 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8803 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8804 | (_keyword = _PyPegen_expect_token(p, 526)) // token='is' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8805 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8806 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8807 | ) |
| 8808 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8809 | 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] | 8810 | _res = _PyPegen_cmpop_expr_pair ( p , Is , a ); |
| 8811 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8812 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8813 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8814 | return NULL; |
| 8815 | } |
| 8816 | goto done; |
| 8817 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8818 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8819 | D(fprintf(stderr, "%*c%s is_bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8820 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'is' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8821 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8822 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8823 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8824 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8825 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8826 | } |
| 8827 | |
| 8828 | // Left-recursive |
| 8829 | // bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor |
| 8830 | static expr_ty bitwise_or_raw(Parser *); |
| 8831 | static expr_ty |
| 8832 | bitwise_or_rule(Parser *p) |
| 8833 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8834 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8835 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8836 | if (_PyPegen_is_memoized(p, bitwise_or_type, &_res)) { |
| 8837 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8838 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8839 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8840 | int _mark = p->mark; |
| 8841 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8842 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8843 | int tmpvar_1 = _PyPegen_update_memo(p, _mark, bitwise_or_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8844 | if (tmpvar_1) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8845 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8846 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8847 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8848 | p->mark = _mark; |
| 8849 | void *_raw = bitwise_or_raw(p); |
| 8850 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8851 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8852 | _resmark = p->mark; |
| 8853 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8854 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8855 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8856 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8857 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8858 | } |
| 8859 | static expr_ty |
| 8860 | bitwise_or_raw(Parser *p) |
| 8861 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8862 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8863 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8864 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8865 | return NULL; |
| 8866 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8867 | expr_ty _res = NULL; |
| 8868 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8869 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8870 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8871 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8872 | return NULL; |
| 8873 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8874 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8875 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8876 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8877 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8878 | { // bitwise_or '|' bitwise_xor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8879 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8880 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8881 | return NULL; |
| 8882 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8883 | 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] | 8884 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8885 | expr_ty a; |
| 8886 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8887 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8888 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8889 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8890 | (_literal = _PyPegen_expect_token(p, 18)) // token='|' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8891 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8892 | (b = bitwise_xor_rule(p)) // bitwise_xor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8893 | ) |
| 8894 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8895 | 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] | 8896 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 8897 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8898 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8899 | return NULL; |
| 8900 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8901 | int _end_lineno = _token->end_lineno; |
| 8902 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 8903 | int _end_col_offset = _token->end_col_offset; |
| 8904 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 8905 | _res = _Py_BinOp ( a , BitOr , b , EXTRA ); |
| 8906 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8907 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8908 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8909 | return NULL; |
| 8910 | } |
| 8911 | goto done; |
| 8912 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8913 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8914 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8915 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_or '|' bitwise_xor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8916 | } |
| 8917 | { // bitwise_xor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8918 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8919 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8920 | return NULL; |
| 8921 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8922 | 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] | 8923 | expr_ty bitwise_xor_var; |
| 8924 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 8925 | (bitwise_xor_var = bitwise_xor_rule(p)) // bitwise_xor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8926 | ) |
| 8927 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8928 | 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] | 8929 | _res = bitwise_xor_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8930 | goto done; |
| 8931 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8932 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8933 | D(fprintf(stderr, "%*c%s bitwise_or[%d-%d]: %s failed!\n", p->level, ' ', |
| 8934 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8935 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8936 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8937 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8938 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8939 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8940 | } |
| 8941 | |
| 8942 | // Left-recursive |
| 8943 | // bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and |
| 8944 | static expr_ty bitwise_xor_raw(Parser *); |
| 8945 | static expr_ty |
| 8946 | bitwise_xor_rule(Parser *p) |
| 8947 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8948 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8949 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8950 | if (_PyPegen_is_memoized(p, bitwise_xor_type, &_res)) { |
| 8951 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8952 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8953 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8954 | int _mark = p->mark; |
| 8955 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8956 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8957 | int tmpvar_2 = _PyPegen_update_memo(p, _mark, bitwise_xor_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8958 | if (tmpvar_2) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8959 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8960 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8961 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8962 | p->mark = _mark; |
| 8963 | void *_raw = bitwise_xor_raw(p); |
| 8964 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8965 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8966 | _resmark = p->mark; |
| 8967 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8968 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8969 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8970 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8971 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8972 | } |
| 8973 | static expr_ty |
| 8974 | bitwise_xor_raw(Parser *p) |
| 8975 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8976 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8977 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8978 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8979 | return NULL; |
| 8980 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8981 | expr_ty _res = NULL; |
| 8982 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8983 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 8984 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8985 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8986 | return NULL; |
| 8987 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 8988 | int _start_lineno = p->tokens[_mark]->lineno; |
| 8989 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 8990 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 8991 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8992 | { // bitwise_xor '^' bitwise_and |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8993 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8994 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 8995 | return NULL; |
| 8996 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 8997 | 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] | 8998 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 8999 | expr_ty a; |
| 9000 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9001 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9002 | (a = bitwise_xor_rule(p)) // bitwise_xor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9003 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9004 | (_literal = _PyPegen_expect_token(p, 32)) // token='^' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9005 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9006 | (b = bitwise_and_rule(p)) // bitwise_and |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9007 | ) |
| 9008 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9009 | 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] | 9010 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9011 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9012 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9013 | return NULL; |
| 9014 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9015 | int _end_lineno = _token->end_lineno; |
| 9016 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9017 | int _end_col_offset = _token->end_col_offset; |
| 9018 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9019 | _res = _Py_BinOp ( a , BitXor , b , EXTRA ); |
| 9020 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9021 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9022 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9023 | return NULL; |
| 9024 | } |
| 9025 | goto done; |
| 9026 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9027 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9028 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9029 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_xor '^' bitwise_and")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9030 | } |
| 9031 | { // bitwise_and |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9032 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9033 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9034 | return NULL; |
| 9035 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9036 | 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] | 9037 | expr_ty bitwise_and_var; |
| 9038 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9039 | (bitwise_and_var = bitwise_and_rule(p)) // bitwise_and |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9040 | ) |
| 9041 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9042 | 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] | 9043 | _res = bitwise_and_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9044 | goto done; |
| 9045 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9046 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9047 | D(fprintf(stderr, "%*c%s bitwise_xor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9048 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9049 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9050 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9051 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9052 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9053 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9054 | } |
| 9055 | |
| 9056 | // Left-recursive |
| 9057 | // bitwise_and: bitwise_and '&' shift_expr | shift_expr |
| 9058 | static expr_ty bitwise_and_raw(Parser *); |
| 9059 | static expr_ty |
| 9060 | bitwise_and_rule(Parser *p) |
| 9061 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9062 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9063 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9064 | if (_PyPegen_is_memoized(p, bitwise_and_type, &_res)) { |
| 9065 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9066 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9067 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9068 | int _mark = p->mark; |
| 9069 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9070 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9071 | int tmpvar_3 = _PyPegen_update_memo(p, _mark, bitwise_and_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9072 | if (tmpvar_3) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9073 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9074 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9075 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9076 | p->mark = _mark; |
| 9077 | void *_raw = bitwise_and_raw(p); |
| 9078 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9079 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9080 | _resmark = p->mark; |
| 9081 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9082 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9083 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9084 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9085 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9086 | } |
| 9087 | static expr_ty |
| 9088 | bitwise_and_raw(Parser *p) |
| 9089 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9090 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9091 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9092 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9093 | return NULL; |
| 9094 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9095 | expr_ty _res = NULL; |
| 9096 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9097 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9098 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9099 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9100 | return NULL; |
| 9101 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9102 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9103 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9104 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9105 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9106 | { // bitwise_and '&' shift_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9107 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9108 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9109 | return NULL; |
| 9110 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9111 | 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] | 9112 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9113 | expr_ty a; |
| 9114 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9115 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9116 | (a = bitwise_and_rule(p)) // bitwise_and |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9117 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9118 | (_literal = _PyPegen_expect_token(p, 19)) // token='&' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9119 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9120 | (b = shift_expr_rule(p)) // shift_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9121 | ) |
| 9122 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9123 | 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] | 9124 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9125 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9126 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9127 | return NULL; |
| 9128 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9129 | int _end_lineno = _token->end_lineno; |
| 9130 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9131 | int _end_col_offset = _token->end_col_offset; |
| 9132 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9133 | _res = _Py_BinOp ( a , BitAnd , b , EXTRA ); |
| 9134 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9135 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9136 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9137 | return NULL; |
| 9138 | } |
| 9139 | goto done; |
| 9140 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9141 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9142 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
| 9143 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "bitwise_and '&' shift_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9144 | } |
| 9145 | { // shift_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9146 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9147 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9148 | return NULL; |
| 9149 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9150 | 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] | 9151 | expr_ty shift_expr_var; |
| 9152 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9153 | (shift_expr_var = shift_expr_rule(p)) // shift_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9154 | ) |
| 9155 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9156 | 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] | 9157 | _res = shift_expr_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9158 | goto done; |
| 9159 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9160 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9161 | D(fprintf(stderr, "%*c%s bitwise_and[%d-%d]: %s failed!\n", p->level, ' ', |
| 9162 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9163 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9164 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9165 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9166 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9167 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9168 | } |
| 9169 | |
| 9170 | // Left-recursive |
| 9171 | // shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum |
| 9172 | static expr_ty shift_expr_raw(Parser *); |
| 9173 | static expr_ty |
| 9174 | shift_expr_rule(Parser *p) |
| 9175 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9176 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9177 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9178 | if (_PyPegen_is_memoized(p, shift_expr_type, &_res)) { |
| 9179 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9180 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9181 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9182 | int _mark = p->mark; |
| 9183 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9184 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9185 | int tmpvar_4 = _PyPegen_update_memo(p, _mark, shift_expr_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9186 | if (tmpvar_4) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9187 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9188 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9189 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9190 | p->mark = _mark; |
| 9191 | void *_raw = shift_expr_raw(p); |
| 9192 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9193 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9194 | _resmark = p->mark; |
| 9195 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9196 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9197 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9198 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9199 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9200 | } |
| 9201 | static expr_ty |
| 9202 | shift_expr_raw(Parser *p) |
| 9203 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9204 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9205 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9206 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9207 | return NULL; |
| 9208 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9209 | expr_ty _res = NULL; |
| 9210 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9211 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9212 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9213 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9214 | return NULL; |
| 9215 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9216 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9217 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9218 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9219 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9220 | { // shift_expr '<<' sum |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9221 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9222 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9223 | return NULL; |
| 9224 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9225 | 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] | 9226 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9227 | expr_ty a; |
| 9228 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9229 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9230 | (a = shift_expr_rule(p)) // shift_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9231 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9232 | (_literal = _PyPegen_expect_token(p, 33)) // token='<<' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9233 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9234 | (b = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9235 | ) |
| 9236 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9237 | 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] | 9238 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9239 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9240 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9241 | return NULL; |
| 9242 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9243 | int _end_lineno = _token->end_lineno; |
| 9244 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9245 | int _end_col_offset = _token->end_col_offset; |
| 9246 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9247 | _res = _Py_BinOp ( a , LShift , b , EXTRA ); |
| 9248 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9249 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9250 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9251 | return NULL; |
| 9252 | } |
| 9253 | goto done; |
| 9254 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9255 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9256 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 9257 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '<<' sum")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9258 | } |
| 9259 | { // shift_expr '>>' sum |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9260 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9261 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9262 | return NULL; |
| 9263 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9264 | 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] | 9265 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9266 | expr_ty a; |
| 9267 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9268 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9269 | (a = shift_expr_rule(p)) // shift_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9270 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9271 | (_literal = _PyPegen_expect_token(p, 34)) // token='>>' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9272 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9273 | (b = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9274 | ) |
| 9275 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9276 | 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] | 9277 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9278 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9279 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9280 | return NULL; |
| 9281 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9282 | int _end_lineno = _token->end_lineno; |
| 9283 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9284 | int _end_col_offset = _token->end_col_offset; |
| 9285 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9286 | _res = _Py_BinOp ( a , RShift , b , EXTRA ); |
| 9287 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9288 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9289 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9290 | return NULL; |
| 9291 | } |
| 9292 | goto done; |
| 9293 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9294 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9295 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 9296 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "shift_expr '>>' sum")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9297 | } |
| 9298 | { // sum |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9299 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9300 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9301 | return NULL; |
| 9302 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9303 | 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] | 9304 | expr_ty sum_var; |
| 9305 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9306 | (sum_var = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9307 | ) |
| 9308 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9309 | 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] | 9310 | _res = sum_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9311 | goto done; |
| 9312 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9313 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9314 | D(fprintf(stderr, "%*c%s shift_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 9315 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9316 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9317 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9318 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9319 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9320 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9321 | } |
| 9322 | |
| 9323 | // Left-recursive |
| 9324 | // sum: sum '+' term | sum '-' term | term |
| 9325 | static expr_ty sum_raw(Parser *); |
| 9326 | static expr_ty |
| 9327 | sum_rule(Parser *p) |
| 9328 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9329 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9330 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9331 | if (_PyPegen_is_memoized(p, sum_type, &_res)) { |
| 9332 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9333 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9334 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9335 | int _mark = p->mark; |
| 9336 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9337 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9338 | int tmpvar_5 = _PyPegen_update_memo(p, _mark, sum_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9339 | if (tmpvar_5) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9340 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9341 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9342 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9343 | p->mark = _mark; |
| 9344 | void *_raw = sum_raw(p); |
| 9345 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9346 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9347 | _resmark = p->mark; |
| 9348 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9349 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9350 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9351 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9352 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9353 | } |
| 9354 | static expr_ty |
| 9355 | sum_raw(Parser *p) |
| 9356 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9357 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9358 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9359 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9360 | return NULL; |
| 9361 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9362 | expr_ty _res = NULL; |
| 9363 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9364 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9365 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9366 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9367 | return NULL; |
| 9368 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9369 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9370 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9371 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9372 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9373 | { // sum '+' term |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9374 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9375 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9376 | return NULL; |
| 9377 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9378 | 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] | 9379 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9380 | expr_ty a; |
| 9381 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9382 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9383 | (a = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9384 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9385 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9386 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9387 | (b = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9388 | ) |
| 9389 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9390 | 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] | 9391 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9392 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9393 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9394 | return NULL; |
| 9395 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9396 | int _end_lineno = _token->end_lineno; |
| 9397 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9398 | int _end_col_offset = _token->end_col_offset; |
| 9399 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9400 | _res = _Py_BinOp ( a , Add , b , EXTRA ); |
| 9401 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9402 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9403 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9404 | return NULL; |
| 9405 | } |
| 9406 | goto done; |
| 9407 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9408 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9409 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 9410 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '+' term")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9411 | } |
| 9412 | { // sum '-' term |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9413 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9414 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9415 | return NULL; |
| 9416 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9417 | 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] | 9418 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9419 | expr_ty a; |
| 9420 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9421 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9422 | (a = sum_rule(p)) // sum |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9423 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9424 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9425 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9426 | (b = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9427 | ) |
| 9428 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9429 | 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] | 9430 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9431 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9432 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9433 | return NULL; |
| 9434 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9435 | int _end_lineno = _token->end_lineno; |
| 9436 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9437 | int _end_col_offset = _token->end_col_offset; |
| 9438 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9439 | _res = _Py_BinOp ( a , Sub , b , EXTRA ); |
| 9440 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9441 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9442 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9443 | return NULL; |
| 9444 | } |
| 9445 | goto done; |
| 9446 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9447 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9448 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 9449 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "sum '-' term")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9450 | } |
| 9451 | { // term |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9452 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9453 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9454 | return NULL; |
| 9455 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9456 | 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] | 9457 | expr_ty term_var; |
| 9458 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9459 | (term_var = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9460 | ) |
| 9461 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9462 | 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] | 9463 | _res = term_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9464 | goto done; |
| 9465 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9466 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9467 | D(fprintf(stderr, "%*c%s sum[%d-%d]: %s failed!\n", p->level, ' ', |
| 9468 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9469 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9470 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9471 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9472 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9473 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9474 | } |
| 9475 | |
| 9476 | // Left-recursive |
| 9477 | // term: |
| 9478 | // | term '*' factor |
| 9479 | // | term '/' factor |
| 9480 | // | term '//' factor |
| 9481 | // | term '%' factor |
| 9482 | // | term '@' factor |
| 9483 | // | factor |
| 9484 | static expr_ty term_raw(Parser *); |
| 9485 | static expr_ty |
| 9486 | term_rule(Parser *p) |
| 9487 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9488 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9489 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9490 | if (_PyPegen_is_memoized(p, term_type, &_res)) { |
| 9491 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9492 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9493 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9494 | int _mark = p->mark; |
| 9495 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9496 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9497 | int tmpvar_6 = _PyPegen_update_memo(p, _mark, term_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9498 | if (tmpvar_6) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9499 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9500 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9501 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9502 | p->mark = _mark; |
| 9503 | void *_raw = term_raw(p); |
| 9504 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9505 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9506 | _resmark = p->mark; |
| 9507 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9508 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9509 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9510 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9511 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9512 | } |
| 9513 | static expr_ty |
| 9514 | term_raw(Parser *p) |
| 9515 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9516 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9517 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9518 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9519 | return NULL; |
| 9520 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9521 | expr_ty _res = NULL; |
| 9522 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9523 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9524 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9525 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9526 | return NULL; |
| 9527 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9528 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9529 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9530 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9531 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9532 | { // term '*' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9533 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9534 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9535 | return NULL; |
| 9536 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9537 | 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] | 9538 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9539 | expr_ty a; |
| 9540 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9541 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9542 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9543 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9544 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9545 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9546 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9547 | ) |
| 9548 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9549 | 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] | 9550 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9551 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9552 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9553 | return NULL; |
| 9554 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9555 | int _end_lineno = _token->end_lineno; |
| 9556 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9557 | int _end_col_offset = _token->end_col_offset; |
| 9558 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9559 | _res = _Py_BinOp ( a , Mult , b , EXTRA ); |
| 9560 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9561 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9562 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9563 | return NULL; |
| 9564 | } |
| 9565 | goto done; |
| 9566 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9567 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9568 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9569 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '*' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9570 | } |
| 9571 | { // term '/' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9572 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9573 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9574 | return NULL; |
| 9575 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9576 | 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] | 9577 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9578 | expr_ty a; |
| 9579 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9580 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9581 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9582 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9583 | (_literal = _PyPegen_expect_token(p, 17)) // token='/' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9584 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9585 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9586 | ) |
| 9587 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9588 | 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] | 9589 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9590 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9591 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9592 | return NULL; |
| 9593 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9594 | int _end_lineno = _token->end_lineno; |
| 9595 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9596 | int _end_col_offset = _token->end_col_offset; |
| 9597 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9598 | _res = _Py_BinOp ( a , Div , b , EXTRA ); |
| 9599 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9600 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9601 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9602 | return NULL; |
| 9603 | } |
| 9604 | goto done; |
| 9605 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9606 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9607 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9608 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '/' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9609 | } |
| 9610 | { // term '//' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9611 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9612 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9613 | return NULL; |
| 9614 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9615 | 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] | 9616 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9617 | expr_ty a; |
| 9618 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9619 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9620 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9621 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9622 | (_literal = _PyPegen_expect_token(p, 47)) // token='//' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9623 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9624 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9625 | ) |
| 9626 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9627 | 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] | 9628 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9629 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9630 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9631 | return NULL; |
| 9632 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9633 | int _end_lineno = _token->end_lineno; |
| 9634 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9635 | int _end_col_offset = _token->end_col_offset; |
| 9636 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9637 | _res = _Py_BinOp ( a , FloorDiv , b , EXTRA ); |
| 9638 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9639 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9640 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9641 | return NULL; |
| 9642 | } |
| 9643 | goto done; |
| 9644 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9645 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9646 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9647 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '//' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9648 | } |
| 9649 | { // term '%' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9650 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9651 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9652 | return NULL; |
| 9653 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9654 | 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] | 9655 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9656 | expr_ty a; |
| 9657 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9658 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9659 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9660 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9661 | (_literal = _PyPegen_expect_token(p, 24)) // token='%' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9662 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9663 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9664 | ) |
| 9665 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9666 | 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] | 9667 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9668 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9669 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9670 | return NULL; |
| 9671 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9672 | int _end_lineno = _token->end_lineno; |
| 9673 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9674 | int _end_col_offset = _token->end_col_offset; |
| 9675 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9676 | _res = _Py_BinOp ( a , Mod , b , EXTRA ); |
| 9677 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9678 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9679 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9680 | return NULL; |
| 9681 | } |
| 9682 | goto done; |
| 9683 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9684 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9685 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9686 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '%' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9687 | } |
| 9688 | { // term '@' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9689 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9690 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9691 | return NULL; |
| 9692 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9693 | 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] | 9694 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9695 | expr_ty a; |
| 9696 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9697 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9698 | (a = term_rule(p)) // term |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9699 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9700 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9701 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9702 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9703 | ) |
| 9704 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9705 | 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] | 9706 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9707 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9708 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9709 | return NULL; |
| 9710 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9711 | int _end_lineno = _token->end_lineno; |
| 9712 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9713 | int _end_col_offset = _token->end_col_offset; |
| 9714 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9715 | _res = CHECK_VERSION ( 5 , "The '@' operator is" , _Py_BinOp ( a , MatMult , b , EXTRA ) ); |
| 9716 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9717 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9718 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9719 | return NULL; |
| 9720 | } |
| 9721 | goto done; |
| 9722 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9723 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9724 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9725 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "term '@' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9726 | } |
| 9727 | { // factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9728 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9729 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9730 | return NULL; |
| 9731 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9732 | 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] | 9733 | expr_ty factor_var; |
| 9734 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9735 | (factor_var = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9736 | ) |
| 9737 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9738 | 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] | 9739 | _res = factor_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9740 | goto done; |
| 9741 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9742 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9743 | D(fprintf(stderr, "%*c%s term[%d-%d]: %s failed!\n", p->level, ' ', |
| 9744 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9745 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9746 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9747 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9748 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9749 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9750 | } |
| 9751 | |
| 9752 | // factor: '+' factor | '-' factor | '~' factor | power |
| 9753 | static expr_ty |
| 9754 | factor_rule(Parser *p) |
| 9755 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9756 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9757 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9758 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9759 | return NULL; |
| 9760 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9761 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9762 | if (_PyPegen_is_memoized(p, factor_type, &_res)) { |
| 9763 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9764 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9765 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9766 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9767 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9768 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9769 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9770 | return NULL; |
| 9771 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9772 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9773 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9774 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9775 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9776 | { // '+' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9777 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9778 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9779 | return NULL; |
| 9780 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9781 | 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] | 9782 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9783 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9784 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9785 | (_literal = _PyPegen_expect_token(p, 14)) // token='+' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9786 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9787 | (a = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9788 | ) |
| 9789 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9790 | 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] | 9791 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9792 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9793 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9794 | return NULL; |
| 9795 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9796 | int _end_lineno = _token->end_lineno; |
| 9797 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9798 | int _end_col_offset = _token->end_col_offset; |
| 9799 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9800 | _res = _Py_UnaryOp ( UAdd , a , EXTRA ); |
| 9801 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9802 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9803 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9804 | return NULL; |
| 9805 | } |
| 9806 | goto done; |
| 9807 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9808 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9809 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9810 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9811 | } |
| 9812 | { // '-' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9813 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9814 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9815 | return NULL; |
| 9816 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9817 | 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] | 9818 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9819 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9820 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9821 | (_literal = _PyPegen_expect_token(p, 15)) // token='-' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9822 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9823 | (a = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9824 | ) |
| 9825 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9826 | 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] | 9827 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9828 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9829 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9830 | return NULL; |
| 9831 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9832 | int _end_lineno = _token->end_lineno; |
| 9833 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9834 | int _end_col_offset = _token->end_col_offset; |
| 9835 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9836 | _res = _Py_UnaryOp ( USub , a , EXTRA ); |
| 9837 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9838 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9839 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9840 | return NULL; |
| 9841 | } |
| 9842 | goto done; |
| 9843 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9844 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9845 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9846 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9847 | } |
| 9848 | { // '~' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9849 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9850 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9851 | return NULL; |
| 9852 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9853 | 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] | 9854 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9855 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9856 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9857 | (_literal = _PyPegen_expect_token(p, 31)) // token='~' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9858 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9859 | (a = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9860 | ) |
| 9861 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9862 | 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] | 9863 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9864 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9865 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9866 | return NULL; |
| 9867 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9868 | int _end_lineno = _token->end_lineno; |
| 9869 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9870 | int _end_col_offset = _token->end_col_offset; |
| 9871 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9872 | _res = _Py_UnaryOp ( Invert , a , EXTRA ); |
| 9873 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9874 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9875 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9876 | return NULL; |
| 9877 | } |
| 9878 | goto done; |
| 9879 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9880 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9881 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9882 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'~' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9883 | } |
| 9884 | { // power |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9885 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9886 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9887 | return NULL; |
| 9888 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9889 | 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] | 9890 | expr_ty power_var; |
| 9891 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9892 | (power_var = power_rule(p)) // power |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9893 | ) |
| 9894 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9895 | 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] | 9896 | _res = power_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9897 | goto done; |
| 9898 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9899 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9900 | D(fprintf(stderr, "%*c%s factor[%d-%d]: %s failed!\n", p->level, ' ', |
| 9901 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "power")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9902 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9903 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9904 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9905 | _PyPegen_insert_memo(p, _mark, factor_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9906 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9907 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9908 | } |
| 9909 | |
| 9910 | // power: await_primary '**' factor | await_primary |
| 9911 | static expr_ty |
| 9912 | power_rule(Parser *p) |
| 9913 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9914 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9915 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9916 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9917 | return NULL; |
| 9918 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9919 | expr_ty _res = NULL; |
| 9920 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9921 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 9922 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9923 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9924 | return NULL; |
| 9925 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9926 | int _start_lineno = p->tokens[_mark]->lineno; |
| 9927 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 9928 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 9929 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9930 | { // await_primary '**' factor |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9931 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9932 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9933 | return NULL; |
| 9934 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9935 | 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] | 9936 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9937 | expr_ty a; |
| 9938 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9939 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9940 | (a = await_primary_rule(p)) // await_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9941 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9942 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9943 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9944 | (b = factor_rule(p)) // factor |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9945 | ) |
| 9946 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9947 | 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] | 9948 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 9949 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9950 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9951 | return NULL; |
| 9952 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9953 | int _end_lineno = _token->end_lineno; |
| 9954 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 9955 | int _end_col_offset = _token->end_col_offset; |
| 9956 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 9957 | _res = _Py_BinOp ( a , Pow , b , EXTRA ); |
| 9958 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9959 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9960 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9961 | return NULL; |
| 9962 | } |
| 9963 | goto done; |
| 9964 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9965 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9966 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
| 9967 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary '**' factor")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9968 | } |
| 9969 | { // await_primary |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9970 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9971 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 9972 | return NULL; |
| 9973 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9974 | 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] | 9975 | expr_ty await_primary_var; |
| 9976 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 9977 | (await_primary_var = await_primary_rule(p)) // await_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9978 | ) |
| 9979 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9980 | 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] | 9981 | _res = await_primary_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9982 | goto done; |
| 9983 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9984 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9985 | D(fprintf(stderr, "%*c%s power[%d-%d]: %s failed!\n", p->level, ' ', |
| 9986 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "await_primary")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9987 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9988 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9989 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9990 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 9991 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9992 | } |
| 9993 | |
| 9994 | // await_primary: AWAIT primary | primary |
| 9995 | static expr_ty |
| 9996 | await_primary_rule(Parser *p) |
| 9997 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 9998 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 9999 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10000 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10001 | return NULL; |
| 10002 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10003 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10004 | if (_PyPegen_is_memoized(p, await_primary_type, &_res)) { |
| 10005 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10006 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10007 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10008 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10009 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10010 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10011 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10012 | return NULL; |
| 10013 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10014 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10015 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10016 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10017 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10018 | { // AWAIT primary |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10019 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10020 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10021 | return NULL; |
| 10022 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10023 | 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] | 10024 | expr_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 10025 | Token * await_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10026 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10027 | (await_var = _PyPegen_expect_token(p, AWAIT)) // token='AWAIT' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10028 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10029 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10030 | ) |
| 10031 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10032 | 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] | 10033 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10034 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10035 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10036 | return NULL; |
| 10037 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10038 | int _end_lineno = _token->end_lineno; |
| 10039 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10040 | int _end_col_offset = _token->end_col_offset; |
| 10041 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10042 | _res = CHECK_VERSION ( 5 , "Await expressions are" , _Py_Await ( a , EXTRA ) ); |
| 10043 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10044 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10045 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10046 | return NULL; |
| 10047 | } |
| 10048 | goto done; |
| 10049 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10050 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10051 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10052 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "AWAIT primary")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10053 | } |
| 10054 | { // primary |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10055 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10056 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10057 | return NULL; |
| 10058 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10059 | 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] | 10060 | expr_ty primary_var; |
| 10061 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10062 | (primary_var = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10063 | ) |
| 10064 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10065 | 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] | 10066 | _res = primary_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10067 | goto done; |
| 10068 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10069 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10070 | D(fprintf(stderr, "%*c%s await_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10071 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10072 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10073 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10074 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10075 | _PyPegen_insert_memo(p, _mark, await_primary_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10076 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10077 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10078 | } |
| 10079 | |
| 10080 | // Left-recursive |
| 10081 | // primary: |
| 10082 | // | primary '.' NAME |
| 10083 | // | primary genexp |
| 10084 | // | primary '(' arguments? ')' |
| 10085 | // | primary '[' slices ']' |
| 10086 | // | atom |
| 10087 | static expr_ty primary_raw(Parser *); |
| 10088 | static expr_ty |
| 10089 | primary_rule(Parser *p) |
| 10090 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10091 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10092 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10093 | if (_PyPegen_is_memoized(p, primary_type, &_res)) { |
| 10094 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10095 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10096 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10097 | int _mark = p->mark; |
| 10098 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10099 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10100 | int tmpvar_7 = _PyPegen_update_memo(p, _mark, primary_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10101 | if (tmpvar_7) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10102 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10103 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10104 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10105 | p->mark = _mark; |
| 10106 | void *_raw = primary_raw(p); |
| 10107 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10108 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10109 | _resmark = p->mark; |
| 10110 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10111 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10112 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10113 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10114 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10115 | } |
| 10116 | static expr_ty |
| 10117 | primary_raw(Parser *p) |
| 10118 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10119 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10120 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10121 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10122 | return NULL; |
| 10123 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10124 | expr_ty _res = NULL; |
| 10125 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10126 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10127 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10128 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10129 | return NULL; |
| 10130 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10131 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10132 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10133 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10134 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10135 | { // primary '.' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10136 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10137 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10138 | return NULL; |
| 10139 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10140 | 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] | 10141 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10142 | expr_ty a; |
| 10143 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10144 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10145 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10146 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10147 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10148 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10149 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10150 | ) |
| 10151 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10152 | 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] | 10153 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10154 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10155 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10156 | return NULL; |
| 10157 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10158 | int _end_lineno = _token->end_lineno; |
| 10159 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10160 | int _end_col_offset = _token->end_col_offset; |
| 10161 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10162 | _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
| 10163 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10164 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10165 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10166 | return NULL; |
| 10167 | } |
| 10168 | goto done; |
| 10169 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10170 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10171 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10172 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '.' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10173 | } |
| 10174 | { // primary genexp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10175 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10176 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10177 | return NULL; |
| 10178 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10179 | 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] | 10180 | expr_ty a; |
| 10181 | expr_ty b; |
| 10182 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10183 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10184 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10185 | (b = genexp_rule(p)) // genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10186 | ) |
| 10187 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10188 | 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] | 10189 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10190 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10191 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10192 | return NULL; |
| 10193 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10194 | int _end_lineno = _token->end_lineno; |
| 10195 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10196 | int _end_col_offset = _token->end_col_offset; |
| 10197 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10198 | _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
| 10199 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10200 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10201 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10202 | return NULL; |
| 10203 | } |
| 10204 | goto done; |
| 10205 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10206 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10207 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10208 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary genexp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10209 | } |
| 10210 | { // primary '(' arguments? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10211 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10212 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10213 | return NULL; |
| 10214 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10215 | 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] | 10216 | Token * _literal; |
| 10217 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10218 | expr_ty a; |
| 10219 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10220 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10221 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10222 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10223 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10224 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10225 | (b = arguments_rule(p), 1) // arguments? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10226 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10227 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10228 | ) |
| 10229 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10230 | 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] | 10231 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10232 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10233 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10234 | return NULL; |
| 10235 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10236 | int _end_lineno = _token->end_lineno; |
| 10237 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10238 | int _end_col_offset = _token->end_col_offset; |
| 10239 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10240 | _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 10241 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10242 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10243 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10244 | return NULL; |
| 10245 | } |
| 10246 | goto done; |
| 10247 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10248 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10249 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10250 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '(' arguments? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10251 | } |
| 10252 | { // primary '[' slices ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10253 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10254 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10255 | return NULL; |
| 10256 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10257 | 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] | 10258 | Token * _literal; |
| 10259 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10260 | expr_ty a; |
| 10261 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10262 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10263 | (a = primary_rule(p)) // primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10264 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10265 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10266 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10267 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10268 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10269 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10270 | ) |
| 10271 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10272 | 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] | 10273 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10274 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10275 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10276 | return NULL; |
| 10277 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10278 | int _end_lineno = _token->end_lineno; |
| 10279 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10280 | int _end_col_offset = _token->end_col_offset; |
| 10281 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10282 | _res = _Py_Subscript ( a , b , Load , EXTRA ); |
| 10283 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10284 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10285 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10286 | return NULL; |
| 10287 | } |
| 10288 | goto done; |
| 10289 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10290 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10291 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10292 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "primary '[' slices ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10293 | } |
| 10294 | { // atom |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10295 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10296 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10297 | return NULL; |
| 10298 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10299 | 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] | 10300 | expr_ty atom_var; |
| 10301 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10302 | (atom_var = atom_rule(p)) // atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10303 | ) |
| 10304 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10305 | 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] | 10306 | _res = atom_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10307 | goto done; |
| 10308 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10309 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10310 | D(fprintf(stderr, "%*c%s primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 10311 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10312 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10313 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10314 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10315 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10316 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10317 | } |
| 10318 | |
| 10319 | // slices: slice !',' | ','.slice+ ','? |
| 10320 | static expr_ty |
| 10321 | slices_rule(Parser *p) |
| 10322 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10323 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10324 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10325 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10326 | return NULL; |
| 10327 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10328 | expr_ty _res = NULL; |
| 10329 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10330 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10331 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10332 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10333 | return NULL; |
| 10334 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10335 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10336 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10337 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10338 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10339 | { // slice !',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10340 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10341 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10342 | return NULL; |
| 10343 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10344 | 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] | 10345 | expr_ty a; |
| 10346 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10347 | (a = slice_rule(p)) // slice |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10348 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10349 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10350 | ) |
| 10351 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10352 | 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] | 10353 | _res = a; |
| 10354 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10355 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10356 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10357 | return NULL; |
| 10358 | } |
| 10359 | goto done; |
| 10360 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10361 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10362 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
| 10363 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10364 | } |
| 10365 | { // ','.slice+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10366 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10367 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10368 | return NULL; |
| 10369 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10370 | 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] | 10371 | void *_opt_var; |
| 10372 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10373 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10374 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10375 | (a = _gather_93_rule(p)) // ','.slice+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10376 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10377 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10378 | ) |
| 10379 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10380 | 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] | 10381 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10382 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10383 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10384 | return NULL; |
| 10385 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10386 | int _end_lineno = _token->end_lineno; |
| 10387 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10388 | int _end_col_offset = _token->end_col_offset; |
| 10389 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10390 | _res = _Py_Tuple ( a , Load , EXTRA ); |
| 10391 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10392 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10393 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10394 | return NULL; |
| 10395 | } |
| 10396 | goto done; |
| 10397 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10398 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10399 | D(fprintf(stderr, "%*c%s slices[%d-%d]: %s failed!\n", p->level, ' ', |
| 10400 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.slice+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10401 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10402 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10403 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10404 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10405 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10406 | } |
| 10407 | |
| 10408 | // slice: expression? ':' expression? [':' expression?] | expression |
| 10409 | static expr_ty |
| 10410 | slice_rule(Parser *p) |
| 10411 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10412 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10413 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10414 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10415 | return NULL; |
| 10416 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10417 | expr_ty _res = NULL; |
| 10418 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10419 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10420 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10421 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10422 | return NULL; |
| 10423 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10424 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10425 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10426 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10427 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10428 | { // expression? ':' expression? [':' expression?] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10429 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10430 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10431 | return NULL; |
| 10432 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10433 | 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] | 10434 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10435 | void *a; |
| 10436 | void *b; |
| 10437 | void *c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10438 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10439 | (a = expression_rule(p), 1) // expression? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10440 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10441 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10442 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10443 | (b = expression_rule(p), 1) // expression? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10444 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10445 | (c = _tmp_95_rule(p), 1) // [':' expression?] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10446 | ) |
| 10447 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10448 | 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] | 10449 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10450 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10451 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10452 | return NULL; |
| 10453 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10454 | int _end_lineno = _token->end_lineno; |
| 10455 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10456 | int _end_col_offset = _token->end_col_offset; |
| 10457 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10458 | _res = _Py_Slice ( a , b , c , EXTRA ); |
| 10459 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10460 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10461 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10462 | return NULL; |
| 10463 | } |
| 10464 | goto done; |
| 10465 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10466 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10467 | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', |
| 10468 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10469 | } |
| 10470 | { // expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10471 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10472 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10473 | return NULL; |
| 10474 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10475 | 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] | 10476 | expr_ty a; |
| 10477 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10478 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10479 | ) |
| 10480 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10481 | 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] | 10482 | _res = a; |
| 10483 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10484 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10485 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10486 | return NULL; |
| 10487 | } |
| 10488 | goto done; |
| 10489 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10490 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10491 | D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ', |
| 10492 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10493 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10494 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10495 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10496 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10497 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10498 | } |
| 10499 | |
| 10500 | // atom: |
| 10501 | // | NAME |
| 10502 | // | 'True' |
| 10503 | // | 'False' |
| 10504 | // | 'None' |
| 10505 | // | '__new_parser__' |
| 10506 | // | &STRING strings |
| 10507 | // | NUMBER |
| 10508 | // | &'(' (tuple | group | genexp) |
| 10509 | // | &'[' (list | listcomp) |
| 10510 | // | &'{' (dict | set | dictcomp | setcomp) |
| 10511 | // | '...' |
| 10512 | static expr_ty |
| 10513 | atom_rule(Parser *p) |
| 10514 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10515 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10516 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10517 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10518 | return NULL; |
| 10519 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10520 | expr_ty _res = NULL; |
| 10521 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10522 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10523 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10524 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10525 | return NULL; |
| 10526 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10527 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10528 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10529 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10530 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10531 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10532 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10533 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10534 | return NULL; |
| 10535 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10536 | 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] | 10537 | expr_ty name_var; |
| 10538 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10539 | (name_var = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10540 | ) |
| 10541 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10542 | 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] | 10543 | _res = name_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10544 | goto done; |
| 10545 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10546 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10547 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10548 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10549 | } |
| 10550 | { // 'True' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10551 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10552 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10553 | return NULL; |
| 10554 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10555 | 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] | 10556 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10557 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10558 | (_keyword = _PyPegen_expect_token(p, 527)) // token='True' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10559 | ) |
| 10560 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10561 | 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] | 10562 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10563 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10564 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10565 | return NULL; |
| 10566 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10567 | int _end_lineno = _token->end_lineno; |
| 10568 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10569 | int _end_col_offset = _token->end_col_offset; |
| 10570 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10571 | _res = _Py_Constant ( Py_True , NULL , EXTRA ); |
| 10572 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10573 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10574 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10575 | return NULL; |
| 10576 | } |
| 10577 | goto done; |
| 10578 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10579 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10580 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10581 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10582 | } |
| 10583 | { // 'False' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10584 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10585 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10586 | return NULL; |
| 10587 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10588 | 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] | 10589 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10590 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10591 | (_keyword = _PyPegen_expect_token(p, 528)) // token='False' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10592 | ) |
| 10593 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10594 | 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] | 10595 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10596 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10597 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10598 | return NULL; |
| 10599 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10600 | int _end_lineno = _token->end_lineno; |
| 10601 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10602 | int _end_col_offset = _token->end_col_offset; |
| 10603 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10604 | _res = _Py_Constant ( Py_False , NULL , EXTRA ); |
| 10605 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10606 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10607 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10608 | return NULL; |
| 10609 | } |
| 10610 | goto done; |
| 10611 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10612 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10613 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10614 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10615 | } |
| 10616 | { // 'None' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10617 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10618 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10619 | return NULL; |
| 10620 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10621 | 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] | 10622 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10623 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10624 | (_keyword = _PyPegen_expect_token(p, 529)) // token='None' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10625 | ) |
| 10626 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10627 | 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] | 10628 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10629 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10630 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10631 | return NULL; |
| 10632 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10633 | int _end_lineno = _token->end_lineno; |
| 10634 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10635 | int _end_col_offset = _token->end_col_offset; |
| 10636 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10637 | _res = _Py_Constant ( Py_None , NULL , EXTRA ); |
| 10638 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10639 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10640 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10641 | return NULL; |
| 10642 | } |
| 10643 | goto done; |
| 10644 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10645 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10646 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10647 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10648 | } |
| 10649 | { // '__new_parser__' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10650 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10651 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10652 | return NULL; |
| 10653 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10654 | 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] | 10655 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10656 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10657 | (_keyword = _PyPegen_expect_token(p, 530)) // token='__new_parser__' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10658 | ) |
| 10659 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10660 | 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] | 10661 | _res = RAISE_SYNTAX_ERROR ( "You found it!" ); |
| 10662 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10663 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10664 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10665 | return NULL; |
| 10666 | } |
| 10667 | goto done; |
| 10668 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10669 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10670 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10671 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'__new_parser__'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10672 | } |
| 10673 | { // &STRING strings |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10674 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10675 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10676 | return NULL; |
| 10677 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10678 | 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] | 10679 | expr_ty strings_var; |
| 10680 | if ( |
| 10681 | _PyPegen_lookahead(1, _PyPegen_string_token, p) |
| 10682 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10683 | (strings_var = strings_rule(p)) // strings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10684 | ) |
| 10685 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10686 | 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] | 10687 | _res = strings_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10688 | goto done; |
| 10689 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10690 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10691 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10692 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&STRING strings")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10693 | } |
| 10694 | { // NUMBER |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10695 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10696 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10697 | return NULL; |
| 10698 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10699 | 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] | 10700 | expr_ty number_var; |
| 10701 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10702 | (number_var = _PyPegen_number_token(p)) // NUMBER |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10703 | ) |
| 10704 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10705 | 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] | 10706 | _res = number_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10707 | goto done; |
| 10708 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10709 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10710 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10711 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NUMBER")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10712 | } |
| 10713 | { // &'(' (tuple | group | genexp) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10714 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10715 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10716 | return NULL; |
| 10717 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10718 | 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] | 10719 | void *_tmp_96_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10720 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10721 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10722 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10723 | (_tmp_96_var = _tmp_96_rule(p)) // tuple | group | genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10724 | ) |
| 10725 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10726 | 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] | 10727 | _res = _tmp_96_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10728 | goto done; |
| 10729 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10730 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10731 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10732 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'(' (tuple | group | genexp)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10733 | } |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10734 | { // &'[' (list | listcomp) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10735 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10736 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10737 | return NULL; |
| 10738 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10739 | 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] | 10740 | void *_tmp_97_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10741 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10742 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10743 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10744 | (_tmp_97_var = _tmp_97_rule(p)) // list | listcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10745 | ) |
| 10746 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10747 | 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] | 10748 | _res = _tmp_97_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10749 | goto done; |
| 10750 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10751 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10752 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10753 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'[' (list | listcomp)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10754 | } |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10755 | { // &'{' (dict | set | dictcomp | setcomp) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10756 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10757 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10758 | return NULL; |
| 10759 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10760 | 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] | 10761 | void *_tmp_98_var; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10762 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10763 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10764 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10765 | (_tmp_98_var = _tmp_98_rule(p)) // dict | set | dictcomp | setcomp |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10766 | ) |
| 10767 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10768 | 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] | 10769 | _res = _tmp_98_var; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10770 | goto done; |
| 10771 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10772 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10773 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10774 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)")); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 10775 | } |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10776 | { // '...' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10777 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10778 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10779 | return NULL; |
| 10780 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10781 | 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] | 10782 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10783 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10784 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10785 | ) |
| 10786 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10787 | 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] | 10788 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10789 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10790 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10791 | return NULL; |
| 10792 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10793 | int _end_lineno = _token->end_lineno; |
| 10794 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10795 | int _end_col_offset = _token->end_col_offset; |
| 10796 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10797 | _res = _Py_Constant ( Py_Ellipsis , NULL , EXTRA ); |
| 10798 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10799 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10800 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10801 | return NULL; |
| 10802 | } |
| 10803 | goto done; |
| 10804 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10805 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10806 | D(fprintf(stderr, "%*c%s atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 10807 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10808 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10809 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10810 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10811 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10812 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10813 | } |
| 10814 | |
| 10815 | // strings: STRING+ |
| 10816 | static expr_ty |
| 10817 | strings_rule(Parser *p) |
| 10818 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10819 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10820 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10821 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10822 | return NULL; |
| 10823 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10824 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10825 | if (_PyPegen_is_memoized(p, strings_type, &_res)) { |
| 10826 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10827 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10828 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10829 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10830 | { // STRING+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10831 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10832 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10833 | return NULL; |
| 10834 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10835 | 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] | 10836 | asdl_seq * a; |
| 10837 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10838 | (a = _loop1_99_rule(p)) // STRING+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10839 | ) |
| 10840 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10841 | 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] | 10842 | _res = _PyPegen_concatenate_strings ( p , a ); |
| 10843 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10844 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10845 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10846 | return NULL; |
| 10847 | } |
| 10848 | goto done; |
| 10849 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10850 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10851 | D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ', |
| 10852 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10853 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10854 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10855 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10856 | _PyPegen_insert_memo(p, _mark, strings_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10857 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10858 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10859 | } |
| 10860 | |
| 10861 | // list: '[' star_named_expressions? ']' |
| 10862 | static expr_ty |
| 10863 | list_rule(Parser *p) |
| 10864 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10865 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10866 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10867 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10868 | return NULL; |
| 10869 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10870 | expr_ty _res = NULL; |
| 10871 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10872 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10873 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10874 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10875 | return NULL; |
| 10876 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10877 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10878 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10879 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10880 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10881 | { // '[' star_named_expressions? ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10882 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10883 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10884 | return NULL; |
| 10885 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10886 | 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] | 10887 | Token * _literal; |
| 10888 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10889 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10890 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10891 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10892 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10893 | (a = star_named_expressions_rule(p), 1) // star_named_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10894 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10895 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10896 | ) |
| 10897 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10898 | 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] | 10899 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10900 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10901 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10902 | return NULL; |
| 10903 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10904 | int _end_lineno = _token->end_lineno; |
| 10905 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10906 | int _end_col_offset = _token->end_col_offset; |
| 10907 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10908 | _res = _Py_List ( a , Load , EXTRA ); |
| 10909 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10910 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10911 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10912 | return NULL; |
| 10913 | } |
| 10914 | goto done; |
| 10915 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10916 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10917 | D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ', |
| 10918 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10919 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10920 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10921 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10922 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10923 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10924 | } |
| 10925 | |
| 10926 | // listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension |
| 10927 | static expr_ty |
| 10928 | listcomp_rule(Parser *p) |
| 10929 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10930 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10931 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10932 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10933 | return NULL; |
| 10934 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10935 | expr_ty _res = NULL; |
| 10936 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10937 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 10938 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10939 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10940 | return NULL; |
| 10941 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10942 | int _start_lineno = p->tokens[_mark]->lineno; |
| 10943 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 10944 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 10945 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10946 | { // '[' named_expression for_if_clauses ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10947 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10948 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10949 | return NULL; |
| 10950 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10951 | 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] | 10952 | Token * _literal; |
| 10953 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10954 | expr_ty a; |
| 10955 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10956 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10957 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10958 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10959 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10960 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10961 | (b = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10962 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10963 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10964 | ) |
| 10965 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10966 | 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] | 10967 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 10968 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10969 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10970 | return NULL; |
| 10971 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10972 | int _end_lineno = _token->end_lineno; |
| 10973 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 10974 | int _end_col_offset = _token->end_col_offset; |
| 10975 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 10976 | _res = _Py_ListComp ( a , b , EXTRA ); |
| 10977 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10978 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10979 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10980 | return NULL; |
| 10981 | } |
| 10982 | goto done; |
| 10983 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 10984 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10985 | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 10986 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10987 | } |
| 10988 | { // invalid_comprehension |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10989 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10990 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 10991 | return NULL; |
| 10992 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10993 | 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] | 10994 | void *invalid_comprehension_var; |
| 10995 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 10996 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 10997 | ) |
| 10998 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 10999 | 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] | 11000 | _res = invalid_comprehension_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11001 | goto done; |
| 11002 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11003 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11004 | D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11005 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11006 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11007 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11008 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11009 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11010 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11011 | } |
| 11012 | |
| 11013 | // tuple: '(' [star_named_expression ',' star_named_expressions?] ')' |
| 11014 | static expr_ty |
| 11015 | tuple_rule(Parser *p) |
| 11016 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11017 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11018 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11019 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11020 | return NULL; |
| 11021 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11022 | expr_ty _res = NULL; |
| 11023 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11024 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11025 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11026 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11027 | return NULL; |
| 11028 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11029 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11030 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11031 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11032 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11033 | { // '(' [star_named_expression ',' star_named_expressions?] ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11034 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11035 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11036 | return NULL; |
| 11037 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11038 | 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] | 11039 | Token * _literal; |
| 11040 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11041 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11042 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11043 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11044 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11045 | (a = _tmp_100_rule(p), 1) // [star_named_expression ',' star_named_expressions?] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11046 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11047 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11048 | ) |
| 11049 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11050 | 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] | 11051 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11052 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11053 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11054 | return NULL; |
| 11055 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11056 | int _end_lineno = _token->end_lineno; |
| 11057 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11058 | int _end_col_offset = _token->end_col_offset; |
| 11059 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11060 | _res = _Py_Tuple ( a , Load , EXTRA ); |
| 11061 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11062 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11063 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11064 | return NULL; |
| 11065 | } |
| 11066 | goto done; |
| 11067 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11068 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11069 | D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ', |
| 11070 | 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] | 11071 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11072 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11073 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11074 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11075 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11076 | } |
| 11077 | |
| 11078 | // group: '(' (yield_expr | named_expression) ')' |
| 11079 | static expr_ty |
| 11080 | group_rule(Parser *p) |
| 11081 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11082 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11083 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11084 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11085 | return NULL; |
| 11086 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11087 | expr_ty _res = NULL; |
| 11088 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11089 | { // '(' (yield_expr | named_expression) ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11090 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11091 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11092 | return NULL; |
| 11093 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11094 | 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] | 11095 | Token * _literal; |
| 11096 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11097 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11098 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11099 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11100 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11101 | (a = _tmp_101_rule(p)) // yield_expr | named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11102 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11103 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11104 | ) |
| 11105 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11106 | 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] | 11107 | _res = a; |
| 11108 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11109 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11110 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11111 | return NULL; |
| 11112 | } |
| 11113 | goto done; |
| 11114 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11115 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11116 | D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ', |
| 11117 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11118 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11119 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11120 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11121 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11122 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11123 | } |
| 11124 | |
| 11125 | // genexp: '(' expression for_if_clauses ')' | invalid_comprehension |
| 11126 | static expr_ty |
| 11127 | genexp_rule(Parser *p) |
| 11128 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11129 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11130 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11131 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11132 | return NULL; |
| 11133 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11134 | expr_ty _res = NULL; |
| 11135 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11136 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11137 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11138 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11139 | return NULL; |
| 11140 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11141 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11142 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11143 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11144 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11145 | { // '(' expression for_if_clauses ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11146 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11147 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11148 | return NULL; |
| 11149 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11150 | 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] | 11151 | Token * _literal; |
| 11152 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11153 | expr_ty a; |
| 11154 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11155 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11156 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11157 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11158 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11159 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11160 | (b = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11161 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11162 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11163 | ) |
| 11164 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11165 | 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] | 11166 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11167 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11168 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11169 | return NULL; |
| 11170 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11171 | int _end_lineno = _token->end_lineno; |
| 11172 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11173 | int _end_col_offset = _token->end_col_offset; |
| 11174 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11175 | _res = _Py_GeneratorExp ( a , b , EXTRA ); |
| 11176 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11177 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11178 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11179 | return NULL; |
| 11180 | } |
| 11181 | goto done; |
| 11182 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11183 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11184 | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11185 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' expression for_if_clauses ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11186 | } |
| 11187 | { // invalid_comprehension |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11188 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11189 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11190 | return NULL; |
| 11191 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11192 | 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] | 11193 | void *invalid_comprehension_var; |
| 11194 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11195 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11196 | ) |
| 11197 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11198 | 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] | 11199 | _res = invalid_comprehension_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11200 | goto done; |
| 11201 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11202 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11203 | D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11204 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11205 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11206 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11207 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11208 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11209 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11210 | } |
| 11211 | |
| 11212 | // set: '{' expressions_list '}' |
| 11213 | static expr_ty |
| 11214 | set_rule(Parser *p) |
| 11215 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11216 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11217 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11218 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11219 | return NULL; |
| 11220 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11221 | expr_ty _res = NULL; |
| 11222 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11223 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11224 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11225 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11226 | return NULL; |
| 11227 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11228 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11229 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11230 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11231 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11232 | { // '{' expressions_list '}' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11233 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11234 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11235 | return NULL; |
| 11236 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11237 | 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] | 11238 | Token * _literal; |
| 11239 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11240 | asdl_seq* a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11241 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11242 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11243 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11244 | (a = expressions_list_rule(p)) // expressions_list |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11245 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11246 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11247 | ) |
| 11248 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11249 | 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] | 11250 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11251 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11252 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11253 | return NULL; |
| 11254 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11255 | int _end_lineno = _token->end_lineno; |
| 11256 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11257 | int _end_col_offset = _token->end_col_offset; |
| 11258 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11259 | _res = _Py_Set ( a , EXTRA ); |
| 11260 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11261 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11262 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11263 | return NULL; |
| 11264 | } |
| 11265 | goto done; |
| 11266 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11267 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11268 | D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ', |
| 11269 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expressions_list '}'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11270 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11271 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11272 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11273 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11274 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11275 | } |
| 11276 | |
| 11277 | // setcomp: '{' expression for_if_clauses '}' | invalid_comprehension |
| 11278 | static expr_ty |
| 11279 | setcomp_rule(Parser *p) |
| 11280 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11281 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11282 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11283 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11284 | return NULL; |
| 11285 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11286 | expr_ty _res = NULL; |
| 11287 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11288 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11289 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11290 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11291 | return NULL; |
| 11292 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11293 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11294 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11295 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11296 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11297 | { // '{' expression for_if_clauses '}' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11298 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11299 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11300 | return NULL; |
| 11301 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11302 | 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] | 11303 | Token * _literal; |
| 11304 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11305 | expr_ty a; |
| 11306 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11307 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11308 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11309 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11310 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11311 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11312 | (b = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11313 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11314 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11315 | ) |
| 11316 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11317 | 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] | 11318 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11319 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11320 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11321 | return NULL; |
| 11322 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11323 | int _end_lineno = _token->end_lineno; |
| 11324 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11325 | int _end_col_offset = _token->end_col_offset; |
| 11326 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11327 | _res = _Py_SetComp ( a , b , EXTRA ); |
| 11328 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11329 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11330 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11331 | return NULL; |
| 11332 | } |
| 11333 | goto done; |
| 11334 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11335 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11336 | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11337 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' expression for_if_clauses '}'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11338 | } |
| 11339 | { // invalid_comprehension |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11340 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11341 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11342 | return NULL; |
| 11343 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11344 | 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] | 11345 | void *invalid_comprehension_var; |
| 11346 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11347 | (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11348 | ) |
| 11349 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11350 | 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] | 11351 | _res = invalid_comprehension_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11352 | goto done; |
| 11353 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11354 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11355 | D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11356 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11357 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11358 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11359 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11360 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11361 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11362 | } |
| 11363 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11364 | // dict: '{' double_starred_kvpairs? '}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11365 | static expr_ty |
| 11366 | dict_rule(Parser *p) |
| 11367 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11368 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11369 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11370 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11371 | return NULL; |
| 11372 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11373 | expr_ty _res = NULL; |
| 11374 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11375 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11376 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11377 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11378 | return NULL; |
| 11379 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11380 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11381 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11382 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11383 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11384 | { // '{' double_starred_kvpairs? '}' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11385 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11386 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11387 | return NULL; |
| 11388 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11389 | 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] | 11390 | Token * _literal; |
| 11391 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11392 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11393 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11394 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11395 | && |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11396 | (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11397 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11398 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11399 | ) |
| 11400 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11401 | 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] | 11402 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11403 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11404 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11405 | return NULL; |
| 11406 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11407 | int _end_lineno = _token->end_lineno; |
| 11408 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11409 | int _end_col_offset = _token->end_col_offset; |
| 11410 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11411 | _res = _Py_Dict ( CHECK ( _PyPegen_get_keys ( p , a ) ) , CHECK ( _PyPegen_get_values ( p , a ) ) , EXTRA ); |
| 11412 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11413 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11414 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11415 | return NULL; |
| 11416 | } |
| 11417 | goto done; |
| 11418 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11419 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11420 | D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ', |
| 11421 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11422 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11423 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11424 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11425 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11426 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11427 | } |
| 11428 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11429 | // dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11430 | static expr_ty |
| 11431 | dictcomp_rule(Parser *p) |
| 11432 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11433 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11434 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11435 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11436 | return NULL; |
| 11437 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11438 | expr_ty _res = NULL; |
| 11439 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11440 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11441 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11442 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11443 | return NULL; |
| 11444 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11445 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11446 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11447 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11448 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11449 | { // '{' kvpair for_if_clauses '}' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11450 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11451 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11452 | return NULL; |
| 11453 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11454 | 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] | 11455 | Token * _literal; |
| 11456 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11457 | KeyValuePair* a; |
| 11458 | asdl_seq* b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11459 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11460 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11461 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11462 | (a = kvpair_rule(p)) // kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11463 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11464 | (b = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11465 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11466 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11467 | ) |
| 11468 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11469 | 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] | 11470 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11471 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11472 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11473 | return NULL; |
| 11474 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11475 | int _end_lineno = _token->end_lineno; |
| 11476 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11477 | int _end_col_offset = _token->end_col_offset; |
| 11478 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11479 | _res = _Py_DictComp ( a -> key , a -> value , b , EXTRA ); |
| 11480 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11481 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11482 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11483 | return NULL; |
| 11484 | } |
| 11485 | goto done; |
| 11486 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11487 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11488 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11489 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11490 | } |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11491 | { // invalid_dict_comprehension |
| 11492 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11493 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11494 | return NULL; |
| 11495 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11496 | 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] | 11497 | void *invalid_dict_comprehension_var; |
| 11498 | if ( |
| 11499 | (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension |
| 11500 | ) |
| 11501 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11502 | 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] | 11503 | _res = invalid_dict_comprehension_var; |
| 11504 | goto done; |
| 11505 | } |
| 11506 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11507 | D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ', |
| 11508 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11509 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11510 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11511 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11512 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11513 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11514 | } |
| 11515 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11516 | // double_starred_kvpairs: ','.double_starred_kvpair+ ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11517 | static asdl_seq* |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11518 | double_starred_kvpairs_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11519 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11520 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11521 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11522 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11523 | return NULL; |
| 11524 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11525 | asdl_seq* _res = NULL; |
| 11526 | int _mark = p->mark; |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11527 | { // ','.double_starred_kvpair+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11528 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11529 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11530 | return NULL; |
| 11531 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11532 | 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] | 11533 | void *_opt_var; |
| 11534 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11535 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11536 | if ( |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11537 | (a = _gather_102_rule(p)) // ','.double_starred_kvpair+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11538 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11539 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11540 | ) |
| 11541 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11542 | 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] | 11543 | _res = a; |
| 11544 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11545 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11546 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11547 | return NULL; |
| 11548 | } |
| 11549 | goto done; |
| 11550 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11551 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11552 | D(fprintf(stderr, "%*c%s double_starred_kvpairs[%d-%d]: %s failed!\n", p->level, ' ', |
| 11553 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.double_starred_kvpair+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11554 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11555 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11556 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11557 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11558 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11559 | } |
| 11560 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11561 | // double_starred_kvpair: '**' bitwise_or | kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11562 | static KeyValuePair* |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11563 | double_starred_kvpair_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11564 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11565 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11566 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11567 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11568 | return NULL; |
| 11569 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11570 | KeyValuePair* _res = NULL; |
| 11571 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11572 | { // '**' bitwise_or |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11573 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11574 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11575 | return NULL; |
| 11576 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11577 | 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] | 11578 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11579 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11580 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11581 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11582 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11583 | (a = bitwise_or_rule(p)) // bitwise_or |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11584 | ) |
| 11585 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11586 | 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] | 11587 | _res = _PyPegen_key_value_pair ( p , NULL , a ); |
| 11588 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11589 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11590 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11591 | return NULL; |
| 11592 | } |
| 11593 | goto done; |
| 11594 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11595 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11596 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11597 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' bitwise_or")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11598 | } |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11599 | { // kvpair |
| 11600 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11601 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11602 | return NULL; |
| 11603 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11604 | 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] | 11605 | KeyValuePair* kvpair_var; |
| 11606 | if ( |
| 11607 | (kvpair_var = kvpair_rule(p)) // kvpair |
| 11608 | ) |
| 11609 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11610 | 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] | 11611 | _res = kvpair_var; |
| 11612 | goto done; |
| 11613 | } |
| 11614 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11615 | D(fprintf(stderr, "%*c%s double_starred_kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11616 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kvpair")); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11617 | } |
| 11618 | _res = NULL; |
| 11619 | done: |
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 | return _res; |
| 11622 | } |
| 11623 | |
| 11624 | // kvpair: expression ':' expression |
| 11625 | static KeyValuePair* |
| 11626 | kvpair_rule(Parser *p) |
| 11627 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11628 | D(p->level++); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11629 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11630 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 11631 | return NULL; |
| 11632 | } |
| 11633 | KeyValuePair* _res = NULL; |
| 11634 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11635 | { // expression ':' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11636 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11637 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11638 | return NULL; |
| 11639 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11640 | 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] | 11641 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11642 | expr_ty a; |
| 11643 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11644 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11645 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11646 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11647 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11648 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11649 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11650 | ) |
| 11651 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11652 | 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] | 11653 | _res = _PyPegen_key_value_pair ( p , a , b ); |
| 11654 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11655 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11656 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11657 | return NULL; |
| 11658 | } |
| 11659 | goto done; |
| 11660 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11661 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11662 | D(fprintf(stderr, "%*c%s kvpair[%d-%d]: %s failed!\n", p->level, ' ', |
| 11663 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11664 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11665 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11666 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11667 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11668 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11669 | } |
| 11670 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11671 | // for_if_clauses: for_if_clause+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11672 | static asdl_seq* |
| 11673 | for_if_clauses_rule(Parser *p) |
| 11674 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11675 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11676 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11677 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11678 | return NULL; |
| 11679 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11680 | asdl_seq* _res = NULL; |
| 11681 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11682 | { // for_if_clause+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11683 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11684 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11685 | return NULL; |
| 11686 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11687 | 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] | 11688 | asdl_seq * _loop1_104_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11689 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11690 | (_loop1_104_var = _loop1_104_rule(p)) // for_if_clause+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11691 | ) |
| 11692 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11693 | 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] | 11694 | _res = _loop1_104_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11695 | goto done; |
| 11696 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11697 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11698 | D(fprintf(stderr, "%*c%s for_if_clauses[%d-%d]: %s failed!\n", p->level, ' ', |
| 11699 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause+")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11700 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11701 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11702 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11703 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11704 | return _res; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11705 | } |
| 11706 | |
| 11707 | // for_if_clause: |
| 11708 | // | ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))* |
| 11709 | // | 'for' star_targets 'in' disjunction (('if' disjunction))* |
| 11710 | static comprehension_ty |
| 11711 | for_if_clause_rule(Parser *p) |
| 11712 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11713 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11714 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11715 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11716 | return NULL; |
| 11717 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11718 | comprehension_ty _res = NULL; |
| 11719 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11720 | { // ASYNC 'for' star_targets 'in' disjunction (('if' disjunction))* |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11721 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11722 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11723 | return NULL; |
| 11724 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11725 | 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] | 11726 | Token * _keyword; |
| 11727 | Token * _keyword_1; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11728 | expr_ty a; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 11729 | Token * async_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11730 | expr_ty b; |
| 11731 | asdl_seq * c; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11732 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11733 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11734 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11735 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11736 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11737 | (a = star_targets_rule(p)) // star_targets |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11738 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11739 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11740 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11741 | (b = disjunction_rule(p)) // disjunction |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11742 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11743 | (c = _loop0_105_rule(p)) // (('if' disjunction))* |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11744 | ) |
| 11745 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11746 | 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] | 11747 | _res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) ); |
| 11748 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11749 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11750 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11751 | return NULL; |
| 11752 | } |
| 11753 | goto done; |
| 11754 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11755 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11756 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
| 11757 | 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] | 11758 | } |
| 11759 | { // 'for' star_targets 'in' disjunction (('if' disjunction))* |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11760 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11761 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11762 | return NULL; |
| 11763 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11764 | 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] | 11765 | Token * _keyword; |
| 11766 | Token * _keyword_1; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11767 | expr_ty a; |
| 11768 | expr_ty b; |
| 11769 | asdl_seq * c; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11770 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11771 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11772 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11773 | (a = star_targets_rule(p)) // star_targets |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11774 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11775 | (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11776 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11777 | (b = disjunction_rule(p)) // disjunction |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11778 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11779 | (c = _loop0_106_rule(p)) // (('if' disjunction))* |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 11780 | ) |
| 11781 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11782 | 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] | 11783 | _res = _Py_comprehension ( a , b , c , 0 , p -> arena ); |
| 11784 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11785 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11786 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11787 | return NULL; |
| 11788 | } |
| 11789 | goto done; |
| 11790 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11791 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11792 | D(fprintf(stderr, "%*c%s for_if_clause[%d-%d]: %s failed!\n", p->level, ' ', |
| 11793 | 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] | 11794 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11795 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11796 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11797 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11798 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11799 | } |
| 11800 | |
| 11801 | // yield_expr: 'yield' 'from' expression | 'yield' star_expressions? |
| 11802 | static expr_ty |
| 11803 | yield_expr_rule(Parser *p) |
| 11804 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11805 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11806 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11807 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11808 | return NULL; |
| 11809 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11810 | expr_ty _res = NULL; |
| 11811 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11812 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11813 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11814 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11815 | return NULL; |
| 11816 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11817 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11818 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11819 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11820 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11821 | { // 'yield' 'from' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11822 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11823 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11824 | return NULL; |
| 11825 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11826 | 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] | 11827 | Token * _keyword; |
| 11828 | Token * _keyword_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11829 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11830 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11831 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11832 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11833 | (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11834 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11835 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11836 | ) |
| 11837 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11838 | 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] | 11839 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11840 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11841 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11842 | return NULL; |
| 11843 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11844 | int _end_lineno = _token->end_lineno; |
| 11845 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11846 | int _end_col_offset = _token->end_col_offset; |
| 11847 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11848 | _res = _Py_YieldFrom ( a , EXTRA ); |
| 11849 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11850 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11851 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11852 | return NULL; |
| 11853 | } |
| 11854 | goto done; |
| 11855 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11856 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11857 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11858 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11859 | } |
| 11860 | { // 'yield' star_expressions? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11861 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11862 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11863 | return NULL; |
| 11864 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11865 | 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] | 11866 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11867 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11868 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11869 | (_keyword = _PyPegen_expect_token(p, 504)) // token='yield' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11870 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11871 | (a = star_expressions_rule(p), 1) // star_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11872 | ) |
| 11873 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11874 | 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] | 11875 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 11876 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11877 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11878 | return NULL; |
| 11879 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11880 | int _end_lineno = _token->end_lineno; |
| 11881 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 11882 | int _end_col_offset = _token->end_col_offset; |
| 11883 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 11884 | _res = _Py_Yield ( a , EXTRA ); |
| 11885 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11886 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11887 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11888 | return NULL; |
| 11889 | } |
| 11890 | goto done; |
| 11891 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11892 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11893 | D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ', |
| 11894 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11895 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11896 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11897 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11898 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11899 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11900 | } |
| 11901 | |
| 11902 | // arguments: args ','? &')' | incorrect_arguments |
| 11903 | static expr_ty |
| 11904 | arguments_rule(Parser *p) |
| 11905 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11906 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11907 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11908 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11909 | return NULL; |
| 11910 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11911 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11912 | if (_PyPegen_is_memoized(p, arguments_type, &_res)) { |
| 11913 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11914 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11915 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11916 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11917 | { // args ','? &')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11918 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11919 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11920 | return NULL; |
| 11921 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11922 | 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] | 11923 | void *_opt_var; |
| 11924 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11925 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11926 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11927 | (a = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11928 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11929 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11930 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11931 | _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11932 | ) |
| 11933 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11934 | 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] | 11935 | _res = a; |
| 11936 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11937 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11938 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11939 | return NULL; |
| 11940 | } |
| 11941 | goto done; |
| 11942 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11943 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11944 | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 11945 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ','? &')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11946 | } |
| 11947 | { // incorrect_arguments |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11948 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11949 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11950 | return NULL; |
| 11951 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11952 | 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] | 11953 | void *incorrect_arguments_var; |
| 11954 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 11955 | (incorrect_arguments_var = incorrect_arguments_rule(p)) // incorrect_arguments |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11956 | ) |
| 11957 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11958 | 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] | 11959 | _res = incorrect_arguments_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11960 | goto done; |
| 11961 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11962 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11963 | D(fprintf(stderr, "%*c%s arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 11964 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "incorrect_arguments")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11965 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11966 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11967 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11968 | _PyPegen_insert_memo(p, _mark, arguments_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11969 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11970 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11971 | } |
| 11972 | |
| 11973 | // args: starred_expression [',' args] | kwargs | named_expression [',' args] |
| 11974 | static expr_ty |
| 11975 | args_rule(Parser *p) |
| 11976 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11977 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11978 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11979 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11980 | return NULL; |
| 11981 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11982 | expr_ty _res = NULL; |
| 11983 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11984 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 11985 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11986 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11987 | return NULL; |
| 11988 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 11989 | int _start_lineno = p->tokens[_mark]->lineno; |
| 11990 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 11991 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 11992 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 11993 | { // starred_expression [',' args] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11994 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11995 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 11996 | return NULL; |
| 11997 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 11998 | 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] | 11999 | expr_ty a; |
| 12000 | void *b; |
| 12001 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12002 | (a = starred_expression_rule(p)) // starred_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12003 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12004 | (b = _tmp_107_rule(p), 1) // [',' args] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12005 | ) |
| 12006 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12007 | 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] | 12008 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12009 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12010 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12011 | return NULL; |
| 12012 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12013 | int _end_lineno = _token->end_lineno; |
| 12014 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12015 | int _end_col_offset = _token->end_col_offset; |
| 12016 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12017 | _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 ); |
| 12018 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12019 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12020 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12021 | return NULL; |
| 12022 | } |
| 12023 | goto done; |
| 12024 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12025 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12026 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
| 12027 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression [',' args]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12028 | } |
| 12029 | { // kwargs |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12030 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12031 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12032 | return NULL; |
| 12033 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12034 | 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] | 12035 | asdl_seq* a; |
| 12036 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12037 | (a = kwargs_rule(p)) // kwargs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12038 | ) |
| 12039 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12040 | 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] | 12041 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12042 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12043 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12044 | return NULL; |
| 12045 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12046 | int _end_lineno = _token->end_lineno; |
| 12047 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12048 | int _end_col_offset = _token->end_col_offset; |
| 12049 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12050 | _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 ); |
| 12051 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12052 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12053 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12054 | return NULL; |
| 12055 | } |
| 12056 | goto done; |
| 12057 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12058 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12059 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
| 12060 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwargs")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12061 | } |
| 12062 | { // named_expression [',' args] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12063 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12064 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12065 | return NULL; |
| 12066 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12067 | 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] | 12068 | expr_ty a; |
| 12069 | void *b; |
| 12070 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12071 | (a = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12072 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12073 | (b = _tmp_108_rule(p), 1) // [',' args] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12074 | ) |
| 12075 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12076 | 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] | 12077 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12078 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12079 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12080 | return NULL; |
| 12081 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12082 | int _end_lineno = _token->end_lineno; |
| 12083 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12084 | int _end_col_offset = _token->end_col_offset; |
| 12085 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12086 | _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 ); |
| 12087 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12088 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12089 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12090 | return NULL; |
| 12091 | } |
| 12092 | goto done; |
| 12093 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12094 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12095 | D(fprintf(stderr, "%*c%s args[%d-%d]: %s failed!\n", p->level, ' ', |
| 12096 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression [',' args]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12097 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12098 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12099 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12100 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12101 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12102 | } |
| 12103 | |
| 12104 | // kwargs: |
| 12105 | // | ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
| 12106 | // | ','.kwarg_or_starred+ |
| 12107 | // | ','.kwarg_or_double_starred+ |
| 12108 | static asdl_seq* |
| 12109 | kwargs_rule(Parser *p) |
| 12110 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12111 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12112 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12113 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12114 | return NULL; |
| 12115 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12116 | asdl_seq* _res = NULL; |
| 12117 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12118 | { // ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12119 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12120 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12121 | return NULL; |
| 12122 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12123 | 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] | 12124 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12125 | asdl_seq * a; |
| 12126 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12127 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12128 | (a = _gather_109_rule(p)) // ','.kwarg_or_starred+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12129 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12130 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12131 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12132 | (b = _gather_111_rule(p)) // ','.kwarg_or_double_starred+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12133 | ) |
| 12134 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12135 | 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] | 12136 | _res = _PyPegen_join_sequences ( p , a , b ); |
| 12137 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12138 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12139 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12140 | return NULL; |
| 12141 | } |
| 12142 | goto done; |
| 12143 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12144 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12145 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 12146 | 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] | 12147 | } |
| 12148 | { // ','.kwarg_or_starred+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12149 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12150 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12151 | return NULL; |
| 12152 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12153 | 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] | 12154 | asdl_seq * _gather_113_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12155 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12156 | (_gather_113_var = _gather_113_rule(p)) // ','.kwarg_or_starred+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12157 | ) |
| 12158 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12159 | 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] | 12160 | _res = _gather_113_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12161 | goto done; |
| 12162 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12163 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12164 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 12165 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_starred+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12166 | } |
| 12167 | { // ','.kwarg_or_double_starred+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12168 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12169 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12170 | return NULL; |
| 12171 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12172 | 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] | 12173 | asdl_seq * _gather_115_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12174 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12175 | (_gather_115_var = _gather_115_rule(p)) // ','.kwarg_or_double_starred+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12176 | ) |
| 12177 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12178 | 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] | 12179 | _res = _gather_115_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12180 | goto done; |
| 12181 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12182 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12183 | D(fprintf(stderr, "%*c%s kwargs[%d-%d]: %s failed!\n", p->level, ' ', |
| 12184 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.kwarg_or_double_starred+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12185 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12186 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12187 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12188 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12189 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12190 | } |
| 12191 | |
| 12192 | // starred_expression: '*' expression |
| 12193 | static expr_ty |
| 12194 | starred_expression_rule(Parser *p) |
| 12195 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12196 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12197 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12198 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12199 | return NULL; |
| 12200 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12201 | expr_ty _res = NULL; |
| 12202 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12203 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12204 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12205 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12206 | return NULL; |
| 12207 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12208 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12209 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12210 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12211 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12212 | { // '*' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12213 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12214 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12215 | return NULL; |
| 12216 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12217 | 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] | 12218 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12219 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12220 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12221 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12222 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12223 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12224 | ) |
| 12225 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12226 | 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] | 12227 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12228 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12229 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12230 | return NULL; |
| 12231 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12232 | int _end_lineno = _token->end_lineno; |
| 12233 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12234 | int _end_col_offset = _token->end_col_offset; |
| 12235 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12236 | _res = _Py_Starred ( a , Load , EXTRA ); |
| 12237 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12238 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12239 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12240 | return NULL; |
| 12241 | } |
| 12242 | goto done; |
| 12243 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12244 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12245 | D(fprintf(stderr, "%*c%s starred_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 12246 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12247 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12248 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12249 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12250 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12251 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12252 | } |
| 12253 | |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12254 | // kwarg_or_starred: NAME '=' expression | starred_expression | invalid_kwarg |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12255 | static KeywordOrStarred* |
| 12256 | kwarg_or_starred_rule(Parser *p) |
| 12257 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12258 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12259 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12260 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12261 | return NULL; |
| 12262 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12263 | KeywordOrStarred* _res = NULL; |
| 12264 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12265 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12266 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12267 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12268 | return NULL; |
| 12269 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12270 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12271 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12272 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12273 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12274 | { // NAME '=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12275 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12276 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12277 | return NULL; |
| 12278 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12279 | 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] | 12280 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12281 | expr_ty a; |
| 12282 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12283 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12284 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12285 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12286 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12287 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12288 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12289 | ) |
| 12290 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12291 | 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] | 12292 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12293 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12294 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12295 | return NULL; |
| 12296 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12297 | int _end_lineno = _token->end_lineno; |
| 12298 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12299 | int _end_col_offset = _token->end_col_offset; |
| 12300 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12301 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
| 12302 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12303 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12304 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12305 | return NULL; |
| 12306 | } |
| 12307 | goto done; |
| 12308 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12309 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12310 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12311 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12312 | } |
| 12313 | { // starred_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12314 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12315 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12316 | return NULL; |
| 12317 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12318 | 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] | 12319 | expr_ty a; |
| 12320 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12321 | (a = starred_expression_rule(p)) // starred_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12322 | ) |
| 12323 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12324 | 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] | 12325 | _res = _PyPegen_keyword_or_starred ( p , a , 0 ); |
| 12326 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12327 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12328 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12329 | return NULL; |
| 12330 | } |
| 12331 | goto done; |
| 12332 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12333 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12334 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12335 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12336 | } |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12337 | { // invalid_kwarg |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12338 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12339 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12340 | return NULL; |
| 12341 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12342 | 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] | 12343 | void *invalid_kwarg_var; |
| 12344 | if ( |
| 12345 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
| 12346 | ) |
| 12347 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12348 | 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] | 12349 | _res = invalid_kwarg_var; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12350 | goto done; |
| 12351 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12352 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12353 | D(fprintf(stderr, "%*c%s kwarg_or_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12354 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12355 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12356 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12357 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12358 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12359 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12360 | } |
| 12361 | |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12362 | // kwarg_or_double_starred: NAME '=' expression | '**' expression | invalid_kwarg |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12363 | static KeywordOrStarred* |
| 12364 | kwarg_or_double_starred_rule(Parser *p) |
| 12365 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12366 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12367 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12368 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12369 | return NULL; |
| 12370 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12371 | KeywordOrStarred* _res = NULL; |
| 12372 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12373 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12374 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12375 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12376 | return NULL; |
| 12377 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12378 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12379 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12380 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12381 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12382 | { // NAME '=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12383 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12384 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12385 | return NULL; |
| 12386 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12387 | 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] | 12388 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12389 | expr_ty a; |
| 12390 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12391 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12392 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12393 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12394 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12395 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12396 | (b = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12397 | ) |
| 12398 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12399 | 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] | 12400 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12401 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12402 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12403 | return NULL; |
| 12404 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12405 | int _end_lineno = _token->end_lineno; |
| 12406 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12407 | int _end_col_offset = _token->end_col_offset; |
| 12408 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12409 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( a -> v . Name . id , b , EXTRA ) ) , 1 ); |
| 12410 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12411 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12412 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12413 | return NULL; |
| 12414 | } |
| 12415 | goto done; |
| 12416 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12417 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12418 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12419 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12420 | } |
| 12421 | { // '**' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12422 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12423 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12424 | return NULL; |
| 12425 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12426 | 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] | 12427 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12428 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12429 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12430 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12431 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12432 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12433 | ) |
| 12434 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12435 | 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] | 12436 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12437 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12438 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12439 | return NULL; |
| 12440 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12441 | int _end_lineno = _token->end_lineno; |
| 12442 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12443 | int _end_col_offset = _token->end_col_offset; |
| 12444 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12445 | _res = _PyPegen_keyword_or_starred ( p , CHECK ( _Py_keyword ( NULL , a , EXTRA ) ) , 1 ); |
| 12446 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12447 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12448 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12449 | return NULL; |
| 12450 | } |
| 12451 | goto done; |
| 12452 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12453 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12454 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12455 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12456 | } |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12457 | { // invalid_kwarg |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12458 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12459 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12460 | return NULL; |
| 12461 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12462 | 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] | 12463 | void *invalid_kwarg_var; |
| 12464 | if ( |
| 12465 | (invalid_kwarg_var = invalid_kwarg_rule(p)) // invalid_kwarg |
| 12466 | ) |
| 12467 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12468 | 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] | 12469 | _res = invalid_kwarg_var; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12470 | goto done; |
| 12471 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12472 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12473 | D(fprintf(stderr, "%*c%s kwarg_or_double_starred[%d-%d]: %s failed!\n", p->level, ' ', |
| 12474 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_kwarg")); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 12475 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12476 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12477 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12478 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12479 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12480 | } |
| 12481 | |
| 12482 | // star_targets: star_target !',' | star_target ((',' star_target))* ','? |
| 12483 | static expr_ty |
| 12484 | star_targets_rule(Parser *p) |
| 12485 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12486 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12487 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12488 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12489 | return NULL; |
| 12490 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12491 | expr_ty _res = NULL; |
| 12492 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12493 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12494 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12495 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12496 | return NULL; |
| 12497 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12498 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12499 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12500 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12501 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12502 | { // star_target !',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12503 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12504 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12505 | return NULL; |
| 12506 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12507 | 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] | 12508 | expr_ty a; |
| 12509 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12510 | (a = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12511 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12512 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 12) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12513 | ) |
| 12514 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12515 | 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] | 12516 | _res = a; |
| 12517 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12518 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12519 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12520 | return NULL; |
| 12521 | } |
| 12522 | goto done; |
| 12523 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12524 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12525 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 12526 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target !','")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12527 | } |
| 12528 | { // star_target ((',' star_target))* ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12529 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12530 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12531 | return NULL; |
| 12532 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12533 | 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] | 12534 | void *_opt_var; |
| 12535 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12536 | expr_ty a; |
| 12537 | asdl_seq * b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12538 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12539 | (a = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12540 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12541 | (b = _loop0_117_rule(p)) // ((',' star_target))* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12542 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12543 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12544 | ) |
| 12545 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12546 | 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] | 12547 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12548 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12549 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12550 | return NULL; |
| 12551 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12552 | int _end_lineno = _token->end_lineno; |
| 12553 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12554 | int _end_col_offset = _token->end_col_offset; |
| 12555 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12556 | _res = _Py_Tuple ( CHECK ( _PyPegen_seq_insert_in_front ( p , a , b ) ) , Store , EXTRA ); |
| 12557 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12558 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12559 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12560 | return NULL; |
| 12561 | } |
| 12562 | goto done; |
| 12563 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12564 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12565 | D(fprintf(stderr, "%*c%s star_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 12566 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target ((',' star_target))* ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12567 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12568 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12569 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12570 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12571 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12572 | } |
| 12573 | |
| 12574 | // star_targets_seq: ','.star_target+ ','? |
| 12575 | static asdl_seq* |
| 12576 | star_targets_seq_rule(Parser *p) |
| 12577 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12578 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12579 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12580 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12581 | return NULL; |
| 12582 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12583 | asdl_seq* _res = NULL; |
| 12584 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12585 | { // ','.star_target+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12586 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12587 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12588 | return NULL; |
| 12589 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12590 | 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] | 12591 | void *_opt_var; |
| 12592 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12593 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12594 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12595 | (a = _gather_118_rule(p)) // ','.star_target+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12596 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12597 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12598 | ) |
| 12599 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12600 | 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] | 12601 | _res = a; |
| 12602 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12603 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12604 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12605 | return NULL; |
| 12606 | } |
| 12607 | goto done; |
| 12608 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12609 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12610 | D(fprintf(stderr, "%*c%s star_targets_seq[%d-%d]: %s failed!\n", p->level, ' ', |
| 12611 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.star_target+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12612 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12613 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12614 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12615 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12616 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12617 | } |
| 12618 | |
| 12619 | // star_target: |
| 12620 | // | '*' (!'*' star_target) |
| 12621 | // | t_primary '.' NAME !t_lookahead |
| 12622 | // | t_primary '[' slices ']' !t_lookahead |
| 12623 | // | star_atom |
| 12624 | static expr_ty |
| 12625 | star_target_rule(Parser *p) |
| 12626 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12627 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12628 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12629 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12630 | return NULL; |
| 12631 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12632 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12633 | if (_PyPegen_is_memoized(p, star_target_type, &_res)) { |
| 12634 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12635 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12636 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12637 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12638 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12639 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12640 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12641 | return NULL; |
| 12642 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12643 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12644 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12645 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12646 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12647 | { // '*' (!'*' star_target) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12648 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12649 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12650 | return NULL; |
| 12651 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12652 | 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] | 12653 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12654 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12655 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12656 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12657 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12658 | (a = _tmp_120_rule(p)) // !'*' star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12659 | ) |
| 12660 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12661 | 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] | 12662 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12663 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12664 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12665 | return NULL; |
| 12666 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12667 | int _end_lineno = _token->end_lineno; |
| 12668 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12669 | int _end_col_offset = _token->end_col_offset; |
| 12670 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12671 | _res = _Py_Starred ( CHECK ( _PyPegen_set_expr_context ( p , a , Store ) ) , Store , EXTRA ); |
| 12672 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12673 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12674 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12675 | return NULL; |
| 12676 | } |
| 12677 | goto done; |
| 12678 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12679 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12680 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12681 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (!'*' star_target)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12682 | } |
| 12683 | { // t_primary '.' NAME !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12684 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12685 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12686 | return NULL; |
| 12687 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12688 | 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] | 12689 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12690 | expr_ty a; |
| 12691 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12692 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12693 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12694 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12695 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12696 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12697 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12698 | && |
| 12699 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 12700 | ) |
| 12701 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12702 | 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] | 12703 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12704 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12705 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12706 | return NULL; |
| 12707 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12708 | int _end_lineno = _token->end_lineno; |
| 12709 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12710 | int _end_col_offset = _token->end_col_offset; |
| 12711 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12712 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 12713 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12714 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12715 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12716 | return NULL; |
| 12717 | } |
| 12718 | goto done; |
| 12719 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12720 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12721 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12722 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12723 | } |
| 12724 | { // t_primary '[' slices ']' !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12725 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12726 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12727 | return NULL; |
| 12728 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12729 | 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] | 12730 | Token * _literal; |
| 12731 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12732 | expr_ty a; |
| 12733 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12734 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12735 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12736 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12737 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12738 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12739 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12740 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12741 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12742 | && |
| 12743 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 12744 | ) |
| 12745 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12746 | 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] | 12747 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12748 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12749 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12750 | return NULL; |
| 12751 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12752 | int _end_lineno = _token->end_lineno; |
| 12753 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12754 | int _end_col_offset = _token->end_col_offset; |
| 12755 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12756 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 12757 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12758 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12759 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12760 | return NULL; |
| 12761 | } |
| 12762 | goto done; |
| 12763 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12764 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12765 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12766 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12767 | } |
| 12768 | { // star_atom |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12769 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12770 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12771 | return NULL; |
| 12772 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12773 | 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] | 12774 | expr_ty star_atom_var; |
| 12775 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12776 | (star_atom_var = star_atom_rule(p)) // star_atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12777 | ) |
| 12778 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12779 | 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] | 12780 | _res = star_atom_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12781 | goto done; |
| 12782 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12783 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12784 | D(fprintf(stderr, "%*c%s star_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12785 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12786 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12787 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12788 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12789 | _PyPegen_insert_memo(p, _mark, star_target_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12790 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12791 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12792 | } |
| 12793 | |
| 12794 | // star_atom: |
| 12795 | // | NAME |
| 12796 | // | '(' star_target ')' |
| 12797 | // | '(' star_targets_seq? ')' |
| 12798 | // | '[' star_targets_seq? ']' |
| 12799 | static expr_ty |
| 12800 | star_atom_rule(Parser *p) |
| 12801 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12802 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12803 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12804 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12805 | return NULL; |
| 12806 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12807 | expr_ty _res = NULL; |
| 12808 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12809 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 12810 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12811 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12812 | return NULL; |
| 12813 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12814 | int _start_lineno = p->tokens[_mark]->lineno; |
| 12815 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 12816 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 12817 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12818 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12819 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12820 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12821 | return NULL; |
| 12822 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12823 | 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] | 12824 | expr_ty a; |
| 12825 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12826 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12827 | ) |
| 12828 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12829 | 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] | 12830 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 12831 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12832 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12833 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12834 | return NULL; |
| 12835 | } |
| 12836 | goto done; |
| 12837 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12838 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12839 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 12840 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12841 | } |
| 12842 | { // '(' star_target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12843 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12844 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12845 | return NULL; |
| 12846 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12847 | 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] | 12848 | Token * _literal; |
| 12849 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12850 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12851 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12852 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12853 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12854 | (a = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12855 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12856 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12857 | ) |
| 12858 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12859 | 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] | 12860 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 12861 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12862 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12863 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12864 | return NULL; |
| 12865 | } |
| 12866 | goto done; |
| 12867 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12868 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12869 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 12870 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12871 | } |
| 12872 | { // '(' star_targets_seq? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12873 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12874 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12875 | return NULL; |
| 12876 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12877 | 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] | 12878 | Token * _literal; |
| 12879 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12880 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12881 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12882 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12883 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12884 | (a = star_targets_seq_rule(p), 1) // star_targets_seq? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12885 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12886 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12887 | ) |
| 12888 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12889 | 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] | 12890 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12891 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12892 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12893 | return NULL; |
| 12894 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12895 | int _end_lineno = _token->end_lineno; |
| 12896 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12897 | int _end_col_offset = _token->end_col_offset; |
| 12898 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12899 | _res = _Py_Tuple ( a , Store , EXTRA ); |
| 12900 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12901 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12902 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12903 | return NULL; |
| 12904 | } |
| 12905 | goto done; |
| 12906 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12907 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12908 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 12909 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' star_targets_seq? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12910 | } |
| 12911 | { // '[' star_targets_seq? ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12912 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12913 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12914 | return NULL; |
| 12915 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12916 | 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] | 12917 | Token * _literal; |
| 12918 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12919 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12920 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12921 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12922 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12923 | (a = star_targets_seq_rule(p), 1) // star_targets_seq? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12924 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12925 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12926 | ) |
| 12927 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12928 | 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] | 12929 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 12930 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12931 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12932 | return NULL; |
| 12933 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12934 | int _end_lineno = _token->end_lineno; |
| 12935 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 12936 | int _end_col_offset = _token->end_col_offset; |
| 12937 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 12938 | _res = _Py_List ( a , Store , EXTRA ); |
| 12939 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12940 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12941 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12942 | return NULL; |
| 12943 | } |
| 12944 | goto done; |
| 12945 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12946 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12947 | D(fprintf(stderr, "%*c%s star_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 12948 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_targets_seq? ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12949 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12950 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12951 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12952 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12953 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12954 | } |
| 12955 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12956 | // single_target: single_subscript_attribute_target | NAME | '(' single_target ')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12957 | static expr_ty |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12958 | single_target_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12959 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12960 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12961 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12962 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12963 | return NULL; |
| 12964 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12965 | expr_ty _res = NULL; |
| 12966 | int _mark = p->mark; |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12967 | { // single_subscript_attribute_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12968 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12969 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12970 | return NULL; |
| 12971 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12972 | 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] | 12973 | expr_ty single_subscript_attribute_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12974 | if ( |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 12975 | (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] | 12976 | ) |
| 12977 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12978 | 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] | 12979 | _res = single_subscript_attribute_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12980 | goto done; |
| 12981 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 12982 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12983 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 12984 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12985 | } |
| 12986 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12987 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12988 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 12989 | return NULL; |
| 12990 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12991 | 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] | 12992 | expr_ty a; |
| 12993 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 12994 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 12995 | ) |
| 12996 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 12997 | 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] | 12998 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 12999 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13000 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13001 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13002 | return NULL; |
| 13003 | } |
| 13004 | goto done; |
| 13005 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13006 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13007 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13008 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13009 | } |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 13010 | { // '(' single_target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13011 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13012 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13013 | return NULL; |
| 13014 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13015 | 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] | 13016 | Token * _literal; |
| 13017 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13018 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13019 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13020 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13021 | && |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 13022 | (a = single_target_rule(p)) // single_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13023 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13024 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13025 | ) |
| 13026 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13027 | 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] | 13028 | _res = a; |
| 13029 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13030 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13031 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13032 | return NULL; |
| 13033 | } |
| 13034 | goto done; |
| 13035 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13036 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13037 | D(fprintf(stderr, "%*c%s single_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13038 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13039 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13040 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13041 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13042 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13043 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13044 | } |
| 13045 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 13046 | // single_subscript_attribute_target: |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13047 | // | t_primary '.' NAME !t_lookahead |
| 13048 | // | t_primary '[' slices ']' !t_lookahead |
| 13049 | static expr_ty |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 13050 | single_subscript_attribute_target_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13051 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13052 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13053 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13054 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13055 | return NULL; |
| 13056 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13057 | expr_ty _res = NULL; |
| 13058 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13059 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13060 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13061 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13062 | return NULL; |
| 13063 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13064 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13065 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13066 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13067 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13068 | { // t_primary '.' NAME !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13069 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13070 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13071 | return NULL; |
| 13072 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13073 | 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] | 13074 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13075 | expr_ty a; |
| 13076 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13077 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13078 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13079 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13080 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13081 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13082 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13083 | && |
| 13084 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 13085 | ) |
| 13086 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13087 | 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] | 13088 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13089 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13090 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13091 | return NULL; |
| 13092 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13093 | int _end_lineno = _token->end_lineno; |
| 13094 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13095 | int _end_col_offset = _token->end_col_offset; |
| 13096 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13097 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 13098 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13099 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13100 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13101 | return NULL; |
| 13102 | } |
| 13103 | goto done; |
| 13104 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13105 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13106 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13107 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13108 | } |
| 13109 | { // t_primary '[' slices ']' !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13110 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13111 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13112 | return NULL; |
| 13113 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13114 | 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] | 13115 | Token * _literal; |
| 13116 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13117 | expr_ty a; |
| 13118 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13119 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13120 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13121 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13122 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13123 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13124 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13125 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13126 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13127 | && |
| 13128 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 13129 | ) |
| 13130 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13131 | 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] | 13132 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13133 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13134 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13135 | return NULL; |
| 13136 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13137 | int _end_lineno = _token->end_lineno; |
| 13138 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13139 | int _end_col_offset = _token->end_col_offset; |
| 13140 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13141 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 13142 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13143 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13144 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13145 | return NULL; |
| 13146 | } |
| 13147 | goto done; |
| 13148 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13149 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13150 | D(fprintf(stderr, "%*c%s single_subscript_attribute_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13151 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13152 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13153 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13154 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13155 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13156 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13157 | } |
| 13158 | |
| 13159 | // del_targets: ','.del_target+ ','? |
| 13160 | static asdl_seq* |
| 13161 | del_targets_rule(Parser *p) |
| 13162 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13163 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13164 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13165 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13166 | return NULL; |
| 13167 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13168 | asdl_seq* _res = NULL; |
| 13169 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13170 | { // ','.del_target+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13171 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13172 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13173 | return NULL; |
| 13174 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13175 | 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] | 13176 | void *_opt_var; |
| 13177 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13178 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13179 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13180 | (a = _gather_121_rule(p)) // ','.del_target+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13181 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13182 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13183 | ) |
| 13184 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13185 | 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] | 13186 | _res = a; |
| 13187 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13188 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13189 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13190 | return NULL; |
| 13191 | } |
| 13192 | goto done; |
| 13193 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13194 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13195 | D(fprintf(stderr, "%*c%s del_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 13196 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.del_target+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13197 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13198 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13199 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13200 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13201 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13202 | } |
| 13203 | |
| 13204 | // del_target: |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13205 | // | t_primary '.' NAME &del_target_end |
| 13206 | // | t_primary '[' slices ']' &del_target_end |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13207 | // | del_t_atom |
| 13208 | static expr_ty |
| 13209 | del_target_rule(Parser *p) |
| 13210 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13211 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13212 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13213 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13214 | return NULL; |
| 13215 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13216 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13217 | if (_PyPegen_is_memoized(p, del_target_type, &_res)) { |
| 13218 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13219 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13220 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13221 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13222 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13223 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13224 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13225 | return NULL; |
| 13226 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13227 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13228 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13229 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13230 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13231 | { // t_primary '.' NAME &del_target_end |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13232 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13233 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13234 | return NULL; |
| 13235 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13236 | 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] | 13237 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13238 | expr_ty a; |
| 13239 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13240 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13241 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13242 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13243 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13244 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13245 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13246 | && |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13247 | _PyPegen_lookahead(1, del_target_end_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13248 | ) |
| 13249 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13250 | 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] | 13251 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13252 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13253 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13254 | return NULL; |
| 13255 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13256 | int _end_lineno = _token->end_lineno; |
| 13257 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13258 | int _end_col_offset = _token->end_col_offset; |
| 13259 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13260 | _res = _Py_Attribute ( a , b -> v . Name . id , Del , EXTRA ); |
| 13261 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13262 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13263 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13264 | return NULL; |
| 13265 | } |
| 13266 | goto done; |
| 13267 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13268 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13269 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13270 | 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] | 13271 | } |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13272 | { // t_primary '[' slices ']' &del_target_end |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13273 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13274 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13275 | return NULL; |
| 13276 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13277 | 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] | 13278 | Token * _literal; |
| 13279 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13280 | expr_ty a; |
| 13281 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13282 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13283 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13284 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13285 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13286 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13287 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13288 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13289 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13290 | && |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13291 | _PyPegen_lookahead(1, del_target_end_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13292 | ) |
| 13293 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13294 | 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] | 13295 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13296 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13297 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13298 | return NULL; |
| 13299 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13300 | int _end_lineno = _token->end_lineno; |
| 13301 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13302 | int _end_col_offset = _token->end_col_offset; |
| 13303 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13304 | _res = _Py_Subscript ( a , b , Del , EXTRA ); |
| 13305 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13306 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13307 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13308 | return NULL; |
| 13309 | } |
| 13310 | goto done; |
| 13311 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13312 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13313 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13314 | 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] | 13315 | } |
| 13316 | { // del_t_atom |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13317 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13318 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13319 | return NULL; |
| 13320 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13321 | 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] | 13322 | expr_ty del_t_atom_var; |
| 13323 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13324 | (del_t_atom_var = del_t_atom_rule(p)) // del_t_atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13325 | ) |
| 13326 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13327 | 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] | 13328 | _res = del_t_atom_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13329 | goto done; |
| 13330 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13331 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13332 | D(fprintf(stderr, "%*c%s del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13333 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_t_atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13334 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13335 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13336 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13337 | _PyPegen_insert_memo(p, _mark, del_target_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13338 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13339 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13340 | } |
| 13341 | |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13342 | // del_t_atom: |
| 13343 | // | NAME &del_target_end |
| 13344 | // | '(' del_target ')' |
| 13345 | // | '(' del_targets? ')' |
| 13346 | // | '[' del_targets? ']' |
| 13347 | // | invalid_del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13348 | static expr_ty |
| 13349 | del_t_atom_rule(Parser *p) |
| 13350 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13351 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13352 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13353 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13354 | return NULL; |
| 13355 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13356 | expr_ty _res = NULL; |
| 13357 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13358 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13359 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13360 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13361 | return NULL; |
| 13362 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13363 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13364 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13365 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13366 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13367 | { // NAME &del_target_end |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13368 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13369 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13370 | return NULL; |
| 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\n", p->level, ' ', _mark, p->mark, "NAME &del_target_end")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13373 | expr_ty a; |
| 13374 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13375 | (a = _PyPegen_name_token(p)) // NAME |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13376 | && |
| 13377 | _PyPegen_lookahead(1, del_target_end_rule, p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13378 | ) |
| 13379 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13380 | 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] | 13381 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
| 13382 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13383 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13384 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13385 | return NULL; |
| 13386 | } |
| 13387 | goto done; |
| 13388 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13389 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13390 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13391 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME &del_target_end")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13392 | } |
| 13393 | { // '(' del_target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13394 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13395 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13396 | return NULL; |
| 13397 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13398 | 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] | 13399 | Token * _literal; |
| 13400 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13401 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13402 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13403 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13404 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13405 | (a = del_target_rule(p)) // del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13406 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13407 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13408 | ) |
| 13409 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13410 | 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] | 13411 | _res = _PyPegen_set_expr_context ( p , a , Del ); |
| 13412 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13413 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13414 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13415 | return NULL; |
| 13416 | } |
| 13417 | goto done; |
| 13418 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13419 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13420 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13421 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13422 | } |
| 13423 | { // '(' del_targets? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13424 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13425 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13426 | return NULL; |
| 13427 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13428 | 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] | 13429 | Token * _literal; |
| 13430 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13431 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13432 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13433 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13434 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13435 | (a = del_targets_rule(p), 1) // del_targets? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13436 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13437 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13438 | ) |
| 13439 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13440 | 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] | 13441 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13442 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13443 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13444 | return NULL; |
| 13445 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13446 | int _end_lineno = _token->end_lineno; |
| 13447 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13448 | int _end_col_offset = _token->end_col_offset; |
| 13449 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13450 | _res = _Py_Tuple ( a , Del , EXTRA ); |
| 13451 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13452 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13453 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13454 | return NULL; |
| 13455 | } |
| 13456 | goto done; |
| 13457 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13458 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13459 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13460 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' del_targets? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13461 | } |
| 13462 | { // '[' del_targets? ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13463 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13464 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13465 | return NULL; |
| 13466 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13467 | 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] | 13468 | Token * _literal; |
| 13469 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13470 | void *a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13471 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13472 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13473 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13474 | (a = del_targets_rule(p), 1) // del_targets? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13475 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13476 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13477 | ) |
| 13478 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13479 | 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] | 13480 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13481 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13482 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13483 | return NULL; |
| 13484 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13485 | int _end_lineno = _token->end_lineno; |
| 13486 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13487 | int _end_col_offset = _token->end_col_offset; |
| 13488 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13489 | _res = _Py_List ( a , Del , EXTRA ); |
| 13490 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13491 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13492 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13493 | return NULL; |
| 13494 | } |
| 13495 | goto done; |
| 13496 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13497 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13498 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13499 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' del_targets? ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13500 | } |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13501 | { // invalid_del_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13502 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13503 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13504 | return NULL; |
| 13505 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13506 | 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] | 13507 | void *invalid_del_target_var; |
| 13508 | if ( |
| 13509 | (invalid_del_target_var = invalid_del_target_rule(p)) // invalid_del_target |
| 13510 | ) |
| 13511 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13512 | 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] | 13513 | _res = invalid_del_target_var; |
| 13514 | goto done; |
| 13515 | } |
| 13516 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13517 | D(fprintf(stderr, "%*c%s del_t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 13518 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_del_target")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13519 | } |
| 13520 | _res = NULL; |
| 13521 | done: |
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 | return _res; |
| 13524 | } |
| 13525 | |
| 13526 | // del_target_end: ')' | ']' | ',' | ';' | NEWLINE |
| 13527 | static void * |
| 13528 | del_target_end_rule(Parser *p) |
| 13529 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13530 | D(p->level++); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13531 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13532 | D(p->level--); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13533 | return NULL; |
| 13534 | } |
| 13535 | void * _res = NULL; |
| 13536 | int _mark = p->mark; |
| 13537 | { // ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13538 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13539 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13540 | return NULL; |
| 13541 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13542 | 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] | 13543 | Token * _literal; |
| 13544 | if ( |
| 13545 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
| 13546 | ) |
| 13547 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13548 | 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] | 13549 | _res = _literal; |
| 13550 | goto done; |
| 13551 | } |
| 13552 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13553 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13554 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13555 | } |
| 13556 | { // ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13557 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13558 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13559 | return NULL; |
| 13560 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13561 | 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] | 13562 | Token * _literal; |
| 13563 | if ( |
| 13564 | (_literal = _PyPegen_expect_token(p, 10)) // token=']' |
| 13565 | ) |
| 13566 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13567 | 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] | 13568 | _res = _literal; |
| 13569 | goto done; |
| 13570 | } |
| 13571 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13572 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13573 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "']'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13574 | } |
| 13575 | { // ',' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13576 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13577 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13578 | return NULL; |
| 13579 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13580 | 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] | 13581 | Token * _literal; |
| 13582 | if ( |
| 13583 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 13584 | ) |
| 13585 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13586 | 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] | 13587 | _res = _literal; |
| 13588 | goto done; |
| 13589 | } |
| 13590 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13591 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13592 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13593 | } |
| 13594 | { // ';' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13595 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13596 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13597 | return NULL; |
| 13598 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13599 | 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] | 13600 | Token * _literal; |
| 13601 | if ( |
| 13602 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
| 13603 | ) |
| 13604 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13605 | 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] | 13606 | _res = _literal; |
| 13607 | goto done; |
| 13608 | } |
| 13609 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13610 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13611 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13612 | } |
| 13613 | { // NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13614 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13615 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13616 | return NULL; |
| 13617 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13618 | 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] | 13619 | Token * newline_var; |
| 13620 | if ( |
| 13621 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
| 13622 | ) |
| 13623 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13624 | 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] | 13625 | _res = newline_var; |
| 13626 | goto done; |
| 13627 | } |
| 13628 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13629 | D(fprintf(stderr, "%*c%s del_target_end[%d-%d]: %s failed!\n", p->level, ' ', |
| 13630 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 13631 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13632 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13633 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13634 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13635 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13636 | } |
| 13637 | |
| 13638 | // targets: ','.target+ ','? |
| 13639 | static asdl_seq* |
| 13640 | targets_rule(Parser *p) |
| 13641 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13642 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13643 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13644 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13645 | return NULL; |
| 13646 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13647 | asdl_seq* _res = NULL; |
| 13648 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13649 | { // ','.target+ ','? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13650 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13651 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13652 | return NULL; |
| 13653 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13654 | 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] | 13655 | void *_opt_var; |
| 13656 | UNUSED(_opt_var); // Silence compiler warnings |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13657 | asdl_seq * a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13658 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13659 | (a = _gather_123_rule(p)) // ','.target+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13660 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13661 | (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13662 | ) |
| 13663 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13664 | 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] | 13665 | _res = a; |
| 13666 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13667 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13668 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13669 | return NULL; |
| 13670 | } |
| 13671 | goto done; |
| 13672 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13673 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13674 | D(fprintf(stderr, "%*c%s targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 13675 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.target+ ','?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13676 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13677 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13678 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13679 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13680 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13681 | } |
| 13682 | |
| 13683 | // target: |
| 13684 | // | t_primary '.' NAME !t_lookahead |
| 13685 | // | t_primary '[' slices ']' !t_lookahead |
| 13686 | // | t_atom |
| 13687 | static expr_ty |
| 13688 | target_rule(Parser *p) |
| 13689 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13690 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13691 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13692 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13693 | return NULL; |
| 13694 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13695 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13696 | if (_PyPegen_is_memoized(p, target_type, &_res)) { |
| 13697 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13698 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13699 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13700 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13701 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13702 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13703 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13704 | return NULL; |
| 13705 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13706 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13707 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13708 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13709 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13710 | { // t_primary '.' NAME !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13711 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13712 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13713 | return NULL; |
| 13714 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13715 | 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] | 13716 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13717 | expr_ty a; |
| 13718 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13719 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13720 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13721 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13722 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13723 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13724 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13725 | && |
| 13726 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 13727 | ) |
| 13728 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13729 | 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] | 13730 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13731 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13732 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13733 | return NULL; |
| 13734 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13735 | int _end_lineno = _token->end_lineno; |
| 13736 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13737 | int _end_col_offset = _token->end_col_offset; |
| 13738 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13739 | _res = _Py_Attribute ( a , b -> v . Name . id , Store , EXTRA ); |
| 13740 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13741 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13742 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13743 | return NULL; |
| 13744 | } |
| 13745 | goto done; |
| 13746 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13747 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13748 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13749 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13750 | } |
| 13751 | { // t_primary '[' slices ']' !t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13752 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13753 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13754 | return NULL; |
| 13755 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13756 | 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] | 13757 | Token * _literal; |
| 13758 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13759 | expr_ty a; |
| 13760 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13761 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13762 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13763 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13764 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13765 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13766 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13767 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13768 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13769 | && |
| 13770 | _PyPegen_lookahead(0, t_lookahead_rule, p) |
| 13771 | ) |
| 13772 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13773 | 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] | 13774 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13775 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13776 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13777 | return NULL; |
| 13778 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13779 | int _end_lineno = _token->end_lineno; |
| 13780 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13781 | int _end_col_offset = _token->end_col_offset; |
| 13782 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13783 | _res = _Py_Subscript ( a , b , Store , EXTRA ); |
| 13784 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13785 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13786 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13787 | return NULL; |
| 13788 | } |
| 13789 | goto done; |
| 13790 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13791 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13792 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13793 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' !t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13794 | } |
| 13795 | { // t_atom |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13796 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13797 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13798 | return NULL; |
| 13799 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13800 | 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] | 13801 | expr_ty t_atom_var; |
| 13802 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13803 | (t_atom_var = t_atom_rule(p)) // t_atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13804 | ) |
| 13805 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13806 | 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] | 13807 | _res = t_atom_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13808 | goto done; |
| 13809 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13810 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13811 | D(fprintf(stderr, "%*c%s target[%d-%d]: %s failed!\n", p->level, ' ', |
| 13812 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_atom")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13813 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13814 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13815 | done: |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13816 | _PyPegen_insert_memo(p, _mark, target_type, _res); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13817 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13818 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13819 | } |
| 13820 | |
| 13821 | // Left-recursive |
| 13822 | // t_primary: |
| 13823 | // | t_primary '.' NAME &t_lookahead |
| 13824 | // | t_primary '[' slices ']' &t_lookahead |
| 13825 | // | t_primary genexp &t_lookahead |
| 13826 | // | t_primary '(' arguments? ')' &t_lookahead |
| 13827 | // | atom &t_lookahead |
| 13828 | static expr_ty t_primary_raw(Parser *); |
| 13829 | static expr_ty |
| 13830 | t_primary_rule(Parser *p) |
| 13831 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13832 | D(p->level++); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13833 | expr_ty _res = NULL; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13834 | if (_PyPegen_is_memoized(p, t_primary_type, &_res)) { |
| 13835 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13836 | return _res; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13837 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13838 | int _mark = p->mark; |
| 13839 | int _resmark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13840 | while (1) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13841 | int tmpvar_8 = _PyPegen_update_memo(p, _mark, t_primary_type, _res); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13842 | if (tmpvar_8) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13843 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13844 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13845 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13846 | p->mark = _mark; |
| 13847 | void *_raw = t_primary_raw(p); |
| 13848 | if (_raw == NULL || p->mark <= _resmark) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13849 | break; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13850 | _resmark = p->mark; |
| 13851 | _res = _raw; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13852 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13853 | p->mark = _resmark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13854 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13855 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13856 | } |
| 13857 | static expr_ty |
| 13858 | t_primary_raw(Parser *p) |
| 13859 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13860 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13861 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13862 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13863 | return NULL; |
| 13864 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13865 | expr_ty _res = NULL; |
| 13866 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13867 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 13868 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13869 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13870 | return NULL; |
| 13871 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13872 | int _start_lineno = p->tokens[_mark]->lineno; |
| 13873 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 13874 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 13875 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13876 | { // t_primary '.' NAME &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13877 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13878 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13879 | return NULL; |
| 13880 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13881 | 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] | 13882 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13883 | expr_ty a; |
| 13884 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13885 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13886 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13887 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13888 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13889 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13890 | (b = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13891 | && |
| 13892 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 13893 | ) |
| 13894 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13895 | 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] | 13896 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13897 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13898 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13899 | return NULL; |
| 13900 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13901 | int _end_lineno = _token->end_lineno; |
| 13902 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13903 | int _end_col_offset = _token->end_col_offset; |
| 13904 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13905 | _res = _Py_Attribute ( a , b -> v . Name . id , Load , EXTRA ); |
| 13906 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13907 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13908 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13909 | return NULL; |
| 13910 | } |
| 13911 | goto done; |
| 13912 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13913 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13914 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 13915 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13916 | } |
| 13917 | { // t_primary '[' slices ']' &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13918 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13919 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13920 | return NULL; |
| 13921 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13922 | 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] | 13923 | Token * _literal; |
| 13924 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13925 | expr_ty a; |
| 13926 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13927 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13928 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13929 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13930 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13931 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13932 | (b = slices_rule(p)) // slices |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13933 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13934 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13935 | && |
| 13936 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 13937 | ) |
| 13938 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13939 | 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] | 13940 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13941 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13942 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13943 | return NULL; |
| 13944 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13945 | int _end_lineno = _token->end_lineno; |
| 13946 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13947 | int _end_col_offset = _token->end_col_offset; |
| 13948 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13949 | _res = _Py_Subscript ( a , b , Load , EXTRA ); |
| 13950 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13951 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13952 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13953 | return NULL; |
| 13954 | } |
| 13955 | goto done; |
| 13956 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13957 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13958 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 13959 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13960 | } |
| 13961 | { // t_primary genexp &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13962 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13963 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 13964 | return NULL; |
| 13965 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13966 | 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] | 13967 | expr_ty a; |
| 13968 | expr_ty b; |
| 13969 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13970 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13971 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 13972 | (b = genexp_rule(p)) // genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13973 | && |
| 13974 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 13975 | ) |
| 13976 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13977 | 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] | 13978 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 13979 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13980 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13981 | return NULL; |
| 13982 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13983 | int _end_lineno = _token->end_lineno; |
| 13984 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 13985 | int _end_col_offset = _token->end_col_offset; |
| 13986 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 13987 | _res = _Py_Call ( a , CHECK ( _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA ); |
| 13988 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13989 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13990 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13991 | return NULL; |
| 13992 | } |
| 13993 | goto done; |
| 13994 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 13995 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 13996 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 13997 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 13998 | } |
| 13999 | { // t_primary '(' arguments? ')' &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14000 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14001 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14002 | return NULL; |
| 14003 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14004 | 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] | 14005 | Token * _literal; |
| 14006 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14007 | expr_ty a; |
| 14008 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14009 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14010 | (a = t_primary_rule(p)) // t_primary |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14011 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14012 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14013 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14014 | (b = arguments_rule(p), 1) // arguments? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14015 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14016 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14017 | && |
| 14018 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 14019 | ) |
| 14020 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14021 | 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] | 14022 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14023 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14024 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14025 | return NULL; |
| 14026 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14027 | int _end_lineno = _token->end_lineno; |
| 14028 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14029 | int _end_col_offset = _token->end_col_offset; |
| 14030 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14031 | _res = _Py_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA ); |
| 14032 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14033 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14034 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14035 | return NULL; |
| 14036 | } |
| 14037 | goto done; |
| 14038 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14039 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14040 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 14041 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14042 | } |
| 14043 | { // atom &t_lookahead |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14044 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14045 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14046 | return NULL; |
| 14047 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14048 | 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] | 14049 | expr_ty a; |
| 14050 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14051 | (a = atom_rule(p)) // atom |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14052 | && |
| 14053 | _PyPegen_lookahead(1, t_lookahead_rule, p) |
| 14054 | ) |
| 14055 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14056 | 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] | 14057 | _res = a; |
| 14058 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14059 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14060 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14061 | return NULL; |
| 14062 | } |
| 14063 | goto done; |
| 14064 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14065 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14066 | D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ', |
| 14067 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14068 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14069 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14070 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14071 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14072 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14073 | } |
| 14074 | |
| 14075 | // t_lookahead: '(' | '[' | '.' |
| 14076 | static void * |
| 14077 | t_lookahead_rule(Parser *p) |
| 14078 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14079 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14080 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14081 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14082 | return NULL; |
| 14083 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14084 | void * _res = NULL; |
| 14085 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14086 | { // '(' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14087 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14088 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14089 | return NULL; |
| 14090 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14091 | 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] | 14092 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14093 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14094 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14095 | ) |
| 14096 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14097 | 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] | 14098 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14099 | goto done; |
| 14100 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14101 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14102 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 14103 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14104 | } |
| 14105 | { // '[' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14106 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14107 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14108 | return NULL; |
| 14109 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14110 | 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] | 14111 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14112 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14113 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14114 | ) |
| 14115 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14116 | 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] | 14117 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14118 | goto done; |
| 14119 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14120 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14121 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 14122 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14123 | } |
| 14124 | { // '.' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14125 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14126 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14127 | return NULL; |
| 14128 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14129 | 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] | 14130 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14131 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14132 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14133 | ) |
| 14134 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14135 | 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] | 14136 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14137 | goto done; |
| 14138 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14139 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14140 | D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ', |
| 14141 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14142 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14143 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14144 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14145 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14146 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14147 | } |
| 14148 | |
| 14149 | // t_atom: NAME | '(' target ')' | '(' targets? ')' | '[' targets? ']' |
| 14150 | static expr_ty |
| 14151 | t_atom_rule(Parser *p) |
| 14152 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14153 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14154 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14155 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14156 | return NULL; |
| 14157 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14158 | expr_ty _res = NULL; |
| 14159 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14160 | if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) { |
| 14161 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14162 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14163 | return NULL; |
| 14164 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14165 | int _start_lineno = p->tokens[_mark]->lineno; |
| 14166 | UNUSED(_start_lineno); // Only used by EXTRA macro |
| 14167 | int _start_col_offset = p->tokens[_mark]->col_offset; |
| 14168 | UNUSED(_start_col_offset); // Only used by EXTRA macro |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14169 | { // NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14170 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14171 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14172 | return NULL; |
| 14173 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14174 | 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] | 14175 | expr_ty a; |
| 14176 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14177 | (a = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14178 | ) |
| 14179 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14180 | 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] | 14181 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 14182 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14183 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14184 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14185 | return NULL; |
| 14186 | } |
| 14187 | goto done; |
| 14188 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14189 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14190 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 14191 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14192 | } |
| 14193 | { // '(' target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14194 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14195 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14196 | return NULL; |
| 14197 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14198 | 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] | 14199 | Token * _literal; |
| 14200 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14201 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14202 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14203 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14204 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14205 | (a = target_rule(p)) // target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14206 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14207 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14208 | ) |
| 14209 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14210 | 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] | 14211 | _res = _PyPegen_set_expr_context ( p , a , Store ); |
| 14212 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14213 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14214 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14215 | return NULL; |
| 14216 | } |
| 14217 | goto done; |
| 14218 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14219 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14220 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 14221 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14222 | } |
| 14223 | { // '(' targets? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14224 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14225 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14226 | return NULL; |
| 14227 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14228 | 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] | 14229 | Token * _literal; |
| 14230 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14231 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14232 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14233 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14234 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14235 | (b = targets_rule(p), 1) // targets? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14236 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14237 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14238 | ) |
| 14239 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14240 | 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] | 14241 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14242 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14243 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14244 | return NULL; |
| 14245 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14246 | int _end_lineno = _token->end_lineno; |
| 14247 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14248 | int _end_col_offset = _token->end_col_offset; |
| 14249 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14250 | _res = _Py_Tuple ( b , Store , EXTRA ); |
| 14251 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14252 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14253 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14254 | return NULL; |
| 14255 | } |
| 14256 | goto done; |
| 14257 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14258 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14259 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 14260 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' targets? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14261 | } |
| 14262 | { // '[' targets? ']' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14263 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14264 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14265 | return NULL; |
| 14266 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14267 | 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] | 14268 | Token * _literal; |
| 14269 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14270 | void *b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14271 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14272 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14273 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14274 | (b = targets_rule(p), 1) // targets? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14275 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14276 | (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14277 | ) |
| 14278 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14279 | 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] | 14280 | Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); |
| 14281 | if (_token == NULL) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14282 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14283 | return NULL; |
| 14284 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14285 | int _end_lineno = _token->end_lineno; |
| 14286 | UNUSED(_end_lineno); // Only used by EXTRA macro |
| 14287 | int _end_col_offset = _token->end_col_offset; |
| 14288 | UNUSED(_end_col_offset); // Only used by EXTRA macro |
| 14289 | _res = _Py_List ( b , Store , EXTRA ); |
| 14290 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14291 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14292 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14293 | return NULL; |
| 14294 | } |
| 14295 | goto done; |
| 14296 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14297 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14298 | D(fprintf(stderr, "%*c%s t_atom[%d-%d]: %s failed!\n", p->level, ' ', |
| 14299 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' targets? ']'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14300 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14301 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14302 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14303 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14304 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14305 | } |
| 14306 | |
| 14307 | // incorrect_arguments: |
| 14308 | // | args ',' '*' |
| 14309 | // | expression for_if_clauses ',' [args | expression for_if_clauses] |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14310 | // | args for_if_clauses |
| 14311 | // | args ',' expression for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14312 | // | args ',' args |
| 14313 | static void * |
| 14314 | incorrect_arguments_rule(Parser *p) |
| 14315 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14316 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14317 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14318 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14319 | return NULL; |
| 14320 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14321 | void * _res = NULL; |
| 14322 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14323 | { // args ',' '*' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14324 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14325 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14326 | return NULL; |
| 14327 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14328 | 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] | 14329 | Token * _literal; |
| 14330 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14331 | expr_ty args_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14332 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14333 | (args_var = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14334 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14335 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14336 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14337 | (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14338 | ) |
| 14339 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14340 | 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] | 14341 | _res = RAISE_SYNTAX_ERROR ( "iterable argument unpacking follows keyword argument unpacking" ); |
| 14342 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14343 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14344 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14345 | return NULL; |
| 14346 | } |
| 14347 | goto done; |
| 14348 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14349 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14350 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14351 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' '*'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14352 | } |
| 14353 | { // expression for_if_clauses ',' [args | expression for_if_clauses] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14354 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14355 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14356 | return NULL; |
| 14357 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14358 | 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] | 14359 | Token * _literal; |
| 14360 | void *_opt_var; |
| 14361 | UNUSED(_opt_var); // Silence compiler warnings |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14362 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14363 | asdl_seq* for_if_clauses_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14364 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14365 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14366 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14367 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14368 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14369 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14370 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14371 | (_opt_var = _tmp_125_rule(p), 1) // [args | expression for_if_clauses] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14372 | ) |
| 14373 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14374 | 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] | 14375 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14376 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14377 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14378 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14379 | return NULL; |
| 14380 | } |
| 14381 | goto done; |
| 14382 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14383 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14384 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14385 | 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] | 14386 | } |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14387 | { // args for_if_clauses |
| 14388 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14389 | D(p->level--); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14390 | return NULL; |
| 14391 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14392 | 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] | 14393 | expr_ty a; |
| 14394 | asdl_seq* for_if_clauses_var; |
| 14395 | if ( |
| 14396 | (a = args_rule(p)) // args |
| 14397 | && |
| 14398 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 14399 | ) |
| 14400 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14401 | 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] | 14402 | _res = _PyPegen_nonparen_genexp_in_call ( p , a ); |
| 14403 | if (_res == NULL && PyErr_Occurred()) { |
| 14404 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14405 | D(p->level--); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14406 | return NULL; |
| 14407 | } |
| 14408 | goto done; |
| 14409 | } |
| 14410 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14411 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14412 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args for_if_clauses")); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14413 | } |
| 14414 | { // args ',' expression for_if_clauses |
| 14415 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14416 | D(p->level--); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14417 | return NULL; |
| 14418 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14419 | 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] | 14420 | Token * _literal; |
| 14421 | expr_ty a; |
| 14422 | expr_ty args_var; |
| 14423 | asdl_seq* for_if_clauses_var; |
| 14424 | if ( |
| 14425 | (args_var = args_rule(p)) // args |
| 14426 | && |
| 14427 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 14428 | && |
| 14429 | (a = expression_rule(p)) // expression |
| 14430 | && |
| 14431 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 14432 | ) |
| 14433 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14434 | 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] | 14435 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "Generator expression must be parenthesized" ); |
| 14436 | if (_res == NULL && PyErr_Occurred()) { |
| 14437 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14438 | D(p->level--); |
Miss Islington (bot) | 55c8923 | 2020-05-21 18:14:55 -0700 | [diff] [blame] | 14439 | return NULL; |
| 14440 | } |
| 14441 | goto done; |
| 14442 | } |
| 14443 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14444 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14445 | 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] | 14446 | } |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14447 | { // args ',' args |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14448 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14449 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14450 | return NULL; |
| 14451 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14452 | 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] | 14453 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14454 | expr_ty a; |
| 14455 | expr_ty args_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14456 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14457 | (a = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14458 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14459 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14460 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14461 | (args_var = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14462 | ) |
| 14463 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14464 | 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] | 14465 | _res = _PyPegen_arguments_parsing_error ( p , a ); |
| 14466 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14467 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14468 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14469 | return NULL; |
| 14470 | } |
| 14471 | goto done; |
| 14472 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14473 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14474 | D(fprintf(stderr, "%*c%s incorrect_arguments[%d-%d]: %s failed!\n", p->level, ' ', |
| 14475 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args ',' args")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14476 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14477 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14478 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14479 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14480 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14481 | } |
| 14482 | |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14483 | // invalid_kwarg: expression '=' |
| 14484 | static void * |
| 14485 | invalid_kwarg_rule(Parser *p) |
| 14486 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14487 | D(p->level++); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14488 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14489 | D(p->level--); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14490 | return NULL; |
| 14491 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14492 | void * _res = NULL; |
| 14493 | int _mark = p->mark; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14494 | { // expression '=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14495 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14496 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14497 | return NULL; |
| 14498 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14499 | 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] | 14500 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14501 | expr_ty a; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14502 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14503 | (a = expression_rule(p)) // expression |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14504 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14505 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14506 | ) |
| 14507 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14508 | 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] | 14509 | _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] | 14510 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14511 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14512 | D(p->level--); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14513 | return NULL; |
| 14514 | } |
| 14515 | goto done; |
| 14516 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14517 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14518 | D(fprintf(stderr, "%*c%s invalid_kwarg[%d-%d]: %s failed!\n", p->level, ' ', |
| 14519 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression '='")); |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14520 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14521 | _res = NULL; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14522 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14523 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14524 | return _res; |
Lysandros Nikolaou | 4638c64 | 2020-05-07 13:44:06 +0300 | [diff] [blame] | 14525 | } |
| 14526 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14527 | // invalid_named_expression: expression ':=' expression |
| 14528 | static void * |
| 14529 | invalid_named_expression_rule(Parser *p) |
| 14530 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14531 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14532 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14533 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14534 | return NULL; |
| 14535 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14536 | void * _res = NULL; |
| 14537 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14538 | { // expression ':=' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14539 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14540 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14541 | return NULL; |
| 14542 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14543 | 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] | 14544 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14545 | expr_ty a; |
| 14546 | expr_ty expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14547 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14548 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14549 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14550 | (_literal = _PyPegen_expect_token(p, 53)) // token=':=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14551 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14552 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14553 | ) |
| 14554 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14555 | 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] | 14556 | _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] | 14557 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14558 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14559 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14560 | return NULL; |
| 14561 | } |
| 14562 | goto done; |
| 14563 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14564 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14565 | D(fprintf(stderr, "%*c%s invalid_named_expression[%d-%d]: %s failed!\n", p->level, ' ', |
| 14566 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':=' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14567 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14568 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14569 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14570 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14571 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14572 | } |
| 14573 | |
| 14574 | // invalid_assignment: |
| 14575 | // | list ':' |
| 14576 | // | tuple ':' |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14577 | // | star_named_expression ',' star_named_expressions* ':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14578 | // | expression ':' expression ['=' annotated_rhs] |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14579 | // | ((star_targets '='))* star_expressions '=' |
| 14580 | // | ((star_targets '='))* yield_expr '=' |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14581 | // | star_expressions augassign (yield_expr | star_expressions) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14582 | static void * |
| 14583 | invalid_assignment_rule(Parser *p) |
| 14584 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14585 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14586 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14587 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14588 | return NULL; |
| 14589 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14590 | void * _res = NULL; |
| 14591 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14592 | { // list ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14593 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14594 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14595 | return NULL; |
| 14596 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14597 | 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] | 14598 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14599 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14600 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14601 | (a = list_rule(p)) // list |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14602 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14603 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14604 | ) |
| 14605 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14606 | 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] | 14607 | _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] | 14608 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14609 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14610 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14611 | return NULL; |
| 14612 | } |
| 14613 | goto done; |
| 14614 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14615 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14616 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14617 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list ':'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14618 | } |
| 14619 | { // tuple ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14620 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14621 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14622 | return NULL; |
| 14623 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14624 | 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] | 14625 | Token * _literal; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14626 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14627 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14628 | (a = tuple_rule(p)) // tuple |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14629 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14630 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14631 | ) |
| 14632 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14633 | 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] | 14634 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "only single target (not tuple) can be annotated" ); |
| 14635 | if (_res == NULL && PyErr_Occurred()) { |
| 14636 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14637 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14638 | return NULL; |
| 14639 | } |
| 14640 | goto done; |
| 14641 | } |
| 14642 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14643 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14644 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple ':'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14645 | } |
| 14646 | { // star_named_expression ',' star_named_expressions* ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14647 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14648 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14649 | return NULL; |
| 14650 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14651 | 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] | 14652 | Token * _literal; |
| 14653 | Token * _literal_1; |
| 14654 | asdl_seq * _loop0_126_var; |
| 14655 | expr_ty a; |
| 14656 | if ( |
| 14657 | (a = star_named_expression_rule(p)) // star_named_expression |
| 14658 | && |
| 14659 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 14660 | && |
| 14661 | (_loop0_126_var = _loop0_126_rule(p)) // star_named_expressions* |
| 14662 | && |
| 14663 | (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' |
| 14664 | ) |
| 14665 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14666 | 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] | 14667 | _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] | 14668 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14669 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14670 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14671 | return NULL; |
| 14672 | } |
| 14673 | goto done; |
| 14674 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14675 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14676 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14677 | 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] | 14678 | } |
| 14679 | { // expression ':' expression ['=' annotated_rhs] |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14680 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14681 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14682 | return NULL; |
| 14683 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14684 | 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] | 14685 | Token * _literal; |
| 14686 | void *_opt_var; |
| 14687 | UNUSED(_opt_var); // Silence compiler warnings |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14688 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14689 | expr_ty expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14690 | if ( |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14691 | (a = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14692 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14693 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14694 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14695 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14696 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14697 | (_opt_var = _tmp_127_rule(p), 1) // ['=' annotated_rhs] |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14698 | ) |
| 14699 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14700 | 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] | 14701 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "illegal target for annotation" ); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14702 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14703 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14704 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14705 | return NULL; |
| 14706 | } |
| 14707 | goto done; |
| 14708 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14709 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14710 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14711 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ':' expression ['=' annotated_rhs]")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14712 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14713 | { // ((star_targets '='))* star_expressions '=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14714 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14715 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14716 | return NULL; |
| 14717 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14718 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14719 | Token * _literal; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14720 | asdl_seq * _loop0_128_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14721 | expr_ty a; |
| 14722 | if ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14723 | (_loop0_128_var = _loop0_128_rule(p)) // ((star_targets '='))* |
| 14724 | && |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14725 | (a = star_expressions_rule(p)) // star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14726 | && |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14727 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14728 | ) |
| 14729 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14730 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14731 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( _PyPegen_get_invalid_target ( a ) , "cannot assign to %s" , _PyPegen_get_expr_name ( _PyPegen_get_invalid_target ( a ) ) ); |
| 14732 | if (_res == NULL && PyErr_Occurred()) { |
| 14733 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14734 | D(p->level--); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14735 | return NULL; |
| 14736 | } |
| 14737 | goto done; |
| 14738 | } |
| 14739 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14740 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14741 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* star_expressions '='")); |
| 14742 | } |
| 14743 | { // ((star_targets '='))* yield_expr '=' |
| 14744 | if (p->error_indicator) { |
| 14745 | D(p->level--); |
| 14746 | return NULL; |
| 14747 | } |
| 14748 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
| 14749 | Token * _literal; |
| 14750 | asdl_seq * _loop0_129_var; |
| 14751 | expr_ty a; |
| 14752 | if ( |
| 14753 | (_loop0_129_var = _loop0_129_rule(p)) // ((star_targets '='))* |
| 14754 | && |
| 14755 | (a = yield_expr_rule(p)) // yield_expr |
| 14756 | && |
| 14757 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 14758 | ) |
| 14759 | { |
| 14760 | D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
| 14761 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "assignment to yield expression not possible" ); |
| 14762 | if (_res == NULL && PyErr_Occurred()) { |
| 14763 | p->error_indicator = 1; |
| 14764 | D(p->level--); |
| 14765 | return NULL; |
| 14766 | } |
| 14767 | goto done; |
| 14768 | } |
| 14769 | p->mark = _mark; |
| 14770 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14771 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "((star_targets '='))* yield_expr '='")); |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14772 | } |
| 14773 | { // star_expressions augassign (yield_expr | star_expressions) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14774 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14775 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14776 | return NULL; |
| 14777 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14778 | D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14779 | void *_tmp_130_var; |
Pablo Galindo | 16ab070 | 2020-05-15 02:04:52 +0100 | [diff] [blame] | 14780 | expr_ty a; |
| 14781 | AugOperator* augassign_var; |
| 14782 | if ( |
| 14783 | (a = star_expressions_rule(p)) // star_expressions |
| 14784 | && |
| 14785 | (augassign_var = augassign_rule(p)) // augassign |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 14786 | && |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14787 | (_tmp_130_var = _tmp_130_rule(p)) // yield_expr | star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14788 | ) |
| 14789 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14790 | 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] | 14791 | _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] | 14792 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14793 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14794 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14795 | return NULL; |
| 14796 | } |
| 14797 | goto done; |
| 14798 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14799 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14800 | D(fprintf(stderr, "%*c%s invalid_assignment[%d-%d]: %s failed!\n", p->level, ' ', |
| 14801 | 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] | 14802 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14803 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14804 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14805 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14806 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14807 | } |
| 14808 | |
| 14809 | // invalid_block: NEWLINE !INDENT |
| 14810 | static void * |
| 14811 | invalid_block_rule(Parser *p) |
| 14812 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14813 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14814 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14815 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14816 | return NULL; |
| 14817 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14818 | void * _res = NULL; |
| 14819 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14820 | { // NEWLINE !INDENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14821 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14822 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14823 | return NULL; |
| 14824 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14825 | 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] | 14826 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14827 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14828 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14829 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14830 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14831 | ) |
| 14832 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14833 | 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] | 14834 | _res = RAISE_INDENTATION_ERROR ( "expected an indented block" ); |
| 14835 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14836 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14837 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14838 | return NULL; |
| 14839 | } |
| 14840 | goto done; |
| 14841 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14842 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14843 | D(fprintf(stderr, "%*c%s invalid_block[%d-%d]: %s failed!\n", p->level, ' ', |
| 14844 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE !INDENT")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14845 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14846 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14847 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14848 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14849 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14850 | } |
| 14851 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14852 | // invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14853 | static void * |
| 14854 | invalid_comprehension_rule(Parser *p) |
| 14855 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14856 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14857 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14858 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14859 | return NULL; |
| 14860 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14861 | void * _res = NULL; |
| 14862 | int _mark = p->mark; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14863 | { // ('[' | '(' | '{') starred_expression for_if_clauses |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14864 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14865 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14866 | return NULL; |
| 14867 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14868 | D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14869 | void *_tmp_131_var; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14870 | expr_ty a; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14871 | asdl_seq* for_if_clauses_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14872 | if ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14873 | (_tmp_131_var = _tmp_131_rule(p)) // '[' | '(' | '{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14874 | && |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 14875 | (a = starred_expression_rule(p)) // starred_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14876 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14877 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14878 | ) |
| 14879 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14880 | 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] | 14881 | _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] | 14882 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14883 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14884 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14885 | return NULL; |
| 14886 | } |
| 14887 | goto done; |
| 14888 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14889 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14890 | D(fprintf(stderr, "%*c%s invalid_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
| 14891 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14892 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14893 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14894 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14895 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14896 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14897 | } |
| 14898 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14899 | // invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}' |
| 14900 | static void * |
| 14901 | invalid_dict_comprehension_rule(Parser *p) |
| 14902 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14903 | D(p->level++); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14904 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14905 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14906 | return NULL; |
| 14907 | } |
| 14908 | void * _res = NULL; |
| 14909 | int _mark = p->mark; |
| 14910 | { // '{' '**' bitwise_or for_if_clauses '}' |
| 14911 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14912 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14913 | return NULL; |
| 14914 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14915 | 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] | 14916 | Token * _literal; |
| 14917 | Token * _literal_1; |
| 14918 | Token * a; |
| 14919 | expr_ty bitwise_or_var; |
| 14920 | asdl_seq* for_if_clauses_var; |
| 14921 | if ( |
| 14922 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
| 14923 | && |
| 14924 | (a = _PyPegen_expect_token(p, 35)) // token='**' |
| 14925 | && |
| 14926 | (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or |
| 14927 | && |
| 14928 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
| 14929 | && |
| 14930 | (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}' |
| 14931 | ) |
| 14932 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14933 | 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] | 14934 | _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "dict unpacking cannot be used in dict comprehension" ); |
| 14935 | if (_res == NULL && PyErr_Occurred()) { |
| 14936 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14937 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14938 | return NULL; |
| 14939 | } |
| 14940 | goto done; |
| 14941 | } |
| 14942 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14943 | D(fprintf(stderr, "%*c%s invalid_dict_comprehension[%d-%d]: %s failed!\n", p->level, ' ', |
| 14944 | 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] | 14945 | } |
| 14946 | _res = NULL; |
| 14947 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14948 | D(p->level--); |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 14949 | return _res; |
| 14950 | } |
| 14951 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14952 | // invalid_parameters: |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 14953 | // | 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 | static void * |
| 14955 | invalid_parameters_rule(Parser *p) |
| 14956 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14957 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14958 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14959 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14960 | return NULL; |
| 14961 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14962 | void * _res = NULL; |
| 14963 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 14964 | { // param_no_default* (slash_with_default | param_with_default+) param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14965 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14966 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 14967 | return NULL; |
| 14968 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14969 | 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")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14970 | asdl_seq * _loop0_132_var; |
| 14971 | void *_tmp_133_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 14972 | arg_ty param_no_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14973 | if ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14974 | (_loop0_132_var = _loop0_132_rule(p)) // param_no_default* |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14975 | && |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 14976 | (_tmp_133_var = _tmp_133_rule(p)) // slash_with_default | param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14977 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 14978 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14979 | ) |
| 14980 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14981 | 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] | 14982 | _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" ); |
| 14983 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14984 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14985 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14986 | return NULL; |
| 14987 | } |
| 14988 | goto done; |
| 14989 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14990 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14991 | D(fprintf(stderr, "%*c%s invalid_parameters[%d-%d]: %s failed!\n", p->level, ' ', |
| 14992 | 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] | 14993 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14994 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14995 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 14996 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 14997 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 14998 | } |
| 14999 | |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 15000 | // invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15001 | static void * |
| 15002 | invalid_star_etc_rule(Parser *p) |
| 15003 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15004 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15005 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15006 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15007 | return NULL; |
| 15008 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15009 | void * _res = NULL; |
| 15010 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15011 | { // '*' (')' | ',' (')' | '**')) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15012 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15013 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15014 | return NULL; |
| 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\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15017 | Token * _literal; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 15018 | void *_tmp_134_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15019 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15020 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15021 | && |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 15022 | (_tmp_134_var = _tmp_134_rule(p)) // ')' | ',' (')' | '**') |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15023 | ) |
| 15024 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15025 | 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] | 15026 | _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); |
| 15027 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15028 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15029 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15030 | return NULL; |
| 15031 | } |
| 15032 | goto done; |
| 15033 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15034 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15035 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 15036 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15037 | } |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 15038 | { // '*' ',' TYPE_COMMENT |
Pablo Galindo | ced4e5c | 2020-05-18 22:47:51 +0100 | [diff] [blame] | 15039 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15040 | D(p->level--); |
Pablo Galindo | ced4e5c | 2020-05-18 22:47:51 +0100 | [diff] [blame] | 15041 | return NULL; |
| 15042 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15043 | 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] | 15044 | Token * _literal; |
| 15045 | Token * _literal_1; |
| 15046 | Token * type_comment_var; |
| 15047 | if ( |
| 15048 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
| 15049 | && |
| 15050 | (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' |
| 15051 | && |
| 15052 | (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' |
| 15053 | ) |
| 15054 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15055 | 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] | 15056 | _res = RAISE_SYNTAX_ERROR ( "bare * has associated type comment" ); |
| 15057 | if (_res == NULL && PyErr_Occurred()) { |
| 15058 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15059 | D(p->level--); |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 15060 | return NULL; |
| 15061 | } |
| 15062 | goto done; |
| 15063 | } |
| 15064 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15065 | D(fprintf(stderr, "%*c%s invalid_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 15066 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' TYPE_COMMENT")); |
Lysandros Nikolaou | 75b863a | 2020-05-18 22:14:47 +0300 | [diff] [blame] | 15067 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15068 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15069 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15070 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15071 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15072 | } |
| 15073 | |
| 15074 | // invalid_lambda_star_etc: '*' (':' | ',' (':' | '**')) |
| 15075 | static void * |
| 15076 | invalid_lambda_star_etc_rule(Parser *p) |
| 15077 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15078 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15079 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15080 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15081 | return NULL; |
| 15082 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15083 | void * _res = NULL; |
| 15084 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15085 | { // '*' (':' | ',' (':' | '**')) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15086 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15087 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15088 | return NULL; |
| 15089 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15090 | 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] | 15091 | Token * _literal; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 15092 | void *_tmp_135_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15093 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15094 | (_literal = _PyPegen_expect_token(p, 16)) // token='*' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15095 | && |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 15096 | (_tmp_135_var = _tmp_135_rule(p)) // ':' | ',' (':' | '**') |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15097 | ) |
| 15098 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15099 | 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] | 15100 | _res = RAISE_SYNTAX_ERROR ( "named arguments must follow bare *" ); |
| 15101 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15102 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15103 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15104 | return NULL; |
| 15105 | } |
| 15106 | goto done; |
| 15107 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15108 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15109 | D(fprintf(stderr, "%*c%s invalid_lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ', |
| 15110 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15111 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15112 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15113 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15114 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15115 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 15116 | } |
| 15117 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15118 | // invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
| 15119 | static void * |
| 15120 | invalid_double_type_comments_rule(Parser *p) |
| 15121 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15122 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15123 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15124 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15125 | return NULL; |
| 15126 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15127 | void * _res = NULL; |
| 15128 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15129 | { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15130 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15131 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15132 | return NULL; |
| 15133 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15134 | 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] | 15135 | Token * indent_var; |
| 15136 | Token * newline_var; |
| 15137 | Token * newline_var_1; |
| 15138 | Token * type_comment_var; |
| 15139 | Token * type_comment_var_1; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15140 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15141 | (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] | 15142 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15143 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15144 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15145 | (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] | 15146 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15147 | (newline_var_1 = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15148 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15149 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15150 | ) |
| 15151 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15152 | 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] | 15153 | _res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" ); |
| 15154 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15155 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15156 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15157 | return NULL; |
| 15158 | } |
| 15159 | goto done; |
| 15160 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15161 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15162 | D(fprintf(stderr, "%*c%s invalid_double_type_comments[%d-%d]: %s failed!\n", p->level, ' ', |
| 15163 | 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] | 15164 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15165 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15166 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15167 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15168 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15169 | } |
| 15170 | |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15171 | // invalid_del_target: star_expression &del_target_end |
| 15172 | static void * |
| 15173 | invalid_del_target_rule(Parser *p) |
| 15174 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15175 | D(p->level++); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15176 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15177 | D(p->level--); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15178 | return NULL; |
| 15179 | } |
| 15180 | void * _res = NULL; |
| 15181 | int _mark = p->mark; |
| 15182 | { // star_expression &del_target_end |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15183 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15184 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15185 | return NULL; |
| 15186 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15187 | 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] | 15188 | expr_ty a; |
| 15189 | if ( |
| 15190 | (a = star_expression_rule(p)) // star_expression |
| 15191 | && |
| 15192 | _PyPegen_lookahead(1, del_target_end_rule, p) |
| 15193 | ) |
| 15194 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15195 | 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] | 15196 | _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] | 15197 | if (_res == NULL && PyErr_Occurred()) { |
| 15198 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15199 | D(p->level--); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15200 | return NULL; |
| 15201 | } |
| 15202 | goto done; |
| 15203 | } |
| 15204 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15205 | D(fprintf(stderr, "%*c%s invalid_del_target[%d-%d]: %s failed!\n", p->level, ' ', |
| 15206 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression &del_target_end")); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15207 | } |
| 15208 | _res = NULL; |
| 15209 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15210 | D(p->level--); |
Shantanu | 27c0d9b | 2020-05-11 14:53:58 -0700 | [diff] [blame] | 15211 | return _res; |
| 15212 | } |
| 15213 | |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15214 | // invalid_import_from_targets: import_from_as_names ',' |
| 15215 | static void * |
| 15216 | invalid_import_from_targets_rule(Parser *p) |
| 15217 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15218 | D(p->level++); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15219 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15220 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15221 | return NULL; |
| 15222 | } |
| 15223 | void * _res = NULL; |
| 15224 | int _mark = p->mark; |
| 15225 | { // import_from_as_names ',' |
| 15226 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15227 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15228 | return NULL; |
| 15229 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15230 | 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] | 15231 | Token * _literal; |
| 15232 | asdl_seq* import_from_as_names_var; |
| 15233 | if ( |
| 15234 | (import_from_as_names_var = import_from_as_names_rule(p)) // import_from_as_names |
| 15235 | && |
| 15236 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
| 15237 | ) |
| 15238 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15239 | 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] | 15240 | _res = RAISE_SYNTAX_ERROR ( "trailing comma not allowed without surrounding parentheses" ); |
| 15241 | if (_res == NULL && PyErr_Occurred()) { |
| 15242 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15243 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15244 | return NULL; |
| 15245 | } |
| 15246 | goto done; |
| 15247 | } |
| 15248 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15249 | D(fprintf(stderr, "%*c%s invalid_import_from_targets[%d-%d]: %s failed!\n", p->level, ' ', |
| 15250 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_names ','")); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15251 | } |
| 15252 | _res = NULL; |
| 15253 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15254 | D(p->level--); |
Pablo Galindo | 275d7e1 | 2020-05-21 22:04:54 +0100 | [diff] [blame] | 15255 | return _res; |
| 15256 | } |
| 15257 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15258 | // _loop0_1: NEWLINE |
| 15259 | static asdl_seq * |
| 15260 | _loop0_1_rule(Parser *p) |
| 15261 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15262 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15263 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15264 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15265 | return NULL; |
| 15266 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15267 | void *_res = NULL; |
| 15268 | int _mark = p->mark; |
| 15269 | int _start_mark = p->mark; |
| 15270 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15271 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15272 | p->error_indicator = 1; |
| 15273 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15274 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15275 | return NULL; |
| 15276 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15277 | ssize_t _children_capacity = 1; |
| 15278 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15279 | { // NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15280 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15281 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15282 | return NULL; |
| 15283 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15284 | 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] | 15285 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15286 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15287 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15288 | ) |
| 15289 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15290 | _res = newline_var; |
| 15291 | if (_n == _children_capacity) { |
| 15292 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15293 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15294 | if (!_new_children) { |
| 15295 | p->error_indicator = 1; |
| 15296 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15297 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15298 | return NULL; |
| 15299 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15300 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15301 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15302 | _children[_n++] = _res; |
| 15303 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15304 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15305 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15306 | D(fprintf(stderr, "%*c%s _loop0_1[%d-%d]: %s failed!\n", p->level, ' ', |
| 15307 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15308 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15309 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15310 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15311 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15312 | p->error_indicator = 1; |
| 15313 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15314 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15315 | return NULL; |
| 15316 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15317 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15318 | PyMem_Free(_children); |
| 15319 | _PyPegen_insert_memo(p, _start_mark, _loop0_1_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15320 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15321 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15322 | } |
| 15323 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15324 | // _loop0_2: NEWLINE |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15325 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15326 | _loop0_2_rule(Parser *p) |
| 15327 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15328 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15329 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15330 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15331 | return NULL; |
| 15332 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15333 | void *_res = NULL; |
| 15334 | int _mark = p->mark; |
| 15335 | int _start_mark = p->mark; |
| 15336 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15337 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15338 | p->error_indicator = 1; |
| 15339 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15340 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15341 | return NULL; |
| 15342 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15343 | ssize_t _children_capacity = 1; |
| 15344 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15345 | { // NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15346 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15347 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15348 | return NULL; |
| 15349 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15350 | 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] | 15351 | Token * newline_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15352 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15353 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15354 | ) |
| 15355 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15356 | _res = newline_var; |
| 15357 | if (_n == _children_capacity) { |
| 15358 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15359 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15360 | if (!_new_children) { |
| 15361 | p->error_indicator = 1; |
| 15362 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15363 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15364 | return NULL; |
| 15365 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15366 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15367 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15368 | _children[_n++] = _res; |
| 15369 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15370 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15371 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15372 | D(fprintf(stderr, "%*c%s _loop0_2[%d-%d]: %s failed!\n", p->level, ' ', |
| 15373 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15374 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15375 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15376 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15377 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15378 | p->error_indicator = 1; |
| 15379 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15380 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15381 | return NULL; |
| 15382 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15383 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15384 | PyMem_Free(_children); |
| 15385 | _PyPegen_insert_memo(p, _start_mark, _loop0_2_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15386 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15387 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15388 | } |
| 15389 | |
| 15390 | // _loop0_4: ',' expression |
| 15391 | static asdl_seq * |
| 15392 | _loop0_4_rule(Parser *p) |
| 15393 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15394 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15395 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15396 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15397 | return NULL; |
| 15398 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15399 | void *_res = NULL; |
| 15400 | int _mark = p->mark; |
| 15401 | int _start_mark = p->mark; |
| 15402 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15403 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15404 | p->error_indicator = 1; |
| 15405 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15406 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15407 | return NULL; |
| 15408 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15409 | ssize_t _children_capacity = 1; |
| 15410 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15411 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15412 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15413 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15414 | return NULL; |
| 15415 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15416 | 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] | 15417 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15418 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15419 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15420 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15421 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15422 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15423 | ) |
| 15424 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15425 | _res = elem; |
| 15426 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15427 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15428 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15429 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15430 | return NULL; |
| 15431 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15432 | if (_n == _children_capacity) { |
| 15433 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15434 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15435 | if (!_new_children) { |
| 15436 | p->error_indicator = 1; |
| 15437 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15438 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15439 | return NULL; |
| 15440 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15441 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15442 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15443 | _children[_n++] = _res; |
| 15444 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15445 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15446 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15447 | D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ', |
| 15448 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15449 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15450 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15451 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15452 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15453 | p->error_indicator = 1; |
| 15454 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15455 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15456 | return NULL; |
| 15457 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15458 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15459 | PyMem_Free(_children); |
| 15460 | _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq); |
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 _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15463 | } |
| 15464 | |
| 15465 | // _gather_3: expression _loop0_4 |
| 15466 | static asdl_seq * |
| 15467 | _gather_3_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 | asdl_seq * _res = NULL; |
| 15475 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15476 | { // expression _loop0_4 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15477 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15478 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15479 | return NULL; |
| 15480 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15481 | 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] | 15482 | expr_ty elem; |
| 15483 | asdl_seq * seq; |
| 15484 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15485 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15486 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15487 | (seq = _loop0_4_rule(p)) // _loop0_4 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15488 | ) |
| 15489 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15490 | 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] | 15491 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15492 | goto done; |
| 15493 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15494 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15495 | D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ', |
| 15496 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15497 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15498 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15499 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15500 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15501 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15502 | } |
| 15503 | |
| 15504 | // _loop0_6: ',' expression |
| 15505 | static asdl_seq * |
| 15506 | _loop0_6_rule(Parser *p) |
| 15507 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15508 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15509 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15510 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15511 | return NULL; |
| 15512 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15513 | void *_res = NULL; |
| 15514 | int _mark = p->mark; |
| 15515 | int _start_mark = p->mark; |
| 15516 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15517 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15518 | p->error_indicator = 1; |
| 15519 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15520 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15521 | return NULL; |
| 15522 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15523 | ssize_t _children_capacity = 1; |
| 15524 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15525 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15526 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15527 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15528 | return NULL; |
| 15529 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15530 | 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] | 15531 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15532 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15533 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15534 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15535 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15536 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15537 | ) |
| 15538 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15539 | _res = elem; |
| 15540 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15541 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15542 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15543 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15544 | return NULL; |
| 15545 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15546 | if (_n == _children_capacity) { |
| 15547 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15548 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15549 | if (!_new_children) { |
| 15550 | p->error_indicator = 1; |
| 15551 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15552 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15553 | return NULL; |
| 15554 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15555 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15556 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15557 | _children[_n++] = _res; |
| 15558 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15559 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15560 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15561 | D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ', |
| 15562 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15563 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15564 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15565 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15566 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15567 | p->error_indicator = 1; |
| 15568 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15569 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15570 | return NULL; |
| 15571 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15572 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15573 | PyMem_Free(_children); |
| 15574 | _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq); |
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 _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15577 | } |
| 15578 | |
| 15579 | // _gather_5: expression _loop0_6 |
| 15580 | static asdl_seq * |
| 15581 | _gather_5_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 | asdl_seq * _res = NULL; |
| 15589 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15590 | { // expression _loop0_6 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15591 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15592 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15593 | return NULL; |
| 15594 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15595 | 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] | 15596 | expr_ty elem; |
| 15597 | asdl_seq * seq; |
| 15598 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15599 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15600 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15601 | (seq = _loop0_6_rule(p)) // _loop0_6 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15602 | ) |
| 15603 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15604 | 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] | 15605 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15606 | goto done; |
| 15607 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15608 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15609 | D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ', |
| 15610 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15611 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15612 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15613 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15614 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15615 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15616 | } |
| 15617 | |
| 15618 | // _loop0_8: ',' expression |
| 15619 | static asdl_seq * |
| 15620 | _loop0_8_rule(Parser *p) |
| 15621 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15622 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15623 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15624 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15625 | return NULL; |
| 15626 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15627 | void *_res = NULL; |
| 15628 | int _mark = p->mark; |
| 15629 | int _start_mark = p->mark; |
| 15630 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15631 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15632 | p->error_indicator = 1; |
| 15633 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15634 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15635 | return NULL; |
| 15636 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15637 | ssize_t _children_capacity = 1; |
| 15638 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15639 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15640 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15641 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15642 | return NULL; |
| 15643 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15644 | 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] | 15645 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15646 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15647 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15648 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15649 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15650 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15651 | ) |
| 15652 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15653 | _res = elem; |
| 15654 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15655 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15656 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15657 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15658 | return NULL; |
| 15659 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15660 | if (_n == _children_capacity) { |
| 15661 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15662 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15663 | if (!_new_children) { |
| 15664 | p->error_indicator = 1; |
| 15665 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15666 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15667 | return NULL; |
| 15668 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15669 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15670 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15671 | _children[_n++] = _res; |
| 15672 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15673 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15674 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15675 | D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ', |
| 15676 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15677 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15678 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15679 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15680 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15681 | p->error_indicator = 1; |
| 15682 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15683 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15684 | return NULL; |
| 15685 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15686 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15687 | PyMem_Free(_children); |
| 15688 | _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq); |
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 _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15691 | } |
| 15692 | |
| 15693 | // _gather_7: expression _loop0_8 |
| 15694 | static asdl_seq * |
| 15695 | _gather_7_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 | asdl_seq * _res = NULL; |
| 15703 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15704 | { // expression _loop0_8 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15705 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15706 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15707 | return NULL; |
| 15708 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15709 | 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] | 15710 | expr_ty elem; |
| 15711 | asdl_seq * seq; |
| 15712 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15713 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15714 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15715 | (seq = _loop0_8_rule(p)) // _loop0_8 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15716 | ) |
| 15717 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15718 | 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] | 15719 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15720 | goto done; |
| 15721 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15722 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15723 | D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ', |
| 15724 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15725 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15726 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15727 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15728 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15729 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15730 | } |
| 15731 | |
| 15732 | // _loop0_10: ',' expression |
| 15733 | static asdl_seq * |
| 15734 | _loop0_10_rule(Parser *p) |
| 15735 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15736 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15737 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15738 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15739 | return NULL; |
| 15740 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15741 | void *_res = NULL; |
| 15742 | int _mark = p->mark; |
| 15743 | int _start_mark = p->mark; |
| 15744 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15745 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15746 | p->error_indicator = 1; |
| 15747 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15748 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15749 | return NULL; |
| 15750 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15751 | ssize_t _children_capacity = 1; |
| 15752 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15753 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15754 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15755 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15756 | return NULL; |
| 15757 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15758 | 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] | 15759 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15760 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15761 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15762 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15763 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15764 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15765 | ) |
| 15766 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15767 | _res = elem; |
| 15768 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15769 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15770 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15771 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15772 | return NULL; |
| 15773 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15774 | if (_n == _children_capacity) { |
| 15775 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15776 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15777 | if (!_new_children) { |
| 15778 | p->error_indicator = 1; |
| 15779 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15780 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15781 | return NULL; |
| 15782 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15783 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15784 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15785 | _children[_n++] = _res; |
| 15786 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15787 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15788 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15789 | D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ', |
| 15790 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15791 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15792 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15793 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15794 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15795 | p->error_indicator = 1; |
| 15796 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15797 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15798 | return NULL; |
| 15799 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15800 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15801 | PyMem_Free(_children); |
| 15802 | _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq); |
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 _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15805 | } |
| 15806 | |
| 15807 | // _gather_9: expression _loop0_10 |
| 15808 | static asdl_seq * |
| 15809 | _gather_9_rule(Parser *p) |
| 15810 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15811 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15812 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15813 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15814 | return NULL; |
| 15815 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15816 | asdl_seq * _res = NULL; |
| 15817 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15818 | { // expression _loop0_10 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15819 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15820 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15821 | return NULL; |
| 15822 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15823 | 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] | 15824 | expr_ty elem; |
| 15825 | asdl_seq * seq; |
| 15826 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15827 | (elem = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15828 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15829 | (seq = _loop0_10_rule(p)) // _loop0_10 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15830 | ) |
| 15831 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15832 | 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] | 15833 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15834 | goto done; |
| 15835 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15836 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15837 | D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ', |
| 15838 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15839 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15840 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15841 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15842 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15843 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15844 | } |
| 15845 | |
| 15846 | // _loop1_11: statement |
| 15847 | static asdl_seq * |
| 15848 | _loop1_11_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15849 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15850 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15851 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15852 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15853 | return NULL; |
| 15854 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15855 | void *_res = NULL; |
| 15856 | int _mark = p->mark; |
| 15857 | int _start_mark = p->mark; |
| 15858 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15859 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15860 | p->error_indicator = 1; |
| 15861 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15862 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15863 | return NULL; |
| 15864 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15865 | ssize_t _children_capacity = 1; |
| 15866 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15867 | { // statement |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15868 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15869 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15870 | return NULL; |
| 15871 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15872 | 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] | 15873 | asdl_seq* statement_var; |
| 15874 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15875 | (statement_var = statement_rule(p)) // statement |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15876 | ) |
| 15877 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15878 | _res = statement_var; |
| 15879 | if (_n == _children_capacity) { |
| 15880 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15881 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15882 | if (!_new_children) { |
| 15883 | p->error_indicator = 1; |
| 15884 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15885 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15886 | return NULL; |
| 15887 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15888 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15889 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15890 | _children[_n++] = _res; |
| 15891 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15892 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15893 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15894 | D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ', |
| 15895 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15896 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15897 | if (_n == 0 || p->error_indicator) { |
| 15898 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15899 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15900 | return NULL; |
| 15901 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15902 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15903 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15904 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15905 | p->error_indicator = 1; |
| 15906 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15907 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15908 | return NULL; |
| 15909 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15910 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15911 | PyMem_Free(_children); |
| 15912 | _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15913 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15914 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15915 | } |
| 15916 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15917 | // _loop0_13: ';' small_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15918 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15919 | _loop0_13_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15920 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15921 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15922 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15923 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15924 | return NULL; |
| 15925 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15926 | void *_res = NULL; |
| 15927 | int _mark = p->mark; |
| 15928 | int _start_mark = p->mark; |
| 15929 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 15930 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15931 | p->error_indicator = 1; |
| 15932 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15933 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15934 | return NULL; |
| 15935 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15936 | ssize_t _children_capacity = 1; |
| 15937 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15938 | { // ';' small_stmt |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15939 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15940 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 15941 | return NULL; |
| 15942 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15943 | 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] | 15944 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15945 | stmt_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15946 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15947 | (_literal = _PyPegen_expect_token(p, 13)) // token=';' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15948 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 15949 | (elem = small_stmt_rule(p)) // small_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15950 | ) |
| 15951 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15952 | _res = elem; |
| 15953 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15954 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15955 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15956 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15957 | return NULL; |
| 15958 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15959 | if (_n == _children_capacity) { |
| 15960 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15961 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 15962 | if (!_new_children) { |
| 15963 | p->error_indicator = 1; |
| 15964 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15965 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15966 | return NULL; |
| 15967 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15968 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15969 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15970 | _children[_n++] = _res; |
| 15971 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15972 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15973 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15974 | D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ', |
| 15975 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' small_stmt")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15976 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15977 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 15978 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15979 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 15980 | p->error_indicator = 1; |
| 15981 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 15982 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15983 | return NULL; |
| 15984 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 15985 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 15986 | PyMem_Free(_children); |
| 15987 | _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq); |
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 _seq; |
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 | // _gather_12: small_stmt _loop0_13 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 15993 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 15994 | _gather_12_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 | asdl_seq * _res = NULL; |
| 16002 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16003 | { // small_stmt _loop0_13 |
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> _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] | 16009 | stmt_ty elem; |
| 16010 | asdl_seq * seq; |
| 16011 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16012 | (elem = small_stmt_rule(p)) // small_stmt |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16013 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16014 | (seq = _loop0_13_rule(p)) // _loop0_13 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16015 | ) |
| 16016 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16017 | 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] | 16018 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16019 | goto done; |
| 16020 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16021 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16022 | D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ', |
| 16023 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "small_stmt _loop0_13")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16024 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16025 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16026 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16027 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16028 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16029 | } |
| 16030 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16031 | // _tmp_14: 'import' | 'from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16032 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16033 | _tmp_14_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16034 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16035 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16036 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16037 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16038 | return NULL; |
| 16039 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16040 | void * _res = NULL; |
| 16041 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16042 | { // 'import' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16043 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16044 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16045 | return NULL; |
| 16046 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16047 | 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] | 16048 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16049 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16050 | (_keyword = _PyPegen_expect_token(p, 513)) // token='import' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16051 | ) |
| 16052 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16053 | 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] | 16054 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16055 | goto done; |
| 16056 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16057 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16058 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', |
| 16059 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16060 | } |
| 16061 | { // 'from' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16062 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16063 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16064 | return NULL; |
| 16065 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16066 | 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] | 16067 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16068 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16069 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16070 | ) |
| 16071 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16072 | 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] | 16073 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16074 | goto done; |
| 16075 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16076 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16077 | D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ', |
| 16078 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16079 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16080 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16081 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16082 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16083 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16084 | } |
| 16085 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16086 | // _tmp_15: 'def' | '@' | ASYNC |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16087 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16088 | _tmp_15_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16089 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16090 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16091 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16092 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16093 | return NULL; |
| 16094 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16095 | void * _res = NULL; |
| 16096 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16097 | { // 'def' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16098 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16099 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16100 | return NULL; |
| 16101 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16102 | 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] | 16103 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16104 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16105 | (_keyword = _PyPegen_expect_token(p, 522)) // token='def' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16106 | ) |
| 16107 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16108 | 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] | 16109 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16110 | goto done; |
| 16111 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16112 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16113 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 16114 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16115 | } |
| 16116 | { // '@' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16117 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16118 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16119 | return NULL; |
| 16120 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16121 | 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] | 16122 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16123 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16124 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16125 | ) |
| 16126 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16127 | 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] | 16128 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16129 | goto done; |
| 16130 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16131 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16132 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 16133 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16134 | } |
| 16135 | { // ASYNC |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16136 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16137 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16138 | return NULL; |
| 16139 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16140 | 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] | 16141 | Token * async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16142 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16143 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16144 | ) |
| 16145 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16146 | 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] | 16147 | _res = async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16148 | goto done; |
| 16149 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16150 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16151 | D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ', |
| 16152 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16153 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16154 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16155 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16156 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16157 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16158 | } |
| 16159 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16160 | // _tmp_16: 'class' | '@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16161 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16162 | _tmp_16_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16163 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16164 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16165 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16166 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16167 | return NULL; |
| 16168 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16169 | void * _res = NULL; |
| 16170 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16171 | { // 'class' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16172 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16173 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16174 | return NULL; |
| 16175 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16176 | 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] | 16177 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16178 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16179 | (_keyword = _PyPegen_expect_token(p, 523)) // token='class' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16180 | ) |
| 16181 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16182 | 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] | 16183 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16184 | goto done; |
| 16185 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16186 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16187 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', |
| 16188 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16189 | } |
| 16190 | { // '@' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16191 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16192 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16193 | return NULL; |
| 16194 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16195 | 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] | 16196 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16197 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16198 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16199 | ) |
| 16200 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16201 | 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] | 16202 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16203 | goto done; |
| 16204 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16205 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16206 | D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ', |
| 16207 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16208 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16209 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16210 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16211 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16212 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16213 | } |
| 16214 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16215 | // _tmp_17: 'with' | ASYNC |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16216 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16217 | _tmp_17_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16218 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16219 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16220 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16221 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16222 | return NULL; |
| 16223 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16224 | void * _res = NULL; |
| 16225 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16226 | { // 'with' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16227 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16228 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16229 | return NULL; |
| 16230 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16231 | 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] | 16232 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16233 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16234 | (_keyword = _PyPegen_expect_token(p, 519)) // token='with' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16235 | ) |
| 16236 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16237 | 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] | 16238 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16239 | goto done; |
| 16240 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16241 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16242 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', |
| 16243 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16244 | } |
| 16245 | { // ASYNC |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16246 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16247 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16248 | return NULL; |
| 16249 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16250 | 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] | 16251 | Token * async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16252 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16253 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16254 | ) |
| 16255 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16256 | 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] | 16257 | _res = async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16258 | goto done; |
| 16259 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16260 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16261 | D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ', |
| 16262 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16263 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16264 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16265 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16266 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16267 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16268 | } |
| 16269 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16270 | // _tmp_18: 'for' | ASYNC |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16271 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16272 | _tmp_18_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16273 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16274 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16275 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16276 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16277 | return NULL; |
| 16278 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16279 | void * _res = NULL; |
| 16280 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16281 | { // 'for' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16282 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16283 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16284 | return NULL; |
| 16285 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16286 | 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] | 16287 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16288 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16289 | (_keyword = _PyPegen_expect_token(p, 517)) // token='for' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16290 | ) |
| 16291 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16292 | 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] | 16293 | _res = _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16294 | goto done; |
| 16295 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16296 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16297 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', |
| 16298 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16299 | } |
| 16300 | { // ASYNC |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16301 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16302 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16303 | return NULL; |
| 16304 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16305 | 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] | 16306 | Token * async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16307 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16308 | (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' |
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_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16312 | _res = async_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16313 | goto done; |
| 16314 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16315 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16316 | D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ', |
| 16317 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16318 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16319 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16320 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16321 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16322 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16323 | } |
| 16324 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16325 | // _tmp_19: '=' annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16326 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16327 | _tmp_19_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16328 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16329 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16330 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16331 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16332 | return NULL; |
| 16333 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16334 | void * _res = NULL; |
| 16335 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16336 | { // '=' annotated_rhs |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16337 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16338 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16339 | return NULL; |
| 16340 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16341 | 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] | 16342 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16343 | expr_ty d; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16344 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16345 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16346 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16347 | (d = annotated_rhs_rule(p)) // annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16348 | ) |
| 16349 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16350 | 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] | 16351 | _res = d; |
| 16352 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16353 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16354 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16355 | return NULL; |
| 16356 | } |
| 16357 | goto done; |
| 16358 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16359 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16360 | D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ', |
| 16361 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16362 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16363 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16364 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16365 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16366 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16367 | } |
| 16368 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16369 | // _tmp_20: '(' single_target ')' | single_subscript_attribute_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16370 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16371 | _tmp_20_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16372 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16373 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16374 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16375 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16376 | return NULL; |
| 16377 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16378 | void * _res = NULL; |
| 16379 | int _mark = p->mark; |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16380 | { // '(' single_target ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16381 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16382 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16383 | return NULL; |
| 16384 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16385 | 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] | 16386 | Token * _literal; |
| 16387 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16388 | expr_ty b; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16389 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16390 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16391 | && |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16392 | (b = single_target_rule(p)) // single_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16393 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16394 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16395 | ) |
| 16396 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16397 | 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] | 16398 | _res = b; |
| 16399 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16400 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16401 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16402 | return NULL; |
| 16403 | } |
| 16404 | goto done; |
| 16405 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16406 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16407 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', |
| 16408 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16409 | } |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16410 | { // single_subscript_attribute_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16411 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16412 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16413 | return NULL; |
| 16414 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16415 | 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] | 16416 | expr_ty single_subscript_attribute_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16417 | if ( |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 16418 | (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] | 16419 | ) |
| 16420 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16421 | 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] | 16422 | _res = single_subscript_attribute_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16423 | goto done; |
| 16424 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16425 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16426 | D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ', |
| 16427 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16428 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16429 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16430 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16431 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16432 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16433 | } |
| 16434 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16435 | // _tmp_21: '=' annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16436 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16437 | _tmp_21_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16438 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16439 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16440 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16441 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16442 | return NULL; |
| 16443 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16444 | void * _res = NULL; |
| 16445 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16446 | { // '=' annotated_rhs |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16447 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16448 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16449 | return NULL; |
| 16450 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16451 | 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] | 16452 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16453 | expr_ty d; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16454 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16455 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16456 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16457 | (d = annotated_rhs_rule(p)) // annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16458 | ) |
| 16459 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16460 | 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] | 16461 | _res = d; |
| 16462 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16463 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16464 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16465 | return NULL; |
| 16466 | } |
| 16467 | goto done; |
| 16468 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16469 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16470 | D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ', |
| 16471 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16472 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16473 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16474 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16475 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16476 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16477 | } |
| 16478 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16479 | // _loop1_22: (star_targets '=') |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16480 | static asdl_seq * |
| 16481 | _loop1_22_rule(Parser *p) |
| 16482 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16483 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16484 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16485 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16486 | return NULL; |
| 16487 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16488 | void *_res = NULL; |
| 16489 | int _mark = p->mark; |
| 16490 | int _start_mark = p->mark; |
| 16491 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 16492 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16493 | p->error_indicator = 1; |
| 16494 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16495 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16496 | return NULL; |
| 16497 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16498 | ssize_t _children_capacity = 1; |
| 16499 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16500 | { // (star_targets '=') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16501 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16502 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16503 | return NULL; |
| 16504 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16505 | D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 16506 | void *_tmp_136_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16507 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 16508 | (_tmp_136_var = _tmp_136_rule(p)) // star_targets '=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16509 | ) |
| 16510 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 16511 | _res = _tmp_136_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16512 | if (_n == _children_capacity) { |
| 16513 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16514 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 16515 | if (!_new_children) { |
| 16516 | p->error_indicator = 1; |
| 16517 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16518 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16519 | return NULL; |
| 16520 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16521 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16522 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16523 | _children[_n++] = _res; |
| 16524 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16525 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16526 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16527 | D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ', |
| 16528 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16529 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16530 | if (_n == 0 || p->error_indicator) { |
| 16531 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16532 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16533 | return NULL; |
| 16534 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16535 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 16536 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16537 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16538 | p->error_indicator = 1; |
| 16539 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16540 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16541 | return NULL; |
| 16542 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16543 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 16544 | PyMem_Free(_children); |
| 16545 | _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16546 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16547 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16548 | } |
| 16549 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16550 | // _tmp_23: yield_expr | star_expressions |
| 16551 | static void * |
| 16552 | _tmp_23_rule(Parser *p) |
| 16553 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16554 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16555 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16556 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16557 | return NULL; |
| 16558 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16559 | void * _res = NULL; |
| 16560 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16561 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16562 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16563 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16564 | return NULL; |
| 16565 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16566 | 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] | 16567 | expr_ty yield_expr_var; |
| 16568 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16569 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16570 | ) |
| 16571 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16572 | 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] | 16573 | _res = yield_expr_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16574 | goto done; |
| 16575 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16576 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16577 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', |
| 16578 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16579 | } |
| 16580 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16581 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16582 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16583 | return NULL; |
| 16584 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16585 | 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] | 16586 | expr_ty star_expressions_var; |
| 16587 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16588 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16589 | ) |
| 16590 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16591 | 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] | 16592 | _res = star_expressions_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16593 | goto done; |
| 16594 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16595 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16596 | D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ', |
| 16597 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16598 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16599 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16600 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16601 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16602 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16603 | } |
| 16604 | |
| 16605 | // _tmp_24: yield_expr | star_expressions |
| 16606 | static void * |
| 16607 | _tmp_24_rule(Parser *p) |
| 16608 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16609 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16610 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16611 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16612 | return NULL; |
| 16613 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16614 | void * _res = NULL; |
| 16615 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16616 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16617 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16618 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16619 | return NULL; |
| 16620 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16621 | 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] | 16622 | expr_ty yield_expr_var; |
| 16623 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16624 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16625 | ) |
| 16626 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16627 | 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] | 16628 | _res = yield_expr_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16629 | goto done; |
| 16630 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16631 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16632 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', |
| 16633 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16634 | } |
| 16635 | { // star_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16636 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16637 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16638 | return NULL; |
| 16639 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16640 | 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] | 16641 | expr_ty star_expressions_var; |
| 16642 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16643 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16644 | ) |
| 16645 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16646 | 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] | 16647 | _res = star_expressions_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16648 | goto done; |
| 16649 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16650 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16651 | D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ', |
| 16652 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16653 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16654 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16655 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16656 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16657 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16658 | } |
| 16659 | |
| 16660 | // _loop0_26: ',' NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 16661 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16662 | _loop0_26_rule(Parser *p) |
| 16663 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16664 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16665 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16666 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16667 | return NULL; |
| 16668 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16669 | void *_res = NULL; |
| 16670 | int _mark = p->mark; |
| 16671 | int _start_mark = p->mark; |
| 16672 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 16673 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16674 | p->error_indicator = 1; |
| 16675 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16676 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16677 | return NULL; |
| 16678 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16679 | ssize_t _children_capacity = 1; |
| 16680 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16681 | { // ',' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16682 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16683 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16684 | return NULL; |
| 16685 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16686 | 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] | 16687 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16688 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16689 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16690 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16691 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16692 | (elem = _PyPegen_name_token(p)) // NAME |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16693 | ) |
| 16694 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16695 | _res = elem; |
| 16696 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16697 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16698 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16699 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16700 | return NULL; |
| 16701 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16702 | if (_n == _children_capacity) { |
| 16703 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16704 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 16705 | if (!_new_children) { |
| 16706 | p->error_indicator = 1; |
| 16707 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16708 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16709 | return NULL; |
| 16710 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16711 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16712 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16713 | _children[_n++] = _res; |
| 16714 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16715 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16716 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16717 | D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ', |
| 16718 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16719 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16720 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 16721 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16722 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16723 | p->error_indicator = 1; |
| 16724 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16725 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16726 | return NULL; |
| 16727 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16728 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 16729 | PyMem_Free(_children); |
| 16730 | _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq); |
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 _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16733 | } |
| 16734 | |
| 16735 | // _gather_25: NAME _loop0_26 |
| 16736 | static asdl_seq * |
| 16737 | _gather_25_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 | asdl_seq * _res = NULL; |
| 16745 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16746 | { // NAME _loop0_26 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16747 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16748 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16749 | return NULL; |
| 16750 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16751 | 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] | 16752 | expr_ty elem; |
| 16753 | asdl_seq * seq; |
| 16754 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16755 | (elem = _PyPegen_name_token(p)) // NAME |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16756 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16757 | (seq = _loop0_26_rule(p)) // _loop0_26 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16758 | ) |
| 16759 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16760 | 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] | 16761 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16762 | goto done; |
| 16763 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16764 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16765 | D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ', |
| 16766 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16767 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16768 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16769 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16770 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16771 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16772 | } |
| 16773 | |
| 16774 | // _loop0_28: ',' NAME |
| 16775 | static asdl_seq * |
| 16776 | _loop0_28_rule(Parser *p) |
| 16777 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16778 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16779 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16780 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16781 | return NULL; |
| 16782 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16783 | void *_res = NULL; |
| 16784 | int _mark = p->mark; |
| 16785 | int _start_mark = p->mark; |
| 16786 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 16787 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16788 | p->error_indicator = 1; |
| 16789 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16790 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16791 | return NULL; |
| 16792 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16793 | ssize_t _children_capacity = 1; |
| 16794 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16795 | { // ',' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16796 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16797 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16798 | return NULL; |
| 16799 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16800 | 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] | 16801 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16802 | expr_ty elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16803 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16804 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16805 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16806 | (elem = _PyPegen_name_token(p)) // NAME |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16807 | ) |
| 16808 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16809 | _res = elem; |
| 16810 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16811 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16812 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16813 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16814 | return NULL; |
| 16815 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16816 | if (_n == _children_capacity) { |
| 16817 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16818 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 16819 | if (!_new_children) { |
| 16820 | p->error_indicator = 1; |
| 16821 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16822 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16823 | return NULL; |
| 16824 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16825 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16826 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16827 | _children[_n++] = _res; |
| 16828 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16829 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16830 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16831 | D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ', |
| 16832 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16833 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16834 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 16835 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16836 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16837 | p->error_indicator = 1; |
| 16838 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16839 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16840 | return NULL; |
| 16841 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16842 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 16843 | PyMem_Free(_children); |
| 16844 | _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq); |
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 _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16847 | } |
| 16848 | |
| 16849 | // _gather_27: NAME _loop0_28 |
| 16850 | static asdl_seq * |
| 16851 | _gather_27_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 | asdl_seq * _res = NULL; |
| 16859 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16860 | { // NAME _loop0_28 |
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> _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] | 16866 | expr_ty elem; |
| 16867 | asdl_seq * seq; |
| 16868 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16869 | (elem = _PyPegen_name_token(p)) // NAME |
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 | (seq = _loop0_28_rule(p)) // _loop0_28 |
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+ _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] | 16875 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16876 | goto done; |
| 16877 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16878 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16879 | D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ', |
| 16880 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16881 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16882 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16883 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16884 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16885 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16886 | } |
| 16887 | |
| 16888 | // _tmp_29: ',' expression |
| 16889 | static void * |
| 16890 | _tmp_29_rule(Parser *p) |
| 16891 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16892 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16893 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16894 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16895 | return NULL; |
| 16896 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16897 | void * _res = NULL; |
| 16898 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16899 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16900 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16901 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16902 | return NULL; |
| 16903 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16904 | 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] | 16905 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16906 | expr_ty z; |
| 16907 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16908 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16909 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 16910 | (z = expression_rule(p)) // expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16911 | ) |
| 16912 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16913 | 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] | 16914 | _res = z; |
| 16915 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16916 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16917 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16918 | return NULL; |
| 16919 | } |
| 16920 | goto done; |
| 16921 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16922 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16923 | D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ', |
| 16924 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16925 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16926 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16927 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16928 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16929 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16930 | } |
| 16931 | |
| 16932 | // _loop0_30: ('.' | '...') |
| 16933 | static asdl_seq * |
| 16934 | _loop0_30_rule(Parser *p) |
| 16935 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16936 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16937 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16938 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16939 | return NULL; |
| 16940 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16941 | void *_res = NULL; |
| 16942 | int _mark = p->mark; |
| 16943 | int _start_mark = p->mark; |
| 16944 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 16945 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16946 | p->error_indicator = 1; |
| 16947 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16948 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16949 | return NULL; |
| 16950 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16951 | ssize_t _children_capacity = 1; |
| 16952 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16953 | { // ('.' | '...') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16954 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16955 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 16956 | return NULL; |
| 16957 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16958 | D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 16959 | void *_tmp_137_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16960 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 16961 | (_tmp_137_var = _tmp_137_rule(p)) // '.' | '...' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16962 | ) |
| 16963 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 16964 | _res = _tmp_137_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16965 | if (_n == _children_capacity) { |
| 16966 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16967 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 16968 | if (!_new_children) { |
| 16969 | p->error_indicator = 1; |
| 16970 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16971 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16972 | return NULL; |
| 16973 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16974 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16975 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16976 | _children[_n++] = _res; |
| 16977 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16978 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16979 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16980 | D(fprintf(stderr, "%*c%s _loop0_30[%d-%d]: %s failed!\n", p->level, ' ', |
| 16981 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16982 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16983 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 16984 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16985 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 16986 | p->error_indicator = 1; |
| 16987 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16988 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16989 | return NULL; |
| 16990 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16991 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 16992 | PyMem_Free(_children); |
| 16993 | _PyPegen_insert_memo(p, _start_mark, _loop0_30_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 16994 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 16995 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 16996 | } |
| 16997 | |
| 16998 | // _loop1_31: ('.' | '...') |
| 16999 | static asdl_seq * |
| 17000 | _loop1_31_rule(Parser *p) |
| 17001 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17002 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17003 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17004 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17005 | return NULL; |
| 17006 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17007 | void *_res = NULL; |
| 17008 | int _mark = p->mark; |
| 17009 | int _start_mark = p->mark; |
| 17010 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17011 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17012 | p->error_indicator = 1; |
| 17013 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17014 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17015 | return NULL; |
| 17016 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17017 | ssize_t _children_capacity = 1; |
| 17018 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17019 | { // ('.' | '...') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17020 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17021 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17022 | return NULL; |
| 17023 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17024 | D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 17025 | void *_tmp_138_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17026 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 17027 | (_tmp_138_var = _tmp_138_rule(p)) // '.' | '...' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17028 | ) |
| 17029 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 17030 | _res = _tmp_138_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17031 | if (_n == _children_capacity) { |
| 17032 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17033 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17034 | if (!_new_children) { |
| 17035 | p->error_indicator = 1; |
| 17036 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17037 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17038 | return NULL; |
| 17039 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17040 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17041 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17042 | _children[_n++] = _res; |
| 17043 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17044 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17045 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17046 | D(fprintf(stderr, "%*c%s _loop1_31[%d-%d]: %s failed!\n", p->level, ' ', |
| 17047 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17048 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17049 | if (_n == 0 || p->error_indicator) { |
| 17050 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17051 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17052 | return NULL; |
| 17053 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17054 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17055 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17056 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17057 | p->error_indicator = 1; |
| 17058 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17059 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17060 | return NULL; |
| 17061 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17062 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17063 | PyMem_Free(_children); |
| 17064 | _PyPegen_insert_memo(p, _start_mark, _loop1_31_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17065 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17066 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17067 | } |
| 17068 | |
| 17069 | // _loop0_33: ',' import_from_as_name |
| 17070 | static asdl_seq * |
| 17071 | _loop0_33_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17072 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17073 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17074 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17075 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17076 | return NULL; |
| 17077 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17078 | void *_res = NULL; |
| 17079 | int _mark = p->mark; |
| 17080 | int _start_mark = p->mark; |
| 17081 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17082 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17083 | p->error_indicator = 1; |
| 17084 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17085 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17086 | return NULL; |
| 17087 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17088 | ssize_t _children_capacity = 1; |
| 17089 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17090 | { // ',' import_from_as_name |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17091 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17092 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17093 | return NULL; |
| 17094 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17095 | 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] | 17096 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17097 | alias_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17098 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17099 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17100 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17101 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17102 | ) |
| 17103 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17104 | _res = elem; |
| 17105 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17106 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17107 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17108 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17109 | return NULL; |
| 17110 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17111 | if (_n == _children_capacity) { |
| 17112 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17113 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17114 | if (!_new_children) { |
| 17115 | p->error_indicator = 1; |
| 17116 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17117 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17118 | return NULL; |
| 17119 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17120 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17121 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17122 | _children[_n++] = _res; |
| 17123 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17124 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17125 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17126 | D(fprintf(stderr, "%*c%s _loop0_33[%d-%d]: %s failed!\n", p->level, ' ', |
| 17127 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17128 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17129 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17130 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17131 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17132 | p->error_indicator = 1; |
| 17133 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17134 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17135 | return NULL; |
| 17136 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17137 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17138 | PyMem_Free(_children); |
| 17139 | _PyPegen_insert_memo(p, _start_mark, _loop0_33_type, _seq); |
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 _seq; |
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 | // _gather_32: import_from_as_name _loop0_33 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17145 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17146 | _gather_32_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 | asdl_seq * _res = NULL; |
| 17154 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17155 | { // import_from_as_name _loop0_33 |
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> _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] | 17161 | alias_ty elem; |
| 17162 | asdl_seq * seq; |
| 17163 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17164 | (elem = import_from_as_name_rule(p)) // import_from_as_name |
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 | (seq = _loop0_33_rule(p)) // _loop0_33 |
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+ _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] | 17170 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17171 | goto done; |
| 17172 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17173 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17174 | D(fprintf(stderr, "%*c%s _gather_32[%d-%d]: %s failed!\n", p->level, ' ', |
| 17175 | 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] | 17176 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17177 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17178 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17179 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17180 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17181 | } |
| 17182 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17183 | // _tmp_34: 'as' NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17184 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17185 | _tmp_34_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17186 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17187 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17188 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17189 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17190 | return NULL; |
| 17191 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17192 | void * _res = NULL; |
| 17193 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17194 | { // 'as' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17195 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17196 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17197 | return NULL; |
| 17198 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17199 | 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] | 17200 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17201 | expr_ty z; |
| 17202 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17203 | (_keyword = _PyPegen_expect_token(p, 531)) // token='as' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17204 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17205 | (z = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17206 | ) |
| 17207 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17208 | 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] | 17209 | _res = z; |
| 17210 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17211 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17212 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17213 | return NULL; |
| 17214 | } |
| 17215 | goto done; |
| 17216 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17217 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17218 | D(fprintf(stderr, "%*c%s _tmp_34[%d-%d]: %s failed!\n", p->level, ' ', |
| 17219 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17220 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17221 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17222 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17223 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17224 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17225 | } |
| 17226 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17227 | // _loop0_36: ',' dotted_as_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17228 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17229 | _loop0_36_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17230 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17231 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17232 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17233 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17234 | return NULL; |
| 17235 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17236 | void *_res = NULL; |
| 17237 | int _mark = p->mark; |
| 17238 | int _start_mark = p->mark; |
| 17239 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17240 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17241 | p->error_indicator = 1; |
| 17242 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17243 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17244 | return NULL; |
| 17245 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17246 | ssize_t _children_capacity = 1; |
| 17247 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17248 | { // ',' dotted_as_name |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17249 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17250 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17251 | return NULL; |
| 17252 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17253 | 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] | 17254 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17255 | alias_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17256 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17257 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17258 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17259 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17260 | ) |
| 17261 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17262 | _res = elem; |
| 17263 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17264 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17265 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17266 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17267 | return NULL; |
| 17268 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17269 | if (_n == _children_capacity) { |
| 17270 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17271 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17272 | if (!_new_children) { |
| 17273 | p->error_indicator = 1; |
| 17274 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17275 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17276 | return NULL; |
| 17277 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17278 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17279 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17280 | _children[_n++] = _res; |
| 17281 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17282 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17283 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17284 | D(fprintf(stderr, "%*c%s _loop0_36[%d-%d]: %s failed!\n", p->level, ' ', |
| 17285 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17286 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17287 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17288 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17289 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17290 | p->error_indicator = 1; |
| 17291 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17292 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17293 | return NULL; |
| 17294 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17295 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17296 | PyMem_Free(_children); |
| 17297 | _PyPegen_insert_memo(p, _start_mark, _loop0_36_type, _seq); |
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 _seq; |
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 | // _gather_35: dotted_as_name _loop0_36 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17303 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17304 | _gather_35_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 | asdl_seq * _res = NULL; |
| 17312 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17313 | { // dotted_as_name _loop0_36 |
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> _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] | 17319 | alias_ty elem; |
| 17320 | asdl_seq * seq; |
| 17321 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17322 | (elem = dotted_as_name_rule(p)) // dotted_as_name |
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 | (seq = _loop0_36_rule(p)) // _loop0_36 |
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+ _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] | 17328 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17329 | goto done; |
| 17330 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17331 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17332 | D(fprintf(stderr, "%*c%s _gather_35[%d-%d]: %s failed!\n", p->level, ' ', |
| 17333 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_36")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17334 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17335 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17336 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17337 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17338 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17339 | } |
| 17340 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17341 | // _tmp_37: 'as' NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17342 | static void * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17343 | _tmp_37_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17344 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17345 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17346 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17347 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17348 | return NULL; |
| 17349 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17350 | void * _res = NULL; |
| 17351 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17352 | { // 'as' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17353 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17354 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17355 | return NULL; |
| 17356 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17357 | 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] | 17358 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17359 | expr_ty z; |
| 17360 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17361 | (_keyword = _PyPegen_expect_token(p, 531)) // token='as' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17362 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17363 | (z = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17364 | ) |
| 17365 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17366 | 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] | 17367 | _res = z; |
| 17368 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17369 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17370 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17371 | return NULL; |
| 17372 | } |
| 17373 | goto done; |
| 17374 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17375 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17376 | D(fprintf(stderr, "%*c%s _tmp_37[%d-%d]: %s failed!\n", p->level, ' ', |
| 17377 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17378 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17379 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17380 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17381 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17382 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17383 | } |
| 17384 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17385 | // _loop0_39: ',' with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17386 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17387 | _loop0_39_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17388 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17389 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17390 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17391 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17392 | return NULL; |
| 17393 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17394 | void *_res = NULL; |
| 17395 | int _mark = p->mark; |
| 17396 | int _start_mark = p->mark; |
| 17397 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17398 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17399 | p->error_indicator = 1; |
| 17400 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17401 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17402 | return NULL; |
| 17403 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17404 | ssize_t _children_capacity = 1; |
| 17405 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17406 | { // ',' with_item |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17407 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17408 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17409 | return NULL; |
| 17410 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17411 | 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] | 17412 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17413 | withitem_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17414 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17415 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17416 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17417 | (elem = with_item_rule(p)) // with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17418 | ) |
| 17419 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17420 | _res = elem; |
| 17421 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17422 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17423 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17424 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17425 | return NULL; |
| 17426 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17427 | if (_n == _children_capacity) { |
| 17428 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17429 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17430 | if (!_new_children) { |
| 17431 | p->error_indicator = 1; |
| 17432 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17433 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17434 | return NULL; |
| 17435 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17436 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17437 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17438 | _children[_n++] = _res; |
| 17439 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17440 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17441 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17442 | D(fprintf(stderr, "%*c%s _loop0_39[%d-%d]: %s failed!\n", p->level, ' ', |
| 17443 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17444 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17445 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17446 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17447 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17448 | p->error_indicator = 1; |
| 17449 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17450 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17451 | return NULL; |
| 17452 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17453 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17454 | PyMem_Free(_children); |
| 17455 | _PyPegen_insert_memo(p, _start_mark, _loop0_39_type, _seq); |
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 _seq; |
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 | // _gather_38: with_item _loop0_39 |
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 | _gather_38_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 | asdl_seq * _res = NULL; |
| 17470 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17471 | { // with_item _loop0_39 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17472 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17473 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17474 | return NULL; |
| 17475 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17476 | 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] | 17477 | withitem_ty elem; |
| 17478 | asdl_seq * seq; |
| 17479 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17480 | (elem = with_item_rule(p)) // with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17481 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17482 | (seq = _loop0_39_rule(p)) // _loop0_39 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17483 | ) |
| 17484 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17485 | 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] | 17486 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17487 | goto done; |
| 17488 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17489 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17490 | D(fprintf(stderr, "%*c%s _gather_38[%d-%d]: %s failed!\n", p->level, ' ', |
| 17491 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_39")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17492 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17493 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17494 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17495 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17496 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17497 | } |
| 17498 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17499 | // _loop0_41: ',' with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17500 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17501 | _loop0_41_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17502 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17503 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17504 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17505 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17506 | return NULL; |
| 17507 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17508 | void *_res = NULL; |
| 17509 | int _mark = p->mark; |
| 17510 | int _start_mark = p->mark; |
| 17511 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17512 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17513 | p->error_indicator = 1; |
| 17514 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17515 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17516 | return NULL; |
| 17517 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17518 | ssize_t _children_capacity = 1; |
| 17519 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17520 | { // ',' with_item |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17521 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17522 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17523 | return NULL; |
| 17524 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17525 | 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] | 17526 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17527 | withitem_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17528 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17529 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17530 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17531 | (elem = with_item_rule(p)) // with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17532 | ) |
| 17533 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17534 | _res = elem; |
| 17535 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17536 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17537 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17538 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17539 | return NULL; |
| 17540 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17541 | if (_n == _children_capacity) { |
| 17542 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17543 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17544 | if (!_new_children) { |
| 17545 | p->error_indicator = 1; |
| 17546 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17547 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17548 | return NULL; |
| 17549 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17550 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17551 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17552 | _children[_n++] = _res; |
| 17553 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17554 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17555 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17556 | D(fprintf(stderr, "%*c%s _loop0_41[%d-%d]: %s failed!\n", p->level, ' ', |
| 17557 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17558 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17559 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17560 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17561 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17562 | p->error_indicator = 1; |
| 17563 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17564 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17565 | return NULL; |
| 17566 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17567 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17568 | PyMem_Free(_children); |
| 17569 | _PyPegen_insert_memo(p, _start_mark, _loop0_41_type, _seq); |
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 _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17572 | } |
| 17573 | |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17574 | // _gather_40: with_item _loop0_41 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17575 | static asdl_seq * |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17576 | _gather_40_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17577 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17578 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17579 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17580 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17581 | return NULL; |
| 17582 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17583 | asdl_seq * _res = NULL; |
| 17584 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 17585 | { // with_item _loop0_41 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17586 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17587 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17588 | return NULL; |
| 17589 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17590 | 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] | 17591 | withitem_ty elem; |
| 17592 | asdl_seq * seq; |
| 17593 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17594 | (elem = with_item_rule(p)) // with_item |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17595 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17596 | (seq = _loop0_41_rule(p)) // _loop0_41 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17597 | ) |
| 17598 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17599 | 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] | 17600 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17601 | goto done; |
| 17602 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17603 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17604 | D(fprintf(stderr, "%*c%s _gather_40[%d-%d]: %s failed!\n", p->level, ' ', |
| 17605 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_41")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17606 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17607 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17608 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17609 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17610 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17611 | } |
| 17612 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17613 | // _loop0_43: ',' with_item |
| 17614 | static asdl_seq * |
| 17615 | _loop0_43_rule(Parser *p) |
| 17616 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17617 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17618 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17619 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17620 | return NULL; |
| 17621 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17622 | void *_res = NULL; |
| 17623 | int _mark = p->mark; |
| 17624 | int _start_mark = p->mark; |
| 17625 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17626 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17627 | p->error_indicator = 1; |
| 17628 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17629 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17630 | return NULL; |
| 17631 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17632 | ssize_t _children_capacity = 1; |
| 17633 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17634 | { // ',' with_item |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17635 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17636 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17637 | return NULL; |
| 17638 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17639 | 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] | 17640 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17641 | withitem_ty elem; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17642 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17643 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17644 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17645 | (elem = with_item_rule(p)) // with_item |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17646 | ) |
| 17647 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17648 | _res = elem; |
| 17649 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17650 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17651 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17652 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17653 | return NULL; |
| 17654 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17655 | if (_n == _children_capacity) { |
| 17656 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17657 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17658 | if (!_new_children) { |
| 17659 | p->error_indicator = 1; |
| 17660 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17661 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17662 | return NULL; |
| 17663 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17664 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17665 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17666 | _children[_n++] = _res; |
| 17667 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17668 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17669 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17670 | D(fprintf(stderr, "%*c%s _loop0_43[%d-%d]: %s failed!\n", p->level, ' ', |
| 17671 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17672 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17673 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17674 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17675 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17676 | p->error_indicator = 1; |
| 17677 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17678 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17679 | return NULL; |
| 17680 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17681 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17682 | PyMem_Free(_children); |
| 17683 | _PyPegen_insert_memo(p, _start_mark, _loop0_43_type, _seq); |
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 _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17686 | } |
| 17687 | |
| 17688 | // _gather_42: with_item _loop0_43 |
| 17689 | static asdl_seq * |
| 17690 | _gather_42_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 | asdl_seq * _res = NULL; |
| 17698 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17699 | { // with_item _loop0_43 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17700 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17701 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17702 | return NULL; |
| 17703 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17704 | 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] | 17705 | withitem_ty elem; |
| 17706 | asdl_seq * seq; |
| 17707 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17708 | (elem = with_item_rule(p)) // with_item |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17709 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17710 | (seq = _loop0_43_rule(p)) // _loop0_43 |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17711 | ) |
| 17712 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17713 | 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] | 17714 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17715 | goto done; |
| 17716 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17717 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17718 | D(fprintf(stderr, "%*c%s _gather_42[%d-%d]: %s failed!\n", p->level, ' ', |
| 17719 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_43")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17720 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17721 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17722 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17723 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17724 | return _res; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17725 | } |
| 17726 | |
| 17727 | // _loop0_45: ',' with_item |
| 17728 | static asdl_seq * |
| 17729 | _loop0_45_rule(Parser *p) |
| 17730 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17731 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17732 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17733 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17734 | return NULL; |
| 17735 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17736 | void *_res = NULL; |
| 17737 | int _mark = p->mark; |
| 17738 | int _start_mark = p->mark; |
| 17739 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17740 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17741 | p->error_indicator = 1; |
| 17742 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17743 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17744 | return NULL; |
| 17745 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17746 | ssize_t _children_capacity = 1; |
| 17747 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17748 | { // ',' with_item |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17749 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17750 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17751 | return NULL; |
| 17752 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17753 | 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] | 17754 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17755 | withitem_ty elem; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17756 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17757 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17758 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17759 | (elem = with_item_rule(p)) // with_item |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17760 | ) |
| 17761 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17762 | _res = elem; |
| 17763 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17764 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17765 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17766 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17767 | return NULL; |
| 17768 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17769 | if (_n == _children_capacity) { |
| 17770 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17771 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17772 | if (!_new_children) { |
| 17773 | p->error_indicator = 1; |
| 17774 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17775 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17776 | return NULL; |
| 17777 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17778 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17779 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17780 | _children[_n++] = _res; |
| 17781 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17782 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17783 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17784 | D(fprintf(stderr, "%*c%s _loop0_45[%d-%d]: %s failed!\n", p->level, ' ', |
| 17785 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17786 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17787 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17788 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17789 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17790 | p->error_indicator = 1; |
| 17791 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17792 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17793 | return NULL; |
| 17794 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17795 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17796 | PyMem_Free(_children); |
| 17797 | _PyPegen_insert_memo(p, _start_mark, _loop0_45_type, _seq); |
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 _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17800 | } |
| 17801 | |
| 17802 | // _gather_44: with_item _loop0_45 |
| 17803 | static asdl_seq * |
| 17804 | _gather_44_rule(Parser *p) |
| 17805 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17806 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17807 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17808 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17809 | return NULL; |
| 17810 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17811 | asdl_seq * _res = NULL; |
| 17812 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17813 | { // with_item _loop0_45 |
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> _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] | 17819 | withitem_ty elem; |
| 17820 | asdl_seq * seq; |
| 17821 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17822 | (elem = with_item_rule(p)) // with_item |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17823 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17824 | (seq = _loop0_45_rule(p)) // _loop0_45 |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17825 | ) |
| 17826 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17827 | 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] | 17828 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17829 | goto done; |
| 17830 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17831 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17832 | D(fprintf(stderr, "%*c%s _gather_44[%d-%d]: %s failed!\n", p->level, ' ', |
| 17833 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_45")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17834 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17835 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17836 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17837 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17838 | return _res; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17839 | } |
| 17840 | |
| 17841 | // _tmp_46: 'as' target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17842 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17843 | _tmp_46_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17844 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17845 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17846 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17847 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17848 | return NULL; |
| 17849 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17850 | void * _res = NULL; |
| 17851 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17852 | { // 'as' target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17853 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17854 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17855 | return NULL; |
| 17856 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17857 | 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] | 17858 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17859 | expr_ty t; |
| 17860 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17861 | (_keyword = _PyPegen_expect_token(p, 531)) // token='as' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17862 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17863 | (t = target_rule(p)) // target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17864 | ) |
| 17865 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17866 | 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] | 17867 | _res = t; |
| 17868 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17869 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17870 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17871 | return NULL; |
| 17872 | } |
| 17873 | goto done; |
| 17874 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17875 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17876 | D(fprintf(stderr, "%*c%s _tmp_46[%d-%d]: %s failed!\n", p->level, ' ', |
| 17877 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17878 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17879 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17880 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17881 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17882 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17883 | } |
| 17884 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17885 | // _loop1_47: except_block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17886 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17887 | _loop1_47_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17888 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17889 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17890 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17891 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17892 | return NULL; |
| 17893 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17894 | void *_res = NULL; |
| 17895 | int _mark = p->mark; |
| 17896 | int _start_mark = p->mark; |
| 17897 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 17898 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17899 | p->error_indicator = 1; |
| 17900 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17901 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17902 | return NULL; |
| 17903 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17904 | ssize_t _children_capacity = 1; |
| 17905 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17906 | { // except_block |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17907 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17908 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17909 | return NULL; |
| 17910 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17911 | 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] | 17912 | excepthandler_ty except_block_var; |
| 17913 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 17914 | (except_block_var = except_block_rule(p)) // except_block |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17915 | ) |
| 17916 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17917 | _res = except_block_var; |
| 17918 | if (_n == _children_capacity) { |
| 17919 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17920 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 17921 | if (!_new_children) { |
| 17922 | p->error_indicator = 1; |
| 17923 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17924 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17925 | return NULL; |
| 17926 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17927 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17928 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17929 | _children[_n++] = _res; |
| 17930 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17931 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17932 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17933 | D(fprintf(stderr, "%*c%s _loop1_47[%d-%d]: %s failed!\n", p->level, ' ', |
| 17934 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17935 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17936 | if (_n == 0 || p->error_indicator) { |
| 17937 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17938 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17939 | return NULL; |
| 17940 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17941 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 17942 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17943 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 17944 | p->error_indicator = 1; |
| 17945 | PyErr_NoMemory(); |
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 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17949 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 17950 | PyMem_Free(_children); |
| 17951 | _PyPegen_insert_memo(p, _start_mark, _loop1_47_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17952 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17953 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17954 | } |
| 17955 | |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 17956 | // _tmp_48: 'as' NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17957 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 17958 | _tmp_48_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17959 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17960 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17961 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17962 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17963 | return NULL; |
| 17964 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17965 | void * _res = NULL; |
| 17966 | int _mark = p->mark; |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 17967 | { // 'as' NAME |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17968 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17969 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 17970 | return NULL; |
| 17971 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17972 | 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] | 17973 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17974 | expr_ty z; |
| 17975 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17976 | (_keyword = _PyPegen_expect_token(p, 531)) // token='as' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17977 | && |
Lysandros Nikolaou | ce21cfc | 2020-05-14 23:13:50 +0300 | [diff] [blame] | 17978 | (z = _PyPegen_name_token(p)) // NAME |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17979 | ) |
| 17980 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17981 | 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] | 17982 | _res = z; |
| 17983 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17984 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17985 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17986 | return NULL; |
| 17987 | } |
| 17988 | goto done; |
| 17989 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17990 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17991 | D(fprintf(stderr, "%*c%s _tmp_48[%d-%d]: %s failed!\n", p->level, ' ', |
| 17992 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17993 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17994 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17995 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 17996 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 17997 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 17998 | } |
| 17999 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18000 | // _tmp_49: 'from' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18001 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18002 | _tmp_49_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18003 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18004 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18005 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18006 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18007 | return NULL; |
| 18008 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18009 | void * _res = NULL; |
| 18010 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18011 | { // 'from' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18012 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18013 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18014 | return NULL; |
| 18015 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18016 | 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] | 18017 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18018 | expr_ty z; |
| 18019 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18020 | (_keyword = _PyPegen_expect_token(p, 514)) // token='from' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18021 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18022 | (z = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18023 | ) |
| 18024 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18025 | 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] | 18026 | _res = z; |
| 18027 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18028 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18029 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18030 | return NULL; |
| 18031 | } |
| 18032 | goto done; |
| 18033 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18034 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18035 | D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ', |
| 18036 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18037 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18038 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18039 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18040 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18041 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18042 | } |
| 18043 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18044 | // _tmp_50: '->' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18045 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18046 | _tmp_50_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18047 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18048 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18049 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18050 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18051 | return NULL; |
| 18052 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18053 | void * _res = NULL; |
| 18054 | int _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18055 | { // '->' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18056 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18057 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18058 | return NULL; |
| 18059 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18060 | 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] | 18061 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18062 | expr_ty z; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18063 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18064 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18065 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18066 | (z = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18067 | ) |
| 18068 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18069 | 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] | 18070 | _res = z; |
| 18071 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18072 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18073 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18074 | return NULL; |
| 18075 | } |
| 18076 | goto done; |
| 18077 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18078 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18079 | D(fprintf(stderr, "%*c%s _tmp_50[%d-%d]: %s failed!\n", p->level, ' ', |
| 18080 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18081 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18082 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18083 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18084 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18085 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18086 | } |
| 18087 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18088 | // _tmp_51: '->' expression |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18089 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18090 | _tmp_51_rule(Parser *p) |
| 18091 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18092 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18093 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18094 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18095 | return NULL; |
| 18096 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18097 | void * _res = NULL; |
| 18098 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18099 | { // '->' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18100 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18101 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18102 | return NULL; |
| 18103 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18104 | 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] | 18105 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18106 | expr_ty z; |
| 18107 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18108 | (_literal = _PyPegen_expect_token(p, 51)) // token='->' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18109 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18110 | (z = expression_rule(p)) // expression |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18111 | ) |
| 18112 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18113 | 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] | 18114 | _res = z; |
| 18115 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18116 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18117 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18118 | return NULL; |
| 18119 | } |
| 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_51[%d-%d]: %s failed!\n", p->level, ' ', |
| 18124 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18125 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18126 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [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; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18130 | } |
| 18131 | |
| 18132 | // _tmp_52: NEWLINE INDENT |
| 18133 | static void * |
| 18134 | _tmp_52_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18135 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18136 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18137 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18138 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [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; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18143 | { // NEWLINE INDENT |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18144 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18145 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18146 | return NULL; |
| 18147 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18148 | 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] | 18149 | Token * indent_var; |
| 18150 | Token * newline_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18151 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18152 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18153 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18154 | (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18155 | ) |
| 18156 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18157 | 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] | 18158 | _res = _PyPegen_dummy_name(p, newline_var, indent_var); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18159 | goto done; |
| 18160 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18161 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18162 | D(fprintf(stderr, "%*c%s _tmp_52[%d-%d]: %s failed!\n", p->level, ' ', |
| 18163 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18164 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18165 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18166 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18167 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18168 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18169 | } |
| 18170 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18171 | // _loop0_53: param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18172 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18173 | _loop0_53_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18174 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18175 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18176 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18177 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18178 | return NULL; |
| 18179 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18180 | void *_res = NULL; |
| 18181 | int _mark = p->mark; |
| 18182 | int _start_mark = p->mark; |
| 18183 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18184 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18185 | p->error_indicator = 1; |
| 18186 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18187 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18188 | return NULL; |
| 18189 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18190 | ssize_t _children_capacity = 1; |
| 18191 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18192 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18193 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18194 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18195 | return NULL; |
| 18196 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18197 | 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] | 18198 | arg_ty param_no_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18199 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18200 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18201 | ) |
| 18202 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18203 | _res = param_no_default_var; |
| 18204 | if (_n == _children_capacity) { |
| 18205 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18206 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18207 | if (!_new_children) { |
| 18208 | p->error_indicator = 1; |
| 18209 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18210 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18211 | return NULL; |
| 18212 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18213 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18214 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18215 | _children[_n++] = _res; |
| 18216 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18217 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18218 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18219 | D(fprintf(stderr, "%*c%s _loop0_53[%d-%d]: %s failed!\n", p->level, ' ', |
| 18220 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18221 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18222 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18223 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18224 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18225 | p->error_indicator = 1; |
| 18226 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18227 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18228 | return NULL; |
| 18229 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18230 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18231 | PyMem_Free(_children); |
| 18232 | _PyPegen_insert_memo(p, _start_mark, _loop0_53_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18233 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18234 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18235 | } |
| 18236 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18237 | // _loop0_54: param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18238 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18239 | _loop0_54_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18240 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18241 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18242 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18243 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18244 | return NULL; |
| 18245 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18246 | void *_res = NULL; |
| 18247 | int _mark = p->mark; |
| 18248 | int _start_mark = p->mark; |
| 18249 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18250 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18251 | p->error_indicator = 1; |
| 18252 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18253 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18254 | return NULL; |
| 18255 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18256 | ssize_t _children_capacity = 1; |
| 18257 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18258 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18259 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18260 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18261 | return NULL; |
| 18262 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18263 | 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] | 18264 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18265 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18266 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18267 | ) |
| 18268 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18269 | _res = param_with_default_var; |
| 18270 | if (_n == _children_capacity) { |
| 18271 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18272 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18273 | if (!_new_children) { |
| 18274 | p->error_indicator = 1; |
| 18275 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18276 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18277 | return NULL; |
| 18278 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18279 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18280 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18281 | _children[_n++] = _res; |
| 18282 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18283 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18284 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18285 | D(fprintf(stderr, "%*c%s _loop0_54[%d-%d]: %s failed!\n", p->level, ' ', |
| 18286 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18287 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18288 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18289 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18290 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18291 | p->error_indicator = 1; |
| 18292 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18293 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18294 | return NULL; |
| 18295 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18296 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18297 | PyMem_Free(_children); |
| 18298 | _PyPegen_insert_memo(p, _start_mark, _loop0_54_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18299 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18300 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18301 | } |
| 18302 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18303 | // _loop0_55: param_with_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18304 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18305 | _loop0_55_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18306 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18307 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18308 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18309 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18310 | return NULL; |
| 18311 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18312 | void *_res = NULL; |
| 18313 | int _mark = p->mark; |
| 18314 | int _start_mark = p->mark; |
| 18315 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18316 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18317 | p->error_indicator = 1; |
| 18318 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18319 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18320 | return NULL; |
| 18321 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18322 | ssize_t _children_capacity = 1; |
| 18323 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18324 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18325 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18326 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18327 | return NULL; |
| 18328 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18329 | 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] | 18330 | NameDefaultPair* param_with_default_var; |
| 18331 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18332 | (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] | 18333 | ) |
| 18334 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18335 | _res = param_with_default_var; |
| 18336 | if (_n == _children_capacity) { |
| 18337 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18338 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18339 | if (!_new_children) { |
| 18340 | p->error_indicator = 1; |
| 18341 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18342 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18343 | return NULL; |
| 18344 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18345 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18346 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18347 | _children[_n++] = _res; |
| 18348 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18349 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18350 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18351 | D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ', |
| 18352 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18353 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18354 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18355 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18356 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18357 | p->error_indicator = 1; |
| 18358 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18359 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18360 | return NULL; |
| 18361 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18362 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18363 | PyMem_Free(_children); |
| 18364 | _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18365 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18366 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18367 | } |
| 18368 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18369 | // _loop1_56: param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18370 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18371 | _loop1_56_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18372 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18373 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18374 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18375 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18376 | return NULL; |
| 18377 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18378 | void *_res = NULL; |
| 18379 | int _mark = p->mark; |
| 18380 | int _start_mark = p->mark; |
| 18381 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18382 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18383 | p->error_indicator = 1; |
| 18384 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18385 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18386 | return NULL; |
| 18387 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18388 | ssize_t _children_capacity = 1; |
| 18389 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18390 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18391 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18392 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18393 | return NULL; |
| 18394 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18395 | 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] | 18396 | arg_ty param_no_default_var; |
| 18397 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18398 | (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] | 18399 | ) |
| 18400 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18401 | _res = param_no_default_var; |
| 18402 | if (_n == _children_capacity) { |
| 18403 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18404 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18405 | if (!_new_children) { |
| 18406 | p->error_indicator = 1; |
| 18407 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18408 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18409 | return NULL; |
| 18410 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18411 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18412 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18413 | _children[_n++] = _res; |
| 18414 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18415 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18416 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18417 | D(fprintf(stderr, "%*c%s _loop1_56[%d-%d]: %s failed!\n", p->level, ' ', |
| 18418 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18419 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18420 | if (_n == 0 || p->error_indicator) { |
| 18421 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18422 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18423 | return NULL; |
| 18424 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18425 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18426 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18427 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18428 | p->error_indicator = 1; |
| 18429 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18430 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18431 | return NULL; |
| 18432 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18433 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18434 | PyMem_Free(_children); |
| 18435 | _PyPegen_insert_memo(p, _start_mark, _loop1_56_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18436 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18437 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18438 | } |
| 18439 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18440 | // _loop0_57: param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18441 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18442 | _loop0_57_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18443 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18444 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18445 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18446 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18447 | return NULL; |
| 18448 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18449 | void *_res = NULL; |
| 18450 | int _mark = p->mark; |
| 18451 | int _start_mark = p->mark; |
| 18452 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18453 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18454 | p->error_indicator = 1; |
| 18455 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18456 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18457 | return NULL; |
| 18458 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18459 | ssize_t _children_capacity = 1; |
| 18460 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18461 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18462 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18463 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18464 | return NULL; |
| 18465 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18466 | 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] | 18467 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18468 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18469 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18470 | ) |
| 18471 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18472 | _res = param_with_default_var; |
| 18473 | if (_n == _children_capacity) { |
| 18474 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18475 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18476 | if (!_new_children) { |
| 18477 | p->error_indicator = 1; |
| 18478 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18479 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18480 | return NULL; |
| 18481 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18482 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18483 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18484 | _children[_n++] = _res; |
| 18485 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18486 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18487 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18488 | D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ', |
| 18489 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18490 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18491 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18492 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18493 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18494 | p->error_indicator = 1; |
| 18495 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18496 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18497 | return NULL; |
| 18498 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18499 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18500 | PyMem_Free(_children); |
| 18501 | _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18502 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18503 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18504 | } |
| 18505 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18506 | // _loop1_58: param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18507 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18508 | _loop1_58_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18509 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18510 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18511 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18512 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18513 | return NULL; |
| 18514 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18515 | void *_res = NULL; |
| 18516 | int _mark = p->mark; |
| 18517 | int _start_mark = p->mark; |
| 18518 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18519 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18520 | p->error_indicator = 1; |
| 18521 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18522 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18523 | return NULL; |
| 18524 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18525 | ssize_t _children_capacity = 1; |
| 18526 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18527 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18528 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18529 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18530 | return NULL; |
| 18531 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18532 | 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] | 18533 | NameDefaultPair* param_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18534 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18535 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18536 | ) |
| 18537 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18538 | _res = param_with_default_var; |
| 18539 | if (_n == _children_capacity) { |
| 18540 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18541 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18542 | if (!_new_children) { |
| 18543 | p->error_indicator = 1; |
| 18544 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18545 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18546 | return NULL; |
| 18547 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18548 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 18549 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18550 | _children[_n++] = _res; |
| 18551 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18552 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18553 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18554 | D(fprintf(stderr, "%*c%s _loop1_58[%d-%d]: %s failed!\n", p->level, ' ', |
| 18555 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18556 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18557 | if (_n == 0 || p->error_indicator) { |
| 18558 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18559 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18560 | return NULL; |
| 18561 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18562 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18563 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18564 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18565 | p->error_indicator = 1; |
| 18566 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18567 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18568 | return NULL; |
| 18569 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18570 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18571 | PyMem_Free(_children); |
| 18572 | _PyPegen_insert_memo(p, _start_mark, _loop1_58_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18573 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18574 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18575 | } |
| 18576 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18577 | // _loop1_59: param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18578 | static asdl_seq * |
| 18579 | _loop1_59_rule(Parser *p) |
| 18580 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18581 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18582 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18583 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18584 | return NULL; |
| 18585 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18586 | void *_res = NULL; |
| 18587 | int _mark = p->mark; |
| 18588 | int _start_mark = p->mark; |
| 18589 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18590 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18591 | p->error_indicator = 1; |
| 18592 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18593 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18594 | return NULL; |
| 18595 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18596 | ssize_t _children_capacity = 1; |
| 18597 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18598 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18599 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18600 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18601 | return NULL; |
| 18602 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18603 | 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] | 18604 | arg_ty param_no_default_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18605 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18606 | (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] | 18607 | ) |
| 18608 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18609 | _res = param_no_default_var; |
| 18610 | if (_n == _children_capacity) { |
| 18611 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18612 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18613 | if (!_new_children) { |
| 18614 | p->error_indicator = 1; |
| 18615 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18616 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18617 | return NULL; |
| 18618 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18619 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18620 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18621 | _children[_n++] = _res; |
| 18622 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18623 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18624 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18625 | D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ', |
| 18626 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18627 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18628 | if (_n == 0 || p->error_indicator) { |
| 18629 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18630 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18631 | return NULL; |
| 18632 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18633 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18634 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18635 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18636 | p->error_indicator = 1; |
| 18637 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18638 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18639 | return NULL; |
| 18640 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18641 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18642 | PyMem_Free(_children); |
| 18643 | _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18644 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18645 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18646 | } |
| 18647 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18648 | // _loop1_60: param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18649 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18650 | _loop1_60_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18651 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18652 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18653 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18654 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18655 | return NULL; |
| 18656 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18657 | void *_res = NULL; |
| 18658 | int _mark = p->mark; |
| 18659 | int _start_mark = p->mark; |
| 18660 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18661 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18662 | p->error_indicator = 1; |
| 18663 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18664 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18665 | return NULL; |
| 18666 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18667 | ssize_t _children_capacity = 1; |
| 18668 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18669 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18670 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18671 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18672 | return NULL; |
| 18673 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18674 | 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] | 18675 | arg_ty param_no_default_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18676 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18677 | (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] | 18678 | ) |
| 18679 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18680 | _res = param_no_default_var; |
| 18681 | if (_n == _children_capacity) { |
| 18682 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18683 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18684 | if (!_new_children) { |
| 18685 | p->error_indicator = 1; |
| 18686 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18687 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18688 | return NULL; |
| 18689 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18690 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18691 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18692 | _children[_n++] = _res; |
| 18693 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18694 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18695 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18696 | D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ', |
| 18697 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18698 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18699 | if (_n == 0 || p->error_indicator) { |
| 18700 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18701 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18702 | return NULL; |
| 18703 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18704 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18705 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18706 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18707 | p->error_indicator = 1; |
| 18708 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18709 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18710 | return NULL; |
| 18711 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18712 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18713 | PyMem_Free(_children); |
| 18714 | _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18715 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18716 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18717 | } |
| 18718 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18719 | // _loop0_61: param_no_default |
| 18720 | static asdl_seq * |
| 18721 | _loop0_61_rule(Parser *p) |
| 18722 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18723 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18724 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18725 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18726 | return NULL; |
| 18727 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18728 | void *_res = NULL; |
| 18729 | int _mark = p->mark; |
| 18730 | int _start_mark = p->mark; |
| 18731 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18732 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18733 | p->error_indicator = 1; |
| 18734 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18735 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18736 | return NULL; |
| 18737 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18738 | ssize_t _children_capacity = 1; |
| 18739 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18740 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18741 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18742 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18743 | return NULL; |
| 18744 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18745 | 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] | 18746 | arg_ty param_no_default_var; |
| 18747 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18748 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18749 | ) |
| 18750 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18751 | _res = param_no_default_var; |
| 18752 | if (_n == _children_capacity) { |
| 18753 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18754 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18755 | if (!_new_children) { |
| 18756 | p->error_indicator = 1; |
| 18757 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18758 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18759 | return NULL; |
| 18760 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18761 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18762 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18763 | _children[_n++] = _res; |
| 18764 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18765 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18766 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18767 | D(fprintf(stderr, "%*c%s _loop0_61[%d-%d]: %s failed!\n", p->level, ' ', |
| 18768 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18769 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18770 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18771 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18772 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18773 | p->error_indicator = 1; |
| 18774 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18775 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18776 | return NULL; |
| 18777 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18778 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18779 | PyMem_Free(_children); |
| 18780 | _PyPegen_insert_memo(p, _start_mark, _loop0_61_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18781 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18782 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18783 | } |
| 18784 | |
| 18785 | // _loop1_62: param_with_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18786 | static asdl_seq * |
| 18787 | _loop1_62_rule(Parser *p) |
| 18788 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18789 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18790 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18791 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18792 | return NULL; |
| 18793 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18794 | void *_res = NULL; |
| 18795 | int _mark = p->mark; |
| 18796 | int _start_mark = p->mark; |
| 18797 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18798 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18799 | p->error_indicator = 1; |
| 18800 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18801 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18802 | return NULL; |
| 18803 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18804 | ssize_t _children_capacity = 1; |
| 18805 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18806 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18807 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18808 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18809 | return NULL; |
| 18810 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18811 | 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] | 18812 | NameDefaultPair* param_with_default_var; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18813 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18814 | (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] | 18815 | ) |
| 18816 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18817 | _res = param_with_default_var; |
| 18818 | if (_n == _children_capacity) { |
| 18819 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18820 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18821 | if (!_new_children) { |
| 18822 | p->error_indicator = 1; |
| 18823 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18824 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18825 | return NULL; |
| 18826 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18827 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18828 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18829 | _children[_n++] = _res; |
| 18830 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18831 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18832 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18833 | D(fprintf(stderr, "%*c%s _loop1_62[%d-%d]: %s failed!\n", p->level, ' ', |
| 18834 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18835 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18836 | if (_n == 0 || p->error_indicator) { |
| 18837 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18838 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18839 | return NULL; |
| 18840 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18841 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18842 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18843 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18844 | p->error_indicator = 1; |
| 18845 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18846 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18847 | return NULL; |
| 18848 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18849 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18850 | PyMem_Free(_children); |
| 18851 | _PyPegen_insert_memo(p, _start_mark, _loop1_62_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18852 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18853 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 18854 | } |
| 18855 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18856 | // _loop0_63: param_no_default |
| 18857 | static asdl_seq * |
| 18858 | _loop0_63_rule(Parser *p) |
| 18859 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18860 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18861 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18862 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18863 | return NULL; |
| 18864 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18865 | void *_res = NULL; |
| 18866 | int _mark = p->mark; |
| 18867 | int _start_mark = p->mark; |
| 18868 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18869 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18870 | p->error_indicator = 1; |
| 18871 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18872 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18873 | return NULL; |
| 18874 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18875 | ssize_t _children_capacity = 1; |
| 18876 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18877 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18878 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18879 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18880 | return NULL; |
| 18881 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18882 | 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] | 18883 | arg_ty param_no_default_var; |
| 18884 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18885 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18886 | ) |
| 18887 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18888 | _res = param_no_default_var; |
| 18889 | if (_n == _children_capacity) { |
| 18890 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18891 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18892 | if (!_new_children) { |
| 18893 | p->error_indicator = 1; |
| 18894 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18895 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18896 | return NULL; |
| 18897 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18898 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18899 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18900 | _children[_n++] = _res; |
| 18901 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18902 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18903 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18904 | D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ', |
| 18905 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18906 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18907 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18908 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18909 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18910 | p->error_indicator = 1; |
| 18911 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18912 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18913 | return NULL; |
| 18914 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18915 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18916 | PyMem_Free(_children); |
| 18917 | _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18918 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18919 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18920 | } |
| 18921 | |
| 18922 | // _loop1_64: param_with_default |
| 18923 | static asdl_seq * |
| 18924 | _loop1_64_rule(Parser *p) |
| 18925 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18926 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18927 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18928 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18929 | return NULL; |
| 18930 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18931 | void *_res = NULL; |
| 18932 | int _mark = p->mark; |
| 18933 | int _start_mark = p->mark; |
| 18934 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 18935 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18936 | p->error_indicator = 1; |
| 18937 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18938 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18939 | return NULL; |
| 18940 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18941 | ssize_t _children_capacity = 1; |
| 18942 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18943 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18944 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18945 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 18946 | return NULL; |
| 18947 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18948 | 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] | 18949 | NameDefaultPair* param_with_default_var; |
| 18950 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 18951 | (param_with_default_var = param_with_default_rule(p)) // param_with_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18952 | ) |
| 18953 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18954 | _res = param_with_default_var; |
| 18955 | if (_n == _children_capacity) { |
| 18956 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18957 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 18958 | if (!_new_children) { |
| 18959 | p->error_indicator = 1; |
| 18960 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18961 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18962 | return NULL; |
| 18963 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18964 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18965 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18966 | _children[_n++] = _res; |
| 18967 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18968 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18969 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18970 | D(fprintf(stderr, "%*c%s _loop1_64[%d-%d]: %s failed!\n", p->level, ' ', |
| 18971 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18972 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18973 | if (_n == 0 || p->error_indicator) { |
| 18974 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18975 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18976 | return NULL; |
| 18977 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18978 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 18979 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18980 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 18981 | p->error_indicator = 1; |
| 18982 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18983 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18984 | return NULL; |
| 18985 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18986 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 18987 | PyMem_Free(_children); |
| 18988 | _PyPegen_insert_memo(p, _start_mark, _loop1_64_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18989 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 18990 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18991 | } |
| 18992 | |
| 18993 | // _loop0_65: param_maybe_default |
| 18994 | static asdl_seq * |
| 18995 | _loop0_65_rule(Parser *p) |
| 18996 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18997 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 18998 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 18999 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19000 | return NULL; |
| 19001 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19002 | void *_res = NULL; |
| 19003 | int _mark = p->mark; |
| 19004 | int _start_mark = p->mark; |
| 19005 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19006 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19007 | p->error_indicator = 1; |
| 19008 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19009 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19010 | return NULL; |
| 19011 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19012 | ssize_t _children_capacity = 1; |
| 19013 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19014 | { // param_maybe_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19015 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19016 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19017 | return NULL; |
| 19018 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19019 | 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] | 19020 | NameDefaultPair* param_maybe_default_var; |
| 19021 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19022 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19023 | ) |
| 19024 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19025 | _res = param_maybe_default_var; |
| 19026 | if (_n == _children_capacity) { |
| 19027 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19028 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19029 | if (!_new_children) { |
| 19030 | p->error_indicator = 1; |
| 19031 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19032 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19033 | return NULL; |
| 19034 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19035 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19036 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19037 | _children[_n++] = _res; |
| 19038 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19039 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19040 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19041 | D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ', |
| 19042 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19043 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19044 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19045 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19046 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19047 | p->error_indicator = 1; |
| 19048 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19049 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19050 | return NULL; |
| 19051 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19052 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19053 | PyMem_Free(_children); |
| 19054 | _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19055 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19056 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19057 | } |
| 19058 | |
| 19059 | // _loop1_66: param_maybe_default |
| 19060 | static asdl_seq * |
| 19061 | _loop1_66_rule(Parser *p) |
| 19062 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19063 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19064 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19065 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19066 | return NULL; |
| 19067 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19068 | void *_res = NULL; |
| 19069 | int _mark = p->mark; |
| 19070 | int _start_mark = p->mark; |
| 19071 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19072 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19073 | p->error_indicator = 1; |
| 19074 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19075 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19076 | return NULL; |
| 19077 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19078 | ssize_t _children_capacity = 1; |
| 19079 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19080 | { // param_maybe_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19081 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19082 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19083 | return NULL; |
| 19084 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19085 | 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] | 19086 | NameDefaultPair* param_maybe_default_var; |
| 19087 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19088 | (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19089 | ) |
| 19090 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19091 | _res = param_maybe_default_var; |
| 19092 | if (_n == _children_capacity) { |
| 19093 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19094 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19095 | if (!_new_children) { |
| 19096 | p->error_indicator = 1; |
| 19097 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19098 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19099 | return NULL; |
| 19100 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19101 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19102 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19103 | _children[_n++] = _res; |
| 19104 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19105 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19106 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19107 | D(fprintf(stderr, "%*c%s _loop1_66[%d-%d]: %s failed!\n", p->level, ' ', |
| 19108 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19109 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19110 | if (_n == 0 || p->error_indicator) { |
| 19111 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19112 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19113 | return NULL; |
| 19114 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19115 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19116 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19117 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19118 | p->error_indicator = 1; |
| 19119 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19120 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19121 | return NULL; |
| 19122 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19123 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19124 | PyMem_Free(_children); |
| 19125 | _PyPegen_insert_memo(p, _start_mark, _loop1_66_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19126 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19127 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19128 | } |
| 19129 | |
| 19130 | // _loop1_67: ('@' named_expression NEWLINE) |
| 19131 | static asdl_seq * |
| 19132 | _loop1_67_rule(Parser *p) |
| 19133 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19134 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19135 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19136 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19137 | return NULL; |
| 19138 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19139 | void *_res = NULL; |
| 19140 | int _mark = p->mark; |
| 19141 | int _start_mark = p->mark; |
| 19142 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19143 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19144 | p->error_indicator = 1; |
| 19145 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19146 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19147 | return NULL; |
| 19148 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19149 | ssize_t _children_capacity = 1; |
| 19150 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19151 | { // ('@' named_expression NEWLINE) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19152 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19153 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19154 | return NULL; |
| 19155 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19156 | D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 19157 | void *_tmp_139_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19158 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 19159 | (_tmp_139_var = _tmp_139_rule(p)) // '@' named_expression NEWLINE |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19160 | ) |
| 19161 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 19162 | _res = _tmp_139_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19163 | if (_n == _children_capacity) { |
| 19164 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19165 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19166 | if (!_new_children) { |
| 19167 | p->error_indicator = 1; |
| 19168 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19169 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19170 | return NULL; |
| 19171 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19172 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19173 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19174 | _children[_n++] = _res; |
| 19175 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19176 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19177 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19178 | D(fprintf(stderr, "%*c%s _loop1_67[%d-%d]: %s failed!\n", p->level, ' ', |
| 19179 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19180 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19181 | if (_n == 0 || p->error_indicator) { |
| 19182 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19183 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19184 | return NULL; |
| 19185 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19186 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19187 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19188 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19189 | p->error_indicator = 1; |
| 19190 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19191 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19192 | return NULL; |
| 19193 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19194 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19195 | PyMem_Free(_children); |
| 19196 | _PyPegen_insert_memo(p, _start_mark, _loop1_67_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19197 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19198 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19199 | } |
| 19200 | |
| 19201 | // _tmp_68: '(' arguments? ')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19202 | static void * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19203 | _tmp_68_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19204 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19205 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19206 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19207 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19208 | return NULL; |
| 19209 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19210 | void * _res = NULL; |
| 19211 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19212 | { // '(' arguments? ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19213 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19214 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19215 | return NULL; |
| 19216 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19217 | 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] | 19218 | Token * _literal; |
| 19219 | Token * _literal_1; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19220 | void *z; |
| 19221 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19222 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19223 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19224 | (z = arguments_rule(p), 1) // arguments? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19225 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19226 | (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19227 | ) |
| 19228 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19229 | 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] | 19230 | _res = z; |
| 19231 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19232 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19233 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19234 | return NULL; |
| 19235 | } |
| 19236 | goto done; |
| 19237 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19238 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19239 | D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', |
| 19240 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19241 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19242 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19243 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19244 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19245 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19246 | } |
| 19247 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19248 | // _loop0_70: ',' star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19249 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19250 | _loop0_70_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19251 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19252 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19253 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19254 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19255 | return NULL; |
| 19256 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19257 | void *_res = NULL; |
| 19258 | int _mark = p->mark; |
| 19259 | int _start_mark = p->mark; |
| 19260 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19261 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19262 | p->error_indicator = 1; |
| 19263 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19264 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19265 | return NULL; |
| 19266 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19267 | ssize_t _children_capacity = 1; |
| 19268 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19269 | { // ',' star_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19270 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19271 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19272 | return NULL; |
| 19273 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19274 | 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] | 19275 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19276 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19277 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19278 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19279 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19280 | (elem = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19281 | ) |
| 19282 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19283 | _res = elem; |
| 19284 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19285 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19286 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19287 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19288 | return NULL; |
| 19289 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19290 | if (_n == _children_capacity) { |
| 19291 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19292 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19293 | if (!_new_children) { |
| 19294 | p->error_indicator = 1; |
| 19295 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19296 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19297 | return NULL; |
| 19298 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19299 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19300 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19301 | _children[_n++] = _res; |
| 19302 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19303 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19304 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19305 | D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ', |
| 19306 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19307 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19308 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19309 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19310 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19311 | p->error_indicator = 1; |
| 19312 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19313 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19314 | return NULL; |
| 19315 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19316 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19317 | PyMem_Free(_children); |
| 19318 | _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq); |
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 _seq; |
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 | // _gather_69: star_expression _loop0_70 |
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 | _gather_69_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 | asdl_seq * _res = NULL; |
| 19333 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19334 | { // star_expression _loop0_70 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19335 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19336 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19337 | return NULL; |
| 19338 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19339 | 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] | 19340 | expr_ty elem; |
| 19341 | asdl_seq * seq; |
| 19342 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19343 | (elem = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19344 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19345 | (seq = _loop0_70_rule(p)) // _loop0_70 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19346 | ) |
| 19347 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19348 | 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] | 19349 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19350 | goto done; |
| 19351 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19352 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19353 | D(fprintf(stderr, "%*c%s _gather_69[%d-%d]: %s failed!\n", p->level, ' ', |
| 19354 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expression _loop0_70")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19355 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19356 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19357 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19358 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19359 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19360 | } |
| 19361 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19362 | // _loop1_71: (',' star_expression) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19363 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19364 | _loop1_71_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19365 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19366 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19367 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19368 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19369 | return NULL; |
| 19370 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19371 | void *_res = NULL; |
| 19372 | int _mark = p->mark; |
| 19373 | int _start_mark = p->mark; |
| 19374 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19375 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19376 | p->error_indicator = 1; |
| 19377 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19378 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19379 | return NULL; |
| 19380 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19381 | ssize_t _children_capacity = 1; |
| 19382 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19383 | { // (',' star_expression) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19384 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19385 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19386 | return NULL; |
| 19387 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19388 | D(fprintf(stderr, "%*c> _loop1_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 19389 | void *_tmp_140_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19390 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 19391 | (_tmp_140_var = _tmp_140_rule(p)) // ',' star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19392 | ) |
| 19393 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 19394 | _res = _tmp_140_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19395 | if (_n == _children_capacity) { |
| 19396 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19397 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19398 | if (!_new_children) { |
| 19399 | p->error_indicator = 1; |
| 19400 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19401 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19402 | return NULL; |
| 19403 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19404 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19405 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19406 | _children[_n++] = _res; |
| 19407 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19408 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19409 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19410 | D(fprintf(stderr, "%*c%s _loop1_71[%d-%d]: %s failed!\n", p->level, ' ', |
| 19411 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19412 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19413 | if (_n == 0 || p->error_indicator) { |
| 19414 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19415 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19416 | return NULL; |
| 19417 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19418 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19419 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19420 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19421 | p->error_indicator = 1; |
| 19422 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19423 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19424 | return NULL; |
| 19425 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19426 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19427 | PyMem_Free(_children); |
| 19428 | _PyPegen_insert_memo(p, _start_mark, _loop1_71_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19429 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19430 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19431 | } |
| 19432 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19433 | // _loop0_73: ',' star_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19434 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19435 | _loop0_73_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19436 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19437 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19438 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19439 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19440 | return NULL; |
| 19441 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19442 | void *_res = NULL; |
| 19443 | int _mark = p->mark; |
| 19444 | int _start_mark = p->mark; |
| 19445 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19446 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19447 | p->error_indicator = 1; |
| 19448 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19449 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19450 | return NULL; |
| 19451 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19452 | ssize_t _children_capacity = 1; |
| 19453 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19454 | { // ',' star_named_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19455 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19456 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19457 | return NULL; |
| 19458 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19459 | 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] | 19460 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19461 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19462 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19463 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19464 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19465 | (elem = star_named_expression_rule(p)) // star_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19466 | ) |
| 19467 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19468 | _res = elem; |
| 19469 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19470 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19471 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19472 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19473 | return NULL; |
| 19474 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19475 | if (_n == _children_capacity) { |
| 19476 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19477 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19478 | if (!_new_children) { |
| 19479 | p->error_indicator = 1; |
| 19480 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19481 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19482 | return NULL; |
| 19483 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19484 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19485 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19486 | _children[_n++] = _res; |
| 19487 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19488 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19489 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19490 | D(fprintf(stderr, "%*c%s _loop0_73[%d-%d]: %s failed!\n", p->level, ' ', |
| 19491 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19492 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19493 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19494 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19495 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19496 | p->error_indicator = 1; |
| 19497 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19498 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19499 | return NULL; |
| 19500 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19501 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19502 | PyMem_Free(_children); |
| 19503 | _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); |
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 _seq; |
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 | // _gather_72: star_named_expression _loop0_73 |
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 | _gather_72_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 | asdl_seq * _res = NULL; |
| 19518 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19519 | { // star_named_expression _loop0_73 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19520 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19521 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19522 | return NULL; |
| 19523 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19524 | 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] | 19525 | expr_ty elem; |
| 19526 | asdl_seq * seq; |
| 19527 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19528 | (elem = star_named_expression_rule(p)) // star_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19529 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19530 | (seq = _loop0_73_rule(p)) // _loop0_73 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19531 | ) |
| 19532 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19533 | 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] | 19534 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19535 | goto done; |
| 19536 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19537 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19538 | D(fprintf(stderr, "%*c%s _gather_72[%d-%d]: %s failed!\n", p->level, ' ', |
| 19539 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_73")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19540 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19541 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19542 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19543 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19544 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19545 | } |
| 19546 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19547 | // _loop1_74: (',' expression) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19548 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 19549 | _loop1_74_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19550 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19551 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19552 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19553 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19554 | return NULL; |
| 19555 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19556 | void *_res = NULL; |
| 19557 | int _mark = p->mark; |
| 19558 | int _start_mark = p->mark; |
| 19559 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19560 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19561 | p->error_indicator = 1; |
| 19562 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19563 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19564 | return NULL; |
| 19565 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19566 | ssize_t _children_capacity = 1; |
| 19567 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19568 | { // (',' expression) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19569 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19570 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19571 | return NULL; |
| 19572 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19573 | D(fprintf(stderr, "%*c> _loop1_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 19574 | void *_tmp_141_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19575 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 19576 | (_tmp_141_var = _tmp_141_rule(p)) // ',' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19577 | ) |
| 19578 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 19579 | _res = _tmp_141_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19580 | if (_n == _children_capacity) { |
| 19581 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19582 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19583 | if (!_new_children) { |
| 19584 | p->error_indicator = 1; |
| 19585 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19586 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19587 | return NULL; |
| 19588 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19589 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19590 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19591 | _children[_n++] = _res; |
| 19592 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19593 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19594 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19595 | D(fprintf(stderr, "%*c%s _loop1_74[%d-%d]: %s failed!\n", p->level, ' ', |
| 19596 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19597 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19598 | if (_n == 0 || p->error_indicator) { |
| 19599 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19600 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19601 | return NULL; |
| 19602 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19603 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19604 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19605 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19606 | p->error_indicator = 1; |
| 19607 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19608 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19609 | return NULL; |
| 19610 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19611 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19612 | PyMem_Free(_children); |
| 19613 | _PyPegen_insert_memo(p, _start_mark, _loop1_74_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19614 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19615 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19616 | } |
| 19617 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19618 | // _loop0_75: lambda_param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19619 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19620 | _loop0_75_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19621 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19622 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19623 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19624 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19625 | return NULL; |
| 19626 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19627 | void *_res = NULL; |
| 19628 | int _mark = p->mark; |
| 19629 | int _start_mark = p->mark; |
| 19630 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19631 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19632 | p->error_indicator = 1; |
| 19633 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19634 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19635 | return NULL; |
| 19636 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19637 | ssize_t _children_capacity = 1; |
| 19638 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19639 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19640 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19641 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19642 | return NULL; |
| 19643 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19644 | 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] | 19645 | arg_ty lambda_param_no_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19646 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19647 | (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] | 19648 | ) |
| 19649 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19650 | _res = lambda_param_no_default_var; |
| 19651 | if (_n == _children_capacity) { |
| 19652 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19653 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19654 | if (!_new_children) { |
| 19655 | p->error_indicator = 1; |
| 19656 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19657 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19658 | return NULL; |
| 19659 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19660 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19661 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19662 | _children[_n++] = _res; |
| 19663 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19664 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19665 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19666 | D(fprintf(stderr, "%*c%s _loop0_75[%d-%d]: %s failed!\n", p->level, ' ', |
| 19667 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19668 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19669 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19670 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19671 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19672 | p->error_indicator = 1; |
| 19673 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19674 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19675 | return NULL; |
| 19676 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19677 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19678 | PyMem_Free(_children); |
| 19679 | _PyPegen_insert_memo(p, _start_mark, _loop0_75_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19680 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19681 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19682 | } |
| 19683 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19684 | // _loop0_76: lambda_param_with_default |
| 19685 | static asdl_seq * |
| 19686 | _loop0_76_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19687 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19688 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19689 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19690 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19691 | return NULL; |
| 19692 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19693 | void *_res = NULL; |
| 19694 | int _mark = p->mark; |
| 19695 | int _start_mark = p->mark; |
| 19696 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19697 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19698 | p->error_indicator = 1; |
| 19699 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19700 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19701 | return NULL; |
| 19702 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19703 | ssize_t _children_capacity = 1; |
| 19704 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19705 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19706 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19707 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19708 | return NULL; |
| 19709 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19710 | 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] | 19711 | NameDefaultPair* lambda_param_with_default_var; |
| 19712 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19713 | (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] | 19714 | ) |
| 19715 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19716 | _res = lambda_param_with_default_var; |
| 19717 | if (_n == _children_capacity) { |
| 19718 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19719 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19720 | if (!_new_children) { |
| 19721 | p->error_indicator = 1; |
| 19722 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19723 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19724 | return NULL; |
| 19725 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19726 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19727 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19728 | _children[_n++] = _res; |
| 19729 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19730 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19731 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19732 | D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ', |
| 19733 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19734 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19735 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19736 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19737 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19738 | p->error_indicator = 1; |
| 19739 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19740 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19741 | return NULL; |
| 19742 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19743 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19744 | PyMem_Free(_children); |
| 19745 | _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19746 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19747 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 19748 | } |
| 19749 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19750 | // _loop0_77: lambda_param_with_default |
| 19751 | static asdl_seq * |
| 19752 | _loop0_77_rule(Parser *p) |
| 19753 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19754 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19755 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19756 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19757 | return NULL; |
| 19758 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19759 | void *_res = NULL; |
| 19760 | int _mark = p->mark; |
| 19761 | int _start_mark = p->mark; |
| 19762 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19763 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19764 | p->error_indicator = 1; |
| 19765 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19766 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19767 | return NULL; |
| 19768 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19769 | ssize_t _children_capacity = 1; |
| 19770 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19771 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19772 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19773 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19774 | return NULL; |
| 19775 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19776 | 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] | 19777 | NameDefaultPair* lambda_param_with_default_var; |
| 19778 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19779 | (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] | 19780 | ) |
| 19781 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19782 | _res = lambda_param_with_default_var; |
| 19783 | if (_n == _children_capacity) { |
| 19784 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19785 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19786 | if (!_new_children) { |
| 19787 | p->error_indicator = 1; |
| 19788 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19789 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19790 | return NULL; |
| 19791 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19792 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19793 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19794 | _children[_n++] = _res; |
| 19795 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19796 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19797 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19798 | D(fprintf(stderr, "%*c%s _loop0_77[%d-%d]: %s failed!\n", p->level, ' ', |
| 19799 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19800 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19801 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19802 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19803 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19804 | p->error_indicator = 1; |
| 19805 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19806 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19807 | return NULL; |
| 19808 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19809 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19810 | PyMem_Free(_children); |
| 19811 | _PyPegen_insert_memo(p, _start_mark, _loop0_77_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19812 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19813 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19814 | } |
| 19815 | |
| 19816 | // _loop1_78: lambda_param_no_default |
| 19817 | static asdl_seq * |
| 19818 | _loop1_78_rule(Parser *p) |
| 19819 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19820 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19821 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19822 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19823 | return NULL; |
| 19824 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19825 | void *_res = NULL; |
| 19826 | int _mark = p->mark; |
| 19827 | int _start_mark = p->mark; |
| 19828 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19829 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19830 | p->error_indicator = 1; |
| 19831 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19832 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19833 | return NULL; |
| 19834 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19835 | ssize_t _children_capacity = 1; |
| 19836 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19837 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19838 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19839 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19840 | return NULL; |
| 19841 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19842 | 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] | 19843 | arg_ty lambda_param_no_default_var; |
| 19844 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19845 | (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] | 19846 | ) |
| 19847 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19848 | _res = lambda_param_no_default_var; |
| 19849 | if (_n == _children_capacity) { |
| 19850 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19851 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19852 | if (!_new_children) { |
| 19853 | p->error_indicator = 1; |
| 19854 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19855 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19856 | return NULL; |
| 19857 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19858 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19859 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19860 | _children[_n++] = _res; |
| 19861 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19862 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19863 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19864 | D(fprintf(stderr, "%*c%s _loop1_78[%d-%d]: %s failed!\n", p->level, ' ', |
| 19865 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19866 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19867 | if (_n == 0 || p->error_indicator) { |
| 19868 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19869 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19870 | return NULL; |
| 19871 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19872 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19873 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19874 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19875 | p->error_indicator = 1; |
| 19876 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19877 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19878 | return NULL; |
| 19879 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19880 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19881 | PyMem_Free(_children); |
| 19882 | _PyPegen_insert_memo(p, _start_mark, _loop1_78_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19883 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19884 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19885 | } |
| 19886 | |
| 19887 | // _loop0_79: lambda_param_with_default |
| 19888 | static asdl_seq * |
| 19889 | _loop0_79_rule(Parser *p) |
| 19890 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19891 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19892 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19893 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19894 | return NULL; |
| 19895 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19896 | void *_res = NULL; |
| 19897 | int _mark = p->mark; |
| 19898 | int _start_mark = p->mark; |
| 19899 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19900 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19901 | p->error_indicator = 1; |
| 19902 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19903 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19904 | return NULL; |
| 19905 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19906 | ssize_t _children_capacity = 1; |
| 19907 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19908 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19909 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19910 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19911 | return NULL; |
| 19912 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19913 | 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] | 19914 | NameDefaultPair* lambda_param_with_default_var; |
| 19915 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19916 | (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] | 19917 | ) |
| 19918 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19919 | _res = lambda_param_with_default_var; |
| 19920 | if (_n == _children_capacity) { |
| 19921 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19922 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19923 | if (!_new_children) { |
| 19924 | p->error_indicator = 1; |
| 19925 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19926 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19927 | return NULL; |
| 19928 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19929 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19930 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19931 | _children[_n++] = _res; |
| 19932 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19933 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19934 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19935 | D(fprintf(stderr, "%*c%s _loop0_79[%d-%d]: %s failed!\n", p->level, ' ', |
| 19936 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19937 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19938 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 19939 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19940 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19941 | p->error_indicator = 1; |
| 19942 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19943 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19944 | return NULL; |
| 19945 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19946 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 19947 | PyMem_Free(_children); |
| 19948 | _PyPegen_insert_memo(p, _start_mark, _loop0_79_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19949 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19950 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19951 | } |
| 19952 | |
| 19953 | // _loop1_80: lambda_param_with_default |
| 19954 | static asdl_seq * |
| 19955 | _loop1_80_rule(Parser *p) |
| 19956 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19957 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19958 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19959 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19960 | return NULL; |
| 19961 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19962 | void *_res = NULL; |
| 19963 | int _mark = p->mark; |
| 19964 | int _start_mark = p->mark; |
| 19965 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 19966 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19967 | p->error_indicator = 1; |
| 19968 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19969 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19970 | return NULL; |
| 19971 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19972 | ssize_t _children_capacity = 1; |
| 19973 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19974 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19975 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19976 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 19977 | return NULL; |
| 19978 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19979 | 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] | 19980 | NameDefaultPair* lambda_param_with_default_var; |
| 19981 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 19982 | (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] | 19983 | ) |
| 19984 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19985 | _res = lambda_param_with_default_var; |
| 19986 | if (_n == _children_capacity) { |
| 19987 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19988 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 19989 | if (!_new_children) { |
| 19990 | p->error_indicator = 1; |
| 19991 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 19992 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19993 | return NULL; |
| 19994 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 19995 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19996 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 19997 | _children[_n++] = _res; |
| 19998 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 19999 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20000 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20001 | D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', |
| 20002 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20003 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20004 | if (_n == 0 || p->error_indicator) { |
| 20005 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20006 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20007 | return NULL; |
| 20008 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20009 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20010 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20011 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20012 | p->error_indicator = 1; |
| 20013 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20014 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20015 | return NULL; |
| 20016 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20017 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20018 | PyMem_Free(_children); |
| 20019 | _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20020 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20021 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20022 | } |
| 20023 | |
| 20024 | // _loop1_81: lambda_param_no_default |
| 20025 | static asdl_seq * |
| 20026 | _loop1_81_rule(Parser *p) |
| 20027 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20028 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20029 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20030 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20031 | return NULL; |
| 20032 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20033 | void *_res = NULL; |
| 20034 | int _mark = p->mark; |
| 20035 | int _start_mark = p->mark; |
| 20036 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20037 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20038 | p->error_indicator = 1; |
| 20039 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20040 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20041 | return NULL; |
| 20042 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20043 | ssize_t _children_capacity = 1; |
| 20044 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20045 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20046 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20047 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20048 | return NULL; |
| 20049 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20050 | 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] | 20051 | arg_ty lambda_param_no_default_var; |
| 20052 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20053 | (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] | 20054 | ) |
| 20055 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20056 | _res = lambda_param_no_default_var; |
| 20057 | if (_n == _children_capacity) { |
| 20058 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20059 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20060 | if (!_new_children) { |
| 20061 | p->error_indicator = 1; |
| 20062 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20063 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20064 | return NULL; |
| 20065 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20066 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20067 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20068 | _children[_n++] = _res; |
| 20069 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20070 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20071 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20072 | D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', |
| 20073 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20074 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20075 | if (_n == 0 || p->error_indicator) { |
| 20076 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20077 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20078 | return NULL; |
| 20079 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20080 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20081 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20082 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20083 | p->error_indicator = 1; |
| 20084 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20085 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20086 | return NULL; |
| 20087 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20088 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20089 | PyMem_Free(_children); |
| 20090 | _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20091 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20092 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20093 | } |
| 20094 | |
| 20095 | // _loop1_82: lambda_param_no_default |
| 20096 | static asdl_seq * |
| 20097 | _loop1_82_rule(Parser *p) |
| 20098 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20099 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20100 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20101 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20102 | return NULL; |
| 20103 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20104 | void *_res = NULL; |
| 20105 | int _mark = p->mark; |
| 20106 | int _start_mark = p->mark; |
| 20107 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20108 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20109 | p->error_indicator = 1; |
| 20110 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20111 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20112 | return NULL; |
| 20113 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20114 | ssize_t _children_capacity = 1; |
| 20115 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20116 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20117 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20118 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20119 | return NULL; |
| 20120 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20121 | 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] | 20122 | arg_ty lambda_param_no_default_var; |
| 20123 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20124 | (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] | 20125 | ) |
| 20126 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20127 | _res = lambda_param_no_default_var; |
| 20128 | if (_n == _children_capacity) { |
| 20129 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20130 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20131 | if (!_new_children) { |
| 20132 | p->error_indicator = 1; |
| 20133 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20134 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20135 | return NULL; |
| 20136 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20137 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20138 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20139 | _children[_n++] = _res; |
| 20140 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20141 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20142 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20143 | D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ', |
| 20144 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20145 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20146 | if (_n == 0 || p->error_indicator) { |
| 20147 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20148 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20149 | return NULL; |
| 20150 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20151 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20152 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20153 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20154 | p->error_indicator = 1; |
| 20155 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20156 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20157 | return NULL; |
| 20158 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20159 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20160 | PyMem_Free(_children); |
| 20161 | _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20162 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20163 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20164 | } |
| 20165 | |
| 20166 | // _loop0_83: lambda_param_no_default |
| 20167 | static asdl_seq * |
| 20168 | _loop0_83_rule(Parser *p) |
| 20169 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20170 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20171 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20172 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20173 | return NULL; |
| 20174 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20175 | void *_res = NULL; |
| 20176 | int _mark = p->mark; |
| 20177 | int _start_mark = p->mark; |
| 20178 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20179 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20180 | p->error_indicator = 1; |
| 20181 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20182 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20183 | return NULL; |
| 20184 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20185 | ssize_t _children_capacity = 1; |
| 20186 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20187 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20188 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20189 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20190 | return NULL; |
| 20191 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20192 | 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] | 20193 | arg_ty lambda_param_no_default_var; |
| 20194 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20195 | (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] | 20196 | ) |
| 20197 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20198 | _res = lambda_param_no_default_var; |
| 20199 | if (_n == _children_capacity) { |
| 20200 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20201 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20202 | if (!_new_children) { |
| 20203 | p->error_indicator = 1; |
| 20204 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20205 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20206 | return NULL; |
| 20207 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20208 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20209 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20210 | _children[_n++] = _res; |
| 20211 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20212 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20213 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20214 | D(fprintf(stderr, "%*c%s _loop0_83[%d-%d]: %s failed!\n", p->level, ' ', |
| 20215 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20216 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20217 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20218 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20219 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20220 | p->error_indicator = 1; |
| 20221 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20222 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20223 | return NULL; |
| 20224 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20225 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20226 | PyMem_Free(_children); |
| 20227 | _PyPegen_insert_memo(p, _start_mark, _loop0_83_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20228 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20229 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20230 | } |
| 20231 | |
| 20232 | // _loop1_84: lambda_param_with_default |
| 20233 | static asdl_seq * |
| 20234 | _loop1_84_rule(Parser *p) |
| 20235 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20236 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20237 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20238 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20239 | return NULL; |
| 20240 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20241 | void *_res = NULL; |
| 20242 | int _mark = p->mark; |
| 20243 | int _start_mark = p->mark; |
| 20244 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20245 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20246 | p->error_indicator = 1; |
| 20247 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20248 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20249 | return NULL; |
| 20250 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20251 | ssize_t _children_capacity = 1; |
| 20252 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20253 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20254 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20255 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20256 | return NULL; |
| 20257 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20258 | 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] | 20259 | NameDefaultPair* lambda_param_with_default_var; |
| 20260 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20261 | (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] | 20262 | ) |
| 20263 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20264 | _res = lambda_param_with_default_var; |
| 20265 | if (_n == _children_capacity) { |
| 20266 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20267 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20268 | if (!_new_children) { |
| 20269 | p->error_indicator = 1; |
| 20270 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20271 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20272 | return NULL; |
| 20273 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20274 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20275 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20276 | _children[_n++] = _res; |
| 20277 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20278 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20279 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20280 | D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', |
| 20281 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20282 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20283 | if (_n == 0 || p->error_indicator) { |
| 20284 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20285 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20286 | return NULL; |
| 20287 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20288 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20289 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20290 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20291 | p->error_indicator = 1; |
| 20292 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20293 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20294 | return NULL; |
| 20295 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20296 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20297 | PyMem_Free(_children); |
| 20298 | _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20299 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20300 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20301 | } |
| 20302 | |
| 20303 | // _loop0_85: lambda_param_no_default |
| 20304 | static asdl_seq * |
| 20305 | _loop0_85_rule(Parser *p) |
| 20306 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20307 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20308 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20309 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20310 | return NULL; |
| 20311 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20312 | void *_res = NULL; |
| 20313 | int _mark = p->mark; |
| 20314 | int _start_mark = p->mark; |
| 20315 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20316 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20317 | p->error_indicator = 1; |
| 20318 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20319 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20320 | return NULL; |
| 20321 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20322 | ssize_t _children_capacity = 1; |
| 20323 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20324 | { // lambda_param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20325 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20326 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20327 | return NULL; |
| 20328 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20329 | 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] | 20330 | arg_ty lambda_param_no_default_var; |
| 20331 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20332 | (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] | 20333 | ) |
| 20334 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20335 | _res = lambda_param_no_default_var; |
| 20336 | if (_n == _children_capacity) { |
| 20337 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20338 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20339 | if (!_new_children) { |
| 20340 | p->error_indicator = 1; |
| 20341 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20342 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20343 | return NULL; |
| 20344 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20345 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20346 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20347 | _children[_n++] = _res; |
| 20348 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20349 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20350 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20351 | D(fprintf(stderr, "%*c%s _loop0_85[%d-%d]: %s failed!\n", p->level, ' ', |
| 20352 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20353 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20354 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20355 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20356 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20357 | p->error_indicator = 1; |
| 20358 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20359 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20360 | return NULL; |
| 20361 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20362 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20363 | PyMem_Free(_children); |
| 20364 | _PyPegen_insert_memo(p, _start_mark, _loop0_85_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20365 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20366 | return _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20367 | } |
| 20368 | |
| 20369 | // _loop1_86: lambda_param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20370 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 20371 | _loop1_86_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20372 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20373 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20374 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20375 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20376 | return NULL; |
| 20377 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20378 | void *_res = NULL; |
| 20379 | int _mark = p->mark; |
| 20380 | int _start_mark = p->mark; |
| 20381 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20382 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20383 | p->error_indicator = 1; |
| 20384 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20385 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20386 | return NULL; |
| 20387 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20388 | ssize_t _children_capacity = 1; |
| 20389 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20390 | { // lambda_param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20391 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20392 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20393 | return NULL; |
| 20394 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20395 | 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] | 20396 | NameDefaultPair* lambda_param_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20397 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20398 | (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] | 20399 | ) |
| 20400 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20401 | _res = lambda_param_with_default_var; |
| 20402 | if (_n == _children_capacity) { |
| 20403 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20404 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20405 | if (!_new_children) { |
| 20406 | p->error_indicator = 1; |
| 20407 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20408 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20409 | return NULL; |
| 20410 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20411 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20412 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20413 | _children[_n++] = _res; |
| 20414 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20415 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20416 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20417 | D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ', |
| 20418 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20419 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20420 | if (_n == 0 || p->error_indicator) { |
| 20421 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20422 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20423 | return NULL; |
| 20424 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20425 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20426 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20427 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20428 | p->error_indicator = 1; |
| 20429 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20430 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20431 | return NULL; |
| 20432 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20433 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20434 | PyMem_Free(_children); |
| 20435 | _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20436 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20437 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20438 | } |
| 20439 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20440 | // _loop0_87: lambda_param_maybe_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20441 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20442 | _loop0_87_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20443 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20444 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20445 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20446 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20447 | return NULL; |
| 20448 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20449 | void *_res = NULL; |
| 20450 | int _mark = p->mark; |
| 20451 | int _start_mark = p->mark; |
| 20452 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20453 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20454 | p->error_indicator = 1; |
| 20455 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20456 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20457 | return NULL; |
| 20458 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20459 | ssize_t _children_capacity = 1; |
| 20460 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20461 | { // lambda_param_maybe_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20462 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20463 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20464 | return NULL; |
| 20465 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20466 | 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] | 20467 | NameDefaultPair* lambda_param_maybe_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20468 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20469 | (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] | 20470 | ) |
| 20471 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20472 | _res = lambda_param_maybe_default_var; |
| 20473 | if (_n == _children_capacity) { |
| 20474 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20475 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20476 | if (!_new_children) { |
| 20477 | p->error_indicator = 1; |
| 20478 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20479 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20480 | return NULL; |
| 20481 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20482 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20483 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20484 | _children[_n++] = _res; |
| 20485 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20486 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20487 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20488 | D(fprintf(stderr, "%*c%s _loop0_87[%d-%d]: %s failed!\n", p->level, ' ', |
| 20489 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20490 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20491 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20492 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20493 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20494 | p->error_indicator = 1; |
| 20495 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20496 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20497 | return NULL; |
| 20498 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20499 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20500 | PyMem_Free(_children); |
| 20501 | _PyPegen_insert_memo(p, _start_mark, _loop0_87_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20502 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20503 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20504 | } |
| 20505 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20506 | // _loop1_88: lambda_param_maybe_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20507 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20508 | _loop1_88_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20509 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20510 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20511 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20512 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20513 | return NULL; |
| 20514 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20515 | void *_res = NULL; |
| 20516 | int _mark = p->mark; |
| 20517 | int _start_mark = p->mark; |
| 20518 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20519 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20520 | p->error_indicator = 1; |
| 20521 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20522 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20523 | return NULL; |
| 20524 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20525 | ssize_t _children_capacity = 1; |
| 20526 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20527 | { // lambda_param_maybe_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20528 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20529 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20530 | return NULL; |
| 20531 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20532 | 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] | 20533 | NameDefaultPair* lambda_param_maybe_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20534 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20535 | (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] | 20536 | ) |
| 20537 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20538 | _res = lambda_param_maybe_default_var; |
| 20539 | if (_n == _children_capacity) { |
| 20540 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20541 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20542 | if (!_new_children) { |
| 20543 | p->error_indicator = 1; |
| 20544 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20545 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20546 | return NULL; |
| 20547 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20548 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20549 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20550 | _children[_n++] = _res; |
| 20551 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20552 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20553 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20554 | D(fprintf(stderr, "%*c%s _loop1_88[%d-%d]: %s failed!\n", p->level, ' ', |
| 20555 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20556 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20557 | if (_n == 0 || p->error_indicator) { |
| 20558 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20559 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20560 | return NULL; |
| 20561 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20562 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20563 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20564 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20565 | p->error_indicator = 1; |
| 20566 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20567 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20568 | return NULL; |
| 20569 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20570 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20571 | PyMem_Free(_children); |
| 20572 | _PyPegen_insert_memo(p, _start_mark, _loop1_88_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20573 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20574 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20575 | } |
| 20576 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20577 | // _loop1_89: ('or' conjunction) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20578 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20579 | _loop1_89_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20580 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20581 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20582 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20583 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20584 | return NULL; |
| 20585 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20586 | void *_res = NULL; |
| 20587 | int _mark = p->mark; |
| 20588 | int _start_mark = p->mark; |
| 20589 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20590 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20591 | p->error_indicator = 1; |
| 20592 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20593 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20594 | return NULL; |
| 20595 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20596 | ssize_t _children_capacity = 1; |
| 20597 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20598 | { // ('or' conjunction) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20599 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20600 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20601 | return NULL; |
| 20602 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20603 | D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 20604 | void *_tmp_142_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20605 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 20606 | (_tmp_142_var = _tmp_142_rule(p)) // 'or' conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20607 | ) |
| 20608 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 20609 | _res = _tmp_142_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20610 | if (_n == _children_capacity) { |
| 20611 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20612 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20613 | if (!_new_children) { |
| 20614 | p->error_indicator = 1; |
| 20615 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20616 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20617 | return NULL; |
| 20618 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20619 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20620 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20621 | _children[_n++] = _res; |
| 20622 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20623 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20624 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20625 | D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ', |
| 20626 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20627 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20628 | if (_n == 0 || p->error_indicator) { |
| 20629 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20630 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20631 | return NULL; |
| 20632 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20633 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20634 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20635 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20636 | p->error_indicator = 1; |
| 20637 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20638 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20639 | return NULL; |
| 20640 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20641 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20642 | PyMem_Free(_children); |
| 20643 | _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20644 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20645 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20646 | } |
| 20647 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20648 | // _loop1_90: ('and' inversion) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20649 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20650 | _loop1_90_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20651 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20652 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20653 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20654 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20655 | return NULL; |
| 20656 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20657 | void *_res = NULL; |
| 20658 | int _mark = p->mark; |
| 20659 | int _start_mark = p->mark; |
| 20660 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20661 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20662 | p->error_indicator = 1; |
| 20663 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20664 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20665 | return NULL; |
| 20666 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20667 | ssize_t _children_capacity = 1; |
| 20668 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20669 | { // ('and' inversion) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20670 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20671 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20672 | return NULL; |
| 20673 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20674 | D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 20675 | void *_tmp_143_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20676 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 20677 | (_tmp_143_var = _tmp_143_rule(p)) // 'and' inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20678 | ) |
| 20679 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 20680 | _res = _tmp_143_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20681 | if (_n == _children_capacity) { |
| 20682 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20683 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20684 | if (!_new_children) { |
| 20685 | p->error_indicator = 1; |
| 20686 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20687 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20688 | return NULL; |
| 20689 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20690 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20691 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20692 | _children[_n++] = _res; |
| 20693 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20694 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20695 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20696 | D(fprintf(stderr, "%*c%s _loop1_90[%d-%d]: %s failed!\n", p->level, ' ', |
| 20697 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20698 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20699 | if (_n == 0 || p->error_indicator) { |
| 20700 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20701 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20702 | return NULL; |
| 20703 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20704 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20705 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20706 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20707 | p->error_indicator = 1; |
| 20708 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20709 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20710 | return NULL; |
| 20711 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20712 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20713 | PyMem_Free(_children); |
| 20714 | _PyPegen_insert_memo(p, _start_mark, _loop1_90_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20715 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20716 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20717 | } |
| 20718 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20719 | // _loop1_91: compare_op_bitwise_or_pair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20720 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20721 | _loop1_91_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20722 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20723 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20724 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20725 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20726 | return NULL; |
| 20727 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20728 | void *_res = NULL; |
| 20729 | int _mark = p->mark; |
| 20730 | int _start_mark = p->mark; |
| 20731 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20732 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20733 | p->error_indicator = 1; |
| 20734 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20735 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20736 | return NULL; |
| 20737 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20738 | ssize_t _children_capacity = 1; |
| 20739 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20740 | { // compare_op_bitwise_or_pair |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20741 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20742 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20743 | return NULL; |
| 20744 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20745 | 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] | 20746 | CmpopExprPair* compare_op_bitwise_or_pair_var; |
| 20747 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20748 | (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] | 20749 | ) |
| 20750 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20751 | _res = compare_op_bitwise_or_pair_var; |
| 20752 | if (_n == _children_capacity) { |
| 20753 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20754 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20755 | if (!_new_children) { |
| 20756 | p->error_indicator = 1; |
| 20757 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20758 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20759 | return NULL; |
| 20760 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20761 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20762 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20763 | _children[_n++] = _res; |
| 20764 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20765 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20766 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20767 | D(fprintf(stderr, "%*c%s _loop1_91[%d-%d]: %s failed!\n", p->level, ' ', |
| 20768 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20769 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20770 | if (_n == 0 || p->error_indicator) { |
| 20771 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20772 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20773 | return NULL; |
| 20774 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20775 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20776 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20777 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20778 | p->error_indicator = 1; |
| 20779 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20780 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20781 | return NULL; |
| 20782 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20783 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20784 | PyMem_Free(_children); |
| 20785 | _PyPegen_insert_memo(p, _start_mark, _loop1_91_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20786 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20787 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20788 | } |
| 20789 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20790 | // _tmp_92: '!=' |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20791 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20792 | _tmp_92_rule(Parser *p) |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20793 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20794 | D(p->level++); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20795 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20796 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20797 | return NULL; |
| 20798 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20799 | void * _res = NULL; |
| 20800 | int _mark = p->mark; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20801 | { // '!=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20802 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20803 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20804 | return NULL; |
| 20805 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20806 | 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] | 20807 | Token * tok; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20808 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20809 | (tok = _PyPegen_expect_token(p, 28)) // token='!=' |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20810 | ) |
| 20811 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20812 | 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] | 20813 | _res = _PyPegen_check_barry_as_flufl ( p ) ? NULL : tok; |
| 20814 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20815 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20816 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20817 | return NULL; |
| 20818 | } |
| 20819 | goto done; |
| 20820 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20821 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20822 | D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ', |
| 20823 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20824 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20825 | _res = NULL; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20826 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20827 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20828 | return _res; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 20829 | } |
| 20830 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20831 | // _loop0_94: ',' slice |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20832 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20833 | _loop0_94_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20834 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20835 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20836 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20837 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20838 | return NULL; |
| 20839 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20840 | void *_res = NULL; |
| 20841 | int _mark = p->mark; |
| 20842 | int _start_mark = p->mark; |
| 20843 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 20844 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20845 | p->error_indicator = 1; |
| 20846 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20847 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20848 | return NULL; |
| 20849 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20850 | ssize_t _children_capacity = 1; |
| 20851 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20852 | { // ',' slice |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20853 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20854 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20855 | return NULL; |
| 20856 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20857 | 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] | 20858 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20859 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20860 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20861 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20862 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20863 | (elem = slice_rule(p)) // slice |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20864 | ) |
| 20865 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20866 | _res = elem; |
| 20867 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20868 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20869 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20870 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20871 | return NULL; |
| 20872 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20873 | if (_n == _children_capacity) { |
| 20874 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20875 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 20876 | if (!_new_children) { |
| 20877 | p->error_indicator = 1; |
| 20878 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20879 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20880 | return NULL; |
| 20881 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20882 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20883 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20884 | _children[_n++] = _res; |
| 20885 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20886 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20887 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20888 | D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', |
| 20889 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20890 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20891 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 20892 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20893 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 20894 | p->error_indicator = 1; |
| 20895 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20896 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20897 | return NULL; |
| 20898 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20899 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 20900 | PyMem_Free(_children); |
| 20901 | _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); |
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 _seq; |
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 | // _gather_93: slice _loop0_94 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20907 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20908 | _gather_93_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 | asdl_seq * _res = NULL; |
| 20916 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20917 | { // slice _loop0_94 |
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> _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] | 20923 | expr_ty elem; |
| 20924 | asdl_seq * seq; |
| 20925 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20926 | (elem = slice_rule(p)) // slice |
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 | (seq = _loop0_94_rule(p)) // _loop0_94 |
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+ _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] | 20932 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20933 | goto done; |
| 20934 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20935 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20936 | D(fprintf(stderr, "%*c%s _gather_93[%d-%d]: %s failed!\n", p->level, ' ', |
| 20937 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_94")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20938 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20939 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20940 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20941 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20942 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20943 | } |
| 20944 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20945 | // _tmp_95: ':' expression? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20946 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20947 | _tmp_95_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20948 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20949 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20950 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20951 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20952 | return NULL; |
| 20953 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20954 | void * _res = NULL; |
| 20955 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20956 | { // ':' expression? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20957 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20958 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 20959 | return NULL; |
| 20960 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20961 | 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] | 20962 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20963 | void *d; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20964 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20965 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20966 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 20967 | (d = expression_rule(p), 1) // expression? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20968 | ) |
| 20969 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20970 | 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] | 20971 | _res = d; |
| 20972 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20973 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20974 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20975 | return NULL; |
| 20976 | } |
| 20977 | goto done; |
| 20978 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20979 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20980 | D(fprintf(stderr, "%*c%s _tmp_95[%d-%d]: %s failed!\n", p->level, ' ', |
| 20981 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20982 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20983 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20984 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20985 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20986 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20987 | } |
| 20988 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20989 | // _tmp_96: tuple | group | genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20990 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 20991 | _tmp_96_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20992 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20993 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20994 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 20995 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 20996 | return NULL; |
| 20997 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 20998 | void * _res = NULL; |
| 20999 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21000 | { // tuple |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21001 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21002 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21003 | return NULL; |
| 21004 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21005 | 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] | 21006 | expr_ty tuple_var; |
| 21007 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21008 | (tuple_var = tuple_rule(p)) // tuple |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21009 | ) |
| 21010 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21011 | 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] | 21012 | _res = tuple_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21013 | goto done; |
| 21014 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21015 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21016 | D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', |
| 21017 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21018 | } |
| 21019 | { // group |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21020 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21021 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21022 | return NULL; |
| 21023 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21024 | 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] | 21025 | expr_ty group_var; |
| 21026 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21027 | (group_var = group_rule(p)) // group |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21028 | ) |
| 21029 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21030 | 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] | 21031 | _res = group_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21032 | goto done; |
| 21033 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21034 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21035 | D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', |
| 21036 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21037 | } |
| 21038 | { // genexp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21039 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21040 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21041 | return NULL; |
| 21042 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21043 | 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] | 21044 | expr_ty genexp_var; |
| 21045 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21046 | (genexp_var = genexp_rule(p)) // genexp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21047 | ) |
| 21048 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21049 | 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] | 21050 | _res = genexp_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21051 | goto done; |
| 21052 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21053 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21054 | D(fprintf(stderr, "%*c%s _tmp_96[%d-%d]: %s failed!\n", p->level, ' ', |
| 21055 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21056 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21057 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21058 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21059 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21060 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21061 | } |
| 21062 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21063 | // _tmp_97: list | listcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21064 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21065 | _tmp_97_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21066 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21067 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21068 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21069 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21070 | return NULL; |
| 21071 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21072 | void * _res = NULL; |
| 21073 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21074 | { // list |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21075 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21076 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21077 | return NULL; |
| 21078 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21079 | 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] | 21080 | expr_ty list_var; |
| 21081 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21082 | (list_var = list_rule(p)) // list |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21083 | ) |
| 21084 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21085 | 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] | 21086 | _res = list_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21087 | goto done; |
| 21088 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21089 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21090 | D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ', |
| 21091 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21092 | } |
| 21093 | { // listcomp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21094 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21095 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21096 | return NULL; |
| 21097 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21098 | 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] | 21099 | expr_ty listcomp_var; |
| 21100 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21101 | (listcomp_var = listcomp_rule(p)) // listcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21102 | ) |
| 21103 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21104 | 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] | 21105 | _res = listcomp_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21106 | goto done; |
| 21107 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21108 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21109 | D(fprintf(stderr, "%*c%s _tmp_97[%d-%d]: %s failed!\n", p->level, ' ', |
| 21110 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21111 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21112 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21113 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21114 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21115 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21116 | } |
| 21117 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21118 | // _tmp_98: dict | set | dictcomp | setcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21119 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21120 | _tmp_98_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21121 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21122 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21123 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21124 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21125 | return NULL; |
| 21126 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21127 | void * _res = NULL; |
| 21128 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21129 | { // dict |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21130 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21131 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21132 | return NULL; |
| 21133 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21134 | 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] | 21135 | expr_ty dict_var; |
| 21136 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21137 | (dict_var = dict_rule(p)) // dict |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21138 | ) |
| 21139 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21140 | 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] | 21141 | _res = dict_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21142 | goto done; |
| 21143 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21144 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21145 | D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', |
| 21146 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21147 | } |
| 21148 | { // set |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21149 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21150 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21151 | return NULL; |
| 21152 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21153 | 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] | 21154 | expr_ty set_var; |
| 21155 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21156 | (set_var = set_rule(p)) // set |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21157 | ) |
| 21158 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21159 | 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] | 21160 | _res = set_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21161 | goto done; |
| 21162 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21163 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21164 | D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', |
| 21165 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21166 | } |
| 21167 | { // dictcomp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21168 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21169 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21170 | return NULL; |
| 21171 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21172 | 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] | 21173 | expr_ty dictcomp_var; |
| 21174 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21175 | (dictcomp_var = dictcomp_rule(p)) // dictcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21176 | ) |
| 21177 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21178 | 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] | 21179 | _res = dictcomp_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21180 | goto done; |
| 21181 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21182 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21183 | D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', |
| 21184 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21185 | } |
| 21186 | { // setcomp |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21187 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21188 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21189 | return NULL; |
| 21190 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21191 | 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] | 21192 | expr_ty setcomp_var; |
| 21193 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21194 | (setcomp_var = setcomp_rule(p)) // setcomp |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21195 | ) |
| 21196 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21197 | 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] | 21198 | _res = setcomp_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21199 | goto done; |
| 21200 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21201 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21202 | D(fprintf(stderr, "%*c%s _tmp_98[%d-%d]: %s failed!\n", p->level, ' ', |
| 21203 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21204 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21205 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21206 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21207 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21208 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21209 | } |
| 21210 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21211 | // _loop1_99: STRING |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21212 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21213 | _loop1_99_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21214 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21215 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21216 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21217 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21218 | return NULL; |
| 21219 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21220 | void *_res = NULL; |
| 21221 | int _mark = p->mark; |
| 21222 | int _start_mark = p->mark; |
| 21223 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21224 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21225 | p->error_indicator = 1; |
| 21226 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21227 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21228 | return NULL; |
| 21229 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21230 | ssize_t _children_capacity = 1; |
| 21231 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21232 | { // STRING |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21233 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21234 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21235 | return NULL; |
| 21236 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21237 | 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] | 21238 | expr_ty string_var; |
| 21239 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21240 | (string_var = _PyPegen_string_token(p)) // STRING |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21241 | ) |
| 21242 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21243 | _res = string_var; |
| 21244 | if (_n == _children_capacity) { |
| 21245 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21246 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21247 | if (!_new_children) { |
| 21248 | p->error_indicator = 1; |
| 21249 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21250 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21251 | return NULL; |
| 21252 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21253 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21254 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21255 | _children[_n++] = _res; |
| 21256 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21257 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21258 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21259 | D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', |
| 21260 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21261 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21262 | if (_n == 0 || p->error_indicator) { |
| 21263 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21264 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21265 | return NULL; |
| 21266 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21267 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21268 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21269 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21270 | p->error_indicator = 1; |
| 21271 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21272 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21273 | return NULL; |
| 21274 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21275 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21276 | PyMem_Free(_children); |
| 21277 | _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21278 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21279 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21280 | } |
| 21281 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21282 | // _tmp_100: star_named_expression ',' star_named_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21283 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21284 | _tmp_100_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21285 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21286 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21287 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21288 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21289 | return NULL; |
| 21290 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21291 | void * _res = NULL; |
| 21292 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21293 | { // star_named_expression ',' star_named_expressions? |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21294 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21295 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21296 | return NULL; |
| 21297 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21298 | 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] | 21299 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21300 | expr_ty y; |
| 21301 | void *z; |
| 21302 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21303 | (y = star_named_expression_rule(p)) // star_named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21304 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21305 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21306 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21307 | (z = star_named_expressions_rule(p), 1) // star_named_expressions? |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21308 | ) |
| 21309 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21310 | 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] | 21311 | _res = _PyPegen_seq_insert_in_front ( p , y , z ); |
| 21312 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21313 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21314 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21315 | return NULL; |
| 21316 | } |
| 21317 | goto done; |
| 21318 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21319 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21320 | D(fprintf(stderr, "%*c%s _tmp_100[%d-%d]: %s failed!\n", p->level, ' ', |
| 21321 | 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] | 21322 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21323 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21324 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21325 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21326 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21327 | } |
| 21328 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21329 | // _tmp_101: yield_expr | named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21330 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21331 | _tmp_101_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21332 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21333 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21334 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21335 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21336 | return NULL; |
| 21337 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21338 | void * _res = NULL; |
| 21339 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21340 | { // yield_expr |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21341 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21342 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21343 | return NULL; |
| 21344 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21345 | 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] | 21346 | expr_ty yield_expr_var; |
| 21347 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21348 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21349 | ) |
| 21350 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21351 | 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] | 21352 | _res = yield_expr_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21353 | goto done; |
| 21354 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21355 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21356 | D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ', |
| 21357 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21358 | } |
| 21359 | { // named_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21360 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21361 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21362 | return NULL; |
| 21363 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21364 | 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] | 21365 | expr_ty named_expression_var; |
| 21366 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21367 | (named_expression_var = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21368 | ) |
| 21369 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21370 | 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] | 21371 | _res = named_expression_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21372 | goto done; |
| 21373 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21374 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21375 | D(fprintf(stderr, "%*c%s _tmp_101[%d-%d]: %s failed!\n", p->level, ' ', |
| 21376 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21377 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21378 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21379 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21380 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21381 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21382 | } |
| 21383 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21384 | // _loop0_103: ',' double_starred_kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21385 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21386 | _loop0_103_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21387 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21388 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21389 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21390 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21391 | return NULL; |
| 21392 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21393 | void *_res = NULL; |
| 21394 | int _mark = p->mark; |
| 21395 | int _start_mark = p->mark; |
| 21396 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21397 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21398 | p->error_indicator = 1; |
| 21399 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21400 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21401 | return NULL; |
| 21402 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21403 | ssize_t _children_capacity = 1; |
| 21404 | ssize_t _n = 0; |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21405 | { // ',' double_starred_kvpair |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21406 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21407 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21408 | return NULL; |
| 21409 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21410 | 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] | 21411 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21412 | KeyValuePair* elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21413 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21414 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21415 | && |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21416 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21417 | ) |
| 21418 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21419 | _res = elem; |
| 21420 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21421 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21422 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21423 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21424 | return NULL; |
| 21425 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21426 | if (_n == _children_capacity) { |
| 21427 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21428 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21429 | if (!_new_children) { |
| 21430 | p->error_indicator = 1; |
| 21431 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21432 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21433 | return NULL; |
| 21434 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21435 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21436 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21437 | _children[_n++] = _res; |
| 21438 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21439 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21440 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21441 | D(fprintf(stderr, "%*c%s _loop0_103[%d-%d]: %s failed!\n", p->level, ' ', |
| 21442 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21443 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21444 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21445 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21446 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21447 | p->error_indicator = 1; |
| 21448 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21449 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21450 | return NULL; |
| 21451 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21452 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21453 | PyMem_Free(_children); |
| 21454 | _PyPegen_insert_memo(p, _start_mark, _loop0_103_type, _seq); |
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 _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21457 | } |
| 21458 | |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21459 | // _gather_102: double_starred_kvpair _loop0_103 |
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 | _gather_102_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 | asdl_seq * _res = NULL; |
| 21469 | int _mark = p->mark; |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21470 | { // double_starred_kvpair _loop0_103 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21471 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21472 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21473 | return NULL; |
| 21474 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21475 | 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] | 21476 | KeyValuePair* elem; |
| 21477 | asdl_seq * seq; |
| 21478 | if ( |
Miss Islington (bot) | d00aaf3 | 2020-05-21 15:58:16 -0700 | [diff] [blame] | 21479 | (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21480 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21481 | (seq = _loop0_103_rule(p)) // _loop0_103 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21482 | ) |
| 21483 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21484 | 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] | 21485 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21486 | goto done; |
| 21487 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21488 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21489 | D(fprintf(stderr, "%*c%s _gather_102[%d-%d]: %s failed!\n", p->level, ' ', |
| 21490 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_103")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21491 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21492 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21493 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21494 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21495 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21496 | } |
| 21497 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21498 | // _loop1_104: for_if_clause |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21499 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21500 | _loop1_104_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21501 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21502 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21503 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21504 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21505 | return NULL; |
| 21506 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21507 | void *_res = NULL; |
| 21508 | int _mark = p->mark; |
| 21509 | int _start_mark = p->mark; |
| 21510 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21511 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21512 | p->error_indicator = 1; |
| 21513 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21514 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21515 | return NULL; |
| 21516 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21517 | ssize_t _children_capacity = 1; |
| 21518 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21519 | { // for_if_clause |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21520 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21521 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21522 | return NULL; |
| 21523 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21524 | 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] | 21525 | comprehension_ty for_if_clause_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21526 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21527 | (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21528 | ) |
| 21529 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21530 | _res = for_if_clause_var; |
| 21531 | if (_n == _children_capacity) { |
| 21532 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21533 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21534 | if (!_new_children) { |
| 21535 | p->error_indicator = 1; |
| 21536 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21537 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21538 | return NULL; |
| 21539 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21540 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21541 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21542 | _children[_n++] = _res; |
| 21543 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21544 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21545 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21546 | D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ', |
| 21547 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21548 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21549 | if (_n == 0 || p->error_indicator) { |
| 21550 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21551 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21552 | return NULL; |
| 21553 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21554 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21555 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21556 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21557 | p->error_indicator = 1; |
| 21558 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21559 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21560 | return NULL; |
| 21561 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21562 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21563 | PyMem_Free(_children); |
| 21564 | _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21565 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21566 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 21567 | } |
| 21568 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21569 | // _loop0_105: ('if' disjunction) |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21570 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21571 | _loop0_105_rule(Parser *p) |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21572 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21573 | D(p->level++); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21574 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21575 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21576 | return NULL; |
| 21577 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21578 | void *_res = NULL; |
| 21579 | int _mark = p->mark; |
| 21580 | int _start_mark = p->mark; |
| 21581 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21582 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21583 | p->error_indicator = 1; |
| 21584 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21585 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21586 | return NULL; |
| 21587 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21588 | ssize_t _children_capacity = 1; |
| 21589 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21590 | { // ('if' disjunction) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21591 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21592 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21593 | return NULL; |
| 21594 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21595 | D(fprintf(stderr, "%*c> _loop0_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 21596 | void *_tmp_144_var; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21597 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 21598 | (_tmp_144_var = _tmp_144_rule(p)) // 'if' disjunction |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21599 | ) |
| 21600 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 21601 | _res = _tmp_144_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21602 | if (_n == _children_capacity) { |
| 21603 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21604 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21605 | if (!_new_children) { |
| 21606 | p->error_indicator = 1; |
| 21607 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21608 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21609 | return NULL; |
| 21610 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21611 | _children = _new_children; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21612 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21613 | _children[_n++] = _res; |
| 21614 | _mark = p->mark; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21615 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21616 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21617 | D(fprintf(stderr, "%*c%s _loop0_105[%d-%d]: %s failed!\n", p->level, ' ', |
| 21618 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21619 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21620 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21621 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21622 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21623 | p->error_indicator = 1; |
| 21624 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21625 | D(p->level--); |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21626 | return NULL; |
| 21627 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21628 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21629 | PyMem_Free(_children); |
| 21630 | _PyPegen_insert_memo(p, _start_mark, _loop0_105_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21631 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21632 | return _seq; |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 21633 | } |
| 21634 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21635 | // _loop0_106: ('if' disjunction) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21636 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21637 | _loop0_106_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21638 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21639 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21640 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21641 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21642 | return NULL; |
| 21643 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21644 | void *_res = NULL; |
| 21645 | int _mark = p->mark; |
| 21646 | int _start_mark = p->mark; |
| 21647 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21648 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21649 | p->error_indicator = 1; |
| 21650 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21651 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21652 | return NULL; |
| 21653 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21654 | ssize_t _children_capacity = 1; |
| 21655 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21656 | { // ('if' disjunction) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21657 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21658 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21659 | return NULL; |
| 21660 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21661 | D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 21662 | void *_tmp_145_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21663 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 21664 | (_tmp_145_var = _tmp_145_rule(p)) // 'if' disjunction |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21665 | ) |
| 21666 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 21667 | _res = _tmp_145_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21668 | if (_n == _children_capacity) { |
| 21669 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21670 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21671 | if (!_new_children) { |
| 21672 | p->error_indicator = 1; |
| 21673 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21674 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21675 | return NULL; |
| 21676 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21677 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21678 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21679 | _children[_n++] = _res; |
| 21680 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21681 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21682 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21683 | D(fprintf(stderr, "%*c%s _loop0_106[%d-%d]: %s failed!\n", p->level, ' ', |
| 21684 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21685 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21686 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21687 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21688 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21689 | p->error_indicator = 1; |
| 21690 | PyErr_NoMemory(); |
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 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21694 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21695 | PyMem_Free(_children); |
| 21696 | _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21697 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21698 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21699 | } |
| 21700 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21701 | // _tmp_107: ',' args |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21702 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21703 | _tmp_107_rule(Parser *p) |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21704 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21705 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21706 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21707 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21708 | return NULL; |
| 21709 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21710 | void * _res = NULL; |
| 21711 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21712 | { // ',' args |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21713 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21714 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21715 | return NULL; |
| 21716 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21717 | 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] | 21718 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21719 | expr_ty c; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21720 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21721 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21722 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21723 | (c = args_rule(p)) // args |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21724 | ) |
| 21725 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21726 | 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] | 21727 | _res = c; |
| 21728 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21729 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21730 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21731 | return NULL; |
| 21732 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21733 | goto done; |
| 21734 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21735 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21736 | D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n", p->level, ' ', |
| 21737 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21738 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21739 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21740 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21741 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21742 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 21743 | } |
| 21744 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21745 | // _tmp_108: ',' args |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21746 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21747 | _tmp_108_rule(Parser *p) |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21748 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21749 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21750 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21751 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21752 | return NULL; |
| 21753 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21754 | void * _res = NULL; |
| 21755 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21756 | { // ',' args |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21757 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21758 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21759 | return NULL; |
| 21760 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21761 | 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] | 21762 | Token * _literal; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21763 | expr_ty c; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21764 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21765 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21766 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21767 | (c = args_rule(p)) // args |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21768 | ) |
| 21769 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21770 | 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] | 21771 | _res = c; |
| 21772 | if (_res == NULL && PyErr_Occurred()) { |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21773 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21774 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21775 | return NULL; |
| 21776 | } |
| 21777 | goto done; |
| 21778 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21779 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21780 | D(fprintf(stderr, "%*c%s _tmp_108[%d-%d]: %s failed!\n", p->level, ' ', |
| 21781 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' args")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21782 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21783 | _res = NULL; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21784 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21785 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21786 | return _res; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 21787 | } |
| 21788 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21789 | // _loop0_110: ',' kwarg_or_starred |
| 21790 | static asdl_seq * |
| 21791 | _loop0_110_rule(Parser *p) |
| 21792 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21793 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21794 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21795 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21796 | return NULL; |
| 21797 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21798 | void *_res = NULL; |
| 21799 | int _mark = p->mark; |
| 21800 | int _start_mark = p->mark; |
| 21801 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21802 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21803 | p->error_indicator = 1; |
| 21804 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21805 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21806 | return NULL; |
| 21807 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21808 | ssize_t _children_capacity = 1; |
| 21809 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21810 | { // ',' kwarg_or_starred |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21811 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21812 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21813 | return NULL; |
| 21814 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21815 | 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] | 21816 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21817 | KeywordOrStarred* elem; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21818 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21819 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21820 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21821 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21822 | ) |
| 21823 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21824 | _res = elem; |
| 21825 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21826 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21827 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21828 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21829 | return NULL; |
| 21830 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21831 | if (_n == _children_capacity) { |
| 21832 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21833 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21834 | if (!_new_children) { |
| 21835 | p->error_indicator = 1; |
| 21836 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21837 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21838 | return NULL; |
| 21839 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21840 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21841 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21842 | _children[_n++] = _res; |
| 21843 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21844 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21845 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21846 | D(fprintf(stderr, "%*c%s _loop0_110[%d-%d]: %s failed!\n", p->level, ' ', |
| 21847 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21848 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21849 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21850 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21851 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21852 | p->error_indicator = 1; |
| 21853 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21854 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21855 | return NULL; |
| 21856 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21857 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21858 | PyMem_Free(_children); |
| 21859 | _PyPegen_insert_memo(p, _start_mark, _loop0_110_type, _seq); |
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 _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21862 | } |
| 21863 | |
| 21864 | // _gather_109: kwarg_or_starred _loop0_110 |
| 21865 | static asdl_seq * |
| 21866 | _gather_109_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 | asdl_seq * _res = NULL; |
| 21874 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21875 | { // kwarg_or_starred _loop0_110 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21876 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21877 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21878 | return NULL; |
| 21879 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21880 | 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] | 21881 | KeywordOrStarred* elem; |
| 21882 | asdl_seq * seq; |
| 21883 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21884 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21885 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21886 | (seq = _loop0_110_rule(p)) // _loop0_110 |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21887 | ) |
| 21888 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21889 | 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] | 21890 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21891 | goto done; |
| 21892 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21893 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21894 | D(fprintf(stderr, "%*c%s _gather_109[%d-%d]: %s failed!\n", p->level, ' ', |
| 21895 | 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] | 21896 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21897 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21898 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21899 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21900 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21901 | } |
| 21902 | |
| 21903 | // _loop0_112: ',' kwarg_or_double_starred |
| 21904 | static asdl_seq * |
| 21905 | _loop0_112_rule(Parser *p) |
| 21906 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21907 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21908 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21909 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21910 | return NULL; |
| 21911 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21912 | void *_res = NULL; |
| 21913 | int _mark = p->mark; |
| 21914 | int _start_mark = p->mark; |
| 21915 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 21916 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21917 | p->error_indicator = 1; |
| 21918 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21919 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21920 | return NULL; |
| 21921 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21922 | ssize_t _children_capacity = 1; |
| 21923 | ssize_t _n = 0; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21924 | { // ',' kwarg_or_double_starred |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21925 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21926 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21927 | return NULL; |
| 21928 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21929 | 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] | 21930 | Token * _literal; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21931 | KeywordOrStarred* elem; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21932 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21933 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21934 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21935 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21936 | ) |
| 21937 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21938 | _res = elem; |
| 21939 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21940 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21941 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21942 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21943 | return NULL; |
| 21944 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21945 | if (_n == _children_capacity) { |
| 21946 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21947 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 21948 | if (!_new_children) { |
| 21949 | p->error_indicator = 1; |
| 21950 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21951 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21952 | return NULL; |
| 21953 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21954 | _children = _new_children; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21955 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21956 | _children[_n++] = _res; |
| 21957 | _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21958 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21959 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21960 | D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', |
| 21961 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21962 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21963 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 21964 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21965 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 21966 | p->error_indicator = 1; |
| 21967 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21968 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21969 | return NULL; |
| 21970 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21971 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 21972 | PyMem_Free(_children); |
| 21973 | _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq); |
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 _seq; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21976 | } |
| 21977 | |
| 21978 | // _gather_111: kwarg_or_double_starred _loop0_112 |
| 21979 | static asdl_seq * |
| 21980 | _gather_111_rule(Parser *p) |
| 21981 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21982 | D(p->level++); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21983 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21984 | D(p->level--); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21985 | return NULL; |
| 21986 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 21987 | asdl_seq * _res = NULL; |
| 21988 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21989 | { // kwarg_or_double_starred _loop0_112 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21990 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21991 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 21992 | return NULL; |
| 21993 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 21994 | 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] | 21995 | KeywordOrStarred* elem; |
| 21996 | asdl_seq * seq; |
| 21997 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 21998 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 21999 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22000 | (seq = _loop0_112_rule(p)) // _loop0_112 |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22001 | ) |
| 22002 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22003 | 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] | 22004 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22005 | goto done; |
| 22006 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22007 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22008 | D(fprintf(stderr, "%*c%s _gather_111[%d-%d]: %s failed!\n", p->level, ' ', |
| 22009 | 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] | 22010 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22011 | _res = NULL; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22012 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22013 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22014 | return _res; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22015 | } |
| 22016 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22017 | // _loop0_114: ',' kwarg_or_starred |
Pablo Galindo | 2b74c83 | 2020-04-27 18:02:07 +0100 | [diff] [blame] | 22018 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22019 | _loop0_114_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22020 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22021 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22022 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22023 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22024 | return NULL; |
| 22025 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22026 | void *_res = NULL; |
| 22027 | int _mark = p->mark; |
| 22028 | int _start_mark = p->mark; |
| 22029 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22030 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22031 | p->error_indicator = 1; |
| 22032 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22033 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22034 | return NULL; |
| 22035 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22036 | ssize_t _children_capacity = 1; |
| 22037 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22038 | { // ',' kwarg_or_starred |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22039 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22040 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22041 | return NULL; |
| 22042 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22043 | 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] | 22044 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22045 | KeywordOrStarred* elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22046 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22047 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22048 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22049 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22050 | ) |
| 22051 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22052 | _res = elem; |
| 22053 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22054 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22055 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22056 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22057 | return NULL; |
| 22058 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22059 | if (_n == _children_capacity) { |
| 22060 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22061 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22062 | if (!_new_children) { |
| 22063 | p->error_indicator = 1; |
| 22064 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22065 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22066 | return NULL; |
| 22067 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22068 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22069 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22070 | _children[_n++] = _res; |
| 22071 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22072 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22073 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22074 | D(fprintf(stderr, "%*c%s _loop0_114[%d-%d]: %s failed!\n", p->level, ' ', |
| 22075 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22076 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22077 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22078 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22079 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22080 | p->error_indicator = 1; |
| 22081 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22082 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22083 | return NULL; |
| 22084 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22085 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22086 | PyMem_Free(_children); |
| 22087 | _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq); |
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 _seq; |
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 | // _gather_113: kwarg_or_starred _loop0_114 |
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 | _gather_113_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 | asdl_seq * _res = NULL; |
| 22102 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22103 | { // kwarg_or_starred _loop0_114 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22104 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22105 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22106 | return NULL; |
| 22107 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22108 | 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] | 22109 | KeywordOrStarred* elem; |
| 22110 | asdl_seq * seq; |
| 22111 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22112 | (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22113 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22114 | (seq = _loop0_114_rule(p)) // _loop0_114 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22115 | ) |
| 22116 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22117 | 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] | 22118 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22119 | goto done; |
| 22120 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22121 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22122 | D(fprintf(stderr, "%*c%s _gather_113[%d-%d]: %s failed!\n", p->level, ' ', |
| 22123 | 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] | 22124 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22125 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22126 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22127 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22128 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22129 | } |
| 22130 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22131 | // _loop0_116: ',' kwarg_or_double_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22132 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22133 | _loop0_116_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22134 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22135 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22136 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22137 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22138 | return NULL; |
| 22139 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22140 | void *_res = NULL; |
| 22141 | int _mark = p->mark; |
| 22142 | int _start_mark = p->mark; |
| 22143 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22144 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22145 | p->error_indicator = 1; |
| 22146 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22147 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22148 | return NULL; |
| 22149 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22150 | ssize_t _children_capacity = 1; |
| 22151 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22152 | { // ',' kwarg_or_double_starred |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22153 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22154 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22155 | return NULL; |
| 22156 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22157 | 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] | 22158 | Token * _literal; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22159 | KeywordOrStarred* elem; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22160 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22161 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22162 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22163 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22164 | ) |
| 22165 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22166 | _res = elem; |
| 22167 | if (_res == NULL && PyErr_Occurred()) { |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22168 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22169 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22170 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22171 | return NULL; |
| 22172 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22173 | if (_n == _children_capacity) { |
| 22174 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22175 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22176 | if (!_new_children) { |
| 22177 | p->error_indicator = 1; |
| 22178 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22179 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22180 | return NULL; |
| 22181 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22182 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22183 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22184 | _children[_n++] = _res; |
| 22185 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22186 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22187 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22188 | D(fprintf(stderr, "%*c%s _loop0_116[%d-%d]: %s failed!\n", p->level, ' ', |
| 22189 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22190 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22191 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22192 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22193 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22194 | p->error_indicator = 1; |
| 22195 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22196 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22197 | return NULL; |
| 22198 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22199 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22200 | PyMem_Free(_children); |
| 22201 | _PyPegen_insert_memo(p, _start_mark, _loop0_116_type, _seq); |
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 _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22204 | } |
| 22205 | |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22206 | // _gather_115: kwarg_or_double_starred _loop0_116 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22207 | static asdl_seq * |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22208 | _gather_115_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22209 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22210 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22211 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22212 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22213 | return NULL; |
| 22214 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22215 | asdl_seq * _res = NULL; |
| 22216 | int _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22217 | { // kwarg_or_double_starred _loop0_116 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22218 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22219 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22220 | return NULL; |
| 22221 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22222 | 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] | 22223 | KeywordOrStarred* elem; |
| 22224 | asdl_seq * seq; |
| 22225 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22226 | (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22227 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22228 | (seq = _loop0_116_rule(p)) // _loop0_116 |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22229 | ) |
| 22230 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22231 | 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] | 22232 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22233 | goto done; |
| 22234 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22235 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22236 | D(fprintf(stderr, "%*c%s _gather_115[%d-%d]: %s failed!\n", p->level, ' ', |
| 22237 | 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] | 22238 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22239 | _res = NULL; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22240 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22241 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22242 | return _res; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22243 | } |
| 22244 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22245 | // _loop0_117: (',' star_target) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22246 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22247 | _loop0_117_rule(Parser *p) |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22248 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22249 | D(p->level++); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22250 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22251 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22252 | return NULL; |
| 22253 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22254 | void *_res = NULL; |
| 22255 | int _mark = p->mark; |
| 22256 | int _start_mark = p->mark; |
| 22257 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22258 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22259 | p->error_indicator = 1; |
| 22260 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22261 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22262 | return NULL; |
| 22263 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22264 | ssize_t _children_capacity = 1; |
| 22265 | ssize_t _n = 0; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22266 | { // (',' star_target) |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22267 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22268 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22269 | return NULL; |
| 22270 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22271 | D(fprintf(stderr, "%*c> _loop0_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22272 | void *_tmp_146_var; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22273 | while ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22274 | (_tmp_146_var = _tmp_146_rule(p)) // ',' star_target |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22275 | ) |
| 22276 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22277 | _res = _tmp_146_var; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22278 | if (_n == _children_capacity) { |
| 22279 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22280 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22281 | if (!_new_children) { |
| 22282 | p->error_indicator = 1; |
| 22283 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22284 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22285 | return NULL; |
| 22286 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22287 | _children = _new_children; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22288 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22289 | _children[_n++] = _res; |
| 22290 | _mark = p->mark; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22291 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22292 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22293 | D(fprintf(stderr, "%*c%s _loop0_117[%d-%d]: %s failed!\n", p->level, ' ', |
| 22294 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22295 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22296 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22297 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22298 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22299 | p->error_indicator = 1; |
| 22300 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22301 | D(p->level--); |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22302 | return NULL; |
| 22303 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22304 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22305 | PyMem_Free(_children); |
| 22306 | _PyPegen_insert_memo(p, _start_mark, _loop0_117_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22307 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22308 | return _seq; |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22309 | } |
| 22310 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22311 | // _loop0_119: ',' star_target |
Lysandros Nikolaou | 3e0a6f3 | 2020-05-01 06:27:52 +0300 | [diff] [blame] | 22312 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22313 | _loop0_119_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22314 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22315 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22316 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22317 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22318 | return NULL; |
| 22319 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22320 | void *_res = NULL; |
| 22321 | int _mark = p->mark; |
| 22322 | int _start_mark = p->mark; |
| 22323 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22324 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22325 | p->error_indicator = 1; |
| 22326 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22327 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 22328 | return NULL; |
| 22329 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22330 | ssize_t _children_capacity = 1; |
| 22331 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22332 | { // ',' star_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22333 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22334 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22335 | return NULL; |
| 22336 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22337 | 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] | 22338 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22339 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22340 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22341 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22342 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22343 | (elem = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22344 | ) |
| 22345 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22346 | _res = elem; |
| 22347 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22348 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22349 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22350 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22351 | return NULL; |
| 22352 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22353 | if (_n == _children_capacity) { |
| 22354 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22355 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22356 | if (!_new_children) { |
| 22357 | p->error_indicator = 1; |
| 22358 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22359 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22360 | return NULL; |
| 22361 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22362 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22363 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22364 | _children[_n++] = _res; |
| 22365 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22366 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22367 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22368 | D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ', |
| 22369 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22370 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22371 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22372 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22373 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22374 | p->error_indicator = 1; |
| 22375 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22376 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22377 | return NULL; |
| 22378 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22379 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22380 | PyMem_Free(_children); |
| 22381 | _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq); |
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 _seq; |
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 | // _gather_118: star_target _loop0_119 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22387 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22388 | _gather_118_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 | asdl_seq * _res = NULL; |
| 22396 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22397 | { // star_target _loop0_119 |
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> _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] | 22403 | expr_ty elem; |
| 22404 | asdl_seq * seq; |
| 22405 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22406 | (elem = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22407 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22408 | (seq = _loop0_119_rule(p)) // _loop0_119 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22409 | ) |
| 22410 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22411 | 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] | 22412 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22413 | goto done; |
| 22414 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22415 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22416 | D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ', |
| 22417 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_119")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22418 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22419 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22420 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22421 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22422 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22423 | } |
| 22424 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22425 | // _tmp_120: !'*' star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22426 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22427 | _tmp_120_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22428 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22429 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22430 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22431 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22432 | return NULL; |
| 22433 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22434 | void * _res = NULL; |
| 22435 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22436 | { // !'*' star_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22437 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22438 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22439 | return NULL; |
| 22440 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22441 | 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] | 22442 | expr_ty star_target_var; |
| 22443 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22444 | _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22445 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22446 | (star_target_var = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22447 | ) |
| 22448 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22449 | 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] | 22450 | _res = star_target_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22451 | goto done; |
| 22452 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22453 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22454 | D(fprintf(stderr, "%*c%s _tmp_120[%d-%d]: %s failed!\n", p->level, ' ', |
| 22455 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22456 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22457 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22458 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22459 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22460 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22461 | } |
| 22462 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22463 | // _loop0_122: ',' del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22464 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22465 | _loop0_122_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22466 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22467 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22468 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22469 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22470 | return NULL; |
| 22471 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22472 | void *_res = NULL; |
| 22473 | int _mark = p->mark; |
| 22474 | int _start_mark = p->mark; |
| 22475 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22476 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22477 | p->error_indicator = 1; |
| 22478 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22479 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22480 | return NULL; |
| 22481 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22482 | ssize_t _children_capacity = 1; |
| 22483 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22484 | { // ',' del_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22485 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22486 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22487 | return NULL; |
| 22488 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22489 | 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] | 22490 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22491 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22492 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22493 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22494 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22495 | (elem = del_target_rule(p)) // del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22496 | ) |
| 22497 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22498 | _res = elem; |
| 22499 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22500 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22501 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22502 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22503 | return NULL; |
| 22504 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22505 | if (_n == _children_capacity) { |
| 22506 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22507 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22508 | if (!_new_children) { |
| 22509 | p->error_indicator = 1; |
| 22510 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22511 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22512 | return NULL; |
| 22513 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22514 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22515 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22516 | _children[_n++] = _res; |
| 22517 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22518 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22519 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22520 | D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ', |
| 22521 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22522 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22523 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22524 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22525 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22526 | p->error_indicator = 1; |
| 22527 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22528 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22529 | return NULL; |
| 22530 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22531 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22532 | PyMem_Free(_children); |
| 22533 | _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); |
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 _seq; |
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 | // _gather_121: del_target _loop0_122 |
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 | _gather_121_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 | asdl_seq * _res = NULL; |
| 22548 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22549 | { // del_target _loop0_122 |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22550 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22551 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22552 | return NULL; |
| 22553 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22554 | 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] | 22555 | expr_ty elem; |
| 22556 | asdl_seq * seq; |
| 22557 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22558 | (elem = del_target_rule(p)) // del_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22559 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22560 | (seq = _loop0_122_rule(p)) // _loop0_122 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22561 | ) |
| 22562 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22563 | 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] | 22564 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22565 | goto done; |
| 22566 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22567 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22568 | D(fprintf(stderr, "%*c%s _gather_121[%d-%d]: %s failed!\n", p->level, ' ', |
| 22569 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_122")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22570 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22571 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22572 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22573 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22574 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22575 | } |
| 22576 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22577 | // _loop0_124: ',' target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22578 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22579 | _loop0_124_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22580 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22581 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22582 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22583 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22584 | return NULL; |
| 22585 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22586 | void *_res = NULL; |
| 22587 | int _mark = p->mark; |
| 22588 | int _start_mark = p->mark; |
| 22589 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22590 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22591 | p->error_indicator = 1; |
| 22592 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22593 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22594 | return NULL; |
| 22595 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22596 | ssize_t _children_capacity = 1; |
| 22597 | ssize_t _n = 0; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22598 | { // ',' target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22599 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22600 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22601 | return NULL; |
| 22602 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22603 | 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] | 22604 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22605 | expr_ty elem; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22606 | while ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22607 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22608 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22609 | (elem = target_rule(p)) // target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22610 | ) |
| 22611 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22612 | _res = elem; |
| 22613 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22614 | p->error_indicator = 1; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22615 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22616 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22617 | return NULL; |
| 22618 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22619 | if (_n == _children_capacity) { |
| 22620 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22621 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22622 | if (!_new_children) { |
| 22623 | p->error_indicator = 1; |
| 22624 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22625 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22626 | return NULL; |
| 22627 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22628 | _children = _new_children; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22629 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22630 | _children[_n++] = _res; |
| 22631 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22632 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22633 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22634 | D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ', |
| 22635 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22636 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22637 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22638 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22639 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22640 | p->error_indicator = 1; |
| 22641 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22642 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22643 | return NULL; |
| 22644 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22645 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22646 | PyMem_Free(_children); |
| 22647 | _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq); |
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 _seq; |
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 | // _gather_123: target _loop0_124 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22653 | static asdl_seq * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22654 | _gather_123_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 | asdl_seq * _res = NULL; |
| 22662 | int _mark = p->mark; |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22663 | { // target _loop0_124 |
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> _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] | 22669 | expr_ty elem; |
| 22670 | asdl_seq * seq; |
| 22671 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22672 | (elem = target_rule(p)) // target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22673 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22674 | (seq = _loop0_124_rule(p)) // _loop0_124 |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22675 | ) |
| 22676 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22677 | 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] | 22678 | _res = _PyPegen_seq_insert_in_front(p, elem, seq); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22679 | goto done; |
| 22680 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22681 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22682 | D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ', |
| 22683 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "target _loop0_124")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22684 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22685 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22686 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22687 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22688 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22689 | } |
| 22690 | |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22691 | // _tmp_125: args | expression for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22692 | static void * |
Guido van Rossum | 3941d97 | 2020-05-01 09:42:03 -0700 | [diff] [blame] | 22693 | _tmp_125_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22694 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22695 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22696 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22697 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22698 | return NULL; |
| 22699 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22700 | void * _res = NULL; |
| 22701 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22702 | { // args |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22703 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22704 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22705 | return NULL; |
| 22706 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22707 | 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] | 22708 | expr_ty args_var; |
| 22709 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22710 | (args_var = args_rule(p)) // args |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22711 | ) |
| 22712 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22713 | 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] | 22714 | _res = args_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22715 | goto done; |
| 22716 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22717 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22718 | D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', |
| 22719 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22720 | } |
| 22721 | { // expression for_if_clauses |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22722 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22723 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22724 | return NULL; |
| 22725 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22726 | 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] | 22727 | expr_ty expression_var; |
| 22728 | asdl_seq* for_if_clauses_var; |
| 22729 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22730 | (expression_var = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22731 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22732 | (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22733 | ) |
| 22734 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22735 | 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] | 22736 | _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22737 | goto done; |
| 22738 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22739 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22740 | D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ', |
| 22741 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22742 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22743 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22744 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22745 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22746 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22747 | } |
| 22748 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22749 | // _loop0_126: star_named_expressions |
| 22750 | static asdl_seq * |
| 22751 | _loop0_126_rule(Parser *p) |
| 22752 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22753 | D(p->level++); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22754 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22755 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22756 | return NULL; |
| 22757 | } |
| 22758 | void *_res = NULL; |
| 22759 | int _mark = p->mark; |
| 22760 | int _start_mark = p->mark; |
| 22761 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22762 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22763 | p->error_indicator = 1; |
| 22764 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22765 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22766 | return NULL; |
| 22767 | } |
| 22768 | ssize_t _children_capacity = 1; |
| 22769 | ssize_t _n = 0; |
| 22770 | { // star_named_expressions |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22771 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22772 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22773 | return NULL; |
| 22774 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22775 | 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] | 22776 | asdl_seq* star_named_expressions_var; |
| 22777 | while ( |
| 22778 | (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions |
| 22779 | ) |
| 22780 | { |
| 22781 | _res = star_named_expressions_var; |
| 22782 | if (_n == _children_capacity) { |
| 22783 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22784 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22785 | if (!_new_children) { |
| 22786 | p->error_indicator = 1; |
| 22787 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22788 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22789 | return NULL; |
| 22790 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22791 | _children = _new_children; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22792 | } |
| 22793 | _children[_n++] = _res; |
| 22794 | _mark = p->mark; |
| 22795 | } |
| 22796 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22797 | D(fprintf(stderr, "%*c%s _loop0_126[%d-%d]: %s failed!\n", p->level, ' ', |
| 22798 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22799 | } |
| 22800 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22801 | if (!_seq) { |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22802 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 22803 | p->error_indicator = 1; |
| 22804 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22805 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22806 | return NULL; |
| 22807 | } |
| 22808 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22809 | PyMem_Free(_children); |
| 22810 | _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22811 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22812 | return _seq; |
| 22813 | } |
| 22814 | |
| 22815 | // _tmp_127: '=' annotated_rhs |
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_127_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 | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22826 | { // '=' annotated_rhs |
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_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22832 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22833 | expr_ty annotated_rhs_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22834 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22835 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22836 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 22837 | (annotated_rhs_var = annotated_rhs_rule(p)) // annotated_rhs |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22838 | ) |
| 22839 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22840 | 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] | 22841 | _res = _PyPegen_dummy_name(p, _literal, annotated_rhs_var); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22842 | goto done; |
| 22843 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22844 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22845 | D(fprintf(stderr, "%*c%s _tmp_127[%d-%d]: %s failed!\n", p->level, ' ', |
| 22846 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22847 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22848 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22849 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22850 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22851 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22852 | } |
| 22853 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22854 | // _loop0_128: (star_targets '=') |
| 22855 | static asdl_seq * |
| 22856 | _loop0_128_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22857 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22858 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22859 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22860 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22861 | return NULL; |
| 22862 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22863 | void *_res = NULL; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22864 | int _mark = p->mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22865 | int _start_mark = p->mark; |
| 22866 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22867 | if (!_children) { |
| 22868 | p->error_indicator = 1; |
| 22869 | PyErr_NoMemory(); |
| 22870 | D(p->level--); |
| 22871 | return NULL; |
| 22872 | } |
| 22873 | ssize_t _children_capacity = 1; |
| 22874 | ssize_t _n = 0; |
| 22875 | { // (star_targets '=') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22876 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22877 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22878 | return NULL; |
| 22879 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22880 | D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
| 22881 | void *_tmp_147_var; |
| 22882 | while ( |
| 22883 | (_tmp_147_var = _tmp_147_rule(p)) // star_targets '=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22884 | ) |
| 22885 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22886 | _res = _tmp_147_var; |
| 22887 | if (_n == _children_capacity) { |
| 22888 | _children_capacity *= 2; |
| 22889 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22890 | if (!_new_children) { |
| 22891 | p->error_indicator = 1; |
| 22892 | PyErr_NoMemory(); |
| 22893 | D(p->level--); |
| 22894 | return NULL; |
| 22895 | } |
| 22896 | _children = _new_children; |
| 22897 | } |
| 22898 | _children[_n++] = _res; |
| 22899 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22900 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22901 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22902 | D(fprintf(stderr, "%*c%s _loop0_128[%d-%d]: %s failed!\n", p->level, ' ', |
| 22903 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22904 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22905 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22906 | if (!_seq) { |
| 22907 | PyMem_Free(_children); |
| 22908 | p->error_indicator = 1; |
| 22909 | PyErr_NoMemory(); |
| 22910 | D(p->level--); |
| 22911 | return NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22912 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22913 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22914 | PyMem_Free(_children); |
| 22915 | _PyPegen_insert_memo(p, _start_mark, _loop0_128_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22916 | D(p->level--); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22917 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22918 | } |
| 22919 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22920 | // _loop0_129: (star_targets '=') |
| 22921 | static asdl_seq * |
| 22922 | _loop0_129_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22923 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22924 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22925 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22926 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22927 | return NULL; |
| 22928 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22929 | void *_res = NULL; |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22930 | int _mark = p->mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22931 | int _start_mark = p->mark; |
| 22932 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 22933 | if (!_children) { |
| 22934 | p->error_indicator = 1; |
| 22935 | PyErr_NoMemory(); |
| 22936 | D(p->level--); |
| 22937 | return NULL; |
| 22938 | } |
| 22939 | ssize_t _children_capacity = 1; |
| 22940 | ssize_t _n = 0; |
| 22941 | { // (star_targets '=') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22942 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22943 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 22944 | return NULL; |
| 22945 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22946 | D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); |
| 22947 | void *_tmp_148_var; |
| 22948 | while ( |
| 22949 | (_tmp_148_var = _tmp_148_rule(p)) // star_targets '=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22950 | ) |
| 22951 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22952 | _res = _tmp_148_var; |
| 22953 | if (_n == _children_capacity) { |
| 22954 | _children_capacity *= 2; |
| 22955 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 22956 | if (!_new_children) { |
| 22957 | p->error_indicator = 1; |
| 22958 | PyErr_NoMemory(); |
| 22959 | D(p->level--); |
| 22960 | return NULL; |
| 22961 | } |
| 22962 | _children = _new_children; |
| 22963 | } |
| 22964 | _children[_n++] = _res; |
| 22965 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22966 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22967 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22968 | D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ', |
| 22969 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22970 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22971 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 22972 | if (!_seq) { |
| 22973 | PyMem_Free(_children); |
| 22974 | p->error_indicator = 1; |
| 22975 | PyErr_NoMemory(); |
| 22976 | D(p->level--); |
| 22977 | return NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22978 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22979 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 22980 | PyMem_Free(_children); |
| 22981 | _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22982 | D(p->level--); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22983 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22984 | } |
| 22985 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22986 | // _tmp_130: yield_expr | star_expressions |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22987 | static void * |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 22988 | _tmp_130_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22989 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22990 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22991 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 22992 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 22993 | return NULL; |
| 22994 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 22995 | void * _res = NULL; |
| 22996 | int _mark = p->mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 22997 | { // yield_expr |
| 22998 | if (p->error_indicator) { |
| 22999 | D(p->level--); |
| 23000 | return NULL; |
| 23001 | } |
| 23002 | D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 23003 | expr_ty yield_expr_var; |
| 23004 | if ( |
| 23005 | (yield_expr_var = yield_expr_rule(p)) // yield_expr |
| 23006 | ) |
| 23007 | { |
| 23008 | D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); |
| 23009 | _res = yield_expr_var; |
| 23010 | goto done; |
| 23011 | } |
| 23012 | p->mark = _mark; |
| 23013 | D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ', |
| 23014 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); |
| 23015 | } |
| 23016 | { // star_expressions |
| 23017 | if (p->error_indicator) { |
| 23018 | D(p->level--); |
| 23019 | return NULL; |
| 23020 | } |
| 23021 | D(fprintf(stderr, "%*c> _tmp_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 23022 | expr_ty star_expressions_var; |
| 23023 | if ( |
| 23024 | (star_expressions_var = star_expressions_rule(p)) // star_expressions |
| 23025 | ) |
| 23026 | { |
| 23027 | D(fprintf(stderr, "%*c+ _tmp_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); |
| 23028 | _res = star_expressions_var; |
| 23029 | goto done; |
| 23030 | } |
| 23031 | p->mark = _mark; |
| 23032 | D(fprintf(stderr, "%*c%s _tmp_130[%d-%d]: %s failed!\n", p->level, ' ', |
| 23033 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); |
| 23034 | } |
| 23035 | _res = NULL; |
| 23036 | done: |
| 23037 | D(p->level--); |
| 23038 | return _res; |
| 23039 | } |
| 23040 | |
| 23041 | // _tmp_131: '[' | '(' | '{' |
| 23042 | static void * |
| 23043 | _tmp_131_rule(Parser *p) |
| 23044 | { |
| 23045 | D(p->level++); |
| 23046 | if (p->error_indicator) { |
| 23047 | D(p->level--); |
| 23048 | return NULL; |
| 23049 | } |
| 23050 | void * _res = NULL; |
| 23051 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23052 | { // '[' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23053 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23054 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23055 | return NULL; |
| 23056 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23057 | D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23058 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23059 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23060 | (_literal = _PyPegen_expect_token(p, 9)) // token='[' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23061 | ) |
| 23062 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23063 | D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23064 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23065 | goto done; |
| 23066 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23067 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23068 | D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23069 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23070 | } |
| 23071 | { // '(' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23072 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23073 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23074 | return NULL; |
| 23075 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23076 | D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23077 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23078 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23079 | (_literal = _PyPegen_expect_token(p, 7)) // token='(' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23080 | ) |
| 23081 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23082 | D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23083 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23084 | goto done; |
| 23085 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23086 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23087 | D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23088 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23089 | } |
| 23090 | { // '{' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23091 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23092 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23093 | return NULL; |
| 23094 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23095 | D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23096 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23097 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23098 | (_literal = _PyPegen_expect_token(p, 25)) // token='{' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23099 | ) |
| 23100 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23101 | D(fprintf(stderr, "%*c+ _tmp_131[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23102 | _res = _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23103 | goto done; |
| 23104 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23105 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23106 | D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23107 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23108 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23109 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23110 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23111 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23112 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23113 | } |
| 23114 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23115 | // _loop0_132: param_no_default |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23116 | static asdl_seq * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23117 | _loop0_132_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23118 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23119 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23120 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23121 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23122 | return NULL; |
| 23123 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23124 | void *_res = NULL; |
| 23125 | int _mark = p->mark; |
| 23126 | int _start_mark = p->mark; |
| 23127 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23128 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23129 | p->error_indicator = 1; |
| 23130 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23131 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23132 | return NULL; |
| 23133 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23134 | ssize_t _children_capacity = 1; |
| 23135 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23136 | { // param_no_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23137 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23138 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23139 | return NULL; |
| 23140 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23141 | D(fprintf(stderr, "%*c> _loop0_132[%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] | 23142 | arg_ty param_no_default_var; |
| 23143 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23144 | (param_no_default_var = param_no_default_rule(p)) // param_no_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23145 | ) |
| 23146 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23147 | _res = param_no_default_var; |
| 23148 | if (_n == _children_capacity) { |
| 23149 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23150 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23151 | if (!_new_children) { |
| 23152 | p->error_indicator = 1; |
| 23153 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23154 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23155 | return NULL; |
| 23156 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23157 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23158 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23159 | _children[_n++] = _res; |
| 23160 | _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23161 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23162 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23163 | D(fprintf(stderr, "%*c%s _loop0_132[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23164 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23165 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23166 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 23167 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23168 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23169 | p->error_indicator = 1; |
| 23170 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23171 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23172 | return NULL; |
| 23173 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23174 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 23175 | PyMem_Free(_children); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23176 | _PyPegen_insert_memo(p, _start_mark, _loop0_132_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23177 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23178 | return _seq; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23179 | } |
| 23180 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23181 | // _tmp_133: slash_with_default | param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23182 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23183 | _tmp_133_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23184 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23185 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23186 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23187 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23188 | return NULL; |
| 23189 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23190 | void * _res = NULL; |
| 23191 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23192 | { // slash_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23193 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23194 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23195 | return NULL; |
| 23196 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23197 | D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23198 | SlashWithDefault* slash_with_default_var; |
| 23199 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23200 | (slash_with_default_var = slash_with_default_rule(p)) // slash_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23201 | ) |
| 23202 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23203 | D(fprintf(stderr, "%*c+ _tmp_133[%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] | 23204 | _res = slash_with_default_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23205 | goto done; |
| 23206 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23207 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23208 | D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23209 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23210 | } |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23211 | { // param_with_default+ |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23212 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23213 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23214 | return NULL; |
| 23215 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23216 | D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); |
| 23217 | asdl_seq * _loop1_149_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23218 | if ( |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23219 | (_loop1_149_var = _loop1_149_rule(p)) // param_with_default+ |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23220 | ) |
| 23221 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23222 | D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); |
| 23223 | _res = _loop1_149_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [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) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23227 | D(fprintf(stderr, "%*c%s _tmp_133[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23228 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23229 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23230 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [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; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23234 | } |
| 23235 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23236 | // _tmp_134: ')' | ',' (')' | '**') |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23237 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23238 | _tmp_134_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23239 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23240 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23241 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23242 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [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; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23247 | { // ')' |
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) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23252 | 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] | 23253 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23254 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23255 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23256 | ) |
| 23257 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23258 | 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] | 23259 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23260 | goto done; |
| 23261 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23262 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23263 | D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23264 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23265 | } |
| 23266 | { // ',' (')' | '**') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23267 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23268 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23269 | return NULL; |
| 23270 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23271 | 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] | 23272 | Token * _literal; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23273 | void *_tmp_150_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23274 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23275 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23276 | && |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23277 | (_tmp_150_var = _tmp_150_rule(p)) // ')' | '**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23278 | ) |
| 23279 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23280 | D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); |
| 23281 | _res = _PyPegen_dummy_name(p, _literal, _tmp_150_var); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23282 | goto done; |
| 23283 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23284 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23285 | D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23286 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23287 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23288 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23289 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23290 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23291 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23292 | } |
| 23293 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23294 | // _tmp_135: ':' | ',' (':' | '**') |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23295 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23296 | _tmp_135_rule(Parser *p) |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23297 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23298 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23299 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23300 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23301 | return NULL; |
| 23302 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23303 | void * _res = NULL; |
| 23304 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23305 | { // ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23306 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23307 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23308 | return NULL; |
| 23309 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23310 | D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23311 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23312 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23313 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23314 | ) |
| 23315 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23316 | D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23317 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23318 | goto done; |
| 23319 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23320 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23321 | D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23322 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23323 | } |
| 23324 | { // ',' (':' | '**') |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23325 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23326 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23327 | return NULL; |
| 23328 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23329 | D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23330 | Token * _literal; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23331 | void *_tmp_151_var; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23332 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23333 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23334 | && |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23335 | (_tmp_151_var = _tmp_151_rule(p)) // ':' | '**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23336 | ) |
| 23337 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23338 | D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); |
| 23339 | _res = _PyPegen_dummy_name(p, _literal, _tmp_151_var); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23340 | goto done; |
| 23341 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23342 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23343 | D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23344 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23345 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23346 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23347 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23348 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23349 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23350 | } |
| 23351 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23352 | // _tmp_136: star_targets '=' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23353 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23354 | _tmp_136_rule(Parser *p) |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23355 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23356 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23357 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23358 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23359 | return NULL; |
| 23360 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23361 | void * _res = NULL; |
| 23362 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23363 | { // star_targets '=' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23364 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23365 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23366 | return NULL; |
| 23367 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23368 | D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23369 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23370 | expr_ty z; |
| 23371 | if ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23372 | (z = star_targets_rule(p)) // star_targets |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23373 | && |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23374 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23375 | ) |
| 23376 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23377 | D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23378 | _res = z; |
| 23379 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23380 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23381 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23382 | return NULL; |
| 23383 | } |
| 23384 | goto done; |
| 23385 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23386 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23387 | D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23388 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23389 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23390 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23391 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23392 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23393 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23394 | } |
| 23395 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23396 | // _tmp_137: '.' | '...' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23397 | static void * |
| 23398 | _tmp_137_rule(Parser *p) |
| 23399 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23400 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23401 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23402 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23403 | return NULL; |
| 23404 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23405 | void * _res = NULL; |
| 23406 | int _mark = p->mark; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23407 | { // '.' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23408 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23409 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23410 | return NULL; |
| 23411 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23412 | 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] | 23413 | Token * _literal; |
| 23414 | if ( |
| 23415 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 23416 | ) |
| 23417 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23418 | 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] | 23419 | _res = _literal; |
| 23420 | goto done; |
| 23421 | } |
| 23422 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23423 | D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', |
| 23424 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23425 | } |
| 23426 | { // '...' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23427 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23428 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23429 | return NULL; |
| 23430 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23431 | 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] | 23432 | Token * _literal; |
| 23433 | if ( |
| 23434 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
| 23435 | ) |
| 23436 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23437 | 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] | 23438 | _res = _literal; |
| 23439 | goto done; |
| 23440 | } |
| 23441 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23442 | D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', |
| 23443 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23444 | } |
| 23445 | _res = NULL; |
| 23446 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23447 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23448 | return _res; |
| 23449 | } |
| 23450 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23451 | // _tmp_138: '.' | '...' |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23452 | static void * |
| 23453 | _tmp_138_rule(Parser *p) |
| 23454 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23455 | D(p->level++); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23456 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23457 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23458 | return NULL; |
| 23459 | } |
| 23460 | void * _res = NULL; |
| 23461 | int _mark = p->mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23462 | { // '.' |
| 23463 | if (p->error_indicator) { |
| 23464 | D(p->level--); |
| 23465 | return NULL; |
| 23466 | } |
| 23467 | D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 23468 | Token * _literal; |
| 23469 | if ( |
| 23470 | (_literal = _PyPegen_expect_token(p, 23)) // token='.' |
| 23471 | ) |
| 23472 | { |
| 23473 | D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); |
| 23474 | _res = _literal; |
| 23475 | goto done; |
| 23476 | } |
| 23477 | p->mark = _mark; |
| 23478 | D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', |
| 23479 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); |
| 23480 | } |
| 23481 | { // '...' |
| 23482 | if (p->error_indicator) { |
| 23483 | D(p->level--); |
| 23484 | return NULL; |
| 23485 | } |
| 23486 | D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); |
| 23487 | Token * _literal; |
| 23488 | if ( |
| 23489 | (_literal = _PyPegen_expect_token(p, 52)) // token='...' |
| 23490 | ) |
| 23491 | { |
| 23492 | D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); |
| 23493 | _res = _literal; |
| 23494 | goto done; |
| 23495 | } |
| 23496 | p->mark = _mark; |
| 23497 | D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', |
| 23498 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); |
| 23499 | } |
| 23500 | _res = NULL; |
| 23501 | done: |
| 23502 | D(p->level--); |
| 23503 | return _res; |
| 23504 | } |
| 23505 | |
| 23506 | // _tmp_139: '@' named_expression NEWLINE |
| 23507 | static void * |
| 23508 | _tmp_139_rule(Parser *p) |
| 23509 | { |
| 23510 | D(p->level++); |
| 23511 | if (p->error_indicator) { |
| 23512 | D(p->level--); |
| 23513 | return NULL; |
| 23514 | } |
| 23515 | void * _res = NULL; |
| 23516 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23517 | { // '@' named_expression NEWLINE |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23518 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23519 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23520 | return NULL; |
| 23521 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23522 | D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23523 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23524 | expr_ty f; |
Pablo Galindo | b796b3f | 2020-05-01 12:32:26 +0100 | [diff] [blame] | 23525 | Token * newline_var; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23526 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23527 | (_literal = _PyPegen_expect_token(p, 49)) // token='@' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23528 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23529 | (f = named_expression_rule(p)) // named_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23530 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23531 | (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23532 | ) |
| 23533 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23534 | D(fprintf(stderr, "%*c+ _tmp_139[%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] | 23535 | _res = f; |
| 23536 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23537 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23538 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23539 | return NULL; |
| 23540 | } |
| 23541 | goto done; |
| 23542 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23543 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23544 | D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23545 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23546 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23547 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23548 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23549 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23550 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23551 | } |
| 23552 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23553 | // _tmp_140: ',' star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23554 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23555 | _tmp_140_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23556 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23557 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23558 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23559 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23560 | return NULL; |
| 23561 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23562 | void * _res = NULL; |
| 23563 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23564 | { // ',' star_expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23565 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23566 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23567 | return NULL; |
| 23568 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23569 | D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23570 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23571 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23572 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23573 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23574 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23575 | (c = star_expression_rule(p)) // star_expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23576 | ) |
| 23577 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23578 | D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23579 | _res = c; |
| 23580 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23581 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23582 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23583 | return NULL; |
| 23584 | } |
| 23585 | goto done; |
| 23586 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23587 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23588 | D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23589 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23590 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23591 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23592 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23593 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23594 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23595 | } |
| 23596 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23597 | // _tmp_141: ',' expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23598 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23599 | _tmp_141_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23600 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23601 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23602 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23603 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23604 | return NULL; |
| 23605 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23606 | void * _res = NULL; |
| 23607 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23608 | { // ',' expression |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23609 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23610 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23611 | return NULL; |
| 23612 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23613 | D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23614 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23615 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23616 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23617 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23618 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23619 | (c = expression_rule(p)) // expression |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23620 | ) |
| 23621 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23622 | D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23623 | _res = c; |
| 23624 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23625 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23626 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23627 | return NULL; |
| 23628 | } |
| 23629 | goto done; |
| 23630 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23631 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23632 | D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23633 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23634 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23635 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23636 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23637 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23638 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23639 | } |
| 23640 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23641 | // _tmp_142: 'or' conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23642 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23643 | _tmp_142_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23644 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23645 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23646 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23647 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23648 | return NULL; |
| 23649 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23650 | void * _res = NULL; |
| 23651 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23652 | { // 'or' conjunction |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23653 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23654 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23655 | return NULL; |
| 23656 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23657 | D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23658 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23659 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23660 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23661 | (_keyword = _PyPegen_expect_token(p, 532)) // token='or' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23662 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23663 | (c = conjunction_rule(p)) // conjunction |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23664 | ) |
| 23665 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23666 | D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23667 | _res = c; |
| 23668 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23669 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23670 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23671 | return NULL; |
| 23672 | } |
| 23673 | goto done; |
| 23674 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23675 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23676 | D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23677 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23678 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23679 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23680 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23681 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23682 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23683 | } |
| 23684 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23685 | // _tmp_143: 'and' inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23686 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23687 | _tmp_143_rule(Parser *p) |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23688 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23689 | D(p->level++); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23690 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23691 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23692 | return NULL; |
| 23693 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23694 | void * _res = NULL; |
| 23695 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23696 | { // 'and' inversion |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23697 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23698 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23699 | return NULL; |
| 23700 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23701 | D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23702 | Token * _keyword; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23703 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23704 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23705 | (_keyword = _PyPegen_expect_token(p, 533)) // token='and' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23706 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23707 | (c = inversion_rule(p)) // inversion |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23708 | ) |
| 23709 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23710 | D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23711 | _res = c; |
| 23712 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23713 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23714 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23715 | return NULL; |
| 23716 | } |
| 23717 | goto done; |
| 23718 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23719 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23720 | D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23721 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23722 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23723 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23724 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23725 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23726 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23727 | } |
| 23728 | |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23729 | // _tmp_144: 'if' disjunction |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23730 | static void * |
| 23731 | _tmp_144_rule(Parser *p) |
| 23732 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23733 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23734 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23735 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 23736 | return NULL; |
| 23737 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23738 | void * _res = NULL; |
| 23739 | int _mark = p->mark; |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23740 | { // 'if' disjunction |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23741 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23742 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23743 | return NULL; |
| 23744 | } |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23745 | 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] | 23746 | Token * _keyword; |
| 23747 | expr_ty z; |
| 23748 | if ( |
| 23749 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 23750 | && |
| 23751 | (z = disjunction_rule(p)) // disjunction |
| 23752 | ) |
| 23753 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23754 | 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] | 23755 | _res = z; |
| 23756 | if (_res == NULL && PyErr_Occurred()) { |
| 23757 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23758 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23759 | return NULL; |
| 23760 | } |
| 23761 | goto done; |
| 23762 | } |
| 23763 | p->mark = _mark; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23764 | D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', |
| 23765 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23766 | } |
| 23767 | _res = NULL; |
| 23768 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23769 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23770 | return _res; |
| 23771 | } |
| 23772 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23773 | // _tmp_145: 'if' disjunction |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23774 | static void * |
| 23775 | _tmp_145_rule(Parser *p) |
| 23776 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23777 | D(p->level++); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23778 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23779 | D(p->level--); |
Lysandros Nikolaou | a15c9b3 | 2020-05-13 22:36:27 +0300 | [diff] [blame] | 23780 | return NULL; |
| 23781 | } |
| 23782 | void * _res = NULL; |
| 23783 | int _mark = p->mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23784 | { // 'if' disjunction |
| 23785 | if (p->error_indicator) { |
| 23786 | D(p->level--); |
| 23787 | return NULL; |
| 23788 | } |
| 23789 | D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
| 23790 | Token * _keyword; |
| 23791 | expr_ty z; |
| 23792 | if ( |
| 23793 | (_keyword = _PyPegen_expect_token(p, 510)) // token='if' |
| 23794 | && |
| 23795 | (z = disjunction_rule(p)) // disjunction |
| 23796 | ) |
| 23797 | { |
| 23798 | D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); |
| 23799 | _res = z; |
| 23800 | if (_res == NULL && PyErr_Occurred()) { |
| 23801 | p->error_indicator = 1; |
| 23802 | D(p->level--); |
| 23803 | return NULL; |
| 23804 | } |
| 23805 | goto done; |
| 23806 | } |
| 23807 | p->mark = _mark; |
| 23808 | D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', |
| 23809 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); |
| 23810 | } |
| 23811 | _res = NULL; |
| 23812 | done: |
| 23813 | D(p->level--); |
| 23814 | return _res; |
| 23815 | } |
| 23816 | |
| 23817 | // _tmp_146: ',' star_target |
| 23818 | static void * |
| 23819 | _tmp_146_rule(Parser *p) |
| 23820 | { |
| 23821 | D(p->level++); |
| 23822 | if (p->error_indicator) { |
| 23823 | D(p->level--); |
| 23824 | return NULL; |
| 23825 | } |
| 23826 | void * _res = NULL; |
| 23827 | int _mark = p->mark; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23828 | { // ',' star_target |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23829 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23830 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23831 | return NULL; |
| 23832 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23833 | D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23834 | Token * _literal; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23835 | expr_ty c; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23836 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23837 | (_literal = _PyPegen_expect_token(p, 12)) // token=',' |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23838 | && |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23839 | (c = star_target_rule(p)) // star_target |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23840 | ) |
| 23841 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23842 | D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23843 | _res = c; |
| 23844 | if (_res == NULL && PyErr_Occurred()) { |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23845 | p->error_indicator = 1; |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23846 | D(p->level--); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23847 | return NULL; |
| 23848 | } |
| 23849 | goto done; |
| 23850 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23851 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23852 | D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23853 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23854 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23855 | _res = NULL; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23856 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23857 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23858 | return _res; |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23859 | } |
| 23860 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23861 | // _tmp_147: star_targets '=' |
| 23862 | static void * |
| 23863 | _tmp_147_rule(Parser *p) |
| 23864 | { |
| 23865 | D(p->level++); |
| 23866 | if (p->error_indicator) { |
| 23867 | D(p->level--); |
| 23868 | return NULL; |
| 23869 | } |
| 23870 | void * _res = NULL; |
| 23871 | int _mark = p->mark; |
| 23872 | { // star_targets '=' |
| 23873 | if (p->error_indicator) { |
| 23874 | D(p->level--); |
| 23875 | return NULL; |
| 23876 | } |
| 23877 | D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
| 23878 | Token * _literal; |
| 23879 | expr_ty star_targets_var; |
| 23880 | if ( |
| 23881 | (star_targets_var = star_targets_rule(p)) // star_targets |
| 23882 | && |
| 23883 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 23884 | ) |
| 23885 | { |
| 23886 | D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
| 23887 | _res = _PyPegen_dummy_name(p, star_targets_var, _literal); |
| 23888 | goto done; |
| 23889 | } |
| 23890 | p->mark = _mark; |
| 23891 | D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', |
| 23892 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
| 23893 | } |
| 23894 | _res = NULL; |
| 23895 | done: |
| 23896 | D(p->level--); |
| 23897 | return _res; |
| 23898 | } |
| 23899 | |
| 23900 | // _tmp_148: star_targets '=' |
| 23901 | static void * |
| 23902 | _tmp_148_rule(Parser *p) |
| 23903 | { |
| 23904 | D(p->level++); |
| 23905 | if (p->error_indicator) { |
| 23906 | D(p->level--); |
| 23907 | return NULL; |
| 23908 | } |
| 23909 | void * _res = NULL; |
| 23910 | int _mark = p->mark; |
| 23911 | { // star_targets '=' |
| 23912 | if (p->error_indicator) { |
| 23913 | D(p->level--); |
| 23914 | return NULL; |
| 23915 | } |
| 23916 | D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
| 23917 | Token * _literal; |
| 23918 | expr_ty star_targets_var; |
| 23919 | if ( |
| 23920 | (star_targets_var = star_targets_rule(p)) // star_targets |
| 23921 | && |
| 23922 | (_literal = _PyPegen_expect_token(p, 22)) // token='=' |
| 23923 | ) |
| 23924 | { |
| 23925 | D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); |
| 23926 | _res = _PyPegen_dummy_name(p, star_targets_var, _literal); |
| 23927 | goto done; |
| 23928 | } |
| 23929 | p->mark = _mark; |
| 23930 | D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', |
| 23931 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); |
| 23932 | } |
| 23933 | _res = NULL; |
| 23934 | done: |
| 23935 | D(p->level--); |
| 23936 | return _res; |
| 23937 | } |
| 23938 | |
| 23939 | // _loop1_149: param_with_default |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 23940 | static asdl_seq * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23941 | _loop1_149_rule(Parser *p) |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23942 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23943 | D(p->level++); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23944 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23945 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23946 | return NULL; |
| 23947 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23948 | void *_res = NULL; |
| 23949 | int _mark = p->mark; |
| 23950 | int _start_mark = p->mark; |
| 23951 | void **_children = PyMem_Malloc(sizeof(void *)); |
| 23952 | if (!_children) { |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23953 | p->error_indicator = 1; |
| 23954 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23955 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23956 | return NULL; |
| 23957 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23958 | ssize_t _children_capacity = 1; |
| 23959 | ssize_t _n = 0; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23960 | { // param_with_default |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23961 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23962 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 23963 | return NULL; |
| 23964 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23965 | D(fprintf(stderr, "%*c> _loop1_149[%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] | 23966 | NameDefaultPair* param_with_default_var; |
| 23967 | while ( |
Pablo Galindo | 470aac4 | 2020-05-06 23:14:43 +0100 | [diff] [blame] | 23968 | (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] | 23969 | ) |
| 23970 | { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23971 | _res = param_with_default_var; |
| 23972 | if (_n == _children_capacity) { |
| 23973 | _children_capacity *= 2; |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23974 | void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); |
| 23975 | if (!_new_children) { |
| 23976 | p->error_indicator = 1; |
| 23977 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23978 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23979 | return NULL; |
| 23980 | } |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23981 | _children = _new_children; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23982 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23983 | _children[_n++] = _res; |
| 23984 | _mark = p->mark; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23985 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23986 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 23987 | D(fprintf(stderr, "%*c%s _loop1_149[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23988 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23989 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23990 | if (_n == 0 || p->error_indicator) { |
| 23991 | PyMem_Free(_children); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 23992 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 23993 | return NULL; |
| 23994 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23995 | asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); |
| 23996 | if (!_seq) { |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 23997 | PyMem_Free(_children); |
Lysandros Nikolaou | 2c8cd06 | 2020-05-17 06:19:23 +0300 | [diff] [blame] | 23998 | p->error_indicator = 1; |
| 23999 | PyErr_NoMemory(); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24000 | D(p->level--); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 24001 | return NULL; |
| 24002 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24003 | for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); |
| 24004 | PyMem_Free(_children); |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24005 | _PyPegen_insert_memo(p, _start_mark, _loop1_149_type, _seq); |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24006 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24007 | return _seq; |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 24008 | } |
| 24009 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24010 | // _tmp_150: ')' | '**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24011 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24012 | _tmp_150_rule(Parser *p) |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24013 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24014 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24015 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24016 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24017 | return NULL; |
| 24018 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24019 | void * _res = NULL; |
| 24020 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24021 | { // ')' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 24022 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24023 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 24024 | return NULL; |
| 24025 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24026 | D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24027 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24028 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24029 | (_literal = _PyPegen_expect_token(p, 8)) // token=')' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24030 | ) |
| 24031 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24032 | D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24033 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24034 | goto done; |
| 24035 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24036 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24037 | D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24038 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24039 | } |
| 24040 | { // '**' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 24041 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24042 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 24043 | return NULL; |
| 24044 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24045 | D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24046 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24047 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24048 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24049 | ) |
| 24050 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24051 | D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24052 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24053 | goto done; |
| 24054 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24055 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24056 | D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24057 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24058 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24059 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24060 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24061 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24062 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24063 | } |
| 24064 | |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24065 | // _tmp_151: ':' | '**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24066 | static void * |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24067 | _tmp_151_rule(Parser *p) |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24068 | { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24069 | D(p->level++); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24070 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24071 | D(p->level--); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24072 | return NULL; |
| 24073 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24074 | void * _res = NULL; |
| 24075 | int _mark = p->mark; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24076 | { // ':' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 24077 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24078 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 24079 | return NULL; |
| 24080 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24081 | D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24082 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24083 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24084 | (_literal = _PyPegen_expect_token(p, 11)) // token=':' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24085 | ) |
| 24086 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24087 | D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24088 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24089 | goto done; |
| 24090 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24091 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24092 | D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24093 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24094 | } |
| 24095 | { // '**' |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 24096 | if (p->error_indicator) { |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24097 | D(p->level--); |
Lysandros Nikolaou | 7b7a21b | 2020-05-18 20:32:03 +0300 | [diff] [blame] | 24098 | return NULL; |
| 24099 | } |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24100 | D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24101 | Token * _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24102 | if ( |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24103 | (_literal = _PyPegen_expect_token(p, 35)) // token='**' |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24104 | ) |
| 24105 | { |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24106 | D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24107 | _res = _literal; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24108 | goto done; |
| 24109 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24110 | p->mark = _mark; |
Miss Islington (bot) | 8df4f39 | 2020-06-08 02:22:06 -0700 | [diff] [blame] | 24111 | D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24112 | p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24113 | } |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24114 | _res = NULL; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24115 | done: |
Miss Islington (bot) | 82da2c3 | 2020-05-25 10:58:03 -0700 | [diff] [blame] | 24116 | D(p->level--); |
Pablo Galindo | ac7a92c | 2020-05-10 05:34:50 +0100 | [diff] [blame] | 24117 | return _res; |
Lysandros Nikolaou | e10e7c7 | 2020-05-04 13:58:31 +0300 | [diff] [blame] | 24118 | } |
| 24119 | |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 24120 | void * |
| 24121 | _PyPegen_parse(Parser *p) |
| 24122 | { |
| 24123 | // Initialize keywords |
| 24124 | p->keywords = reserved_keywords; |
| 24125 | p->n_keyword_lists = n_keyword_lists; |
| 24126 | |
| 24127 | // Run parser |
| 24128 | void *result = NULL; |
| 24129 | if (p->start_rule == Py_file_input) { |
| 24130 | result = file_rule(p); |
| 24131 | } else if (p->start_rule == Py_single_input) { |
| 24132 | result = interactive_rule(p); |
| 24133 | } else if (p->start_rule == Py_eval_input) { |
| 24134 | result = eval_rule(p); |
Guido van Rossum | c001c09 | 2020-04-30 12:12:19 -0700 | [diff] [blame] | 24135 | } else if (p->start_rule == Py_func_type_input) { |
| 24136 | result = func_type_rule(p); |
Pablo Galindo | c5fc156 | 2020-04-22 23:29:27 +0100 | [diff] [blame] | 24137 | } else if (p->start_rule == Py_fstring_input) { |
| 24138 | result = fstring_rule(p); |
| 24139 | } |
| 24140 | |
| 24141 | return result; |
| 24142 | } |
| 24143 | |
| 24144 | // The end |