From 206cbdab16cb054e859597a562e2f6ab35e99766 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Sun, 7 Feb 2021 18:42:21 +0000 Subject: [PATCH] bpo-43149: Improve error message for exception group without parentheses (GH-24467) --- Grammar/python.gram | 11 +- Lib/test/test_syntax.py | 33 + .../2021-02-07-03-27-14.bpo-43149.0umPKD.rst | 2 + Parser/parser.c | 1419 ++++++++++------- 4 files changed, 862 insertions(+), 603 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-02-07-03-27-14.bpo-43149.0umPKD.rst diff --git a/Grammar/python.gram b/Grammar/python.gram index d1a36f0e4d0..bb70bbb565d 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -201,9 +201,10 @@ try_stmt[stmt_ty]: | 'try' &&':' b=block f=finally_block { _Py_Try(b, NULL, NULL, f, EXTRA) } | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block] { _Py_Try(b, ex, el, f, EXTRA) } except_block[excepthandler_ty]: - | 'except' e=expression t=['as' z=NAME { z }] &&':' b=block { + | 'except' e=expression t=['as' z=NAME { z }] ':' b=block { _Py_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, EXTRA) } - | 'except' &&':' b=block { _Py_ExceptHandler(NULL, NULL, b, EXTRA) } + | 'except' ':' b=block { _Py_ExceptHandler(NULL, NULL, b, EXTRA) } + | invalid_except_block finally_block[asdl_stmt_seq*]: 'finally' ':' a=block { a } return_stmt[stmt_ty]: @@ -737,3 +738,9 @@ invalid_import_from_targets: invalid_with_stmt: | [ASYNC] 'with' ','.(expression ['as' star_target])+ &&':' | [ASYNC] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':' + +invalid_except_block: + | 'except' a=expression ',' expressions ['as' NAME ] ':' { + RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "exception group must be parenthesized") } + | 'except' expression ['as' NAME ] &&':' + | 'except' &&':' diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 70dd22c62aa..47df0579f1e 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -835,6 +835,39 @@ Make sure that the old "raise X, Y[, Z]" form is gone: ... SyntaxError: invalid syntax +Check that an exception group with missing parentheses +raise a custom exception + + >>> try: + ... pass + ... except A, B: + ... pass + Traceback (most recent call last): + SyntaxError: exception group must be parenthesized + + >>> try: + ... pass + ... except A, B, C: + ... pass + Traceback (most recent call last): + SyntaxError: exception group must be parenthesized + + >>> try: + ... pass + ... except A, B, C as blech: + ... pass + Traceback (most recent call last): + SyntaxError: exception group must be parenthesized + + >>> try: + ... pass + ... except A, B, C as blech: + ... pass + ... finally: + ... pass + Traceback (most recent call last): + SyntaxError: exception group must be parenthesized + >>> f(a=23, a=234) Traceback (most recent call last): diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-02-07-03-27-14.bpo-43149.0umPKD.rst b/Misc/NEWS.d/next/Core and Builtins/2021-02-07-03-27-14.bpo-43149.0umPKD.rst new file mode 100644 index 00000000000..35ef84cc1e2 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2021-02-07-03-27-14.bpo-43149.0umPKD.rst @@ -0,0 +1,2 @@ +Improve the error message in the parser for exception groups without +parentheses. Patch by Pablo Galindo. diff --git a/Parser/parser.c b/Parser/parser.c index f4501d3bca0..3f0d06fc833 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -232,170 +232,173 @@ static KeywordToken *reserved_keywords[] = { #define invalid_group_type 1163 #define invalid_import_from_targets_type 1164 #define invalid_with_stmt_type 1165 -#define _loop0_1_type 1166 -#define _loop0_2_type 1167 -#define _loop0_4_type 1168 -#define _gather_3_type 1169 -#define _loop0_6_type 1170 -#define _gather_5_type 1171 -#define _loop0_8_type 1172 -#define _gather_7_type 1173 -#define _loop0_10_type 1174 -#define _gather_9_type 1175 -#define _loop1_11_type 1176 -#define _loop0_13_type 1177 -#define _gather_12_type 1178 -#define _tmp_14_type 1179 -#define _tmp_15_type 1180 -#define _tmp_16_type 1181 -#define _tmp_17_type 1182 -#define _tmp_18_type 1183 -#define _tmp_19_type 1184 -#define _tmp_20_type 1185 -#define _tmp_21_type 1186 -#define _loop1_22_type 1187 -#define _tmp_23_type 1188 -#define _tmp_24_type 1189 -#define _loop0_26_type 1190 -#define _gather_25_type 1191 -#define _loop0_28_type 1192 -#define _gather_27_type 1193 -#define _tmp_29_type 1194 -#define _tmp_30_type 1195 -#define _loop0_31_type 1196 -#define _loop1_32_type 1197 -#define _loop0_34_type 1198 -#define _gather_33_type 1199 -#define _tmp_35_type 1200 -#define _loop0_37_type 1201 -#define _gather_36_type 1202 -#define _tmp_38_type 1203 -#define _loop0_40_type 1204 -#define _gather_39_type 1205 -#define _loop0_42_type 1206 -#define _gather_41_type 1207 -#define _loop0_44_type 1208 -#define _gather_43_type 1209 -#define _loop0_46_type 1210 -#define _gather_45_type 1211 -#define _tmp_47_type 1212 -#define _loop1_48_type 1213 -#define _tmp_49_type 1214 -#define _tmp_50_type 1215 -#define _tmp_51_type 1216 -#define _tmp_52_type 1217 -#define _tmp_53_type 1218 -#define _loop0_54_type 1219 -#define _loop0_55_type 1220 -#define _loop0_56_type 1221 -#define _loop1_57_type 1222 -#define _loop0_58_type 1223 -#define _loop1_59_type 1224 -#define _loop1_60_type 1225 -#define _loop1_61_type 1226 -#define _loop0_62_type 1227 -#define _loop1_63_type 1228 -#define _loop0_64_type 1229 -#define _loop1_65_type 1230 -#define _loop0_66_type 1231 -#define _loop1_67_type 1232 -#define _loop1_68_type 1233 -#define _tmp_69_type 1234 -#define _loop1_70_type 1235 -#define _loop0_72_type 1236 -#define _gather_71_type 1237 -#define _loop1_73_type 1238 -#define _loop0_74_type 1239 -#define _loop0_75_type 1240 -#define _loop0_76_type 1241 -#define _loop1_77_type 1242 -#define _loop0_78_type 1243 -#define _loop1_79_type 1244 -#define _loop1_80_type 1245 -#define _loop1_81_type 1246 -#define _loop0_82_type 1247 -#define _loop1_83_type 1248 -#define _loop0_84_type 1249 -#define _loop1_85_type 1250 -#define _loop0_86_type 1251 -#define _loop1_87_type 1252 -#define _loop1_88_type 1253 -#define _loop1_89_type 1254 -#define _loop1_90_type 1255 -#define _tmp_91_type 1256 -#define _loop0_93_type 1257 -#define _gather_92_type 1258 -#define _tmp_94_type 1259 -#define _tmp_95_type 1260 -#define _tmp_96_type 1261 -#define _tmp_97_type 1262 -#define _loop1_98_type 1263 -#define _tmp_99_type 1264 -#define _tmp_100_type 1265 -#define _loop0_102_type 1266 -#define _gather_101_type 1267 -#define _loop1_103_type 1268 -#define _loop0_104_type 1269 -#define _loop0_105_type 1270 -#define _loop0_107_type 1271 -#define _gather_106_type 1272 -#define _tmp_108_type 1273 -#define _loop0_110_type 1274 -#define _gather_109_type 1275 -#define _loop0_112_type 1276 -#define _gather_111_type 1277 -#define _loop0_114_type 1278 -#define _gather_113_type 1279 -#define _loop0_116_type 1280 -#define _gather_115_type 1281 -#define _loop0_117_type 1282 -#define _loop0_119_type 1283 -#define _gather_118_type 1284 -#define _loop1_120_type 1285 -#define _tmp_121_type 1286 -#define _loop0_123_type 1287 -#define _gather_122_type 1288 -#define _loop0_125_type 1289 -#define _gather_124_type 1290 -#define _tmp_126_type 1291 -#define _loop0_127_type 1292 -#define _loop0_128_type 1293 -#define _loop0_129_type 1294 -#define _tmp_130_type 1295 -#define _tmp_131_type 1296 -#define _tmp_132_type 1297 -#define _loop0_133_type 1298 -#define _loop1_134_type 1299 -#define _loop0_135_type 1300 -#define _loop1_136_type 1301 -#define _tmp_137_type 1302 -#define _tmp_138_type 1303 -#define _tmp_139_type 1304 -#define _loop0_141_type 1305 -#define _gather_140_type 1306 -#define _loop0_143_type 1307 -#define _gather_142_type 1308 -#define _tmp_144_type 1309 -#define _tmp_145_type 1310 -#define _tmp_146_type 1311 -#define _tmp_147_type 1312 -#define _tmp_148_type 1313 -#define _tmp_149_type 1314 -#define _tmp_150_type 1315 -#define _tmp_151_type 1316 -#define _tmp_152_type 1317 -#define _tmp_153_type 1318 -#define _tmp_154_type 1319 -#define _tmp_155_type 1320 -#define _tmp_156_type 1321 -#define _tmp_157_type 1322 -#define _tmp_158_type 1323 -#define _tmp_159_type 1324 -#define _tmp_160_type 1325 -#define _tmp_161_type 1326 -#define _tmp_162_type 1327 -#define _tmp_163_type 1328 -#define _tmp_164_type 1329 +#define invalid_except_block_type 1166 +#define _loop0_1_type 1167 +#define _loop0_2_type 1168 +#define _loop0_4_type 1169 +#define _gather_3_type 1170 +#define _loop0_6_type 1171 +#define _gather_5_type 1172 +#define _loop0_8_type 1173 +#define _gather_7_type 1174 +#define _loop0_10_type 1175 +#define _gather_9_type 1176 +#define _loop1_11_type 1177 +#define _loop0_13_type 1178 +#define _gather_12_type 1179 +#define _tmp_14_type 1180 +#define _tmp_15_type 1181 +#define _tmp_16_type 1182 +#define _tmp_17_type 1183 +#define _tmp_18_type 1184 +#define _tmp_19_type 1185 +#define _tmp_20_type 1186 +#define _tmp_21_type 1187 +#define _loop1_22_type 1188 +#define _tmp_23_type 1189 +#define _tmp_24_type 1190 +#define _loop0_26_type 1191 +#define _gather_25_type 1192 +#define _loop0_28_type 1193 +#define _gather_27_type 1194 +#define _tmp_29_type 1195 +#define _tmp_30_type 1196 +#define _loop0_31_type 1197 +#define _loop1_32_type 1198 +#define _loop0_34_type 1199 +#define _gather_33_type 1200 +#define _tmp_35_type 1201 +#define _loop0_37_type 1202 +#define _gather_36_type 1203 +#define _tmp_38_type 1204 +#define _loop0_40_type 1205 +#define _gather_39_type 1206 +#define _loop0_42_type 1207 +#define _gather_41_type 1208 +#define _loop0_44_type 1209 +#define _gather_43_type 1210 +#define _loop0_46_type 1211 +#define _gather_45_type 1212 +#define _tmp_47_type 1213 +#define _loop1_48_type 1214 +#define _tmp_49_type 1215 +#define _tmp_50_type 1216 +#define _tmp_51_type 1217 +#define _tmp_52_type 1218 +#define _tmp_53_type 1219 +#define _loop0_54_type 1220 +#define _loop0_55_type 1221 +#define _loop0_56_type 1222 +#define _loop1_57_type 1223 +#define _loop0_58_type 1224 +#define _loop1_59_type 1225 +#define _loop1_60_type 1226 +#define _loop1_61_type 1227 +#define _loop0_62_type 1228 +#define _loop1_63_type 1229 +#define _loop0_64_type 1230 +#define _loop1_65_type 1231 +#define _loop0_66_type 1232 +#define _loop1_67_type 1233 +#define _loop1_68_type 1234 +#define _tmp_69_type 1235 +#define _loop1_70_type 1236 +#define _loop0_72_type 1237 +#define _gather_71_type 1238 +#define _loop1_73_type 1239 +#define _loop0_74_type 1240 +#define _loop0_75_type 1241 +#define _loop0_76_type 1242 +#define _loop1_77_type 1243 +#define _loop0_78_type 1244 +#define _loop1_79_type 1245 +#define _loop1_80_type 1246 +#define _loop1_81_type 1247 +#define _loop0_82_type 1248 +#define _loop1_83_type 1249 +#define _loop0_84_type 1250 +#define _loop1_85_type 1251 +#define _loop0_86_type 1252 +#define _loop1_87_type 1253 +#define _loop1_88_type 1254 +#define _loop1_89_type 1255 +#define _loop1_90_type 1256 +#define _tmp_91_type 1257 +#define _loop0_93_type 1258 +#define _gather_92_type 1259 +#define _tmp_94_type 1260 +#define _tmp_95_type 1261 +#define _tmp_96_type 1262 +#define _tmp_97_type 1263 +#define _loop1_98_type 1264 +#define _tmp_99_type 1265 +#define _tmp_100_type 1266 +#define _loop0_102_type 1267 +#define _gather_101_type 1268 +#define _loop1_103_type 1269 +#define _loop0_104_type 1270 +#define _loop0_105_type 1271 +#define _loop0_107_type 1272 +#define _gather_106_type 1273 +#define _tmp_108_type 1274 +#define _loop0_110_type 1275 +#define _gather_109_type 1276 +#define _loop0_112_type 1277 +#define _gather_111_type 1278 +#define _loop0_114_type 1279 +#define _gather_113_type 1280 +#define _loop0_116_type 1281 +#define _gather_115_type 1282 +#define _loop0_117_type 1283 +#define _loop0_119_type 1284 +#define _gather_118_type 1285 +#define _loop1_120_type 1286 +#define _tmp_121_type 1287 +#define _loop0_123_type 1288 +#define _gather_122_type 1289 +#define _loop0_125_type 1290 +#define _gather_124_type 1291 +#define _tmp_126_type 1292 +#define _loop0_127_type 1293 +#define _loop0_128_type 1294 +#define _loop0_129_type 1295 +#define _tmp_130_type 1296 +#define _tmp_131_type 1297 +#define _tmp_132_type 1298 +#define _loop0_133_type 1299 +#define _loop1_134_type 1300 +#define _loop0_135_type 1301 +#define _loop1_136_type 1302 +#define _tmp_137_type 1303 +#define _tmp_138_type 1304 +#define _tmp_139_type 1305 +#define _loop0_141_type 1306 +#define _gather_140_type 1307 +#define _loop0_143_type 1308 +#define _gather_142_type 1309 +#define _tmp_144_type 1310 +#define _tmp_145_type 1311 +#define _tmp_146_type 1312 +#define _tmp_147_type 1313 +#define _tmp_148_type 1314 +#define _tmp_149_type 1315 +#define _tmp_150_type 1316 +#define _tmp_151_type 1317 +#define _tmp_152_type 1318 +#define _tmp_153_type 1319 +#define _tmp_154_type 1320 +#define _tmp_155_type 1321 +#define _tmp_156_type 1322 +#define _tmp_157_type 1323 +#define _tmp_158_type 1324 +#define _tmp_159_type 1325 +#define _tmp_160_type 1326 +#define _tmp_161_type 1327 +#define _tmp_162_type 1328 +#define _tmp_163_type 1329 +#define _tmp_164_type 1330 +#define _tmp_165_type 1331 +#define _tmp_166_type 1332 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -563,6 +566,7 @@ static void *invalid_for_target_rule(Parser *p); static void *invalid_group_rule(Parser *p); static void *invalid_import_from_targets_rule(Parser *p); static void *invalid_with_stmt_rule(Parser *p); +static void *invalid_except_block_rule(Parser *p); static asdl_seq *_loop0_1_rule(Parser *p); static asdl_seq *_loop0_2_rule(Parser *p); static asdl_seq *_loop0_4_rule(Parser *p); @@ -727,6 +731,8 @@ static void *_tmp_161_rule(Parser *p); static void *_tmp_162_rule(Parser *p); static void *_tmp_163_rule(Parser *p); static void *_tmp_164_rule(Parser *p); +static void *_tmp_165_rule(Parser *p); +static void *_tmp_166_rule(Parser *p); // file: statements? $ @@ -4551,7 +4557,10 @@ try_stmt_rule(Parser *p) return _res; } -// except_block: 'except' expression ['as' NAME] &&':' block | 'except' &&':' block +// except_block: +// | 'except' expression ['as' NAME] ':' block +// | 'except' ':' block +// | invalid_except_block static excepthandler_ty except_block_rule(Parser *p) { @@ -4571,12 +4580,12 @@ except_block_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // 'except' expression ['as' NAME] &&':' block + { // 'except' expression ['as' NAME] ':' block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] &&':' block")); + D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block")); Token * _keyword; Token * _literal; asdl_stmt_seq* b; @@ -4589,12 +4598,12 @@ except_block_rule(Parser *p) && (t = _tmp_49_rule(p), 1) // ['as' NAME] && - (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' + (_literal = _PyPegen_expect_token(p, 11)) // token=':' && (b = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] &&':' block")); + D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' block")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -4614,26 +4623,26 @@ except_block_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] &&':' block")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' block")); } - { // 'except' &&':' block + { // 'except' ':' block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' &&':' block")); + D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' block")); Token * _keyword; Token * _literal; asdl_stmt_seq* b; if ( (_keyword = _PyPegen_expect_token(p, 521)) // token='except' && - (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' + (_literal = _PyPegen_expect_token(p, 11)) // token=':' && (b = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' &&':' block")); + D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' block")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -4653,7 +4662,26 @@ except_block_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' &&':' block")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' block")); + } + if (p->call_invalid_rules) { // invalid_except_block + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_block")); + void *invalid_except_block_var; + if ( + (invalid_except_block_var = invalid_except_block_rule(p)) // invalid_except_block + ) + { + D(fprintf(stderr, "%*c+ except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_block")); + _res = invalid_except_block_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s except_block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_block")); } _res = NULL; done: @@ -16017,6 +16045,117 @@ invalid_with_stmt_rule(Parser *p) return _res; } +// invalid_except_block: +// | 'except' expression ',' expressions ['as' NAME] ':' +// | 'except' expression ['as' NAME] &&':' +// | 'except' &&':' +static void * +invalid_except_block_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'except' expression ',' expressions ['as' NAME] ':' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); + Token * _keyword; + Token * _literal; + Token * _literal_1; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + expr_ty a; + expr_ty expressions_var; + if ( + (_keyword = _PyPegen_expect_token(p, 521)) // token='except' + && + (a = expression_rule(p)) // expression + && + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (expressions_var = expressions_rule(p)) // expressions + && + (_opt_var = _tmp_144_rule(p), 1) // ['as' NAME] + && + (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' + ) + { + D(fprintf(stderr, "%*c+ invalid_except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); + _res = RAISE_SYNTAX_ERROR_KNOWN_LOCATION ( a , "exception group must be parenthesized" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_except_block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); + } + { // 'except' expression ['as' NAME] &&':' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] &&':'")); + Token * _keyword; + Token * _literal; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + expr_ty expression_var; + if ( + (_keyword = _PyPegen_expect_token(p, 521)) // token='except' + && + (expression_var = expression_rule(p)) // expression + && + (_opt_var = _tmp_145_rule(p), 1) // ['as' NAME] + && + (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' + ) + { + D(fprintf(stderr, "%*c+ invalid_except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] &&':'")); + _res = _PyPegen_dummy_name(p, _keyword, expression_var, _opt_var, _literal); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_except_block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] &&':'")); + } + { // 'except' &&':' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_except_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' &&':'")); + Token * _keyword; + Token * _literal; + if ( + (_keyword = _PyPegen_expect_token(p, 521)) // token='except' + && + (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' + ) + { + D(fprintf(stderr, "%*c+ invalid_except_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' &&':'")); + _res = _PyPegen_dummy_name(p, _keyword, _literal); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_except_block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' &&':'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + // _loop0_1: NEWLINE static asdl_seq * _loop0_1_rule(Parser *p) @@ -17265,12 +17404,12 @@ _loop1_22_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_144_var; + void *_tmp_146_var; while ( - (_tmp_144_var = _tmp_144_rule(p)) // star_targets '=' + (_tmp_146_var = _tmp_146_rule(p)) // star_targets '=' ) { - _res = _tmp_144_var; + _res = _tmp_146_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -17773,12 +17912,12 @@ _loop0_31_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_145_var; + void *_tmp_147_var; while ( - (_tmp_145_var = _tmp_145_rule(p)) // '.' | '...' + (_tmp_147_var = _tmp_147_rule(p)) // '.' | '...' ) { - _res = _tmp_145_var; + _res = _tmp_147_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -17839,12 +17978,12 @@ _loop1_32_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_146_var; + void *_tmp_148_var; while ( - (_tmp_146_var = _tmp_146_rule(p)) // '.' | '...' + (_tmp_148_var = _tmp_148_rule(p)) // '.' | '...' ) { - _res = _tmp_146_var; + _res = _tmp_148_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20001,12 +20140,12 @@ _loop1_68_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_147_var; + void *_tmp_149_var; while ( - (_tmp_147_var = _tmp_147_rule(p)) // '@' named_expression NEWLINE + (_tmp_149_var = _tmp_149_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_147_var; + _res = _tmp_149_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20119,12 +20258,12 @@ _loop1_70_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_148_var; + void *_tmp_150_var; while ( - (_tmp_148_var = _tmp_148_rule(p)) // ',' star_expression + (_tmp_150_var = _tmp_150_rule(p)) // ',' star_expression ) { - _res = _tmp_148_var; + _res = _tmp_150_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20304,12 +20443,12 @@ _loop1_73_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_149_var; + void *_tmp_151_var; while ( - (_tmp_149_var = _tmp_149_rule(p)) // ',' expression + (_tmp_151_var = _tmp_151_rule(p)) // ',' expression ) { - _res = _tmp_149_var; + _res = _tmp_151_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21334,12 +21473,12 @@ _loop1_88_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_150_var; + void *_tmp_152_var; while ( - (_tmp_150_var = _tmp_150_rule(p)) // 'or' conjunction + (_tmp_152_var = _tmp_152_rule(p)) // 'or' conjunction ) { - _res = _tmp_150_var; + _res = _tmp_152_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21405,12 +21544,12 @@ _loop1_89_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_151_var; + void *_tmp_153_var; while ( - (_tmp_151_var = _tmp_151_rule(p)) // 'and' inversion + (_tmp_153_var = _tmp_153_rule(p)) // 'and' inversion ) { - _res = _tmp_151_var; + _res = _tmp_153_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22326,12 +22465,12 @@ _loop0_104_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_152_var; + void *_tmp_154_var; while ( - (_tmp_152_var = _tmp_152_rule(p)) // 'if' disjunction + (_tmp_154_var = _tmp_154_rule(p)) // 'if' disjunction ) { - _res = _tmp_152_var; + _res = _tmp_154_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22392,12 +22531,12 @@ _loop0_105_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_153_var; + void *_tmp_155_var; while ( - (_tmp_153_var = _tmp_153_rule(p)) // 'if' disjunction + (_tmp_155_var = _tmp_155_rule(p)) // 'if' disjunction ) { - _res = _tmp_153_var; + _res = _tmp_155_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22463,7 +22602,7 @@ _loop0_107_rule(Parser *p) while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_154_rule(p)) // starred_expression | named_expression !'=' + (elem = _tmp_156_rule(p)) // starred_expression | named_expression !'=' ) { _res = elem; @@ -22526,7 +22665,7 @@ _gather_106_rule(Parser *p) void *elem; asdl_seq * seq; if ( - (elem = _tmp_154_rule(p)) // starred_expression | named_expression !'=' + (elem = _tmp_156_rule(p)) // starred_expression | named_expression !'=' && (seq = _loop0_107_rule(p)) // _loop0_107 ) @@ -23072,12 +23211,12 @@ _loop0_117_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_155_var; + void *_tmp_157_var; while ( - (_tmp_155_var = _tmp_155_rule(p)) // ',' star_target + (_tmp_157_var = _tmp_157_rule(p)) // ',' star_target ) { - _res = _tmp_155_var; + _res = _tmp_157_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23252,12 +23391,12 @@ _loop1_120_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_156_var; + void *_tmp_158_var; while ( - (_tmp_156_var = _tmp_156_rule(p)) // ',' star_target + (_tmp_158_var = _tmp_158_rule(p)) // ',' star_target ) { - _res = _tmp_156_var; + _res = _tmp_158_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23713,12 +23852,12 @@ _loop0_128_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_157_var; + void *_tmp_159_var; while ( - (_tmp_157_var = _tmp_157_rule(p)) // star_targets '=' + (_tmp_159_var = _tmp_159_rule(p)) // star_targets '=' ) { - _res = _tmp_157_var; + _res = _tmp_159_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23779,12 +23918,12 @@ _loop0_129_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_158_var; + void *_tmp_160_var; while ( - (_tmp_158_var = _tmp_158_rule(p)) // star_targets '=' + (_tmp_160_var = _tmp_160_rule(p)) // star_targets '=' ) { - _res = _tmp_158_var; + _res = _tmp_160_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24313,15 +24452,15 @@ _tmp_137_rule(Parser *p) } D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_159_var; + void *_tmp_161_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_159_var = _tmp_159_rule(p)) // ')' | '**' + (_tmp_161_var = _tmp_161_rule(p)) // ')' | '**' ) { D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_159_var); + _res = _PyPegen_dummy_name(p, _literal, _tmp_161_var); goto done; } p->mark = _mark; @@ -24371,15 +24510,15 @@ _tmp_138_rule(Parser *p) } D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_160_var; + void *_tmp_162_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_160_var = _tmp_160_rule(p)) // ':' | '**' + (_tmp_162_var = _tmp_162_rule(p)) // ':' | '**' ) { D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_160_var); + _res = _PyPegen_dummy_name(p, _literal, _tmp_162_var); goto done; } p->mark = _mark; @@ -24498,7 +24637,7 @@ _loop0_141_rule(Parser *p) while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_161_rule(p)) // expression ['as' star_target] + (elem = _tmp_163_rule(p)) // expression ['as' star_target] ) { _res = elem; @@ -24561,7 +24700,7 @@ _gather_140_rule(Parser *p) void *elem; asdl_seq * seq; if ( - (elem = _tmp_161_rule(p)) // expression ['as' star_target] + (elem = _tmp_163_rule(p)) // expression ['as' star_target] && (seq = _loop0_141_rule(p)) // _loop0_141 ) @@ -24612,7 +24751,7 @@ _loop0_143_rule(Parser *p) while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_162_rule(p)) // expressions ['as' star_target] + (elem = _tmp_164_rule(p)) // expressions ['as' star_target] ) { _res = elem; @@ -24675,7 +24814,7 @@ _gather_142_rule(Parser *p) void *elem; asdl_seq * seq; if ( - (elem = _tmp_162_rule(p)) // expressions ['as' star_target] + (elem = _tmp_164_rule(p)) // expressions ['as' star_target] && (seq = _loop0_143_rule(p)) // _loop0_143 ) @@ -24694,9 +24833,87 @@ _gather_142_rule(Parser *p) return _res; } -// _tmp_144: star_targets '=' +// _tmp_144: 'as' NAME static void * _tmp_144_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'as' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty name_var; + if ( + (_keyword = _PyPegen_expect_token(p, 520)) // token='as' + && + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = _PyPegen_dummy_name(p, _keyword, name_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_145: 'as' NAME +static void * +_tmp_145_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'as' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty name_var; + if ( + (_keyword = _PyPegen_expect_token(p, 520)) // token='as' + && + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = _PyPegen_dummy_name(p, _keyword, name_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_146: star_targets '=' +static void * +_tmp_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24710,7 +24927,7 @@ _tmp_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -24719,7 +24936,7 @@ _tmp_144_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24729,7 +24946,7 @@ _tmp_144_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -24738,119 +24955,119 @@ _tmp_144_rule(Parser *p) return _res; } -// _tmp_145: '.' | '...' -static void * -_tmp_145_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // '.' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - ) - { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); - } - { // '...' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 52)) // token='...' - ) - { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_146: '.' | '...' -static void * -_tmp_146_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // '.' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 23)) // token='.' - ) - { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); - } - { // '...' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); - Token * _literal; - if ( - (_literal = _PyPegen_expect_token(p, 52)) // token='...' - ) - { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); - _res = _literal; - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_147: '@' named_expression NEWLINE +// _tmp_147: '.' | '...' static void * _tmp_147_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // '.' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + ) + { + D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + } + { // '...' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 52)) // token='...' + ) + { + D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_148: '.' | '...' +static void * +_tmp_148_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // '.' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 23)) // token='.' + ) + { + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); + } + { // '...' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 52)) // token='...' + ) + { + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_149: '@' named_expression NEWLINE +static void * +_tmp_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24864,7 +25081,7 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -24876,7 +25093,7 @@ _tmp_147_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24886,7 +25103,7 @@ _tmp_147_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -24895,9 +25112,9 @@ _tmp_147_rule(Parser *p) return _res; } -// _tmp_148: ',' star_expression +// _tmp_150: ',' star_expression static void * -_tmp_148_rule(Parser *p) +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24911,7 +25128,7 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -24920,7 +25137,7 @@ _tmp_148_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24930,7 +25147,7 @@ _tmp_148_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -24939,9 +25156,9 @@ _tmp_148_rule(Parser *p) return _res; } -// _tmp_149: ',' expression +// _tmp_151: ',' expression static void * -_tmp_149_rule(Parser *p) +_tmp_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24955,7 +25172,7 @@ _tmp_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -24964,7 +25181,7 @@ _tmp_149_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -24974,7 +25191,7 @@ _tmp_149_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -24983,9 +25200,9 @@ _tmp_149_rule(Parser *p) return _res; } -// _tmp_150: 'or' conjunction +// _tmp_152: 'or' conjunction static void * -_tmp_150_rule(Parser *p) +_tmp_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24999,7 +25216,7 @@ _tmp_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -25008,7 +25225,7 @@ _tmp_150_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25018,7 +25235,7 @@ _tmp_150_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -25027,9 +25244,9 @@ _tmp_150_rule(Parser *p) return _res; } -// _tmp_151: 'and' inversion +// _tmp_153: 'and' inversion static void * -_tmp_151_rule(Parser *p) +_tmp_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25043,7 +25260,7 @@ _tmp_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -25052,7 +25269,7 @@ _tmp_151_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -25062,7 +25279,7 @@ _tmp_151_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -25071,97 +25288,97 @@ _tmp_151_rule(Parser *p) return _res; } -// _tmp_152: 'if' disjunction -static void * -_tmp_152_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // 'if' disjunction - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); - Token * _keyword; - expr_ty z; - if ( - (_keyword = _PyPegen_expect_token(p, 510)) // token='if' - && - (z = disjunction_rule(p)) // disjunction - ) - { - D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_152[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_153: 'if' disjunction -static void * -_tmp_153_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // 'if' disjunction - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); - Token * _keyword; - expr_ty z; - if ( - (_keyword = _PyPegen_expect_token(p, 510)) // token='if' - && - (z = disjunction_rule(p)) // disjunction - ) - { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); - _res = z; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_154: starred_expression | named_expression !'=' +// _tmp_154: 'if' disjunction static void * _tmp_154_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'if' disjunction + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + Token * _keyword; + expr_ty z; + if ( + (_keyword = _PyPegen_expect_token(p, 510)) // token='if' + && + (z = disjunction_rule(p)) // disjunction + ) + { + D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_155: 'if' disjunction +static void * +_tmp_155_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'if' disjunction + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + Token * _keyword; + expr_ty z; + if ( + (_keyword = _PyPegen_expect_token(p, 510)) // token='if' + && + (z = disjunction_rule(p)) // disjunction + ) + { + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + _res = z; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_156: starred_expression | named_expression !'=' +static void * +_tmp_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25175,18 +25392,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); expr_ty starred_expression_var; if ( (starred_expression_var = starred_expression_rule(p)) // starred_expression ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); _res = starred_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); } { // named_expression !'=' @@ -25194,7 +25411,7 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); expr_ty named_expression_var; if ( (named_expression_var = named_expression_rule(p)) // named_expression @@ -25202,12 +25419,12 @@ _tmp_154_rule(Parser *p) _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression !'='")); _res = named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression !'='")); } _res = NULL; @@ -25216,95 +25433,7 @@ _tmp_154_rule(Parser *p) return _res; } -// _tmp_155: ',' star_target -static void * -_tmp_155_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // ',' star_target - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); - Token * _literal; - expr_ty c; - if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (c = star_target_rule(p)) // star_target - ) - { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); - _res = c; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_156: ',' star_target -static void * -_tmp_156_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // ',' star_target - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); - Token * _literal; - expr_ty c; - if ( - (_literal = _PyPegen_expect_token(p, 12)) // token=',' - && - (c = star_target_rule(p)) // star_target - ) - { - D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); - _res = c; - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _tmp_157: star_targets '=' +// _tmp_157: ',' star_target static void * _tmp_157_rule(Parser *p) { @@ -25315,27 +25444,32 @@ _tmp_157_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // star_targets '=' + { // ',' star_target if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; - expr_ty star_targets_var; + expr_ty c; if ( - (star_targets_var = star_targets_rule(p)) // star_targets + (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_literal = _PyPegen_expect_token(p, 22)) // token='=' + (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); - _res = _PyPegen_dummy_name(p, star_targets_var, _literal); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + _res = c; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; done: @@ -25343,9 +25477,53 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: star_targets '=' +// _tmp_158: ',' star_target static void * _tmp_158_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // ',' star_target + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + Token * _literal; + expr_ty c; + if ( + (_literal = _PyPegen_expect_token(p, 12)) // token=',' + && + (c = star_target_rule(p)) // star_target + ) + { + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + _res = c; + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_159: star_targets '=' +static void * +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25359,7 +25537,7 @@ _tmp_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -25368,12 +25546,12 @@ _tmp_158_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -25382,9 +25560,48 @@ _tmp_158_rule(Parser *p) return _res; } -// _tmp_159: ')' | '**' +// _tmp_160: star_targets '=' static void * -_tmp_159_rule(Parser *p) +_tmp_160_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // star_targets '=' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + Token * _literal; + expr_ty star_targets_var; + if ( + (star_targets_var = star_targets_rule(p)) // star_targets + && + (_literal = _PyPegen_expect_token(p, 22)) // token='=' + ) + { + D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + _res = _PyPegen_dummy_name(p, star_targets_var, _literal); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_161: ')' | '**' +static void * +_tmp_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25398,18 +25615,18 @@ _tmp_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -25417,18 +25634,18 @@ _tmp_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -25437,9 +25654,9 @@ _tmp_159_rule(Parser *p) return _res; } -// _tmp_160: ':' | '**' +// _tmp_162: ':' | '**' static void * -_tmp_160_rule(Parser *p) +_tmp_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25453,18 +25670,18 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -25472,18 +25689,18 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -25492,9 +25709,9 @@ _tmp_160_rule(Parser *p) return _res; } -// _tmp_161: expression ['as' star_target] +// _tmp_163: expression ['as' star_target] static void * -_tmp_161_rule(Parser *p) +_tmp_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25508,22 +25725,22 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expression_var; if ( (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_163_rule(p), 1) // ['as' star_target] + (_opt_var = _tmp_165_rule(p), 1) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); _res = _PyPegen_dummy_name(p, expression_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]")); } _res = NULL; @@ -25532,9 +25749,9 @@ _tmp_161_rule(Parser *p) return _res; } -// _tmp_162: expressions ['as' star_target] +// _tmp_164: expressions ['as' star_target] static void * -_tmp_162_rule(Parser *p) +_tmp_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25548,22 +25765,22 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expressions_var; if ( (expressions_var = expressions_rule(p)) // expressions && - (_opt_var = _tmp_164_rule(p), 1) // ['as' star_target] + (_opt_var = _tmp_166_rule(p), 1) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]")); } _res = NULL; @@ -25572,9 +25789,9 @@ _tmp_162_rule(Parser *p) return _res; } -// _tmp_163: 'as' star_target +// _tmp_165: 'as' star_target static void * -_tmp_163_rule(Parser *p) +_tmp_165_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25588,7 +25805,7 @@ _tmp_163_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( @@ -25597,12 +25814,12 @@ _tmp_163_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_165[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; @@ -25611,9 +25828,9 @@ _tmp_163_rule(Parser *p) return _res; } -// _tmp_164: 'as' star_target +// _tmp_166: 'as' star_target static void * -_tmp_164_rule(Parser *p) +_tmp_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25627,7 +25844,7 @@ _tmp_164_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( @@ -25636,12 +25853,12 @@ _tmp_164_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL;