From b280248be8e648feb82f3f3ed0050e50b238df7b Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Thu, 15 Apr 2021 21:38:45 +0100 Subject: bpo-43822: Improve syntax errors for missing commas (GH-25377) --- Doc/library/token-list.inc | 2 + Grammar/Tokens | 1 + Grammar/python.gram | 9 + Include/token.h | 5 +- Lib/test/test_genexps.py | 2 +- Lib/test/test_syntax.py | 24 +- Lib/token.py | 11 +- .../2021-04-13-02-32-18.bpo-43822.lej0OO.rst | 2 + Parser/parser.c | 1412 +++++++++++--------- Parser/pegen.c | 18 + Parser/pegen.h | 2 + Parser/token.c | 1 + Tools/peg_generator/pegen/c_generator.py | 12 + 13 files changed, 851 insertions(+), 650 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-04-13-02-32-18.bpo-43822.lej0OO.rst diff --git a/Doc/library/token-list.inc b/Doc/library/token-list.inc index 877d39a..1a99f05 100644 --- a/Doc/library/token-list.inc +++ b/Doc/library/token-list.inc @@ -211,6 +211,8 @@ .. data:: TYPE_COMMENT +.. data:: SOFT_KEYWORD + .. data:: ERRORTOKEN .. data:: N_TOKENS diff --git a/Grammar/Tokens b/Grammar/Tokens index 9de2da5..1f3e3b0 100644 --- a/Grammar/Tokens +++ b/Grammar/Tokens @@ -59,6 +59,7 @@ AWAIT ASYNC TYPE_IGNORE TYPE_COMMENT +SOFT_KEYWORD ERRORTOKEN # These aren't used by the C tokenizer but are needed for tokenize.py diff --git a/Grammar/python.gram b/Grammar/python.gram index 8e399f1..e5baac3 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -7,6 +7,7 @@ _PyPegen_parse(Parser *p) // Initialize keywords p->keywords = reserved_keywords; p->n_keyword_lists = n_keyword_lists; + p->soft_keywords = soft_keywords; // Run parser void *result = NULL; @@ -459,6 +460,7 @@ expressions[expr_ty]: | a=expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_singleton_seq(p, a)), Load, EXTRA) } | expression expression[expr_ty] (memo): + | invalid_expression | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, a, c, EXTRA) } | disjunction | lambdef @@ -778,6 +780,13 @@ invalid_kwarg: | expression a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION( a, "expression cannot contain assignment, perhaps you meant \"==\"?") } + +invalid_expression: + # !(NAME STRING) is not matched so we don't show this error with some invalid string prefixes like: kf"dsfsdf" + # Soft keywords need to also be ignored because they can be parsed as NAME NAME + | !(NAME STRING | SOFT_KEYWORD) a=disjunction expression { + RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, a->lineno, a->end_col_offset - 1, "invalid syntax. Perhaps you forgot a comma?") } + invalid_named_expression: | a=expression ':=' expression { RAISE_SYNTAX_ERROR_KNOWN_LOCATION( diff --git a/Include/token.h b/Include/token.h index 9b8a3aa..eb1b9ea 100644 --- a/Include/token.h +++ b/Include/token.h @@ -69,8 +69,9 @@ extern "C" { #define ASYNC 56 #define TYPE_IGNORE 57 #define TYPE_COMMENT 58 -#define ERRORTOKEN 59 -#define N_TOKENS 63 +#define SOFT_KEYWORD 59 +#define ERRORTOKEN 60 +#define N_TOKENS 64 #define NT_OFFSET 256 /* Special definitions for cooperation with parser */ diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py index 5c1a209..70fe2bb 100644 --- a/Lib/test/test_genexps.py +++ b/Lib/test/test_genexps.py @@ -103,7 +103,7 @@ Verify that parenthesis are required when used as a keyword argument value >>> dict(a = i for i in range(10)) Traceback (most recent call last): ... - SyntaxError: invalid syntax + SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='? Verify that parenthesis are required when used as a keyword argument value diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 75b778d..4d8198e 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -248,22 +248,36 @@ SyntaxError: did you forget parentheses around the comprehension target? # Missing commas in literals collections should not # produce special error messages regarding missing -# parentheses +# parentheses, but about missing commas instead >>> [1, 2 3] Traceback (most recent call last): -SyntaxError: invalid syntax +SyntaxError: invalid syntax. Perhaps you forgot a comma? >>> {1, 2 3} Traceback (most recent call last): -SyntaxError: invalid syntax +SyntaxError: invalid syntax. Perhaps you forgot a comma? >>> {1:2, 2:5 3:12} Traceback (most recent call last): -SyntaxError: invalid syntax +SyntaxError: invalid syntax. Perhaps you forgot a comma? >>> (1, 2 3) Traceback (most recent call last): +SyntaxError: invalid syntax. Perhaps you forgot a comma? + +# Make sure soft keywords constructs don't raise specialized +# errors regarding missing commas + +>>> match x: +... y = 3 +Traceback (most recent call last): +SyntaxError: invalid syntax + +>>> match x: +... case y: +... 3 $ 3 +Traceback (most recent call last): SyntaxError: invalid syntax From compiler_complex_args(): @@ -864,7 +878,7 @@ leading to spurious errors. SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='? Ensure that early = are not matched by the parser as invalid comparisons - >>> f(2, 4, x=34); {1,2 a} + >>> f(2, 4, x=34); 1 $ 2 Traceback (most recent call last): SyntaxError: invalid syntax diff --git a/Lib/token.py b/Lib/token.py index 493bf04..9d0c0bf 100644 --- a/Lib/token.py +++ b/Lib/token.py @@ -62,12 +62,13 @@ AWAIT = 55 ASYNC = 56 TYPE_IGNORE = 57 TYPE_COMMENT = 58 +SOFT_KEYWORD = 59 # These aren't used by the C tokenizer but are needed for tokenize.py -ERRORTOKEN = 59 -COMMENT = 60 -NL = 61 -ENCODING = 62 -N_TOKENS = 63 +ERRORTOKEN = 60 +COMMENT = 61 +NL = 62 +ENCODING = 63 +N_TOKENS = 64 # Special definitions for cooperation with parser NT_OFFSET = 256 diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-04-13-02-32-18.bpo-43822.lej0OO.rst b/Misc/NEWS.d/next/Core and Builtins/2021-04-13-02-32-18.bpo-43822.lej0OO.rst new file mode 100644 index 0000000..f0e1c2f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2021-04-13-02-32-18.bpo-43822.lej0OO.rst @@ -0,0 +1,2 @@ +Improve syntax errors in the parser for missing commas between expressions. +Patch by Pablo Galindo. diff --git a/Parser/parser.c b/Parser/parser.c index 2ead052..2f7a71a 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -65,6 +65,12 @@ static KeywordToken *reserved_keywords[] = { {NULL, -1}, }, }; +static char *soft_keywords[] = { + "_", + "case", + "match", + NULL, +}; #define file_type 1000 #define interactive_type 1001 #define eval_type 1002 @@ -242,222 +248,224 @@ static KeywordToken *reserved_keywords[] = { #define t_atom_type 1174 #define invalid_arguments_type 1175 #define invalid_kwarg_type 1176 -#define invalid_named_expression_type 1177 -#define invalid_assignment_type 1178 -#define invalid_ann_assign_target_type 1179 -#define invalid_del_stmt_type 1180 -#define invalid_block_type 1181 -#define invalid_primary_type 1182 // Left-recursive -#define invalid_comprehension_type 1183 -#define invalid_dict_comprehension_type 1184 -#define invalid_parameters_type 1185 -#define invalid_parameters_helper_type 1186 -#define invalid_lambda_parameters_type 1187 -#define invalid_lambda_parameters_helper_type 1188 -#define invalid_star_etc_type 1189 -#define invalid_lambda_star_etc_type 1190 -#define invalid_double_type_comments_type 1191 -#define invalid_with_item_type 1192 -#define invalid_for_target_type 1193 -#define invalid_group_type 1194 -#define invalid_import_from_targets_type 1195 -#define invalid_with_stmt_type 1196 -#define invalid_except_block_type 1197 -#define invalid_match_stmt_type 1198 -#define invalid_case_block_type 1199 -#define invalid_if_stmt_type 1200 -#define invalid_elif_stmt_type 1201 -#define invalid_while_stmt_type 1202 -#define invalid_double_starred_kvpairs_type 1203 -#define invalid_kvpair_type 1204 -#define _loop0_1_type 1205 -#define _loop0_2_type 1206 -#define _loop0_4_type 1207 -#define _gather_3_type 1208 -#define _loop0_6_type 1209 -#define _gather_5_type 1210 -#define _loop0_8_type 1211 -#define _gather_7_type 1212 -#define _loop0_10_type 1213 -#define _gather_9_type 1214 -#define _loop1_11_type 1215 -#define _loop0_13_type 1216 -#define _gather_12_type 1217 -#define _tmp_14_type 1218 -#define _tmp_15_type 1219 -#define _tmp_16_type 1220 -#define _tmp_17_type 1221 -#define _tmp_18_type 1222 -#define _tmp_19_type 1223 -#define _tmp_20_type 1224 -#define _tmp_21_type 1225 -#define _loop1_22_type 1226 -#define _tmp_23_type 1227 -#define _tmp_24_type 1228 -#define _loop0_26_type 1229 -#define _gather_25_type 1230 -#define _loop0_28_type 1231 -#define _gather_27_type 1232 -#define _tmp_29_type 1233 -#define _tmp_30_type 1234 -#define _loop0_31_type 1235 -#define _loop1_32_type 1236 -#define _loop0_34_type 1237 -#define _gather_33_type 1238 -#define _tmp_35_type 1239 -#define _loop0_37_type 1240 -#define _gather_36_type 1241 -#define _tmp_38_type 1242 -#define _loop0_40_type 1243 -#define _gather_39_type 1244 -#define _loop0_42_type 1245 -#define _gather_41_type 1246 -#define _loop0_44_type 1247 -#define _gather_43_type 1248 -#define _loop0_46_type 1249 -#define _gather_45_type 1250 -#define _tmp_47_type 1251 -#define _loop1_48_type 1252 -#define _tmp_49_type 1253 -#define _loop1_50_type 1254 -#define _loop0_52_type 1255 -#define _gather_51_type 1256 -#define _tmp_53_type 1257 -#define _tmp_54_type 1258 -#define _tmp_55_type 1259 -#define _loop0_57_type 1260 -#define _gather_56_type 1261 -#define _tmp_58_type 1262 -#define _loop0_60_type 1263 -#define _gather_59_type 1264 -#define _tmp_61_type 1265 -#define _loop0_63_type 1266 -#define _gather_62_type 1267 -#define _loop0_65_type 1268 -#define _gather_64_type 1269 -#define _tmp_66_type 1270 -#define _tmp_67_type 1271 -#define _tmp_68_type 1272 -#define _tmp_69_type 1273 -#define _loop0_70_type 1274 -#define _loop0_71_type 1275 -#define _loop0_72_type 1276 -#define _loop1_73_type 1277 -#define _loop0_74_type 1278 -#define _loop1_75_type 1279 -#define _loop1_76_type 1280 -#define _loop1_77_type 1281 -#define _loop0_78_type 1282 -#define _loop1_79_type 1283 -#define _loop0_80_type 1284 -#define _loop1_81_type 1285 -#define _loop0_82_type 1286 -#define _loop1_83_type 1287 -#define _loop1_84_type 1288 -#define _tmp_85_type 1289 -#define _loop1_86_type 1290 -#define _loop0_88_type 1291 -#define _gather_87_type 1292 -#define _loop1_89_type 1293 -#define _loop0_90_type 1294 -#define _loop0_91_type 1295 -#define _loop0_92_type 1296 -#define _loop1_93_type 1297 -#define _loop0_94_type 1298 -#define _loop1_95_type 1299 -#define _loop1_96_type 1300 -#define _loop1_97_type 1301 -#define _loop0_98_type 1302 -#define _loop1_99_type 1303 -#define _loop0_100_type 1304 -#define _loop1_101_type 1305 -#define _loop0_102_type 1306 -#define _loop1_103_type 1307 -#define _loop1_104_type 1308 -#define _loop1_105_type 1309 -#define _loop1_106_type 1310 -#define _tmp_107_type 1311 -#define _loop0_109_type 1312 -#define _gather_108_type 1313 -#define _tmp_110_type 1314 -#define _tmp_111_type 1315 -#define _tmp_112_type 1316 -#define _tmp_113_type 1317 -#define _loop1_114_type 1318 -#define _tmp_115_type 1319 -#define _tmp_116_type 1320 -#define _loop0_118_type 1321 -#define _gather_117_type 1322 -#define _loop1_119_type 1323 -#define _loop0_120_type 1324 -#define _loop0_121_type 1325 -#define _loop0_123_type 1326 -#define _gather_122_type 1327 -#define _tmp_124_type 1328 -#define _loop0_126_type 1329 -#define _gather_125_type 1330 -#define _loop0_128_type 1331 -#define _gather_127_type 1332 -#define _loop0_130_type 1333 -#define _gather_129_type 1334 -#define _loop0_132_type 1335 -#define _gather_131_type 1336 -#define _loop0_133_type 1337 -#define _loop0_135_type 1338 -#define _gather_134_type 1339 -#define _loop1_136_type 1340 -#define _tmp_137_type 1341 -#define _loop0_139_type 1342 -#define _gather_138_type 1343 -#define _loop0_141_type 1344 -#define _gather_140_type 1345 -#define _tmp_142_type 1346 -#define _tmp_143_type 1347 -#define _tmp_144_type 1348 -#define _tmp_145_type 1349 -#define _loop0_146_type 1350 -#define _loop0_147_type 1351 -#define _loop0_148_type 1352 -#define _tmp_149_type 1353 -#define _tmp_150_type 1354 -#define _tmp_151_type 1355 -#define _loop0_152_type 1356 -#define _loop1_153_type 1357 -#define _loop0_154_type 1358 -#define _loop1_155_type 1359 -#define _tmp_156_type 1360 -#define _tmp_157_type 1361 -#define _tmp_158_type 1362 -#define _loop0_160_type 1363 -#define _gather_159_type 1364 -#define _loop0_162_type 1365 -#define _gather_161_type 1366 -#define _tmp_163_type 1367 -#define _tmp_164_type 1368 -#define _loop0_166_type 1369 -#define _gather_165_type 1370 -#define _tmp_167_type 1371 -#define _tmp_168_type 1372 -#define _tmp_169_type 1373 -#define _tmp_170_type 1374 -#define _tmp_171_type 1375 -#define _tmp_172_type 1376 -#define _tmp_173_type 1377 -#define _tmp_174_type 1378 -#define _tmp_175_type 1379 -#define _tmp_176_type 1380 -#define _tmp_177_type 1381 -#define _tmp_178_type 1382 -#define _tmp_179_type 1383 -#define _tmp_180_type 1384 -#define _tmp_181_type 1385 -#define _tmp_182_type 1386 -#define _tmp_183_type 1387 -#define _tmp_184_type 1388 -#define _tmp_185_type 1389 -#define _tmp_186_type 1390 -#define _tmp_187_type 1391 -#define _tmp_188_type 1392 +#define invalid_expression_type 1177 +#define invalid_named_expression_type 1178 +#define invalid_assignment_type 1179 +#define invalid_ann_assign_target_type 1180 +#define invalid_del_stmt_type 1181 +#define invalid_block_type 1182 +#define invalid_primary_type 1183 // Left-recursive +#define invalid_comprehension_type 1184 +#define invalid_dict_comprehension_type 1185 +#define invalid_parameters_type 1186 +#define invalid_parameters_helper_type 1187 +#define invalid_lambda_parameters_type 1188 +#define invalid_lambda_parameters_helper_type 1189 +#define invalid_star_etc_type 1190 +#define invalid_lambda_star_etc_type 1191 +#define invalid_double_type_comments_type 1192 +#define invalid_with_item_type 1193 +#define invalid_for_target_type 1194 +#define invalid_group_type 1195 +#define invalid_import_from_targets_type 1196 +#define invalid_with_stmt_type 1197 +#define invalid_except_block_type 1198 +#define invalid_match_stmt_type 1199 +#define invalid_case_block_type 1200 +#define invalid_if_stmt_type 1201 +#define invalid_elif_stmt_type 1202 +#define invalid_while_stmt_type 1203 +#define invalid_double_starred_kvpairs_type 1204 +#define invalid_kvpair_type 1205 +#define _loop0_1_type 1206 +#define _loop0_2_type 1207 +#define _loop0_4_type 1208 +#define _gather_3_type 1209 +#define _loop0_6_type 1210 +#define _gather_5_type 1211 +#define _loop0_8_type 1212 +#define _gather_7_type 1213 +#define _loop0_10_type 1214 +#define _gather_9_type 1215 +#define _loop1_11_type 1216 +#define _loop0_13_type 1217 +#define _gather_12_type 1218 +#define _tmp_14_type 1219 +#define _tmp_15_type 1220 +#define _tmp_16_type 1221 +#define _tmp_17_type 1222 +#define _tmp_18_type 1223 +#define _tmp_19_type 1224 +#define _tmp_20_type 1225 +#define _tmp_21_type 1226 +#define _loop1_22_type 1227 +#define _tmp_23_type 1228 +#define _tmp_24_type 1229 +#define _loop0_26_type 1230 +#define _gather_25_type 1231 +#define _loop0_28_type 1232 +#define _gather_27_type 1233 +#define _tmp_29_type 1234 +#define _tmp_30_type 1235 +#define _loop0_31_type 1236 +#define _loop1_32_type 1237 +#define _loop0_34_type 1238 +#define _gather_33_type 1239 +#define _tmp_35_type 1240 +#define _loop0_37_type 1241 +#define _gather_36_type 1242 +#define _tmp_38_type 1243 +#define _loop0_40_type 1244 +#define _gather_39_type 1245 +#define _loop0_42_type 1246 +#define _gather_41_type 1247 +#define _loop0_44_type 1248 +#define _gather_43_type 1249 +#define _loop0_46_type 1250 +#define _gather_45_type 1251 +#define _tmp_47_type 1252 +#define _loop1_48_type 1253 +#define _tmp_49_type 1254 +#define _loop1_50_type 1255 +#define _loop0_52_type 1256 +#define _gather_51_type 1257 +#define _tmp_53_type 1258 +#define _tmp_54_type 1259 +#define _tmp_55_type 1260 +#define _loop0_57_type 1261 +#define _gather_56_type 1262 +#define _tmp_58_type 1263 +#define _loop0_60_type 1264 +#define _gather_59_type 1265 +#define _tmp_61_type 1266 +#define _loop0_63_type 1267 +#define _gather_62_type 1268 +#define _loop0_65_type 1269 +#define _gather_64_type 1270 +#define _tmp_66_type 1271 +#define _tmp_67_type 1272 +#define _tmp_68_type 1273 +#define _tmp_69_type 1274 +#define _loop0_70_type 1275 +#define _loop0_71_type 1276 +#define _loop0_72_type 1277 +#define _loop1_73_type 1278 +#define _loop0_74_type 1279 +#define _loop1_75_type 1280 +#define _loop1_76_type 1281 +#define _loop1_77_type 1282 +#define _loop0_78_type 1283 +#define _loop1_79_type 1284 +#define _loop0_80_type 1285 +#define _loop1_81_type 1286 +#define _loop0_82_type 1287 +#define _loop1_83_type 1288 +#define _loop1_84_type 1289 +#define _tmp_85_type 1290 +#define _loop1_86_type 1291 +#define _loop0_88_type 1292 +#define _gather_87_type 1293 +#define _loop1_89_type 1294 +#define _loop0_90_type 1295 +#define _loop0_91_type 1296 +#define _loop0_92_type 1297 +#define _loop1_93_type 1298 +#define _loop0_94_type 1299 +#define _loop1_95_type 1300 +#define _loop1_96_type 1301 +#define _loop1_97_type 1302 +#define _loop0_98_type 1303 +#define _loop1_99_type 1304 +#define _loop0_100_type 1305 +#define _loop1_101_type 1306 +#define _loop0_102_type 1307 +#define _loop1_103_type 1308 +#define _loop1_104_type 1309 +#define _loop1_105_type 1310 +#define _loop1_106_type 1311 +#define _tmp_107_type 1312 +#define _loop0_109_type 1313 +#define _gather_108_type 1314 +#define _tmp_110_type 1315 +#define _tmp_111_type 1316 +#define _tmp_112_type 1317 +#define _tmp_113_type 1318 +#define _loop1_114_type 1319 +#define _tmp_115_type 1320 +#define _tmp_116_type 1321 +#define _loop0_118_type 1322 +#define _gather_117_type 1323 +#define _loop1_119_type 1324 +#define _loop0_120_type 1325 +#define _loop0_121_type 1326 +#define _loop0_123_type 1327 +#define _gather_122_type 1328 +#define _tmp_124_type 1329 +#define _loop0_126_type 1330 +#define _gather_125_type 1331 +#define _loop0_128_type 1332 +#define _gather_127_type 1333 +#define _loop0_130_type 1334 +#define _gather_129_type 1335 +#define _loop0_132_type 1336 +#define _gather_131_type 1337 +#define _loop0_133_type 1338 +#define _loop0_135_type 1339 +#define _gather_134_type 1340 +#define _loop1_136_type 1341 +#define _tmp_137_type 1342 +#define _loop0_139_type 1343 +#define _gather_138_type 1344 +#define _loop0_141_type 1345 +#define _gather_140_type 1346 +#define _tmp_142_type 1347 +#define _tmp_143_type 1348 +#define _tmp_144_type 1349 +#define _tmp_145_type 1350 +#define _tmp_146_type 1351 +#define _loop0_147_type 1352 +#define _loop0_148_type 1353 +#define _loop0_149_type 1354 +#define _tmp_150_type 1355 +#define _tmp_151_type 1356 +#define _tmp_152_type 1357 +#define _loop0_153_type 1358 +#define _loop1_154_type 1359 +#define _loop0_155_type 1360 +#define _loop1_156_type 1361 +#define _tmp_157_type 1362 +#define _tmp_158_type 1363 +#define _tmp_159_type 1364 +#define _loop0_161_type 1365 +#define _gather_160_type 1366 +#define _loop0_163_type 1367 +#define _gather_162_type 1368 +#define _tmp_164_type 1369 +#define _tmp_165_type 1370 +#define _loop0_167_type 1371 +#define _gather_166_type 1372 +#define _tmp_168_type 1373 +#define _tmp_169_type 1374 +#define _tmp_170_type 1375 +#define _tmp_171_type 1376 +#define _tmp_172_type 1377 +#define _tmp_173_type 1378 +#define _tmp_174_type 1379 +#define _tmp_175_type 1380 +#define _tmp_176_type 1381 +#define _tmp_177_type 1382 +#define _tmp_178_type 1383 +#define _tmp_179_type 1384 +#define _tmp_180_type 1385 +#define _tmp_181_type 1386 +#define _tmp_182_type 1387 +#define _tmp_183_type 1388 +#define _tmp_184_type 1389 +#define _tmp_185_type 1390 +#define _tmp_186_type 1391 +#define _tmp_187_type 1392 +#define _tmp_188_type 1393 +#define _tmp_189_type 1394 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -636,6 +644,7 @@ static void *t_lookahead_rule(Parser *p); static expr_ty t_atom_rule(Parser *p); static void *invalid_arguments_rule(Parser *p); static void *invalid_kwarg_rule(Parser *p); +static void *invalid_expression_rule(Parser *p); static void *invalid_named_expression_rule(Parser *p); static void *invalid_assignment_rule(Parser *p); static expr_ty invalid_ann_assign_target_rule(Parser *p); @@ -809,28 +818,28 @@ static void *_tmp_142_rule(Parser *p); static void *_tmp_143_rule(Parser *p); static void *_tmp_144_rule(Parser *p); static void *_tmp_145_rule(Parser *p); -static asdl_seq *_loop0_146_rule(Parser *p); +static void *_tmp_146_rule(Parser *p); static asdl_seq *_loop0_147_rule(Parser *p); static asdl_seq *_loop0_148_rule(Parser *p); -static void *_tmp_149_rule(Parser *p); +static asdl_seq *_loop0_149_rule(Parser *p); static void *_tmp_150_rule(Parser *p); static void *_tmp_151_rule(Parser *p); -static asdl_seq *_loop0_152_rule(Parser *p); -static asdl_seq *_loop1_153_rule(Parser *p); -static asdl_seq *_loop0_154_rule(Parser *p); -static asdl_seq *_loop1_155_rule(Parser *p); -static void *_tmp_156_rule(Parser *p); +static void *_tmp_152_rule(Parser *p); +static asdl_seq *_loop0_153_rule(Parser *p); +static asdl_seq *_loop1_154_rule(Parser *p); +static asdl_seq *_loop0_155_rule(Parser *p); +static asdl_seq *_loop1_156_rule(Parser *p); static void *_tmp_157_rule(Parser *p); static void *_tmp_158_rule(Parser *p); -static asdl_seq *_loop0_160_rule(Parser *p); -static asdl_seq *_gather_159_rule(Parser *p); -static asdl_seq *_loop0_162_rule(Parser *p); -static asdl_seq *_gather_161_rule(Parser *p); -static void *_tmp_163_rule(Parser *p); +static void *_tmp_159_rule(Parser *p); +static asdl_seq *_loop0_161_rule(Parser *p); +static asdl_seq *_gather_160_rule(Parser *p); +static asdl_seq *_loop0_163_rule(Parser *p); +static asdl_seq *_gather_162_rule(Parser *p); static void *_tmp_164_rule(Parser *p); -static asdl_seq *_loop0_166_rule(Parser *p); -static asdl_seq *_gather_165_rule(Parser *p); -static void *_tmp_167_rule(Parser *p); +static void *_tmp_165_rule(Parser *p); +static asdl_seq *_loop0_167_rule(Parser *p); +static asdl_seq *_gather_166_rule(Parser *p); static void *_tmp_168_rule(Parser *p); static void *_tmp_169_rule(Parser *p); static void *_tmp_170_rule(Parser *p); @@ -852,6 +861,7 @@ static void *_tmp_185_rule(Parser *p); static void *_tmp_186_rule(Parser *p); static void *_tmp_187_rule(Parser *p); static void *_tmp_188_rule(Parser *p); +static void *_tmp_189_rule(Parser *p); // file: statements? $ @@ -9678,7 +9688,11 @@ expressions_rule(Parser *p) return _res; } -// expression: disjunction 'if' disjunction 'else' expression | disjunction | lambdef +// expression: +// | invalid_expression +// | disjunction 'if' disjunction 'else' expression +// | disjunction +// | lambdef static expr_ty expression_rule(Parser *p) { @@ -9702,6 +9716,25 @@ expression_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 + if (p->call_invalid_rules) { // invalid_expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_expression")); + void *invalid_expression_var; + if ( + (invalid_expression_var = invalid_expression_rule(p)) // invalid_expression + ) + { + D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_expression")); + _res = invalid_expression_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_expression")); + } { // disjunction 'if' disjunction 'else' expression if (p->error_indicator) { D(p->level--); @@ -17443,6 +17476,52 @@ invalid_kwarg_rule(Parser *p) return _res; } +// invalid_expression: !(NAME STRING | SOFT_KEYWORD) disjunction expression +static void * +invalid_expression_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // !(NAME STRING | SOFT_KEYWORD) disjunction expression + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression")); + expr_ty a; + expr_ty expression_var; + if ( + _PyPegen_lookahead(0, _tmp_143_rule, p) + && + (a = disjunction_rule(p)) // disjunction + && + (expression_var = expression_rule(p)) // expression + ) + { + D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression")); + _res = RAISE_ERROR_KNOWN_LOCATION ( p , PyExc_SyntaxError , a -> lineno , a -> end_col_offset - 1 , "invalid syntax. Perhaps you forgot a comma?" ); + 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_expression[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + // invalid_named_expression: // | expression ':=' expression // | NAME '=' bitwise_or !('=' | ':=' | ',') @@ -17503,7 +17582,7 @@ invalid_named_expression_rule(Parser *p) && (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or && - _PyPegen_lookahead(0, _tmp_143_rule, p) + _PyPegen_lookahead(0, _tmp_144_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=' | ',')")); @@ -17529,7 +17608,7 @@ invalid_named_expression_rule(Parser *p) Token * b; expr_ty bitwise_or_var; if ( - _PyPegen_lookahead(0, _tmp_144_rule, p) + _PyPegen_lookahead(0, _tmp_145_rule, p) && (a = bitwise_or_rule(p)) // bitwise_or && @@ -17537,7 +17616,7 @@ invalid_named_expression_rule(Parser *p) && (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or && - _PyPegen_lookahead(0, _tmp_145_rule, p) + _PyPegen_lookahead(0, _tmp_146_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=' | ',')")); @@ -17614,7 +17693,7 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_146_var; + asdl_seq * _loop0_147_var; expr_ty a; expr_ty expression_var; if ( @@ -17622,7 +17701,7 @@ invalid_assignment_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_146_var = _loop0_146_rule(p)) // star_named_expressions* + (_loop0_147_var = _loop0_147_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -17679,10 +17758,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); Token * _literal; - asdl_seq * _loop0_147_var; + asdl_seq * _loop0_148_var; expr_ty a; if ( - (_loop0_147_var = _loop0_147_rule(p)) // ((star_targets '='))* + (_loop0_148_var = _loop0_148_rule(p)) // ((star_targets '='))* && (a = star_expressions_rule(p)) // star_expressions && @@ -17709,10 +17788,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); Token * _literal; - asdl_seq * _loop0_148_var; + asdl_seq * _loop0_149_var; expr_ty a; if ( - (_loop0_148_var = _loop0_148_rule(p)) // ((star_targets '='))* + (_loop0_149_var = _loop0_149_rule(p)) // ((star_targets '='))* && (a = yield_expr_rule(p)) // yield_expr && @@ -17738,7 +17817,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_149_var; + void *_tmp_150_var; expr_ty a; AugOperator* augassign_var; if ( @@ -17746,7 +17825,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_149_var = _tmp_149_rule(p)) // yield_expr | star_expressions + (_tmp_150_var = _tmp_150_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -18004,11 +18083,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_150_var; + void *_tmp_151_var; expr_ty a; asdl_comprehension_seq* for_if_clauses_var; if ( - (_tmp_150_var = _tmp_150_rule(p)) // '[' | '(' | '{' + (_tmp_151_var = _tmp_151_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -18037,11 +18116,11 @@ invalid_comprehension_rule(Parser *p) Token * _literal; void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings - void *_tmp_151_var; + void *_tmp_152_var; expr_ty a; asdl_comprehension_seq* for_if_clauses_var; if ( - (_tmp_151_var = _tmp_151_rule(p)) // '[' | '{' + (_tmp_152_var = _tmp_152_rule(p)) // '[' | '{' && (a = star_named_expression_rule(p)) // star_named_expression && @@ -18141,11 +18220,11 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default")); - asdl_seq * _loop0_152_var; + asdl_seq * _loop0_153_var; void *invalid_parameters_helper_var; arg_ty param_no_default_var; if ( - (_loop0_152_var = _loop0_152_rule(p)) // param_no_default* + (_loop0_153_var = _loop0_153_rule(p)) // param_no_default* && (invalid_parameters_helper_var = invalid_parameters_helper_rule(p)) // invalid_parameters_helper && @@ -18212,13 +18291,13 @@ invalid_parameters_helper_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_153_var; + asdl_seq * _loop1_154_var; if ( - (_loop1_153_var = _loop1_153_rule(p)) // param_with_default+ + (_loop1_154_var = _loop1_154_rule(p)) // param_with_default+ ) { D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_153_var; + _res = _loop1_154_var; goto done; } p->mark = _mark; @@ -18249,11 +18328,11 @@ invalid_lambda_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default")); - asdl_seq * _loop0_154_var; + asdl_seq * _loop0_155_var; void *invalid_lambda_parameters_helper_var; arg_ty lambda_param_no_default_var; if ( - (_loop0_154_var = _loop0_154_rule(p)) // lambda_param_no_default* + (_loop0_155_var = _loop0_155_rule(p)) // lambda_param_no_default* && (invalid_lambda_parameters_helper_var = invalid_lambda_parameters_helper_rule(p)) // invalid_lambda_parameters_helper && @@ -18322,13 +18401,13 @@ invalid_lambda_parameters_helper_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - asdl_seq * _loop1_155_var; + asdl_seq * _loop1_156_var; if ( - (_loop1_155_var = _loop1_155_rule(p)) // lambda_param_with_default+ + (_loop1_156_var = _loop1_156_rule(p)) // lambda_param_with_default+ ) { D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - _res = _loop1_155_var; + _res = _loop1_156_var; goto done; } p->mark = _mark; @@ -18359,11 +18438,11 @@ invalid_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); Token * _literal; - void *_tmp_156_var; + void *_tmp_157_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_156_var = _tmp_156_rule(p)) // ')' | ',' (')' | '**') + (_tmp_157_var = _tmp_157_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -18433,11 +18512,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_157_var; + void *_tmp_158_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_157_var = _tmp_157_rule(p)) // ':' | ',' (':' | '**') + (_tmp_158_var = _tmp_158_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -18539,7 +18618,7 @@ invalid_with_item_rule(Parser *p) && (a = expression_rule(p)) // expression && - _PyPegen_lookahead(1, _tmp_158_rule, p) + _PyPegen_lookahead(1, _tmp_159_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')")); @@ -18752,7 +18831,7 @@ invalid_with_stmt_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'")); - asdl_seq * _gather_159_var; + asdl_seq * _gather_160_var; Token * _keyword; Token * _literal; void *_opt_var; @@ -18762,13 +18841,13 @@ invalid_with_stmt_rule(Parser *p) && (_keyword = _PyPegen_expect_token(p, 519)) // token='with' && - (_gather_159_var = _gather_159_rule(p)) // ','.(expression ['as' star_target])+ + (_gather_160_var = _gather_160_rule(p)) // ','.(expression ['as' star_target])+ && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' ) { D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'")); - _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _gather_159_var, _literal); + _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _gather_160_var, _literal); goto done; } p->mark = _mark; @@ -18781,7 +18860,7 @@ invalid_with_stmt_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'")); - asdl_seq * _gather_161_var; + asdl_seq * _gather_162_var; Token * _keyword; Token * _literal; Token * _literal_1; @@ -18797,7 +18876,7 @@ invalid_with_stmt_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_gather_161_var = _gather_161_rule(p)) // ','.(expressions ['as' star_target])+ + (_gather_162_var = _gather_162_rule(p)) // ','.(expressions ['as' star_target])+ && (_opt_var_1 = _PyPegen_expect_token(p, 12), 1) // ','? && @@ -18807,7 +18886,7 @@ invalid_with_stmt_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'")); - _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _literal, _gather_161_var, _opt_var_1, _literal_1, _literal_2); + _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _literal, _gather_162_var, _opt_var_1, _literal_1, _literal_2); goto done; } p->mark = _mark; @@ -18856,7 +18935,7 @@ invalid_except_block_rule(Parser *p) && (expressions_var = expressions_rule(p)) // expressions && - (_opt_var = _tmp_163_rule(p), 1) // ['as' NAME] + (_opt_var = _tmp_164_rule(p), 1) // ['as' NAME] && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' ) @@ -18890,7 +18969,7 @@ invalid_except_block_rule(Parser *p) && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_164_rule(p), 1) // ['as' NAME] + (_opt_var = _tmp_165_rule(p), 1) // ['as' NAME] && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' ) @@ -19188,11 +19267,11 @@ invalid_double_starred_kvpairs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair")); - asdl_seq * _gather_165_var; + asdl_seq * _gather_166_var; Token * _literal; void *invalid_kvpair_var; if ( - (_gather_165_var = _gather_165_rule(p)) // ','.double_starred_kvpair+ + (_gather_166_var = _gather_166_rule(p)) // ','.double_starred_kvpair+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -19200,7 +19279,7 @@ invalid_double_starred_kvpairs_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair")); - _res = _PyPegen_dummy_name(p, _gather_165_var, _literal, invalid_kvpair_var); + _res = _PyPegen_dummy_name(p, _gather_166_var, _literal, invalid_kvpair_var); goto done; } p->mark = _mark; @@ -19253,7 +19332,7 @@ invalid_double_starred_kvpairs_rule(Parser *p) && (a = _PyPegen_expect_token(p, 11)) // token=':' && - _PyPegen_lookahead(1, _tmp_167_rule, p) + _PyPegen_lookahead(1, _tmp_168_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')")); @@ -20626,12 +20705,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_168_var; + void *_tmp_169_var; while ( - (_tmp_168_var = _tmp_168_rule(p)) // star_targets '=' + (_tmp_169_var = _tmp_169_rule(p)) // star_targets '=' ) { - _res = _tmp_168_var; + _res = _tmp_169_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21134,12 +21213,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_169_var; + void *_tmp_170_var; while ( - (_tmp_169_var = _tmp_169_rule(p)) // '.' | '...' + (_tmp_170_var = _tmp_170_rule(p)) // '.' | '...' ) { - _res = _tmp_169_var; + _res = _tmp_170_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21200,12 +21279,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_170_var; + void *_tmp_171_var; while ( - (_tmp_170_var = _tmp_170_rule(p)) // '.' | '...' + (_tmp_171_var = _tmp_171_rule(p)) // '.' | '...' ) { - _res = _tmp_170_var; + _res = _tmp_171_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24316,12 +24395,12 @@ _loop1_84_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_171_var; + void *_tmp_172_var; while ( - (_tmp_171_var = _tmp_171_rule(p)) // '@' named_expression NEWLINE + (_tmp_172_var = _tmp_172_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_171_var; + _res = _tmp_172_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24434,12 +24513,12 @@ _loop1_86_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_172_var; + void *_tmp_173_var; while ( - (_tmp_172_var = _tmp_172_rule(p)) // ',' star_expression + (_tmp_173_var = _tmp_173_rule(p)) // ',' star_expression ) { - _res = _tmp_172_var; + _res = _tmp_173_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24619,12 +24698,12 @@ _loop1_89_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_173_var; + void *_tmp_174_var; while ( - (_tmp_173_var = _tmp_173_rule(p)) // ',' expression + (_tmp_174_var = _tmp_174_rule(p)) // ',' expression ) { - _res = _tmp_173_var; + _res = _tmp_174_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25649,12 +25728,12 @@ _loop1_104_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_174_var; + void *_tmp_175_var; while ( - (_tmp_174_var = _tmp_174_rule(p)) // 'or' conjunction + (_tmp_175_var = _tmp_175_rule(p)) // 'or' conjunction ) { - _res = _tmp_174_var; + _res = _tmp_175_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25720,12 +25799,12 @@ _loop1_105_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_175_var; + void *_tmp_176_var; while ( - (_tmp_175_var = _tmp_175_rule(p)) // 'and' inversion + (_tmp_176_var = _tmp_176_rule(p)) // 'and' inversion ) { - _res = _tmp_175_var; + _res = _tmp_176_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26641,12 +26720,12 @@ _loop0_120_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_176_var; + void *_tmp_177_var; while ( - (_tmp_176_var = _tmp_176_rule(p)) // 'if' disjunction + (_tmp_177_var = _tmp_177_rule(p)) // 'if' disjunction ) { - _res = _tmp_176_var; + _res = _tmp_177_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26707,12 +26786,12 @@ _loop0_121_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_177_var; + void *_tmp_178_var; while ( - (_tmp_177_var = _tmp_177_rule(p)) // 'if' disjunction + (_tmp_178_var = _tmp_178_rule(p)) // 'if' disjunction ) { - _res = _tmp_177_var; + _res = _tmp_178_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26778,7 +26857,7 @@ _loop0_123_rule(Parser *p) while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_178_rule(p)) // starred_expression | direct_named_expression !'=' + (elem = _tmp_179_rule(p)) // starred_expression | direct_named_expression !'=' ) { _res = elem; @@ -26841,7 +26920,7 @@ _gather_122_rule(Parser *p) void *elem; asdl_seq * seq; if ( - (elem = _tmp_178_rule(p)) // starred_expression | direct_named_expression !'=' + (elem = _tmp_179_rule(p)) // starred_expression | direct_named_expression !'=' && (seq = _loop0_123_rule(p)) // _loop0_123 ) @@ -27387,12 +27466,12 @@ _loop0_133_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_179_var; + void *_tmp_180_var; while ( - (_tmp_179_var = _tmp_179_rule(p)) // ',' star_target + (_tmp_180_var = _tmp_180_rule(p)) // ',' star_target ) { - _res = _tmp_179_var; + _res = _tmp_180_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27567,12 +27646,12 @@ _loop1_136_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_180_var; + void *_tmp_181_var; while ( - (_tmp_180_var = _tmp_180_rule(p)) // ',' star_target + (_tmp_181_var = _tmp_181_rule(p)) // ',' star_target ) { - _res = _tmp_180_var; + _res = _tmp_181_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27935,7 +28014,7 @@ _tmp_142_rule(Parser *p) return _res; } -// _tmp_143: '=' | ':=' | ',' +// _tmp_143: NAME STRING | SOFT_KEYWORD static void * _tmp_143_rule(Parser *p) { @@ -27946,23 +28025,81 @@ _tmp_143_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; + { // NAME STRING + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME STRING")); + expr_ty name_var; + expr_ty string_var; + if ( + (name_var = _PyPegen_name_token(p)) // NAME + && + (string_var = _PyPegen_string_token(p)) // STRING + ) + { + D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME STRING")); + _res = _PyPegen_dummy_name(p, name_var, string_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME STRING")); + } + { // SOFT_KEYWORD + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD")); + expr_ty soft_keyword_var; + if ( + (soft_keyword_var = _PyPegen_soft_keyword_token(p)) // SOFT_KEYWORD + ) + { + D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD")); + _res = soft_keyword_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "SOFT_KEYWORD")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_144: '=' | ':=' | ',' +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; { // '=' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); } { // ':=' @@ -27970,18 +28107,18 @@ _tmp_143_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 53)) // token=':=' ) { - D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':='")); } { // ',' @@ -27989,18 +28126,18 @@ _tmp_143_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); } _res = NULL; @@ -28009,9 +28146,9 @@ _tmp_143_rule(Parser *p) return _res; } -// _tmp_144: list | tuple | genexp | 'True' | 'None' | 'False' +// _tmp_145: list | tuple | genexp | 'True' | 'None' | 'False' static void * -_tmp_144_rule(Parser *p) +_tmp_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28025,18 +28162,18 @@ _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, "list")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); expr_ty list_var; if ( (list_var = list_rule(p)) // list ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); _res = list_var; 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_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // tuple @@ -28044,18 +28181,18 @@ _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, "tuple")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); expr_ty tuple_var; if ( (tuple_var = tuple_rule(p)) // tuple ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); _res = tuple_var; 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_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // genexp @@ -28063,18 +28200,18 @@ _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, "genexp")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); expr_ty genexp_var; if ( (genexp_var = genexp_rule(p)) // genexp ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); _res = genexp_var; 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_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } { // 'True' @@ -28082,18 +28219,18 @@ _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, "'True'")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); Token * _keyword; if ( (_keyword = _PyPegen_expect_token(p, 524)) // token='True' ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); _res = _keyword; 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_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); } { // 'None' @@ -28101,18 +28238,18 @@ _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, "'None'")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); Token * _keyword; if ( (_keyword = _PyPegen_expect_token(p, 523)) // token='None' ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); _res = _keyword; 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_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); } { // 'False' @@ -28120,18 +28257,18 @@ _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, "'False'")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); Token * _keyword; if ( (_keyword = _PyPegen_expect_token(p, 525)) // token='False' ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); _res = _keyword; 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_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); } _res = NULL; @@ -28140,9 +28277,9 @@ _tmp_144_rule(Parser *p) return _res; } -// _tmp_145: '=' | ':=' | ',' +// _tmp_146: '=' | ':=' | ',' static void * -_tmp_145_rule(Parser *p) +_tmp_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28156,18 +28293,18 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); + 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_145[%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, "'='")); } { // ':=' @@ -28175,18 +28312,18 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 53)) // token=':=' ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='")); + 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_145[%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, "':='")); } { // ',' @@ -28194,18 +28331,18 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); + 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_145[%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, "','")); } _res = NULL; @@ -28214,9 +28351,9 @@ _tmp_145_rule(Parser *p) return _res; } -// _loop0_146: star_named_expressions +// _loop0_147: star_named_expressions static asdl_seq * -_loop0_146_rule(Parser *p) +_loop0_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28240,7 +28377,7 @@ _loop0_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_expr_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -28262,7 +28399,7 @@ _loop0_146_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -28275,14 +28412,14 @@ _loop0_146_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_146_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); D(p->level--); return _seq; } -// _loop0_147: (star_targets '=') +// _loop0_148: (star_targets '=') static asdl_seq * -_loop0_147_rule(Parser *p) +_loop0_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28306,13 +28443,13 @@ _loop0_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_181_var; + D(fprintf(stderr, "%*c> _loop0_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_182_var; while ( - (_tmp_181_var = _tmp_181_rule(p)) // star_targets '=' + (_tmp_182_var = _tmp_182_rule(p)) // star_targets '=' ) { - _res = _tmp_181_var; + _res = _tmp_182_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -28328,7 +28465,7 @@ _loop0_147_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -28341,14 +28478,14 @@ _loop0_147_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_147_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_148_type, _seq); D(p->level--); return _seq; } -// _loop0_148: (star_targets '=') +// _loop0_149: (star_targets '=') static asdl_seq * -_loop0_148_rule(Parser *p) +_loop0_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28372,13 +28509,13 @@ _loop0_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_182_var; + D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_183_var; while ( - (_tmp_182_var = _tmp_182_rule(p)) // star_targets '=' + (_tmp_183_var = _tmp_183_rule(p)) // star_targets '=' ) { - _res = _tmp_182_var; + _res = _tmp_183_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -28394,7 +28531,7 @@ _loop0_148_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -28407,14 +28544,14 @@ _loop0_148_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_148_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_149_type, _seq); D(p->level--); return _seq; } -// _tmp_149: yield_expr | star_expressions +// _tmp_150: yield_expr | star_expressions static void * -_tmp_149_rule(Parser *p) +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28428,18 +28565,18 @@ _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, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); expr_ty yield_expr_var; if ( (yield_expr_var = yield_expr_rule(p)) // yield_expr ) { - D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); _res = yield_expr_var; 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_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -28447,18 +28584,18 @@ _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, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); expr_ty star_expressions_var; if ( (star_expressions_var = star_expressions_rule(p)) // star_expressions ) { - D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); _res = star_expressions_var; 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_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -28467,9 +28604,9 @@ _tmp_149_rule(Parser *p) return _res; } -// _tmp_150: '[' | '(' | '{' +// _tmp_151: '[' | '(' | '{' static void * -_tmp_150_rule(Parser *p) +_tmp_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28483,18 +28620,18 @@ _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, "'['")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; 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_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -28502,18 +28639,18 @@ _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, "'('")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; 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_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -28521,18 +28658,18 @@ _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, "'{'")); + D(fprintf(stderr, "%*c> _tmp_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; 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_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -28541,9 +28678,9 @@ _tmp_150_rule(Parser *p) return _res; } -// _tmp_151: '[' | '{' +// _tmp_152: '[' | '{' static void * -_tmp_151_rule(Parser *p) +_tmp_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28557,18 +28694,18 @@ _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, "'['")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; 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_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '{' @@ -28576,18 +28713,18 @@ _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, "'{'")); + D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; 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_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -28596,9 +28733,9 @@ _tmp_151_rule(Parser *p) return _res; } -// _loop0_152: param_no_default +// _loop0_153: param_no_default static asdl_seq * -_loop0_152_rule(Parser *p) +_loop0_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28622,7 +28759,7 @@ _loop0_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); arg_ty param_no_default_var; while ( (param_no_default_var = param_no_default_rule(p)) // param_no_default @@ -28644,7 +28781,7 @@ _loop0_152_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -28657,14 +28794,14 @@ _loop0_152_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_152_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_153_type, _seq); D(p->level--); return _seq; } -// _loop1_153: param_with_default +// _loop1_154: param_with_default static asdl_seq * -_loop1_153_rule(Parser *p) +_loop1_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28688,7 +28825,7 @@ _loop1_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); NameDefaultPair* param_with_default_var; while ( (param_with_default_var = param_with_default_rule(p)) // param_with_default @@ -28710,7 +28847,7 @@ _loop1_153_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -28728,14 +28865,14 @@ _loop1_153_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_153_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_154_type, _seq); D(p->level--); return _seq; } -// _loop0_154: lambda_param_no_default +// _loop0_155: lambda_param_no_default static asdl_seq * -_loop0_154_rule(Parser *p) +_loop0_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28759,7 +28896,7 @@ _loop0_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); arg_ty lambda_param_no_default_var; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -28781,7 +28918,7 @@ _loop0_154_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -28794,14 +28931,14 @@ _loop0_154_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_154_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_155_type, _seq); D(p->level--); return _seq; } -// _loop1_155: lambda_param_with_default +// _loop1_156: lambda_param_with_default static asdl_seq * -_loop1_155_rule(Parser *p) +_loop1_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28825,7 +28962,7 @@ _loop1_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); NameDefaultPair* lambda_param_with_default_var; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -28847,7 +28984,7 @@ _loop1_155_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -28865,14 +29002,14 @@ _loop1_155_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_155_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_156_type, _seq); D(p->level--); return _seq; } -// _tmp_156: ')' | ',' (')' | '**') +// _tmp_157: ')' | ',' (')' | '**') static void * -_tmp_156_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28886,18 +29023,18 @@ _tmp_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -28905,21 +29042,21 @@ _tmp_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_183_var; + void *_tmp_184_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_183_var = _tmp_183_rule(p)) // ')' | '**' + (_tmp_184_var = _tmp_184_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_183_var); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_184_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -28928,9 +29065,9 @@ _tmp_156_rule(Parser *p) return _res; } -// _tmp_157: ':' | ',' (':' | '**') +// _tmp_158: ':' | ',' (':' | '**') static void * -_tmp_157_rule(Parser *p) +_tmp_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28944,18 +29081,18 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -28963,21 +29100,21 @@ _tmp_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_184_var; + void *_tmp_185_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_184_var = _tmp_184_rule(p)) // ':' | '**' + (_tmp_185_var = _tmp_185_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_184_var); + D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_185_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_158[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -28986,9 +29123,9 @@ _tmp_157_rule(Parser *p) return _res; } -// _tmp_158: ',' | ')' | ':' +// _tmp_159: ',' | ')' | ':' static void * -_tmp_158_rule(Parser *p) +_tmp_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29002,18 +29139,18 @@ _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, "','")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); _res = _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, "','")); } { // ')' @@ -29021,18 +29158,18 @@ _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, "')'")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _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, "')'")); } { // ':' @@ -29040,18 +29177,18 @@ _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, "':'")); + D(fprintf(stderr, "%*c> _tmp_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_158[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _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, "':'")); } _res = NULL; @@ -29060,9 +29197,9 @@ _tmp_158_rule(Parser *p) return _res; } -// _loop0_160: ',' (expression ['as' star_target]) +// _loop0_161: ',' (expression ['as' star_target]) static asdl_seq * -_loop0_160_rule(Parser *p) +_loop0_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29086,13 +29223,13 @@ _loop0_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])")); + D(fprintf(stderr, "%*c> _loop0_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_185_rule(p)) // expression ['as' star_target] + (elem = _tmp_186_rule(p)) // expression ['as' star_target] ) { _res = elem; @@ -29117,7 +29254,7 @@ _loop0_160_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -29130,14 +29267,14 @@ _loop0_160_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_160_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_161_type, _seq); D(p->level--); return _seq; } -// _gather_159: (expression ['as' star_target]) _loop0_160 +// _gather_160: (expression ['as' star_target]) _loop0_161 static asdl_seq * -_gather_159_rule(Parser *p) +_gather_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29146,27 +29283,27 @@ _gather_159_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (expression ['as' star_target]) _loop0_160 + { // (expression ['as' star_target]) _loop0_161 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_160")); + D(fprintf(stderr, "%*c> _gather_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_161")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_185_rule(p)) // expression ['as' star_target] + (elem = _tmp_186_rule(p)) // expression ['as' star_target] && - (seq = _loop0_160_rule(p)) // _loop0_160 + (seq = _loop0_161_rule(p)) // _loop0_161 ) { - D(fprintf(stderr, "%*c+ _gather_159[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_160")); + D(fprintf(stderr, "%*c+ _gather_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_161")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_159[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_160")); + D(fprintf(stderr, "%*c%s _gather_160[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_161")); } _res = NULL; done: @@ -29174,9 +29311,9 @@ _gather_159_rule(Parser *p) return _res; } -// _loop0_162: ',' (expressions ['as' star_target]) +// _loop0_163: ',' (expressions ['as' star_target]) static asdl_seq * -_loop0_162_rule(Parser *p) +_loop0_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29200,13 +29337,13 @@ _loop0_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])")); + D(fprintf(stderr, "%*c> _loop0_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_186_rule(p)) // expressions ['as' star_target] + (elem = _tmp_187_rule(p)) // expressions ['as' star_target] ) { _res = elem; @@ -29231,7 +29368,7 @@ _loop0_162_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -29244,14 +29381,14 @@ _loop0_162_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_162_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_163_type, _seq); D(p->level--); return _seq; } -// _gather_161: (expressions ['as' star_target]) _loop0_162 +// _gather_162: (expressions ['as' star_target]) _loop0_163 static asdl_seq * -_gather_161_rule(Parser *p) +_gather_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29260,27 +29397,27 @@ _gather_161_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (expressions ['as' star_target]) _loop0_162 + { // (expressions ['as' star_target]) _loop0_163 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_162")); + D(fprintf(stderr, "%*c> _gather_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_163")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_186_rule(p)) // expressions ['as' star_target] + (elem = _tmp_187_rule(p)) // expressions ['as' star_target] && - (seq = _loop0_162_rule(p)) // _loop0_162 + (seq = _loop0_163_rule(p)) // _loop0_163 ) { - D(fprintf(stderr, "%*c+ _gather_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_162")); + D(fprintf(stderr, "%*c+ _gather_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_163")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_161[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_162")); + D(fprintf(stderr, "%*c%s _gather_162[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_163")); } _res = NULL; done: @@ -29288,9 +29425,9 @@ _gather_161_rule(Parser *p) return _res; } -// _tmp_163: 'as' NAME +// _tmp_164: 'as' NAME static void * -_tmp_163_rule(Parser *p) +_tmp_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29304,7 +29441,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' NAME")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); Token * _keyword; expr_ty name_var; if ( @@ -29313,12 +29450,12 @@ _tmp_163_rule(Parser *p) (name_var = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c+ _tmp_164[%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_163[%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, "'as' NAME")); } _res = NULL; @@ -29327,9 +29464,9 @@ _tmp_163_rule(Parser *p) return _res; } -// _tmp_164: 'as' NAME +// _tmp_165: 'as' NAME static void * -_tmp_164_rule(Parser *p) +_tmp_165_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29343,7 +29480,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' NAME")); + D(fprintf(stderr, "%*c> _tmp_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); Token * _keyword; expr_ty name_var; if ( @@ -29352,12 +29489,12 @@ _tmp_164_rule(Parser *p) (name_var = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c+ _tmp_165[%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_164[%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' NAME")); } _res = NULL; @@ -29366,9 +29503,9 @@ _tmp_164_rule(Parser *p) return _res; } -// _loop0_166: ',' double_starred_kvpair +// _loop0_167: ',' double_starred_kvpair static asdl_seq * -_loop0_166_rule(Parser *p) +_loop0_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29392,7 +29529,7 @@ _loop0_166_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -29423,7 +29560,7 @@ _loop0_166_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_166[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_167[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -29436,14 +29573,14 @@ _loop0_166_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop0_166_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_167_type, _seq); D(p->level--); return _seq; } -// _gather_165: double_starred_kvpair _loop0_166 +// _gather_166: double_starred_kvpair _loop0_167 static asdl_seq * -_gather_165_rule(Parser *p) +_gather_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29452,27 +29589,27 @@ _gather_165_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_166 + { // double_starred_kvpair _loop0_167 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_166")); + D(fprintf(stderr, "%*c> _gather_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_167")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_166_rule(p)) // _loop0_166 + (seq = _loop0_167_rule(p)) // _loop0_167 ) { - D(fprintf(stderr, "%*c+ _gather_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_166")); + D(fprintf(stderr, "%*c+ _gather_166[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_167")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_165[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_166")); + D(fprintf(stderr, "%*c%s _gather_166[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_167")); } _res = NULL; done: @@ -29480,9 +29617,9 @@ _gather_165_rule(Parser *p) return _res; } -// _tmp_167: '}' | ',' +// _tmp_168: '}' | ',' static void * -_tmp_167_rule(Parser *p) +_tmp_168_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29496,18 +29633,18 @@ _tmp_167_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); + D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); + D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'")); } { // ',' @@ -29515,18 +29652,18 @@ _tmp_167_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_167[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); } _res = NULL; @@ -29535,9 +29672,9 @@ _tmp_167_rule(Parser *p) return _res; } -// _tmp_168: star_targets '=' +// _tmp_169: star_targets '=' static void * -_tmp_168_rule(Parser *p) +_tmp_169_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29551,7 +29688,7 @@ _tmp_168_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -29560,7 +29697,7 @@ _tmp_168_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_168[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -29570,7 +29707,7 @@ _tmp_168_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_168[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -29579,9 +29716,9 @@ _tmp_168_rule(Parser *p) return _res; } -// _tmp_169: '.' | '...' +// _tmp_170: '.' | '...' static void * -_tmp_169_rule(Parser *p) +_tmp_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29595,18 +29732,18 @@ _tmp_169_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -29614,18 +29751,18 @@ _tmp_169_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_169[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -29634,9 +29771,9 @@ _tmp_169_rule(Parser *p) return _res; } -// _tmp_170: '.' | '...' +// _tmp_171: '.' | '...' static void * -_tmp_170_rule(Parser *p) +_tmp_171_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29650,18 +29787,18 @@ _tmp_170_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -29669,18 +29806,18 @@ _tmp_170_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_170[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_170[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -29689,9 +29826,9 @@ _tmp_170_rule(Parser *p) return _res; } -// _tmp_171: '@' named_expression NEWLINE +// _tmp_172: '@' named_expression NEWLINE static void * -_tmp_171_rule(Parser *p) +_tmp_172_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29705,7 +29842,7 @@ _tmp_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -29717,7 +29854,7 @@ _tmp_171_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -29727,7 +29864,7 @@ _tmp_171_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -29736,9 +29873,9 @@ _tmp_171_rule(Parser *p) return _res; } -// _tmp_172: ',' star_expression +// _tmp_173: ',' star_expression static void * -_tmp_172_rule(Parser *p) +_tmp_173_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29752,7 +29889,7 @@ _tmp_172_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -29761,7 +29898,7 @@ _tmp_172_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -29771,7 +29908,7 @@ _tmp_172_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -29780,9 +29917,9 @@ _tmp_172_rule(Parser *p) return _res; } -// _tmp_173: ',' expression +// _tmp_174: ',' expression static void * -_tmp_173_rule(Parser *p) +_tmp_174_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29796,7 +29933,7 @@ _tmp_173_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -29805,7 +29942,7 @@ _tmp_173_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -29815,7 +29952,7 @@ _tmp_173_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -29824,9 +29961,9 @@ _tmp_173_rule(Parser *p) return _res; } -// _tmp_174: 'or' conjunction +// _tmp_175: 'or' conjunction static void * -_tmp_174_rule(Parser *p) +_tmp_175_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29840,7 +29977,7 @@ _tmp_174_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -29849,7 +29986,7 @@ _tmp_174_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -29859,7 +29996,7 @@ _tmp_174_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -29868,9 +30005,9 @@ _tmp_174_rule(Parser *p) return _res; } -// _tmp_175: 'and' inversion +// _tmp_176: 'and' inversion static void * -_tmp_175_rule(Parser *p) +_tmp_176_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29884,7 +30021,7 @@ _tmp_175_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -29893,7 +30030,7 @@ _tmp_175_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -29903,7 +30040,7 @@ _tmp_175_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -29912,9 +30049,9 @@ _tmp_175_rule(Parser *p) return _res; } -// _tmp_176: 'if' disjunction +// _tmp_177: 'if' disjunction static void * -_tmp_176_rule(Parser *p) +_tmp_177_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29928,7 +30065,7 @@ _tmp_176_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -29937,7 +30074,7 @@ _tmp_176_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -29947,7 +30084,7 @@ _tmp_176_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -29956,9 +30093,9 @@ _tmp_176_rule(Parser *p) return _res; } -// _tmp_177: 'if' disjunction +// _tmp_178: 'if' disjunction static void * -_tmp_177_rule(Parser *p) +_tmp_178_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29972,7 +30109,7 @@ _tmp_177_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -29981,7 +30118,7 @@ _tmp_177_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -29991,7 +30128,7 @@ _tmp_177_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -30000,9 +30137,9 @@ _tmp_177_rule(Parser *p) return _res; } -// _tmp_178: starred_expression | direct_named_expression !'=' +// _tmp_179: starred_expression | direct_named_expression !'=' static void * -_tmp_178_rule(Parser *p) +_tmp_179_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30016,18 +30153,18 @@ _tmp_178_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c> _tmp_179[%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_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c+ _tmp_179[%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_178[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); } { // direct_named_expression !'=' @@ -30035,7 +30172,7 @@ _tmp_178_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "direct_named_expression !'='")); + D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "direct_named_expression !'='")); expr_ty direct_named_expression_var; if ( (direct_named_expression_var = direct_named_expression_rule(p)) // direct_named_expression @@ -30043,12 +30180,12 @@ _tmp_178_rule(Parser *p) _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "direct_named_expression !'='")); + D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "direct_named_expression !'='")); _res = direct_named_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "direct_named_expression !'='")); } _res = NULL; @@ -30057,9 +30194,9 @@ _tmp_178_rule(Parser *p) return _res; } -// _tmp_179: ',' star_target +// _tmp_180: ',' star_target static void * -_tmp_179_rule(Parser *p) +_tmp_180_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30073,7 +30210,7 @@ _tmp_179_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -30082,7 +30219,7 @@ _tmp_179_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -30092,7 +30229,7 @@ _tmp_179_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -30101,9 +30238,9 @@ _tmp_179_rule(Parser *p) return _res; } -// _tmp_180: ',' star_target +// _tmp_181: ',' star_target static void * -_tmp_180_rule(Parser *p) +_tmp_181_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30117,7 +30254,7 @@ _tmp_180_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -30126,7 +30263,7 @@ _tmp_180_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -30136,7 +30273,7 @@ _tmp_180_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -30145,9 +30282,9 @@ _tmp_180_rule(Parser *p) return _res; } -// _tmp_181: star_targets '=' +// _tmp_182: star_targets '=' static void * -_tmp_181_rule(Parser *p) +_tmp_182_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30161,7 +30298,7 @@ _tmp_181_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -30170,12 +30307,12 @@ _tmp_181_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_182[%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_181[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -30184,9 +30321,9 @@ _tmp_181_rule(Parser *p) return _res; } -// _tmp_182: star_targets '=' +// _tmp_183: star_targets '=' static void * -_tmp_182_rule(Parser *p) +_tmp_183_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30200,7 +30337,7 @@ _tmp_182_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -30209,12 +30346,12 @@ _tmp_182_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_183[%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_182[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -30223,9 +30360,9 @@ _tmp_182_rule(Parser *p) return _res; } -// _tmp_183: ')' | '**' +// _tmp_184: ')' | '**' static void * -_tmp_183_rule(Parser *p) +_tmp_184_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30239,18 +30376,18 @@ _tmp_183_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -30258,18 +30395,18 @@ _tmp_183_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -30278,9 +30415,9 @@ _tmp_183_rule(Parser *p) return _res; } -// _tmp_184: ':' | '**' +// _tmp_185: ':' | '**' static void * -_tmp_184_rule(Parser *p) +_tmp_185_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30294,18 +30431,18 @@ _tmp_184_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -30313,18 +30450,18 @@ _tmp_184_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -30333,9 +30470,9 @@ _tmp_184_rule(Parser *p) return _res; } -// _tmp_185: expression ['as' star_target] +// _tmp_186: expression ['as' star_target] static void * -_tmp_185_rule(Parser *p) +_tmp_186_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30349,22 +30486,22 @@ _tmp_185_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_186[%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_187_rule(p), 1) // ['as' star_target] + (_opt_var = _tmp_188_rule(p), 1) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_186[%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_185[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_186[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]")); } _res = NULL; @@ -30373,9 +30510,9 @@ _tmp_185_rule(Parser *p) return _res; } -// _tmp_186: expressions ['as' star_target] +// _tmp_187: expressions ['as' star_target] static void * -_tmp_186_rule(Parser *p) +_tmp_187_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30389,22 +30526,22 @@ _tmp_186_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_187[%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_188_rule(p), 1) // ['as' star_target] + (_opt_var = _tmp_189_rule(p), 1) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_186[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_187[%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_186[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]")); } _res = NULL; @@ -30413,9 +30550,9 @@ _tmp_186_rule(Parser *p) return _res; } -// _tmp_187: 'as' star_target +// _tmp_188: 'as' star_target static void * -_tmp_187_rule(Parser *p) +_tmp_188_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30429,7 +30566,7 @@ _tmp_187_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( @@ -30438,12 +30575,12 @@ _tmp_187_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_188[%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_187[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; @@ -30452,9 +30589,9 @@ _tmp_187_rule(Parser *p) return _res; } -// _tmp_188: 'as' star_target +// _tmp_189: 'as' star_target static void * -_tmp_188_rule(Parser *p) +_tmp_189_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30468,7 +30605,7 @@ _tmp_188_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( @@ -30477,12 +30614,12 @@ _tmp_188_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_189[%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_188[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; @@ -30497,6 +30634,7 @@ _PyPegen_parse(Parser *p) // Initialize keywords p->keywords = reserved_keywords; p->n_keyword_lists = n_keyword_lists; + p->soft_keywords = soft_keywords; // Run parser void *result = NULL; diff --git a/Parser/pegen.c b/Parser/pegen.c index 7258caf..eb70ea7 100644 --- a/Parser/pegen.c +++ b/Parser/pegen.c @@ -943,6 +943,23 @@ _PyPegen_string_token(Parser *p) return _PyPegen_expect_token(p, STRING); } + +expr_ty _PyPegen_soft_keyword_token(Parser *p) { + Token *t = _PyPegen_expect_token(p, NAME); + if (t == NULL) { + return NULL; + } + char *the_token; + Py_ssize_t size; + PyBytes_AsStringAndSize(t->bytes, &the_token, &size); + for (char **keyword = p->soft_keywords; *keyword != NULL; keyword++) { + if (strncmp(*keyword, the_token, size) == 0) { + return _PyPegen_name_token(p); + } + } + return NULL; +} + static PyObject * parsenumber_raw(const char *s) { @@ -1151,6 +1168,7 @@ _PyPegen_Parser_New(struct tok_state *tok, int start_rule, int flags, p->tok = tok; p->keywords = NULL; p->n_keyword_lists = -1; + p->soft_keywords = NULL; p->tokens = PyMem_Malloc(sizeof(Token *)); if (!p->tokens) { PyMem_Free(p); diff --git a/Parser/pegen.h b/Parser/pegen.h index f3e0876..9b218d4 100644 --- a/Parser/pegen.h +++ b/Parser/pegen.h @@ -59,6 +59,7 @@ typedef struct { int fill, size; PyArena *arena; KeywordToken **keywords; + char **soft_keywords; int n_keyword_lists; int start_rule; int *errcode; @@ -125,6 +126,7 @@ int _PyPegen_lookahead(int, void *(func)(Parser *), Parser *); Token *_PyPegen_expect_token(Parser *p, int type); Token *_PyPegen_expect_forced_token(Parser *p, int type, const char* expected); expr_ty _PyPegen_expect_soft_keyword(Parser *p, const char *keyword); +expr_ty _PyPegen_soft_keyword_token(Parser *p); Token *_PyPegen_get_last_nonnwhitespace_token(Parser *); int _PyPegen_fill_token(Parser *p); expr_ty _PyPegen_name_token(Parser *p); diff --git a/Parser/token.c b/Parser/token.c index a489668..74bca0e 100644 --- a/Parser/token.c +++ b/Parser/token.c @@ -65,6 +65,7 @@ const char * const _PyParser_TokenNames[] = { "ASYNC", "TYPE_IGNORE", "TYPE_COMMENT", + "SOFT_KEYWORD", "", "", "", diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index 24418ea..d762240 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -46,6 +46,7 @@ _PyPegen_parse(Parser *p) // Initialize keywords p->keywords = reserved_keywords; p->n_keyword_lists = n_keyword_lists; + p->soft_keywords = soft_keywords; return start_rule(p); } @@ -66,6 +67,7 @@ BASE_NODETYPES = { "NAME": NodeTypes.NAME_TOKEN, "NUMBER": NodeTypes.NUMBER_TOKEN, "STRING": NodeTypes.STRING_TOKEN, + "SOFT_KEYWORD": NodeTypes.SOFT_KEYWORD, } @@ -411,6 +413,7 @@ class CParserGenerator(ParserGenerator, GrammarVisitor): if subheader: self.print(subheader) self._setup_keywords() + self._setup_soft_keywords() for i, (rulename, rule) in enumerate(self.todo.items(), 1000): comment = " // Left-recursive" if rule.left_recursive else "" self.print(f"#define {rulename}_type {i}{comment}") @@ -474,6 +477,15 @@ class CParserGenerator(ParserGenerator, GrammarVisitor): self.print("},") self.print("};") + def _setup_soft_keywords(self) -> None: + soft_keywords = sorted(self.callmakervisitor.soft_keywords) + self.print("static char *soft_keywords[] = {") + with self.indent(): + for keyword in soft_keywords: + self.print(f'"{keyword}",') + self.print("NULL,") + self.print("};") + def _set_up_token_start_metadata_extraction(self) -> None: self.print("if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {") with self.indent(): -- cgit v0.12