diff options
-rw-r--r-- | Grammar/python.gram | 9 | ||||
-rw-r--r-- | Lib/test/test_positional_only_arg.py | 30 | ||||
-rw-r--r-- | Parser/pegen/parse.c | 1119 |
3 files changed, 732 insertions, 426 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram index dd425ef..2c350ef 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -329,7 +329,11 @@ expression[expr_ty] (memo): | lambdef lambdef[expr_ty]: - | 'lambda' a=[lambda_parameters] ':' b=expression { _Py_Lambda((a) ? a : CHECK(_PyPegen_empty_arguments(p)), b, EXTRA) } + | 'lambda' a=[lambda_params] ':' b=expression { _Py_Lambda((a) ? a : CHECK(_PyPegen_empty_arguments(p)), b, EXTRA) } + +lambda_params[arguments_ty]: + | invalid_lambda_parameters + | lambda_parameters # lambda_parameters etc. duplicates parameters but without annotations # or type comments, and if there's no comma after a parameter, we expect @@ -669,6 +673,9 @@ invalid_dict_comprehension: invalid_parameters: | param_no_default* (slash_with_default | param_with_default+) param_no_default { RAISE_SYNTAX_ERROR("non-default argument follows default argument") } +invalid_lambda_parameters: + | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default { + RAISE_SYNTAX_ERROR("non-default argument follows default argument") } invalid_star_etc: | '*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR("named arguments must follow bare *") } | '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR("bare * has associated type comment") } diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py index f7bd401..0a9503e 100644 --- a/Lib/test/test_positional_only_arg.py +++ b/Lib/test/test_positional_only_arg.py @@ -4,7 +4,7 @@ import dis import pickle import unittest -from test.support import check_syntax_error, use_old_parser +from test.support import check_syntax_error def global_pos_only_f(a, b, /): @@ -23,12 +23,10 @@ class PositionalOnlyTestCase(unittest.TestCase): compile(codestr + "\n", "<test>", "single") def test_invalid_syntax_errors(self): - if use_old_parser(): - check_syntax_error(self, "def f(a, b = 5, /, c): pass", "non-default argument follows default argument") - check_syntax_error(self, "def f(a = 5, b, /, c): pass", "non-default argument follows default argument") - check_syntax_error(self, "def f(a = 5, b=1, /, c, *, d=2): pass", "non-default argument follows default argument") - check_syntax_error(self, "def f(a = 5, b, /): pass", "non-default argument follows default argument") - + check_syntax_error(self, "def f(a, b = 5, /, c): pass", "non-default argument follows default argument") + check_syntax_error(self, "def f(a = 5, b, /, c): pass", "non-default argument follows default argument") + check_syntax_error(self, "def f(a = 5, b=1, /, c, *, d=2): pass", "non-default argument follows default argument") + check_syntax_error(self, "def f(a = 5, b, /): pass", "non-default argument follows default argument") check_syntax_error(self, "def f(*args, /): pass") check_syntax_error(self, "def f(*args, a, /): pass") check_syntax_error(self, "def f(**kwargs, /): pass") @@ -46,12 +44,10 @@ class PositionalOnlyTestCase(unittest.TestCase): check_syntax_error(self, "def f(a, *, c, /, d, e): pass") def test_invalid_syntax_errors_async(self): - if use_old_parser(): - check_syntax_error(self, "async def f(a, b = 5, /, c): pass", "non-default argument follows default argument") - check_syntax_error(self, "async def f(a = 5, b, /, c): pass", "non-default argument follows default argument") - check_syntax_error(self, "async def f(a = 5, b=1, /, c, d=2): pass", "non-default argument follows default argument") - check_syntax_error(self, "async def f(a = 5, b, /): pass", "non-default argument follows default argument") - + check_syntax_error(self, "async def f(a, b = 5, /, c): pass", "non-default argument follows default argument") + check_syntax_error(self, "async def f(a = 5, b, /, c): pass", "non-default argument follows default argument") + check_syntax_error(self, "async def f(a = 5, b=1, /, c, d=2): pass", "non-default argument follows default argument") + check_syntax_error(self, "async def f(a = 5, b, /): pass", "non-default argument follows default argument") check_syntax_error(self, "async def f(*args, /): pass") check_syntax_error(self, "async def f(*args, a, /): pass") check_syntax_error(self, "async def f(**kwargs, /): pass") @@ -235,11 +231,9 @@ class PositionalOnlyTestCase(unittest.TestCase): self.assertEqual(x(1, 2), 3) def test_invalid_syntax_lambda(self): - if use_old_parser(): - check_syntax_error(self, "lambda a, b = 5, /, c: None", "non-default argument follows default argument") - check_syntax_error(self, "lambda a = 5, b, /, c: None", "non-default argument follows default argument") - check_syntax_error(self, "lambda a = 5, b, /: None", "non-default argument follows default argument") - + check_syntax_error(self, "lambda a, b = 5, /, c: None", "non-default argument follows default argument") + check_syntax_error(self, "lambda a = 5, b, /, c: None", "non-default argument follows default argument") + check_syntax_error(self, "lambda a = 5, b, /: None", "non-default argument follows default argument") check_syntax_error(self, "lambda *args, /: None") check_syntax_error(self, "lambda *args, a, /: None") check_syntax_error(self, "lambda **kwargs, /: None") diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index e5738e3..4f13bf7 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -144,244 +144,249 @@ static KeywordToken *reserved_keywords[] = { #define expressions_type 1066 #define expression_type 1067 #define lambdef_type 1068 -#define lambda_parameters_type 1069 -#define lambda_slash_no_default_type 1070 -#define lambda_slash_with_default_type 1071 -#define lambda_star_etc_type 1072 -#define lambda_kwds_type 1073 -#define lambda_param_no_default_type 1074 -#define lambda_param_with_default_type 1075 -#define lambda_param_maybe_default_type 1076 -#define lambda_param_type 1077 -#define disjunction_type 1078 -#define conjunction_type 1079 -#define inversion_type 1080 -#define comparison_type 1081 -#define compare_op_bitwise_or_pair_type 1082 -#define eq_bitwise_or_type 1083 -#define noteq_bitwise_or_type 1084 -#define lte_bitwise_or_type 1085 -#define lt_bitwise_or_type 1086 -#define gte_bitwise_or_type 1087 -#define gt_bitwise_or_type 1088 -#define notin_bitwise_or_type 1089 -#define in_bitwise_or_type 1090 -#define isnot_bitwise_or_type 1091 -#define is_bitwise_or_type 1092 -#define bitwise_or_type 1093 // Left-recursive -#define bitwise_xor_type 1094 // Left-recursive -#define bitwise_and_type 1095 // Left-recursive -#define shift_expr_type 1096 // Left-recursive -#define sum_type 1097 // Left-recursive -#define term_type 1098 // Left-recursive -#define factor_type 1099 -#define power_type 1100 -#define await_primary_type 1101 -#define primary_type 1102 // Left-recursive -#define slices_type 1103 -#define slice_type 1104 -#define atom_type 1105 -#define strings_type 1106 -#define list_type 1107 -#define listcomp_type 1108 -#define tuple_type 1109 -#define group_type 1110 -#define genexp_type 1111 -#define set_type 1112 -#define setcomp_type 1113 -#define dict_type 1114 -#define dictcomp_type 1115 -#define double_starred_kvpairs_type 1116 -#define double_starred_kvpair_type 1117 -#define kvpair_type 1118 -#define for_if_clauses_type 1119 -#define for_if_clause_type 1120 -#define yield_expr_type 1121 -#define arguments_type 1122 -#define args_type 1123 -#define kwargs_type 1124 -#define starred_expression_type 1125 -#define kwarg_or_starred_type 1126 -#define kwarg_or_double_starred_type 1127 -#define star_targets_type 1128 -#define star_targets_seq_type 1129 -#define star_target_type 1130 -#define star_atom_type 1131 -#define single_target_type 1132 -#define single_subscript_attribute_target_type 1133 -#define del_targets_type 1134 -#define del_target_type 1135 -#define del_t_atom_type 1136 -#define del_target_end_type 1137 -#define targets_type 1138 -#define target_type 1139 -#define t_primary_type 1140 // Left-recursive -#define t_lookahead_type 1141 -#define t_atom_type 1142 -#define incorrect_arguments_type 1143 -#define invalid_kwarg_type 1144 -#define invalid_named_expression_type 1145 -#define invalid_assignment_type 1146 -#define invalid_block_type 1147 -#define invalid_comprehension_type 1148 -#define invalid_dict_comprehension_type 1149 -#define invalid_parameters_type 1150 -#define invalid_star_etc_type 1151 -#define invalid_lambda_star_etc_type 1152 -#define invalid_double_type_comments_type 1153 -#define invalid_del_target_type 1154 -#define invalid_import_from_targets_type 1155 -#define _loop0_1_type 1156 -#define _loop0_2_type 1157 -#define _loop0_4_type 1158 -#define _gather_3_type 1159 -#define _loop0_6_type 1160 -#define _gather_5_type 1161 -#define _loop0_8_type 1162 -#define _gather_7_type 1163 -#define _loop0_10_type 1164 -#define _gather_9_type 1165 -#define _loop1_11_type 1166 -#define _loop0_13_type 1167 -#define _gather_12_type 1168 -#define _tmp_14_type 1169 -#define _tmp_15_type 1170 -#define _tmp_16_type 1171 -#define _tmp_17_type 1172 -#define _tmp_18_type 1173 -#define _tmp_19_type 1174 -#define _tmp_20_type 1175 -#define _tmp_21_type 1176 -#define _loop1_22_type 1177 -#define _tmp_23_type 1178 -#define _tmp_24_type 1179 -#define _loop0_26_type 1180 -#define _gather_25_type 1181 -#define _loop0_28_type 1182 -#define _gather_27_type 1183 -#define _tmp_29_type 1184 -#define _loop0_30_type 1185 -#define _loop1_31_type 1186 -#define _loop0_33_type 1187 -#define _gather_32_type 1188 -#define _tmp_34_type 1189 -#define _loop0_36_type 1190 -#define _gather_35_type 1191 -#define _tmp_37_type 1192 -#define _loop0_39_type 1193 -#define _gather_38_type 1194 -#define _loop0_41_type 1195 -#define _gather_40_type 1196 -#define _loop0_43_type 1197 -#define _gather_42_type 1198 -#define _loop0_45_type 1199 -#define _gather_44_type 1200 -#define _tmp_46_type 1201 -#define _loop1_47_type 1202 -#define _tmp_48_type 1203 -#define _tmp_49_type 1204 -#define _tmp_50_type 1205 -#define _tmp_51_type 1206 -#define _tmp_52_type 1207 -#define _loop0_53_type 1208 -#define _loop0_54_type 1209 -#define _loop0_55_type 1210 -#define _loop1_56_type 1211 -#define _loop0_57_type 1212 -#define _loop1_58_type 1213 -#define _loop1_59_type 1214 -#define _loop1_60_type 1215 -#define _loop0_61_type 1216 -#define _loop1_62_type 1217 -#define _loop0_63_type 1218 -#define _loop1_64_type 1219 -#define _loop0_65_type 1220 -#define _loop1_66_type 1221 -#define _loop1_67_type 1222 -#define _tmp_68_type 1223 -#define _loop0_70_type 1224 -#define _gather_69_type 1225 -#define _loop1_71_type 1226 -#define _loop0_73_type 1227 -#define _gather_72_type 1228 -#define _loop1_74_type 1229 -#define _loop0_75_type 1230 -#define _loop0_76_type 1231 -#define _loop0_77_type 1232 -#define _loop1_78_type 1233 -#define _loop0_79_type 1234 -#define _loop1_80_type 1235 -#define _loop1_81_type 1236 -#define _loop1_82_type 1237 -#define _loop0_83_type 1238 -#define _loop1_84_type 1239 -#define _loop0_85_type 1240 -#define _loop1_86_type 1241 -#define _loop0_87_type 1242 -#define _loop1_88_type 1243 -#define _loop1_89_type 1244 -#define _loop1_90_type 1245 -#define _loop1_91_type 1246 -#define _tmp_92_type 1247 -#define _loop0_94_type 1248 -#define _gather_93_type 1249 -#define _tmp_95_type 1250 -#define _tmp_96_type 1251 -#define _tmp_97_type 1252 -#define _tmp_98_type 1253 -#define _loop1_99_type 1254 -#define _tmp_100_type 1255 -#define _tmp_101_type 1256 -#define _loop0_103_type 1257 -#define _gather_102_type 1258 -#define _loop1_104_type 1259 -#define _loop0_105_type 1260 -#define _loop0_106_type 1261 -#define _tmp_107_type 1262 -#define _tmp_108_type 1263 -#define _loop0_110_type 1264 -#define _gather_109_type 1265 -#define _loop0_112_type 1266 -#define _gather_111_type 1267 -#define _loop0_114_type 1268 -#define _gather_113_type 1269 -#define _loop0_116_type 1270 -#define _gather_115_type 1271 -#define _loop0_117_type 1272 -#define _loop0_119_type 1273 -#define _gather_118_type 1274 -#define _tmp_120_type 1275 -#define _loop0_122_type 1276 -#define _gather_121_type 1277 -#define _loop0_124_type 1278 -#define _gather_123_type 1279 -#define _tmp_125_type 1280 -#define _loop0_126_type 1281 -#define _tmp_127_type 1282 -#define _loop0_128_type 1283 -#define _loop0_129_type 1284 -#define _tmp_130_type 1285 -#define _tmp_131_type 1286 -#define _loop0_132_type 1287 -#define _tmp_133_type 1288 -#define _tmp_134_type 1289 -#define _tmp_135_type 1290 -#define _tmp_136_type 1291 -#define _tmp_137_type 1292 -#define _tmp_138_type 1293 -#define _tmp_139_type 1294 -#define _tmp_140_type 1295 -#define _tmp_141_type 1296 -#define _tmp_142_type 1297 -#define _tmp_143_type 1298 -#define _tmp_144_type 1299 -#define _tmp_145_type 1300 -#define _tmp_146_type 1301 -#define _tmp_147_type 1302 -#define _tmp_148_type 1303 -#define _loop1_149_type 1304 -#define _tmp_150_type 1305 -#define _tmp_151_type 1306 +#define lambda_params_type 1069 +#define lambda_parameters_type 1070 +#define lambda_slash_no_default_type 1071 +#define lambda_slash_with_default_type 1072 +#define lambda_star_etc_type 1073 +#define lambda_kwds_type 1074 +#define lambda_param_no_default_type 1075 +#define lambda_param_with_default_type 1076 +#define lambda_param_maybe_default_type 1077 +#define lambda_param_type 1078 +#define disjunction_type 1079 +#define conjunction_type 1080 +#define inversion_type 1081 +#define comparison_type 1082 +#define compare_op_bitwise_or_pair_type 1083 +#define eq_bitwise_or_type 1084 +#define noteq_bitwise_or_type 1085 +#define lte_bitwise_or_type 1086 +#define lt_bitwise_or_type 1087 +#define gte_bitwise_or_type 1088 +#define gt_bitwise_or_type 1089 +#define notin_bitwise_or_type 1090 +#define in_bitwise_or_type 1091 +#define isnot_bitwise_or_type 1092 +#define is_bitwise_or_type 1093 +#define bitwise_or_type 1094 // Left-recursive +#define bitwise_xor_type 1095 // Left-recursive +#define bitwise_and_type 1096 // Left-recursive +#define shift_expr_type 1097 // Left-recursive +#define sum_type 1098 // Left-recursive +#define term_type 1099 // Left-recursive +#define factor_type 1100 +#define power_type 1101 +#define await_primary_type 1102 +#define primary_type 1103 // Left-recursive +#define slices_type 1104 +#define slice_type 1105 +#define atom_type 1106 +#define strings_type 1107 +#define list_type 1108 +#define listcomp_type 1109 +#define tuple_type 1110 +#define group_type 1111 +#define genexp_type 1112 +#define set_type 1113 +#define setcomp_type 1114 +#define dict_type 1115 +#define dictcomp_type 1116 +#define double_starred_kvpairs_type 1117 +#define double_starred_kvpair_type 1118 +#define kvpair_type 1119 +#define for_if_clauses_type 1120 +#define for_if_clause_type 1121 +#define yield_expr_type 1122 +#define arguments_type 1123 +#define args_type 1124 +#define kwargs_type 1125 +#define starred_expression_type 1126 +#define kwarg_or_starred_type 1127 +#define kwarg_or_double_starred_type 1128 +#define star_targets_type 1129 +#define star_targets_seq_type 1130 +#define star_target_type 1131 +#define star_atom_type 1132 +#define single_target_type 1133 +#define single_subscript_attribute_target_type 1134 +#define del_targets_type 1135 +#define del_target_type 1136 +#define del_t_atom_type 1137 +#define del_target_end_type 1138 +#define targets_type 1139 +#define target_type 1140 +#define t_primary_type 1141 // Left-recursive +#define t_lookahead_type 1142 +#define t_atom_type 1143 +#define incorrect_arguments_type 1144 +#define invalid_kwarg_type 1145 +#define invalid_named_expression_type 1146 +#define invalid_assignment_type 1147 +#define invalid_block_type 1148 +#define invalid_comprehension_type 1149 +#define invalid_dict_comprehension_type 1150 +#define invalid_parameters_type 1151 +#define invalid_lambda_parameters_type 1152 +#define invalid_star_etc_type 1153 +#define invalid_lambda_star_etc_type 1154 +#define invalid_double_type_comments_type 1155 +#define invalid_del_target_type 1156 +#define invalid_import_from_targets_type 1157 +#define _loop0_1_type 1158 +#define _loop0_2_type 1159 +#define _loop0_4_type 1160 +#define _gather_3_type 1161 +#define _loop0_6_type 1162 +#define _gather_5_type 1163 +#define _loop0_8_type 1164 +#define _gather_7_type 1165 +#define _loop0_10_type 1166 +#define _gather_9_type 1167 +#define _loop1_11_type 1168 +#define _loop0_13_type 1169 +#define _gather_12_type 1170 +#define _tmp_14_type 1171 +#define _tmp_15_type 1172 +#define _tmp_16_type 1173 +#define _tmp_17_type 1174 +#define _tmp_18_type 1175 +#define _tmp_19_type 1176 +#define _tmp_20_type 1177 +#define _tmp_21_type 1178 +#define _loop1_22_type 1179 +#define _tmp_23_type 1180 +#define _tmp_24_type 1181 +#define _loop0_26_type 1182 +#define _gather_25_type 1183 +#define _loop0_28_type 1184 +#define _gather_27_type 1185 +#define _tmp_29_type 1186 +#define _loop0_30_type 1187 +#define _loop1_31_type 1188 +#define _loop0_33_type 1189 +#define _gather_32_type 1190 +#define _tmp_34_type 1191 +#define _loop0_36_type 1192 +#define _gather_35_type 1193 +#define _tmp_37_type 1194 +#define _loop0_39_type 1195 +#define _gather_38_type 1196 +#define _loop0_41_type 1197 +#define _gather_40_type 1198 +#define _loop0_43_type 1199 +#define _gather_42_type 1200 +#define _loop0_45_type 1201 +#define _gather_44_type 1202 +#define _tmp_46_type 1203 +#define _loop1_47_type 1204 +#define _tmp_48_type 1205 +#define _tmp_49_type 1206 +#define _tmp_50_type 1207 +#define _tmp_51_type 1208 +#define _tmp_52_type 1209 +#define _loop0_53_type 1210 +#define _loop0_54_type 1211 +#define _loop0_55_type 1212 +#define _loop1_56_type 1213 +#define _loop0_57_type 1214 +#define _loop1_58_type 1215 +#define _loop1_59_type 1216 +#define _loop1_60_type 1217 +#define _loop0_61_type 1218 +#define _loop1_62_type 1219 +#define _loop0_63_type 1220 +#define _loop1_64_type 1221 +#define _loop0_65_type 1222 +#define _loop1_66_type 1223 +#define _loop1_67_type 1224 +#define _tmp_68_type 1225 +#define _loop0_70_type 1226 +#define _gather_69_type 1227 +#define _loop1_71_type 1228 +#define _loop0_73_type 1229 +#define _gather_72_type 1230 +#define _loop1_74_type 1231 +#define _loop0_75_type 1232 +#define _loop0_76_type 1233 +#define _loop0_77_type 1234 +#define _loop1_78_type 1235 +#define _loop0_79_type 1236 +#define _loop1_80_type 1237 +#define _loop1_81_type 1238 +#define _loop1_82_type 1239 +#define _loop0_83_type 1240 +#define _loop1_84_type 1241 +#define _loop0_85_type 1242 +#define _loop1_86_type 1243 +#define _loop0_87_type 1244 +#define _loop1_88_type 1245 +#define _loop1_89_type 1246 +#define _loop1_90_type 1247 +#define _loop1_91_type 1248 +#define _tmp_92_type 1249 +#define _loop0_94_type 1250 +#define _gather_93_type 1251 +#define _tmp_95_type 1252 +#define _tmp_96_type 1253 +#define _tmp_97_type 1254 +#define _tmp_98_type 1255 +#define _loop1_99_type 1256 +#define _tmp_100_type 1257 +#define _tmp_101_type 1258 +#define _loop0_103_type 1259 +#define _gather_102_type 1260 +#define _loop1_104_type 1261 +#define _loop0_105_type 1262 +#define _loop0_106_type 1263 +#define _tmp_107_type 1264 +#define _tmp_108_type 1265 +#define _loop0_110_type 1266 +#define _gather_109_type 1267 +#define _loop0_112_type 1268 +#define _gather_111_type 1269 +#define _loop0_114_type 1270 +#define _gather_113_type 1271 +#define _loop0_116_type 1272 +#define _gather_115_type 1273 +#define _loop0_117_type 1274 +#define _loop0_119_type 1275 +#define _gather_118_type 1276 +#define _tmp_120_type 1277 +#define _loop0_122_type 1278 +#define _gather_121_type 1279 +#define _loop0_124_type 1280 +#define _gather_123_type 1281 +#define _tmp_125_type 1282 +#define _loop0_126_type 1283 +#define _tmp_127_type 1284 +#define _loop0_128_type 1285 +#define _loop0_129_type 1286 +#define _tmp_130_type 1287 +#define _tmp_131_type 1288 +#define _loop0_132_type 1289 +#define _tmp_133_type 1290 +#define _loop0_134_type 1291 +#define _tmp_135_type 1292 +#define _tmp_136_type 1293 +#define _tmp_137_type 1294 +#define _tmp_138_type 1295 +#define _tmp_139_type 1296 +#define _tmp_140_type 1297 +#define _tmp_141_type 1298 +#define _tmp_142_type 1299 +#define _tmp_143_type 1300 +#define _tmp_144_type 1301 +#define _tmp_145_type 1302 +#define _tmp_146_type 1303 +#define _tmp_147_type 1304 +#define _tmp_148_type 1305 +#define _tmp_149_type 1306 +#define _tmp_150_type 1307 +#define _loop1_151_type 1308 +#define _loop1_152_type 1309 +#define _tmp_153_type 1310 +#define _tmp_154_type 1311 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -452,6 +457,7 @@ static expr_ty annotated_rhs_rule(Parser *p); static expr_ty expressions_rule(Parser *p); static expr_ty expression_rule(Parser *p); static expr_ty lambdef_rule(Parser *p); +static arguments_ty lambda_params_rule(Parser *p); static arguments_ty lambda_parameters_rule(Parser *p); static asdl_seq* lambda_slash_no_default_rule(Parser *p); static SlashWithDefault* lambda_slash_with_default_rule(Parser *p); @@ -534,6 +540,7 @@ static void *invalid_block_rule(Parser *p); static void *invalid_comprehension_rule(Parser *p); static void *invalid_dict_comprehension_rule(Parser *p); static void *invalid_parameters_rule(Parser *p); +static void *invalid_lambda_parameters_rule(Parser *p); static void *invalid_star_etc_rule(Parser *p); static void *invalid_lambda_star_etc_rule(Parser *p); static void *invalid_double_type_comments_rule(Parser *p); @@ -672,7 +679,7 @@ static void *_tmp_130_rule(Parser *p); static void *_tmp_131_rule(Parser *p); static asdl_seq *_loop0_132_rule(Parser *p); static void *_tmp_133_rule(Parser *p); -static void *_tmp_134_rule(Parser *p); +static asdl_seq *_loop0_134_rule(Parser *p); static void *_tmp_135_rule(Parser *p); static void *_tmp_136_rule(Parser *p); static void *_tmp_137_rule(Parser *p); @@ -687,9 +694,12 @@ static void *_tmp_145_rule(Parser *p); static void *_tmp_146_rule(Parser *p); static void *_tmp_147_rule(Parser *p); static void *_tmp_148_rule(Parser *p); -static asdl_seq *_loop1_149_rule(Parser *p); +static void *_tmp_149_rule(Parser *p); static void *_tmp_150_rule(Parser *p); -static void *_tmp_151_rule(Parser *p); +static asdl_seq *_loop1_151_rule(Parser *p); +static asdl_seq *_loop1_152_rule(Parser *p); +static void *_tmp_153_rule(Parser *p); +static void *_tmp_154_rule(Parser *p); // file: statements? $ @@ -6972,7 +6982,7 @@ expression_rule(Parser *p) return _res; } -// lambdef: 'lambda' lambda_parameters? ':' expression +// lambdef: 'lambda' lambda_params? ':' expression static expr_ty lambdef_rule(Parser *p) { @@ -6992,12 +7002,12 @@ lambdef_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 - { // 'lambda' lambda_parameters? ':' expression + { // 'lambda' lambda_params? ':' expression if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); + D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression")); Token * _keyword; Token * _literal; void *a; @@ -7005,14 +7015,14 @@ lambdef_rule(Parser *p) if ( (_keyword = _PyPegen_expect_token(p, 524)) // token='lambda' && - (a = lambda_parameters_rule(p), 1) // lambda_parameters? + (a = lambda_params_rule(p), 1) // lambda_params? && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && (b = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); + D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -7032,7 +7042,62 @@ lambdef_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_parameters? ':' expression")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// lambda_params: invalid_lambda_parameters | lambda_parameters +static arguments_ty +lambda_params_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + arguments_ty _res = NULL; + int _mark = p->mark; + { // invalid_lambda_parameters + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters")); + void *invalid_lambda_parameters_var; + if ( + (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters + ) + { + D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters")); + _res = invalid_lambda_parameters_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters")); + } + { // lambda_parameters + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters")); + arguments_ty lambda_parameters_var; + if ( + (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters + ) + { + D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters")); + _res = lambda_parameters_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters")); } _res = NULL; done: @@ -14997,6 +15062,54 @@ invalid_parameters_rule(Parser *p) return _res; } +// invalid_lambda_parameters: +// | lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default +static void * +invalid_lambda_parameters_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default")); + asdl_seq * _loop0_134_var; + void *_tmp_135_var; + arg_ty lambda_param_no_default_var; + if ( + (_loop0_134_var = _loop0_134_rule(p)) // lambda_param_no_default* + && + (_tmp_135_var = _tmp_135_rule(p)) // lambda_slash_with_default | lambda_param_with_default+ + && + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default + ) + { + D(fprintf(stderr, "%*c+ invalid_lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default")); + _res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" ); + 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_lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + // invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT static void * invalid_star_etc_rule(Parser *p) @@ -15015,11 +15128,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_134_var; + void *_tmp_136_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_134_var = _tmp_134_rule(p)) // ')' | ',' (')' | '**') + (_tmp_136_var = _tmp_136_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -15089,11 +15202,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_135_var; + void *_tmp_137_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_135_var = _tmp_135_rule(p)) // ':' | ',' (':' | '**') + (_tmp_137_var = _tmp_137_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -16503,12 +16616,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_136_var; + void *_tmp_138_var; while ( - (_tmp_136_var = _tmp_136_rule(p)) // star_targets '=' + (_tmp_138_var = _tmp_138_rule(p)) // star_targets '=' ) { - _res = _tmp_136_var; + _res = _tmp_138_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -16956,12 +17069,12 @@ _loop0_30_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_137_var; + void *_tmp_139_var; while ( - (_tmp_137_var = _tmp_137_rule(p)) // '.' | '...' + (_tmp_139_var = _tmp_139_rule(p)) // '.' | '...' ) { - _res = _tmp_137_var; + _res = _tmp_139_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -17022,12 +17135,12 @@ _loop1_31_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_138_var; + void *_tmp_140_var; while ( - (_tmp_138_var = _tmp_138_rule(p)) // '.' | '...' + (_tmp_140_var = _tmp_140_rule(p)) // '.' | '...' ) { - _res = _tmp_138_var; + _res = _tmp_140_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19154,12 +19267,12 @@ _loop1_67_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_139_var; + void *_tmp_141_var; while ( - (_tmp_139_var = _tmp_139_rule(p)) // '@' named_expression NEWLINE + (_tmp_141_var = _tmp_141_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_139_var; + _res = _tmp_141_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19386,12 +19499,12 @@ _loop1_71_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_140_var; + void *_tmp_142_var; while ( - (_tmp_140_var = _tmp_140_rule(p)) // ',' star_expression + (_tmp_142_var = _tmp_142_rule(p)) // ',' star_expression ) { - _res = _tmp_140_var; + _res = _tmp_142_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -19571,12 +19684,12 @@ _loop1_74_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_141_var; + void *_tmp_143_var; while ( - (_tmp_141_var = _tmp_141_rule(p)) // ',' expression + (_tmp_143_var = _tmp_143_rule(p)) // ',' expression ) { - _res = _tmp_141_var; + _res = _tmp_143_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20601,12 +20714,12 @@ _loop1_89_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_142_var; + void *_tmp_144_var; while ( - (_tmp_142_var = _tmp_142_rule(p)) // 'or' conjunction + (_tmp_144_var = _tmp_144_rule(p)) // 'or' conjunction ) { - _res = _tmp_142_var; + _res = _tmp_144_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -20672,12 +20785,12 @@ _loop1_90_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_143_var; + void *_tmp_145_var; while ( - (_tmp_143_var = _tmp_143_rule(p)) // 'and' inversion + (_tmp_145_var = _tmp_145_rule(p)) // 'and' inversion ) { - _res = _tmp_143_var; + _res = _tmp_145_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21593,12 +21706,12 @@ _loop0_105_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_144_var; + void *_tmp_146_var; while ( - (_tmp_144_var = _tmp_144_rule(p)) // 'if' disjunction + (_tmp_146_var = _tmp_146_rule(p)) // 'if' disjunction ) { - _res = _tmp_144_var; + _res = _tmp_146_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -21659,12 +21772,12 @@ _loop0_106_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_145_var; + void *_tmp_147_var; while ( - (_tmp_145_var = _tmp_145_rule(p)) // 'if' disjunction + (_tmp_147_var = _tmp_147_rule(p)) // 'if' disjunction ) { - _res = _tmp_145_var; + _res = _tmp_147_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22269,12 +22382,12 @@ _loop0_117_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_146_var; + void *_tmp_148_var; while ( - (_tmp_146_var = _tmp_146_rule(p)) // ',' star_target + (_tmp_148_var = _tmp_148_rule(p)) // ',' star_target ) { - _res = _tmp_146_var; + _res = _tmp_148_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22878,12 +22991,12 @@ _loop0_128_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_147_var; + void *_tmp_149_var; while ( - (_tmp_147_var = _tmp_147_rule(p)) // star_targets '=' + (_tmp_149_var = _tmp_149_rule(p)) // star_targets '=' ) { - _res = _tmp_147_var; + _res = _tmp_149_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22944,12 +23057,12 @@ _loop0_129_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_148_var; + void *_tmp_150_var; while ( - (_tmp_148_var = _tmp_148_rule(p)) // star_targets '=' + (_tmp_150_var = _tmp_150_rule(p)) // star_targets '=' ) { - _res = _tmp_148_var; + _res = _tmp_150_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23214,13 +23327,13 @@ _tmp_133_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _tmp_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_149_var; + asdl_seq * _loop1_151_var; if ( - (_loop1_149_var = _loop1_149_rule(p)) // param_with_default+ + (_loop1_151_var = _loop1_151_rule(p)) // param_with_default+ ) { D(fprintf(stderr, "%*c+ _tmp_133[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_149_var; + _res = _loop1_151_var; goto done; } p->mark = _mark; @@ -23233,9 +23346,130 @@ _tmp_133_rule(Parser *p) return _res; } -// _tmp_134: ')' | ',' (')' | '**') +// _loop0_134: lambda_param_no_default +static asdl_seq * +_loop0_134_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // lambda_param_no_default + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop0_134[%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 + ) + { + _res = lambda_param_no_default_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq); + D(p->level--); + return _seq; +} + +// _tmp_135: lambda_slash_with_default | lambda_param_with_default+ +static void * +_tmp_135_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // lambda_slash_with_default + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); + SlashWithDefault* lambda_slash_with_default_var; + if ( + (lambda_slash_with_default_var = lambda_slash_with_default_rule(p)) // lambda_slash_with_default + ) + { + D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default")); + _res = lambda_slash_with_default_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default")); + } + { // lambda_param_with_default+ + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); + asdl_seq * _loop1_152_var; + if ( + (_loop1_152_var = _loop1_152_rule(p)) // lambda_param_with_default+ + ) + { + D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); + _res = _loop1_152_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_136: ')' | ',' (')' | '**') static void * -_tmp_134_rule(Parser *p) +_tmp_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23249,18 +23483,18 @@ _tmp_134_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -23268,21 +23502,21 @@ _tmp_134_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_150_var; + void *_tmp_153_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_150_var = _tmp_150_rule(p)) // ')' | '**' + (_tmp_153_var = _tmp_153_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_150_var); + D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_153_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_134[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -23291,9 +23525,9 @@ _tmp_134_rule(Parser *p) return _res; } -// _tmp_135: ':' | ',' (':' | '**') +// _tmp_137: ':' | ',' (':' | '**') static void * -_tmp_135_rule(Parser *p) +_tmp_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23307,18 +23541,18 @@ _tmp_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -23326,21 +23560,21 @@ _tmp_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_151_var; + void *_tmp_154_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_151_var = _tmp_151_rule(p)) // ':' | '**' + (_tmp_154_var = _tmp_154_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_151_var); + D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_154_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_135[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -23349,9 +23583,9 @@ _tmp_135_rule(Parser *p) return _res; } -// _tmp_136: star_targets '=' +// _tmp_138: star_targets '=' static void * -_tmp_136_rule(Parser *p) +_tmp_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23365,7 +23599,7 @@ _tmp_136_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -23374,7 +23608,7 @@ _tmp_136_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23384,7 +23618,7 @@ _tmp_136_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_136[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -23393,9 +23627,9 @@ _tmp_136_rule(Parser *p) return _res; } -// _tmp_137: '.' | '...' +// _tmp_139: '.' | '...' static void * -_tmp_137_rule(Parser *p) +_tmp_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23409,18 +23643,18 @@ _tmp_137_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -23428,18 +23662,18 @@ _tmp_137_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_137[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_137[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -23448,9 +23682,9 @@ _tmp_137_rule(Parser *p) return _res; } -// _tmp_138: '.' | '...' +// _tmp_140: '.' | '...' static void * -_tmp_138_rule(Parser *p) +_tmp_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23464,18 +23698,18 @@ _tmp_138_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -23483,18 +23717,18 @@ _tmp_138_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -23503,9 +23737,9 @@ _tmp_138_rule(Parser *p) return _res; } -// _tmp_139: '@' named_expression NEWLINE +// _tmp_141: '@' named_expression NEWLINE static void * -_tmp_139_rule(Parser *p) +_tmp_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23519,7 +23753,7 @@ _tmp_139_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -23531,7 +23765,7 @@ _tmp_139_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23541,7 +23775,7 @@ _tmp_139_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_139[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -23550,9 +23784,9 @@ _tmp_139_rule(Parser *p) return _res; } -// _tmp_140: ',' star_expression +// _tmp_142: ',' star_expression static void * -_tmp_140_rule(Parser *p) +_tmp_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23566,7 +23800,7 @@ _tmp_140_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -23575,7 +23809,7 @@ _tmp_140_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23585,7 +23819,7 @@ _tmp_140_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -23594,9 +23828,9 @@ _tmp_140_rule(Parser *p) return _res; } -// _tmp_141: ',' expression +// _tmp_143: ',' expression static void * -_tmp_141_rule(Parser *p) +_tmp_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23610,7 +23844,7 @@ _tmp_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -23619,7 +23853,7 @@ _tmp_141_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23629,7 +23863,7 @@ _tmp_141_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -23638,9 +23872,9 @@ _tmp_141_rule(Parser *p) return _res; } -// _tmp_142: 'or' conjunction +// _tmp_144: 'or' conjunction static void * -_tmp_142_rule(Parser *p) +_tmp_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23654,7 +23888,7 @@ _tmp_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -23663,7 +23897,7 @@ _tmp_142_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23673,7 +23907,7 @@ _tmp_142_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_142[%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, "'or' conjunction")); } _res = NULL; @@ -23682,9 +23916,9 @@ _tmp_142_rule(Parser *p) return _res; } -// _tmp_143: 'and' inversion +// _tmp_145: 'and' inversion static void * -_tmp_143_rule(Parser *p) +_tmp_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23698,7 +23932,7 @@ _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, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -23707,7 +23941,7 @@ _tmp_143_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23717,7 +23951,7 @@ _tmp_143_rule(Parser *p) 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_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -23726,9 +23960,9 @@ _tmp_143_rule(Parser *p) return _res; } -// _tmp_144: 'if' disjunction +// _tmp_146: 'if' disjunction static void * -_tmp_144_rule(Parser *p) +_tmp_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23742,7 +23976,7 @@ _tmp_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -23751,7 +23985,7 @@ _tmp_144_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23761,7 +23995,7 @@ _tmp_144_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -23770,9 +24004,9 @@ _tmp_144_rule(Parser *p) return _res; } -// _tmp_145: 'if' disjunction +// _tmp_147: 'if' disjunction static void * -_tmp_145_rule(Parser *p) +_tmp_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23786,7 +24020,7 @@ _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, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( @@ -23795,7 +24029,7 @@ _tmp_145_rule(Parser *p) (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23805,7 +24039,7 @@ _tmp_145_rule(Parser *p) 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_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -23814,9 +24048,9 @@ _tmp_145_rule(Parser *p) return _res; } -// _tmp_146: ',' star_target +// _tmp_148: ',' star_target static void * -_tmp_146_rule(Parser *p) +_tmp_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23830,7 +24064,7 @@ _tmp_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -23839,7 +24073,7 @@ _tmp_146_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -23849,7 +24083,7 @@ _tmp_146_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -23858,9 +24092,9 @@ _tmp_146_rule(Parser *p) return _res; } -// _tmp_147: star_targets '=' +// _tmp_149: star_targets '=' static void * -_tmp_147_rule(Parser *p) +_tmp_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23874,7 +24108,7 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -23883,12 +24117,12 @@ _tmp_147_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_149[%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_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -23897,9 +24131,9 @@ _tmp_147_rule(Parser *p) return _res; } -// _tmp_148: star_targets '=' +// _tmp_150: star_targets '=' static void * -_tmp_148_rule(Parser *p) +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23913,7 +24147,7 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -23922,12 +24156,12 @@ _tmp_148_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_150[%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_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -23936,9 +24170,9 @@ _tmp_148_rule(Parser *p) return _res; } -// _loop1_149: param_with_default +// _loop1_151: param_with_default static asdl_seq * -_loop1_149_rule(Parser *p) +_loop1_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -23962,7 +24196,7 @@ _loop1_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_151[%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 @@ -23984,7 +24218,7 @@ _loop1_149_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -24002,14 +24236,85 @@ _loop1_149_rule(Parser *p) } for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); PyMem_Free(_children); - _PyPegen_insert_memo(p, _start_mark, _loop1_149_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_151_type, _seq); D(p->level--); return _seq; } -// _tmp_150: ')' | '**' +// _loop1_152: lambda_param_with_default +static asdl_seq * +_loop1_152_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void *_res = NULL; + int _mark = p->mark; + int _start_mark = p->mark; + void **_children = PyMem_Malloc(sizeof(void *)); + if (!_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + ssize_t _children_capacity = 1; + ssize_t _n = 0; + { // lambda_param_with_default + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop1_152[%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 + ) + { + _res = lambda_param_with_default_var; + if (_n == _children_capacity) { + _children_capacity *= 2; + void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); + if (!_new_children) { + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + _children = _new_children; + } + _children[_n++] = _res; + _mark = p->mark; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _loop1_152[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); + } + if (_n == 0 || p->error_indicator) { + PyMem_Free(_children); + D(p->level--); + return NULL; + } + asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena); + if (!_seq) { + PyMem_Free(_children); + p->error_indicator = 1; + PyErr_NoMemory(); + D(p->level--); + return NULL; + } + for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]); + PyMem_Free(_children); + _PyPegen_insert_memo(p, _start_mark, _loop1_152_type, _seq); + D(p->level--); + return _seq; +} + +// _tmp_153: ')' | '**' static void * -_tmp_150_rule(Parser *p) +_tmp_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24023,18 +24328,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_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_153[%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_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -24042,18 +24347,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_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_153[%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_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -24062,9 +24367,9 @@ _tmp_150_rule(Parser *p) return _res; } -// _tmp_151: ':' | '**' +// _tmp_154: ':' | '**' static void * -_tmp_151_rule(Parser *p) +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24078,18 +24383,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_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_154[%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_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -24097,18 +24402,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_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_151[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_154[%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_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; |