From 3941d9700b2a272689cb8a8435b5c60a1466ef79 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 1 May 2020 09:42:03 -0700 Subject: [PATCH] bpo-40334: Refactor lambda_parameters similar to parameters (GH-19830) --- Grammar/python.gram | 54 +- Parser/pegen/parse.c | 2886 ++++++++++++++++++++++-------------------- 2 files changed, 1521 insertions(+), 1419 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 0acd851e09f..cbd4bc010dc 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -246,8 +246,7 @@ star_etc[StarEtc*]: _PyPegen_star_etc(p, NULL, b, c) } | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) } -kwds[arg_ty]: - | '**' a=param_no_default { a } +kwds[arg_ty]: '**' a=param_no_default { a } # One parameter. This *includes* a following comma and type comment. # @@ -325,32 +324,47 @@ expression[expr_ty] (memo): lambdef[expr_ty]: | 'lambda' a=[lambda_parameters] ':' b=expression { _Py_Lambda((a) ? a : CHECK(_PyPegen_empty_arguments(p)), b, EXTRA) } + +# lambda_parameters etc. duplicates parameters but without annotations +# or type comments, and if there's no comma after a parameter, we expect +# a colon, not a close parenthesis. (For more, see parameters above.) +# lambda_parameters[arguments_ty]: - | a=lambda_slash_without_default b=[',' x=lambda_plain_names { x }] c=[',' y=lambda_names_with_default { y }] d=[',' z=[lambda_star_etc] { z }] { + | a=lambda_slash_no_default b=lambda_param_no_default* c=lambda_param_with_default* d=[lambda_star_etc] { _PyPegen_make_arguments(p, a, NULL, b, c, d) } - | a=lambda_slash_with_default b=[',' y=lambda_names_with_default { y }] c=[',' z=[lambda_star_etc] { z }] { + | a=lambda_slash_with_default b=lambda_param_with_default* c=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, a, NULL, b, c) } - | a=lambda_plain_names b=[',' y=lambda_names_with_default { y }] c=[',' z=[lambda_star_etc] { z }] { + | a=lambda_param_no_default+ b=lambda_param_with_default* c=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, NULL, a, b, c) } - | a=lambda_names_with_default b=[',' z=[lambda_star_etc] { z }] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)} + | a=lambda_param_with_default+ b=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)} | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) } -lambda_slash_without_default[asdl_seq*]: a=lambda_plain_names ',' '/' { a } -lambda_slash_with_default[SlashWithDefault*]: a=[n=lambda_plain_names ',' { n }] b=lambda_names_with_default ',' '/' { - _PyPegen_slash_with_default(p, a, b) } + +lambda_slash_no_default[asdl_seq*]: + | a=lambda_param_no_default+ '/' ',' { a } + | a=lambda_param_no_default+ '/' &':' { a } +lambda_slash_with_default[SlashWithDefault*]: + | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, a, b) } + | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' { _PyPegen_slash_with_default(p, a, b) } + lambda_star_etc[StarEtc*]: - | '*' a=lambda_plain_name b=lambda_name_with_optional_default* c=[',' d=lambda_kwds { d }] [','] { + | '*' a=lambda_param_no_default b=lambda_param_maybe_default* c=[lambda_kwds] { _PyPegen_star_etc(p, a, b, c) } - | '*' b=lambda_name_with_optional_default+ c=[',' d=lambda_kwds { d }] [','] { + | '*' ',' b=lambda_param_maybe_default+ c=[lambda_kwds] { _PyPegen_star_etc(p, NULL, b, c) } - | a=lambda_kwds [','] { _PyPegen_star_etc(p, NULL, NULL, a) } -lambda_name_with_optional_default[NameDefaultPair*]: - | ',' a=lambda_plain_name b=['=' e=expression { e }] { _PyPegen_name_default_pair(p, a, b, NULL) } -lambda_names_with_default[asdl_seq*]: a=','.lambda_name_with_default+ { a } -lambda_name_with_default[NameDefaultPair*]: - | n=lambda_plain_name '=' e=expression { _PyPegen_name_default_pair(p, n, e, NULL) } -lambda_plain_names[asdl_seq*]: a=','.(lambda_plain_name !'=')+ { a } -lambda_plain_name[arg_ty]: a=NAME { _Py_arg(a->v.Name.id, NULL, NULL, EXTRA) } -lambda_kwds[arg_ty]: '**' a=lambda_plain_name { a } + | a=lambda_kwds { _PyPegen_star_etc(p, NULL, NULL, a) } + +lambda_kwds[arg_ty]: '**' a=lambda_param_no_default { a } + +lambda_param_no_default[arg_ty]: + | a=lambda_param ',' { a } + | a=lambda_param &':' { a } +lambda_param_with_default[NameDefaultPair*]: + | a=lambda_param c=default ',' { _PyPegen_name_default_pair(p, a, c, NULL) } + | a=lambda_param c=default &':' { _PyPegen_name_default_pair(p, a, c, NULL) } +lambda_param_maybe_default[NameDefaultPair*]: + | a=lambda_param c=default? ',' { _PyPegen_name_default_pair(p, a, c, NULL) } + | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, NULL) } +lambda_param[arg_ty]: a=NAME { _Py_arg(a->v.Name.id, NULL, NULL, EXTRA) } disjunction[expr_ty] (memo): | a=conjunction b=('or' c=conjunction { c })+ { _Py_BoolOp( diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index f4dacbffba4..b4745ba4d4f 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -138,233 +138,227 @@ static KeywordToken *reserved_keywords[] = { #define expression_type 1067 #define lambdef_type 1068 #define lambda_parameters_type 1069 -#define lambda_slash_without_default_type 1070 +#define lambda_slash_no_default_type 1070 #define lambda_slash_with_default_type 1071 #define lambda_star_etc_type 1072 -#define lambda_name_with_optional_default_type 1073 -#define lambda_names_with_default_type 1074 -#define lambda_name_with_default_type 1075 -#define lambda_plain_names_type 1076 -#define lambda_plain_name_type 1077 -#define lambda_kwds_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 kvpairs_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 inside_paren_ann_assign_target_type 1132 -#define ann_assign_subscript_attribute_target_type 1133 -#define del_targets_type 1134 -#define del_target_type 1135 -#define del_t_atom_type 1136 -#define targets_type 1137 -#define target_type 1138 -#define t_primary_type 1139 // Left-recursive -#define t_lookahead_type 1140 -#define t_atom_type 1141 -#define incorrect_arguments_type 1142 -#define invalid_named_expression_type 1143 -#define invalid_assignment_type 1144 -#define invalid_block_type 1145 -#define invalid_comprehension_type 1146 -#define invalid_parameters_type 1147 -#define invalid_double_type_comments_type 1148 -#define _loop0_1_type 1149 -#define _loop0_2_type 1150 -#define _loop0_4_type 1151 -#define _gather_3_type 1152 -#define _loop0_6_type 1153 -#define _gather_5_type 1154 -#define _loop0_8_type 1155 -#define _gather_7_type 1156 -#define _loop0_10_type 1157 -#define _gather_9_type 1158 -#define _loop1_11_type 1159 -#define _loop0_13_type 1160 -#define _gather_12_type 1161 -#define _tmp_14_type 1162 -#define _tmp_15_type 1163 -#define _tmp_16_type 1164 -#define _tmp_17_type 1165 -#define _tmp_18_type 1166 -#define _tmp_19_type 1167 -#define _tmp_20_type 1168 -#define _tmp_21_type 1169 -#define _loop1_22_type 1170 -#define _tmp_23_type 1171 -#define _tmp_24_type 1172 -#define _loop0_26_type 1173 -#define _gather_25_type 1174 -#define _loop0_28_type 1175 -#define _gather_27_type 1176 -#define _tmp_29_type 1177 -#define _loop0_30_type 1178 -#define _loop1_31_type 1179 -#define _loop0_33_type 1180 -#define _gather_32_type 1181 -#define _tmp_34_type 1182 -#define _loop0_36_type 1183 -#define _gather_35_type 1184 -#define _tmp_37_type 1185 -#define _loop0_39_type 1186 -#define _gather_38_type 1187 -#define _loop0_41_type 1188 -#define _gather_40_type 1189 -#define _loop0_43_type 1190 -#define _gather_42_type 1191 -#define _loop0_45_type 1192 -#define _gather_44_type 1193 -#define _tmp_46_type 1194 -#define _loop1_47_type 1195 -#define _tmp_48_type 1196 -#define _tmp_49_type 1197 -#define _tmp_50_type 1198 -#define _tmp_51_type 1199 -#define _tmp_52_type 1200 -#define _loop0_53_type 1201 -#define _loop0_54_type 1202 -#define _loop0_55_type 1203 -#define _loop1_56_type 1204 -#define _loop0_57_type 1205 -#define _loop1_58_type 1206 -#define _loop1_59_type 1207 -#define _loop1_60_type 1208 -#define _loop0_61_type 1209 -#define _loop1_62_type 1210 -#define _loop0_63_type 1211 -#define _loop1_64_type 1212 -#define _loop0_65_type 1213 -#define _loop1_66_type 1214 -#define _loop1_67_type 1215 -#define _tmp_68_type 1216 -#define _loop0_70_type 1217 -#define _gather_69_type 1218 -#define _loop1_71_type 1219 -#define _loop0_73_type 1220 -#define _gather_72_type 1221 -#define _loop1_74_type 1222 -#define _tmp_75_type 1223 -#define _tmp_76_type 1224 -#define _tmp_77_type 1225 -#define _tmp_78_type 1226 -#define _tmp_79_type 1227 -#define _tmp_80_type 1228 -#define _tmp_81_type 1229 -#define _tmp_82_type 1230 -#define _tmp_83_type 1231 -#define _loop0_84_type 1232 -#define _tmp_85_type 1233 -#define _loop1_86_type 1234 -#define _tmp_87_type 1235 -#define _tmp_88_type 1236 -#define _loop0_90_type 1237 -#define _gather_89_type 1238 -#define _loop0_92_type 1239 -#define _gather_91_type 1240 -#define _loop1_93_type 1241 -#define _loop1_94_type 1242 -#define _loop1_95_type 1243 -#define _tmp_96_type 1244 -#define _loop0_98_type 1245 -#define _gather_97_type 1246 -#define _tmp_99_type 1247 -#define _tmp_100_type 1248 -#define _tmp_101_type 1249 -#define _tmp_102_type 1250 -#define _loop1_103_type 1251 -#define _tmp_104_type 1252 -#define _tmp_105_type 1253 -#define _loop0_107_type 1254 -#define _gather_106_type 1255 -#define _loop1_108_type 1256 -#define _loop0_109_type 1257 -#define _loop0_110_type 1258 -#define _tmp_111_type 1259 -#define _tmp_112_type 1260 -#define _loop0_114_type 1261 -#define _gather_113_type 1262 -#define _loop0_116_type 1263 -#define _gather_115_type 1264 -#define _loop0_118_type 1265 -#define _gather_117_type 1266 -#define _loop0_120_type 1267 -#define _gather_119_type 1268 -#define _loop0_121_type 1269 -#define _loop0_123_type 1270 -#define _gather_122_type 1271 -#define _tmp_124_type 1272 -#define _loop0_126_type 1273 -#define _gather_125_type 1274 -#define _loop0_128_type 1275 -#define _gather_127_type 1276 -#define _tmp_129_type 1277 -#define _tmp_130_type 1278 -#define _tmp_131_type 1279 -#define _tmp_132_type 1280 -#define _tmp_133_type 1281 -#define _loop0_134_type 1282 -#define _tmp_135_type 1283 -#define _tmp_136_type 1284 -#define _tmp_137_type 1285 -#define _tmp_138_type 1286 -#define _tmp_139_type 1287 -#define _tmp_140_type 1288 -#define _tmp_141_type 1289 -#define _tmp_142_type 1290 -#define _tmp_143_type 1291 -#define _tmp_144_type 1292 -#define _tmp_145_type 1293 -#define _tmp_146_type 1294 -#define _tmp_147_type 1295 -#define _loop1_148_type 1296 +#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 kvpairs_type 1116 +#define kvpair_type 1117 +#define for_if_clauses_type 1118 +#define for_if_clause_type 1119 +#define yield_expr_type 1120 +#define arguments_type 1121 +#define args_type 1122 +#define kwargs_type 1123 +#define starred_expression_type 1124 +#define kwarg_or_starred_type 1125 +#define kwarg_or_double_starred_type 1126 +#define star_targets_type 1127 +#define star_targets_seq_type 1128 +#define star_target_type 1129 +#define star_atom_type 1130 +#define inside_paren_ann_assign_target_type 1131 +#define ann_assign_subscript_attribute_target_type 1132 +#define del_targets_type 1133 +#define del_target_type 1134 +#define del_t_atom_type 1135 +#define targets_type 1136 +#define target_type 1137 +#define t_primary_type 1138 // Left-recursive +#define t_lookahead_type 1139 +#define t_atom_type 1140 +#define incorrect_arguments_type 1141 +#define invalid_named_expression_type 1142 +#define invalid_assignment_type 1143 +#define invalid_block_type 1144 +#define invalid_comprehension_type 1145 +#define invalid_parameters_type 1146 +#define invalid_double_type_comments_type 1147 +#define _loop0_1_type 1148 +#define _loop0_2_type 1149 +#define _loop0_4_type 1150 +#define _gather_3_type 1151 +#define _loop0_6_type 1152 +#define _gather_5_type 1153 +#define _loop0_8_type 1154 +#define _gather_7_type 1155 +#define _loop0_10_type 1156 +#define _gather_9_type 1157 +#define _loop1_11_type 1158 +#define _loop0_13_type 1159 +#define _gather_12_type 1160 +#define _tmp_14_type 1161 +#define _tmp_15_type 1162 +#define _tmp_16_type 1163 +#define _tmp_17_type 1164 +#define _tmp_18_type 1165 +#define _tmp_19_type 1166 +#define _tmp_20_type 1167 +#define _tmp_21_type 1168 +#define _loop1_22_type 1169 +#define _tmp_23_type 1170 +#define _tmp_24_type 1171 +#define _loop0_26_type 1172 +#define _gather_25_type 1173 +#define _loop0_28_type 1174 +#define _gather_27_type 1175 +#define _tmp_29_type 1176 +#define _loop0_30_type 1177 +#define _loop1_31_type 1178 +#define _loop0_33_type 1179 +#define _gather_32_type 1180 +#define _tmp_34_type 1181 +#define _loop0_36_type 1182 +#define _gather_35_type 1183 +#define _tmp_37_type 1184 +#define _loop0_39_type 1185 +#define _gather_38_type 1186 +#define _loop0_41_type 1187 +#define _gather_40_type 1188 +#define _loop0_43_type 1189 +#define _gather_42_type 1190 +#define _loop0_45_type 1191 +#define _gather_44_type 1192 +#define _tmp_46_type 1193 +#define _loop1_47_type 1194 +#define _tmp_48_type 1195 +#define _tmp_49_type 1196 +#define _tmp_50_type 1197 +#define _tmp_51_type 1198 +#define _tmp_52_type 1199 +#define _loop0_53_type 1200 +#define _loop0_54_type 1201 +#define _loop0_55_type 1202 +#define _loop1_56_type 1203 +#define _loop0_57_type 1204 +#define _loop1_58_type 1205 +#define _loop1_59_type 1206 +#define _loop1_60_type 1207 +#define _loop0_61_type 1208 +#define _loop1_62_type 1209 +#define _loop0_63_type 1210 +#define _loop1_64_type 1211 +#define _loop0_65_type 1212 +#define _loop1_66_type 1213 +#define _loop1_67_type 1214 +#define _tmp_68_type 1215 +#define _loop0_70_type 1216 +#define _gather_69_type 1217 +#define _loop1_71_type 1218 +#define _loop0_73_type 1219 +#define _gather_72_type 1220 +#define _loop1_74_type 1221 +#define _loop0_75_type 1222 +#define _loop0_76_type 1223 +#define _loop0_77_type 1224 +#define _loop1_78_type 1225 +#define _loop0_79_type 1226 +#define _loop1_80_type 1227 +#define _loop1_81_type 1228 +#define _loop1_82_type 1229 +#define _loop0_83_type 1230 +#define _loop1_84_type 1231 +#define _loop0_85_type 1232 +#define _loop1_86_type 1233 +#define _loop0_87_type 1234 +#define _loop1_88_type 1235 +#define _loop1_89_type 1236 +#define _loop1_90_type 1237 +#define _loop1_91_type 1238 +#define _tmp_92_type 1239 +#define _loop0_94_type 1240 +#define _gather_93_type 1241 +#define _tmp_95_type 1242 +#define _tmp_96_type 1243 +#define _tmp_97_type 1244 +#define _tmp_98_type 1245 +#define _loop1_99_type 1246 +#define _tmp_100_type 1247 +#define _tmp_101_type 1248 +#define _loop0_103_type 1249 +#define _gather_102_type 1250 +#define _loop1_104_type 1251 +#define _loop0_105_type 1252 +#define _loop0_106_type 1253 +#define _tmp_107_type 1254 +#define _tmp_108_type 1255 +#define _loop0_110_type 1256 +#define _gather_109_type 1257 +#define _loop0_112_type 1258 +#define _gather_111_type 1259 +#define _loop0_114_type 1260 +#define _gather_113_type 1261 +#define _loop0_116_type 1262 +#define _gather_115_type 1263 +#define _loop0_117_type 1264 +#define _loop0_119_type 1265 +#define _gather_118_type 1266 +#define _tmp_120_type 1267 +#define _loop0_122_type 1268 +#define _gather_121_type 1269 +#define _loop0_124_type 1270 +#define _gather_123_type 1271 +#define _tmp_125_type 1272 +#define _tmp_126_type 1273 +#define _tmp_127_type 1274 +#define _tmp_128_type 1275 +#define _tmp_129_type 1276 +#define _loop0_130_type 1277 +#define _tmp_131_type 1278 +#define _tmp_132_type 1279 +#define _tmp_133_type 1280 +#define _tmp_134_type 1281 +#define _tmp_135_type 1282 +#define _tmp_136_type 1283 +#define _tmp_137_type 1284 +#define _tmp_138_type 1285 +#define _tmp_139_type 1286 +#define _tmp_140_type 1287 +#define _tmp_141_type 1288 +#define _tmp_142_type 1289 +#define _loop1_143_type 1290 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -436,15 +430,14 @@ 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_parameters_rule(Parser *p); -static asdl_seq* lambda_slash_without_default_rule(Parser *p); +static asdl_seq* lambda_slash_no_default_rule(Parser *p); static SlashWithDefault* lambda_slash_with_default_rule(Parser *p); static StarEtc* lambda_star_etc_rule(Parser *p); -static NameDefaultPair* lambda_name_with_optional_default_rule(Parser *p); -static asdl_seq* lambda_names_with_default_rule(Parser *p); -static NameDefaultPair* lambda_name_with_default_rule(Parser *p); -static asdl_seq* lambda_plain_names_rule(Parser *p); -static arg_ty lambda_plain_name_rule(Parser *p); static arg_ty lambda_kwds_rule(Parser *p); +static arg_ty lambda_param_no_default_rule(Parser *p); +static NameDefaultPair* lambda_param_with_default_rule(Parser *p); +static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p); +static arg_ty lambda_param_rule(Parser *p); static expr_ty disjunction_rule(Parser *p); static expr_ty conjunction_rule(Parser *p); static expr_ty inversion_rule(Parser *p); @@ -589,66 +582,66 @@ static asdl_seq *_loop1_71_rule(Parser *p); static asdl_seq *_loop0_73_rule(Parser *p); static asdl_seq *_gather_72_rule(Parser *p); static asdl_seq *_loop1_74_rule(Parser *p); -static void *_tmp_75_rule(Parser *p); -static void *_tmp_76_rule(Parser *p); -static void *_tmp_77_rule(Parser *p); -static void *_tmp_78_rule(Parser *p); -static void *_tmp_79_rule(Parser *p); -static void *_tmp_80_rule(Parser *p); -static void *_tmp_81_rule(Parser *p); -static void *_tmp_82_rule(Parser *p); -static void *_tmp_83_rule(Parser *p); -static asdl_seq *_loop0_84_rule(Parser *p); -static void *_tmp_85_rule(Parser *p); +static asdl_seq *_loop0_75_rule(Parser *p); +static asdl_seq *_loop0_76_rule(Parser *p); +static asdl_seq *_loop0_77_rule(Parser *p); +static asdl_seq *_loop1_78_rule(Parser *p); +static asdl_seq *_loop0_79_rule(Parser *p); +static asdl_seq *_loop1_80_rule(Parser *p); +static asdl_seq *_loop1_81_rule(Parser *p); +static asdl_seq *_loop1_82_rule(Parser *p); +static asdl_seq *_loop0_83_rule(Parser *p); +static asdl_seq *_loop1_84_rule(Parser *p); +static asdl_seq *_loop0_85_rule(Parser *p); static asdl_seq *_loop1_86_rule(Parser *p); -static void *_tmp_87_rule(Parser *p); -static void *_tmp_88_rule(Parser *p); -static asdl_seq *_loop0_90_rule(Parser *p); -static asdl_seq *_gather_89_rule(Parser *p); -static asdl_seq *_loop0_92_rule(Parser *p); -static asdl_seq *_gather_91_rule(Parser *p); -static asdl_seq *_loop1_93_rule(Parser *p); -static asdl_seq *_loop1_94_rule(Parser *p); -static asdl_seq *_loop1_95_rule(Parser *p); +static asdl_seq *_loop0_87_rule(Parser *p); +static asdl_seq *_loop1_88_rule(Parser *p); +static asdl_seq *_loop1_89_rule(Parser *p); +static asdl_seq *_loop1_90_rule(Parser *p); +static asdl_seq *_loop1_91_rule(Parser *p); +static void *_tmp_92_rule(Parser *p); +static asdl_seq *_loop0_94_rule(Parser *p); +static asdl_seq *_gather_93_rule(Parser *p); +static void *_tmp_95_rule(Parser *p); static void *_tmp_96_rule(Parser *p); -static asdl_seq *_loop0_98_rule(Parser *p); -static asdl_seq *_gather_97_rule(Parser *p); -static void *_tmp_99_rule(Parser *p); +static void *_tmp_97_rule(Parser *p); +static void *_tmp_98_rule(Parser *p); +static asdl_seq *_loop1_99_rule(Parser *p); static void *_tmp_100_rule(Parser *p); static void *_tmp_101_rule(Parser *p); -static void *_tmp_102_rule(Parser *p); -static asdl_seq *_loop1_103_rule(Parser *p); -static void *_tmp_104_rule(Parser *p); -static void *_tmp_105_rule(Parser *p); -static asdl_seq *_loop0_107_rule(Parser *p); -static asdl_seq *_gather_106_rule(Parser *p); -static asdl_seq *_loop1_108_rule(Parser *p); -static asdl_seq *_loop0_109_rule(Parser *p); +static asdl_seq *_loop0_103_rule(Parser *p); +static asdl_seq *_gather_102_rule(Parser *p); +static asdl_seq *_loop1_104_rule(Parser *p); +static asdl_seq *_loop0_105_rule(Parser *p); +static asdl_seq *_loop0_106_rule(Parser *p); +static void *_tmp_107_rule(Parser *p); +static void *_tmp_108_rule(Parser *p); static asdl_seq *_loop0_110_rule(Parser *p); -static void *_tmp_111_rule(Parser *p); -static void *_tmp_112_rule(Parser *p); +static asdl_seq *_gather_109_rule(Parser *p); +static asdl_seq *_loop0_112_rule(Parser *p); +static asdl_seq *_gather_111_rule(Parser *p); static asdl_seq *_loop0_114_rule(Parser *p); static asdl_seq *_gather_113_rule(Parser *p); static asdl_seq *_loop0_116_rule(Parser *p); static asdl_seq *_gather_115_rule(Parser *p); -static asdl_seq *_loop0_118_rule(Parser *p); -static asdl_seq *_gather_117_rule(Parser *p); -static asdl_seq *_loop0_120_rule(Parser *p); -static asdl_seq *_gather_119_rule(Parser *p); -static asdl_seq *_loop0_121_rule(Parser *p); -static asdl_seq *_loop0_123_rule(Parser *p); -static asdl_seq *_gather_122_rule(Parser *p); -static void *_tmp_124_rule(Parser *p); -static asdl_seq *_loop0_126_rule(Parser *p); -static asdl_seq *_gather_125_rule(Parser *p); -static asdl_seq *_loop0_128_rule(Parser *p); -static asdl_seq *_gather_127_rule(Parser *p); +static asdl_seq *_loop0_117_rule(Parser *p); +static asdl_seq *_loop0_119_rule(Parser *p); +static asdl_seq *_gather_118_rule(Parser *p); +static void *_tmp_120_rule(Parser *p); +static asdl_seq *_loop0_122_rule(Parser *p); +static asdl_seq *_gather_121_rule(Parser *p); +static asdl_seq *_loop0_124_rule(Parser *p); +static asdl_seq *_gather_123_rule(Parser *p); +static void *_tmp_125_rule(Parser *p); +static void *_tmp_126_rule(Parser *p); +static void *_tmp_127_rule(Parser *p); +static void *_tmp_128_rule(Parser *p); static void *_tmp_129_rule(Parser *p); -static void *_tmp_130_rule(Parser *p); +static asdl_seq *_loop0_130_rule(Parser *p); static void *_tmp_131_rule(Parser *p); static void *_tmp_132_rule(Parser *p); static void *_tmp_133_rule(Parser *p); -static asdl_seq *_loop0_134_rule(Parser *p); +static void *_tmp_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); @@ -657,12 +650,7 @@ static void *_tmp_139_rule(Parser *p); static void *_tmp_140_rule(Parser *p); static void *_tmp_141_rule(Parser *p); 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 void *_tmp_146_rule(Parser *p); -static void *_tmp_147_rule(Parser *p); -static asdl_seq *_loop1_148_rule(Parser *p); +static asdl_seq *_loop1_143_rule(Parser *p); // file: statements? $ @@ -5217,10 +5205,10 @@ lambdef_rule(Parser *p) } // lambda_parameters: -// | lambda_slash_without_default [',' lambda_plain_names] [',' lambda_names_with_default] [',' lambda_star_etc?] -// | lambda_slash_with_default [',' lambda_names_with_default] [',' lambda_star_etc?] -// | lambda_plain_names [',' lambda_names_with_default] [',' lambda_star_etc?] -// | lambda_names_with_default [',' lambda_star_etc?] +// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? +// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc? +// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? +// | lambda_param_with_default+ lambda_star_etc? // | lambda_star_etc static arguments_ty lambda_parameters_rule(Parser *p) @@ -5230,19 +5218,19 @@ lambda_parameters_rule(Parser *p) } arguments_ty res = NULL; int mark = p->mark; - { // lambda_slash_without_default [',' lambda_plain_names] [',' lambda_names_with_default] [',' lambda_star_etc?] + { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc? asdl_seq* a; - void *b; - void *c; + asdl_seq * b; + asdl_seq * c; void *d; if ( - (a = lambda_slash_without_default_rule(p)) + (a = lambda_slash_no_default_rule(p)) && - (b = _tmp_75_rule(p), 1) + (b = _loop0_75_rule(p)) && - (c = _tmp_76_rule(p), 1) + (c = _loop0_76_rule(p)) && - (d = _tmp_77_rule(p), 1) + (d = lambda_star_etc_rule(p), 1) ) { res = _PyPegen_make_arguments ( p , a , NULL , b , c , d ); @@ -5254,16 +5242,16 @@ lambda_parameters_rule(Parser *p) } p->mark = mark; } - { // lambda_slash_with_default [',' lambda_names_with_default] [',' lambda_star_etc?] + { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc? SlashWithDefault* a; - void *b; + asdl_seq * b; void *c; if ( (a = lambda_slash_with_default_rule(p)) && - (b = _tmp_78_rule(p), 1) + (b = _loop0_77_rule(p)) && - (c = _tmp_79_rule(p), 1) + (c = lambda_star_etc_rule(p), 1) ) { res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c ); @@ -5275,16 +5263,16 @@ lambda_parameters_rule(Parser *p) } p->mark = mark; } - { // lambda_plain_names [',' lambda_names_with_default] [',' lambda_star_etc?] - asdl_seq* a; - void *b; + { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc? + asdl_seq * a; + asdl_seq * b; void *c; if ( - (a = lambda_plain_names_rule(p)) + (a = _loop1_78_rule(p)) && - (b = _tmp_80_rule(p), 1) + (b = _loop0_79_rule(p)) && - (c = _tmp_81_rule(p), 1) + (c = lambda_star_etc_rule(p), 1) ) { res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c ); @@ -5296,13 +5284,13 @@ lambda_parameters_rule(Parser *p) } p->mark = mark; } - { // lambda_names_with_default [',' lambda_star_etc?] - asdl_seq* a; + { // lambda_param_with_default+ lambda_star_etc? + asdl_seq * a; void *b; if ( - (a = lambda_names_with_default_rule(p)) + (a = _loop1_80_rule(p)) && - (b = _tmp_82_rule(p), 1) + (b = lambda_star_etc_rule(p), 1) ) { res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b ); @@ -5334,25 +5322,47 @@ lambda_parameters_rule(Parser *p) return res; } -// lambda_slash_without_default: lambda_plain_names ',' '/' +// lambda_slash_no_default: +// | lambda_param_no_default+ '/' ',' +// | lambda_param_no_default+ '/' &':' static asdl_seq* -lambda_slash_without_default_rule(Parser *p) +lambda_slash_no_default_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq* res = NULL; int mark = p->mark; - { // lambda_plain_names ',' '/' - asdl_seq* a; + { // lambda_param_no_default+ '/' ',' + asdl_seq * a; Token * literal; Token * literal_1; if ( - (a = lambda_plain_names_rule(p)) + (a = _loop1_81_rule(p)) && - (literal = _PyPegen_expect_token(p, 12)) + (literal = _PyPegen_expect_token(p, 17)) && - (literal_1 = _PyPegen_expect_token(p, 17)) + (literal_1 = _PyPegen_expect_token(p, 12)) + ) + { + res = a; + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param_no_default+ '/' &':' + asdl_seq * a; + Token * literal; + if ( + (a = _loop1_82_rule(p)) + && + (literal = _PyPegen_expect_token(p, 17)) + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) ) { res = a; @@ -5369,7 +5379,9 @@ lambda_slash_without_default_rule(Parser *p) return res; } -// lambda_slash_with_default: [lambda_plain_names ','] lambda_names_with_default ',' '/' +// lambda_slash_with_default: +// | lambda_param_no_default* lambda_param_with_default+ '/' ',' +// | lambda_param_no_default* lambda_param_with_default+ '/' &':' static SlashWithDefault* lambda_slash_with_default_rule(Parser *p) { @@ -5378,19 +5390,42 @@ lambda_slash_with_default_rule(Parser *p) } SlashWithDefault* res = NULL; int mark = p->mark; - { // [lambda_plain_names ','] lambda_names_with_default ',' '/' - void *a; - asdl_seq* b; + { // lambda_param_no_default* lambda_param_with_default+ '/' ',' + asdl_seq * a; + asdl_seq * b; Token * literal; Token * literal_1; if ( - (a = _tmp_83_rule(p), 1) + (a = _loop0_83_rule(p)) && - (b = lambda_names_with_default_rule(p)) + (b = _loop1_84_rule(p)) && - (literal = _PyPegen_expect_token(p, 12)) + (literal = _PyPegen_expect_token(p, 17)) && - (literal_1 = _PyPegen_expect_token(p, 17)) + (literal_1 = _PyPegen_expect_token(p, 12)) + ) + { + res = _PyPegen_slash_with_default ( p , a , b ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param_no_default* lambda_param_with_default+ '/' &':' + asdl_seq * a; + asdl_seq * b; + Token * literal; + if ( + (a = _loop0_85_rule(p)) + && + (b = _loop1_86_rule(p)) + && + (literal = _PyPegen_expect_token(p, 17)) + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) ) { res = _PyPegen_slash_with_default ( p , a , b ); @@ -5408,9 +5443,9 @@ lambda_slash_with_default_rule(Parser *p) } // lambda_star_etc: -// | '*' lambda_plain_name lambda_name_with_optional_default* [',' lambda_kwds] ','? -// | '*' lambda_name_with_optional_default+ [',' lambda_kwds] ','? -// | lambda_kwds ','? +// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? +// | '*' ',' lambda_param_maybe_default+ lambda_kwds? +// | lambda_kwds static StarEtc* lambda_star_etc_rule(Parser *p) { @@ -5419,23 +5454,19 @@ lambda_star_etc_rule(Parser *p) } StarEtc* res = NULL; int mark = p->mark; - { // '*' lambda_plain_name lambda_name_with_optional_default* [',' lambda_kwds] ','? + { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds? arg_ty a; asdl_seq * b; void *c; Token * literal; - void *opt_var; - UNUSED(opt_var); // Silence compiler warnings if ( (literal = _PyPegen_expect_token(p, 16)) && - (a = lambda_plain_name_rule(p)) + (a = lambda_param_no_default_rule(p)) && - (b = _loop0_84_rule(p)) + (b = _loop0_87_rule(p)) && - (c = _tmp_85_rule(p), 1) - && - (opt_var = _PyPegen_expect_token(p, 12), 1) + (c = lambda_kwds_rule(p), 1) ) { res = _PyPegen_star_etc ( p , a , b , c ); @@ -5447,20 +5478,19 @@ lambda_star_etc_rule(Parser *p) } p->mark = mark; } - { // '*' lambda_name_with_optional_default+ [',' lambda_kwds] ','? + { // '*' ',' lambda_param_maybe_default+ lambda_kwds? asdl_seq * b; void *c; Token * literal; - void *opt_var; - UNUSED(opt_var); // Silence compiler warnings + Token * literal_1; if ( (literal = _PyPegen_expect_token(p, 16)) && - (b = _loop1_86_rule(p)) + (literal_1 = _PyPegen_expect_token(p, 12)) && - (c = _tmp_87_rule(p), 1) + (b = _loop1_88_rule(p)) && - (opt_var = _PyPegen_expect_token(p, 12), 1) + (c = lambda_kwds_rule(p), 1) ) { res = _PyPegen_star_etc ( p , NULL , b , c ); @@ -5472,14 +5502,10 @@ lambda_star_etc_rule(Parser *p) } p->mark = mark; } - { // lambda_kwds ','? + { // lambda_kwds arg_ty a; - void *opt_var; - UNUSED(opt_var); // Silence compiler warnings if ( (a = lambda_kwds_rule(p)) - && - (opt_var = _PyPegen_expect_token(p, 12), 1) ) { res = _PyPegen_star_etc ( p , NULL , NULL , a ); @@ -5496,137 +5522,200 @@ lambda_star_etc_rule(Parser *p) return res; } -// lambda_name_with_optional_default: ',' lambda_plain_name ['=' expression] -static NameDefaultPair* -lambda_name_with_optional_default_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - NameDefaultPair* res = NULL; - int mark = p->mark; - { // ',' lambda_plain_name ['=' expression] - arg_ty a; - void *b; - Token * literal; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (a = lambda_plain_name_rule(p)) - && - (b = _tmp_88_rule(p), 1) - ) - { - res = _PyPegen_name_default_pair ( p , a , b , NULL ); - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// lambda_names_with_default: ','.lambda_name_with_default+ -static asdl_seq* -lambda_names_with_default_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - asdl_seq* res = NULL; - int mark = p->mark; - { // ','.lambda_name_with_default+ - asdl_seq * a; - if ( - (a = _gather_89_rule(p)) - ) - { - res = a; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// lambda_name_with_default: lambda_plain_name '=' expression -static NameDefaultPair* -lambda_name_with_default_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - NameDefaultPair* res = NULL; - int mark = p->mark; - { // lambda_plain_name '=' expression - expr_ty e; - Token * literal; - arg_ty n; - if ( - (n = lambda_plain_name_rule(p)) - && - (literal = _PyPegen_expect_token(p, 22)) - && - (e = expression_rule(p)) - ) - { - res = _PyPegen_name_default_pair ( p , n , e , NULL ); - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// lambda_plain_names: ','.(lambda_plain_name !'=')+ -static asdl_seq* -lambda_plain_names_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - asdl_seq* res = NULL; - int mark = p->mark; - { // ','.(lambda_plain_name !'=')+ - asdl_seq * a; - if ( - (a = _gather_91_rule(p)) - ) - { - res = a; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// lambda_plain_name: NAME +// lambda_kwds: '**' lambda_param_no_default static arg_ty -lambda_plain_name_rule(Parser *p) +lambda_kwds_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + arg_ty res = NULL; + int mark = p->mark; + { // '**' lambda_param_no_default + arg_ty a; + Token * literal; + if ( + (literal = _PyPegen_expect_token(p, 35)) + && + (a = lambda_param_no_default_rule(p)) + ) + { + res = a; + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + +// lambda_param_no_default: lambda_param ',' | lambda_param &':' +static arg_ty +lambda_param_no_default_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + arg_ty res = NULL; + int mark = p->mark; + { // lambda_param ',' + arg_ty a; + Token * literal; + if ( + (a = lambda_param_rule(p)) + && + (literal = _PyPegen_expect_token(p, 12)) + ) + { + res = a; + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param &':' + arg_ty a; + if ( + (a = lambda_param_rule(p)) + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) + ) + { + res = a; + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + +// lambda_param_with_default: lambda_param default ',' | lambda_param default &':' +static NameDefaultPair* +lambda_param_with_default_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + NameDefaultPair* res = NULL; + int mark = p->mark; + { // lambda_param default ',' + arg_ty a; + expr_ty c; + Token * literal; + if ( + (a = lambda_param_rule(p)) + && + (c = default_rule(p)) + && + (literal = _PyPegen_expect_token(p, 12)) + ) + { + res = _PyPegen_name_default_pair ( p , a , c , NULL ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param default &':' + arg_ty a; + expr_ty c; + if ( + (a = lambda_param_rule(p)) + && + (c = default_rule(p)) + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) + ) + { + res = _PyPegen_name_default_pair ( p , a , c , NULL ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + +// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':' +static NameDefaultPair* +lambda_param_maybe_default_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + NameDefaultPair* res = NULL; + int mark = p->mark; + { // lambda_param default? ',' + arg_ty a; + void *c; + Token * literal; + if ( + (a = lambda_param_rule(p)) + && + (c = default_rule(p), 1) + && + (literal = _PyPegen_expect_token(p, 12)) + ) + { + res = _PyPegen_name_default_pair ( p , a , c , NULL ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + { // lambda_param default? &':' + arg_ty a; + void *c; + if ( + (a = lambda_param_rule(p)) + && + (c = default_rule(p), 1) + && + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) + ) + { + res = _PyPegen_name_default_pair ( p , a , c , NULL ); + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + return NULL; + } + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + +// lambda_param: NAME +static arg_ty +lambda_param_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -5669,38 +5758,6 @@ lambda_plain_name_rule(Parser *p) return res; } -// lambda_kwds: '**' lambda_plain_name -static arg_ty -lambda_kwds_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - arg_ty res = NULL; - int mark = p->mark; - { // '**' lambda_plain_name - arg_ty a; - Token * literal; - if ( - (literal = _PyPegen_expect_token(p, 35)) - && - (a = lambda_plain_name_rule(p)) - ) - { - res = a; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - // disjunction: conjunction (('or' conjunction))+ | conjunction static expr_ty disjunction_rule(Parser *p) @@ -5726,7 +5783,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) && - (b = _loop1_93_rule(p)) + (b = _loop1_89_rule(p)) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -5788,7 +5845,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) && - (b = _loop1_94_rule(p)) + (b = _loop1_90_rule(p)) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -5910,7 +5967,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) && - (b = _loop1_95_rule(p)) + (b = _loop1_91_rule(p)) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -6122,10 +6179,10 @@ noteq_bitwise_or_rule(Parser *p) CmpopExprPair* res = NULL; int mark = p->mark; { // ('!=') bitwise_or - void *_tmp_96_var; + void *_tmp_92_var; expr_ty a; if ( - (_tmp_96_var = _tmp_96_rule(p)) + (_tmp_92_var = _tmp_92_rule(p)) && (a = bitwise_or_rule(p)) ) @@ -7567,7 +7624,7 @@ slices_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_97_rule(p)) + (a = _gather_93_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -7623,7 +7680,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), 1) && - (c = _tmp_99_rule(p), 1) + (c = _tmp_95_rule(p), 1) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -7811,40 +7868,40 @@ atom_rule(Parser *p) p->mark = mark; } { // &'(' (tuple | group | genexp) - void *_tmp_100_var; + void *_tmp_96_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) && - (_tmp_100_var = _tmp_100_rule(p)) + (_tmp_96_var = _tmp_96_rule(p)) ) { - res = _tmp_100_var; + res = _tmp_96_var; goto done; } p->mark = mark; } { // &'[' (list | listcomp) - void *_tmp_101_var; + void *_tmp_97_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) && - (_tmp_101_var = _tmp_101_rule(p)) + (_tmp_97_var = _tmp_97_rule(p)) ) { - res = _tmp_101_var; + res = _tmp_97_var; goto done; } p->mark = mark; } { // &'{' (dict | set | dictcomp | setcomp) - void *_tmp_102_var; + void *_tmp_98_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) && - (_tmp_102_var = _tmp_102_rule(p)) + (_tmp_98_var = _tmp_98_rule(p)) ) { - res = _tmp_102_var; + res = _tmp_98_var; goto done; } p->mark = mark; @@ -7891,7 +7948,7 @@ strings_rule(Parser *p) { // STRING+ asdl_seq * a; if ( - (a = _loop1_103_rule(p)) + (a = _loop1_99_rule(p)) ) { res = _PyPegen_concatenate_strings ( p , a ); @@ -8049,7 +8106,7 @@ tuple_rule(Parser *p) if ( (literal = _PyPegen_expect_token(p, 7)) && - (a = _tmp_104_rule(p), 1) + (a = _tmp_100_rule(p), 1) && (literal_1 = _PyPegen_expect_token(p, 8)) ) @@ -8092,7 +8149,7 @@ group_rule(Parser *p) if ( (literal = _PyPegen_expect_token(p, 7)) && - (a = _tmp_105_rule(p)) + (a = _tmp_101_rule(p)) && (literal_1 = _PyPegen_expect_token(p, 8)) ) @@ -8411,7 +8468,7 @@ kvpairs_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_106_rule(p)) + (a = _gather_102_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -8493,12 +8550,12 @@ for_if_clauses_rule(Parser *p) asdl_seq* res = NULL; int mark = p->mark; { // for_if_clause+ - asdl_seq * _loop1_108_var; + asdl_seq * _loop1_104_var; if ( - (_loop1_108_var = _loop1_108_rule(p)) + (_loop1_104_var = _loop1_104_rule(p)) ) { - res = _loop1_108_var; + res = _loop1_104_var; goto done; } p->mark = mark; @@ -8537,7 +8594,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) && - (c = _loop0_109_rule(p)) + (c = _loop0_105_rule(p)) ) { res = CHECK_VERSION ( 6 , "Async comprehensions are" , _Py_comprehension ( a , b , c , 1 , p -> arena ) ); @@ -8564,7 +8621,7 @@ for_if_clause_rule(Parser *p) && (b = disjunction_rule(p)) && - (c = _loop0_110_rule(p)) + (c = _loop0_106_rule(p)) ) { res = _Py_comprehension ( a , b , c , 0 , p -> arena ); @@ -8730,7 +8787,7 @@ args_rule(Parser *p) if ( (a = starred_expression_rule(p)) && - (b = _tmp_111_rule(p), 1) + (b = _tmp_107_rule(p), 1) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -8779,7 +8836,7 @@ args_rule(Parser *p) if ( (a = named_expression_rule(p)) && - (b = _tmp_112_rule(p), 1) + (b = _tmp_108_rule(p), 1) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -8821,11 +8878,11 @@ kwargs_rule(Parser *p) asdl_seq * b; Token * literal; if ( - (a = _gather_113_rule(p)) + (a = _gather_109_rule(p)) && (literal = _PyPegen_expect_token(p, 12)) && - (b = _gather_115_rule(p)) + (b = _gather_111_rule(p)) ) { res = _PyPegen_join_sequences ( p , a , b ); @@ -8838,23 +8895,23 @@ kwargs_rule(Parser *p) p->mark = mark; } { // ','.kwarg_or_starred+ - asdl_seq * _gather_117_var; + asdl_seq * _gather_113_var; if ( - (_gather_117_var = _gather_117_rule(p)) + (_gather_113_var = _gather_113_rule(p)) ) { - res = _gather_117_var; + res = _gather_113_var; goto done; } p->mark = mark; } { // ','.kwarg_or_double_starred+ - asdl_seq * _gather_119_var; + asdl_seq * _gather_115_var; if ( - (_gather_119_var = _gather_119_rule(p)) + (_gather_115_var = _gather_115_rule(p)) ) { - res = _gather_119_var; + res = _gather_115_var; goto done; } p->mark = mark; @@ -9097,7 +9154,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) && - (b = _loop0_121_rule(p)) + (b = _loop0_117_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -9138,7 +9195,7 @@ star_targets_seq_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_122_rule(p)) + (a = _gather_118_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -9186,7 +9243,7 @@ star_target_rule(Parser *p) if ( (literal = _PyPegen_expect_token(p, 16)) && - (a = _tmp_124_rule(p)) + (a = _tmp_120_rule(p)) ) { Token *token = _PyPegen_get_last_nonnwhitespace_token(p); @@ -9575,7 +9632,7 @@ del_targets_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_125_rule(p)) + (a = _gather_121_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -9828,7 +9885,7 @@ targets_rule(Parser *p) void *opt_var; UNUSED(opt_var); // Silence compiler warnings if ( - (a = _gather_127_rule(p)) + (a = _gather_123_rule(p)) && (opt_var = _PyPegen_expect_token(p, 12), 1) ) @@ -10356,7 +10413,7 @@ incorrect_arguments_rule(Parser *p) && (literal = _PyPegen_expect_token(p, 12)) && - (opt_var = _tmp_129_rule(p), 1) + (opt_var = _tmp_125_rule(p), 1) ) { res = RAISE_SYNTAX_ERROR ( "Generator expression must be parenthesized" ); @@ -10491,7 +10548,7 @@ invalid_assignment_rule(Parser *p) && (expression_var_1 = expression_rule(p)) && - (opt_var = _tmp_130_rule(p), 1) + (opt_var = _tmp_126_rule(p), 1) ) { res = RAISE_SYNTAX_ERROR ( "illegal target for annotation" ); @@ -10504,15 +10561,15 @@ invalid_assignment_rule(Parser *p) p->mark = mark; } { // expression ('=' | augassign) (yield_expr | star_expressions) - void *_tmp_131_var; - void *_tmp_132_var; + void *_tmp_127_var; + void *_tmp_128_var; expr_ty a; if ( (a = expression_rule(p)) && - (_tmp_131_var = _tmp_131_rule(p)) + (_tmp_127_var = _tmp_127_rule(p)) && - (_tmp_132_var = _tmp_132_rule(p)) + (_tmp_128_var = _tmp_128_rule(p)) ) { res = RAISE_SYNTAX_ERROR_NO_COL_OFFSET ( "cannot assign to %s" , _PyPegen_get_expr_name ( a ) ); @@ -10570,12 +10627,12 @@ invalid_comprehension_rule(Parser *p) void * res = NULL; int mark = p->mark; { // ('[' | '(' | '{') '*' expression for_if_clauses - void *_tmp_133_var; + void *_tmp_129_var; expr_ty expression_var; asdl_seq* for_if_clauses_var; Token * literal; if ( - (_tmp_133_var = _tmp_133_rule(p)) + (_tmp_129_var = _tmp_129_rule(p)) && (literal = _PyPegen_expect_token(p, 16)) && @@ -10609,13 +10666,13 @@ invalid_parameters_rule(Parser *p) void * res = NULL; int mark = p->mark; { // param_no_default* (slash_with_default | param_with_default+) param_no_default - asdl_seq * _loop0_134_var; - void *_tmp_135_var; + asdl_seq * _loop0_130_var; + void *_tmp_131_var; arg_ty param_no_default_var; if ( - (_loop0_134_var = _loop0_134_rule(p)) + (_loop0_130_var = _loop0_130_rule(p)) && - (_tmp_135_var = _tmp_135_rule(p)) + (_tmp_131_var = _tmp_131_rule(p)) && (param_no_default_var = param_no_default_rule(p)) ) @@ -11570,12 +11627,12 @@ _loop1_22_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (star_targets '=') - void *_tmp_136_var; + void *_tmp_132_var; while ( - (_tmp_136_var = _tmp_136_rule(p)) + (_tmp_132_var = _tmp_132_rule(p)) ) { - res = _tmp_136_var; + res = _tmp_132_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -11897,12 +11954,12 @@ _loop0_30_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('.' | '...') - void *_tmp_137_var; + void *_tmp_133_var; while ( - (_tmp_137_var = _tmp_137_rule(p)) + (_tmp_133_var = _tmp_133_rule(p)) ) { - res = _tmp_137_var; + res = _tmp_133_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -11946,12 +12003,12 @@ _loop1_31_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('.' | '...') - void *_tmp_138_var; + void *_tmp_134_var; while ( - (_tmp_138_var = _tmp_138_rule(p)) + (_tmp_134_var = _tmp_134_rule(p)) ) { - res = _tmp_138_var; + res = _tmp_134_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13528,12 +13585,12 @@ _loop1_67_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('@' named_expression NEWLINE) - void *_tmp_139_var; + void *_tmp_135_var; while ( - (_tmp_139_var = _tmp_139_rule(p)) + (_tmp_135_var = _tmp_135_rule(p)) ) { - res = _tmp_139_var; + res = _tmp_135_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13701,12 +13758,12 @@ _loop1_71_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (',' star_expression) - void *_tmp_140_var; + void *_tmp_136_var; while ( - (_tmp_140_var = _tmp_140_rule(p)) + (_tmp_136_var = _tmp_136_rule(p)) ) { - res = _tmp_140_var; + res = _tmp_136_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13839,12 +13896,12 @@ _loop1_74_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (',' expression) - void *_tmp_141_var; + void *_tmp_137_var; while ( - (_tmp_141_var = _tmp_141_rule(p)) + (_tmp_137_var = _tmp_137_rule(p)) ) { - res = _tmp_141_var; + res = _tmp_137_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -13874,297 +13931,9 @@ _loop1_74_rule(Parser *p) return seq; } -// _tmp_75: ',' lambda_plain_names -static void * -_tmp_75_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_plain_names - Token * literal; - asdl_seq* x; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (x = lambda_plain_names_rule(p)) - ) - { - res = x; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_76: ',' lambda_names_with_default -static void * -_tmp_76_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_names_with_default - Token * literal; - asdl_seq* y; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (y = lambda_names_with_default_rule(p)) - ) - { - res = y; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_77: ',' lambda_star_etc? -static void * -_tmp_77_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_star_etc? - Token * literal; - void *z; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (z = lambda_star_etc_rule(p), 1) - ) - { - res = z; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_78: ',' lambda_names_with_default -static void * -_tmp_78_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_names_with_default - Token * literal; - asdl_seq* y; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (y = lambda_names_with_default_rule(p)) - ) - { - res = y; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_79: ',' lambda_star_etc? -static void * -_tmp_79_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_star_etc? - Token * literal; - void *z; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (z = lambda_star_etc_rule(p), 1) - ) - { - res = z; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_80: ',' lambda_names_with_default -static void * -_tmp_80_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_names_with_default - Token * literal; - asdl_seq* y; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (y = lambda_names_with_default_rule(p)) - ) - { - res = y; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_81: ',' lambda_star_etc? -static void * -_tmp_81_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_star_etc? - Token * literal; - void *z; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (z = lambda_star_etc_rule(p), 1) - ) - { - res = z; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_82: ',' lambda_star_etc? -static void * -_tmp_82_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_star_etc? - Token * literal; - void *z; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (z = lambda_star_etc_rule(p), 1) - ) - { - res = z; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_83: lambda_plain_names ',' -static void * -_tmp_83_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // lambda_plain_names ',' - Token * literal; - asdl_seq* n; - if ( - (n = lambda_plain_names_rule(p)) - && - (literal = _PyPegen_expect_token(p, 12)) - ) - { - res = n; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop0_84: lambda_name_with_optional_default +// _loop0_75: lambda_param_no_default static asdl_seq * -_loop0_84_rule(Parser *p) +_loop0_75_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14179,13 +13948,13 @@ _loop0_84_rule(Parser *p) } ssize_t children_capacity = 1; ssize_t n = 0; - { // lambda_name_with_optional_default - NameDefaultPair* lambda_name_with_optional_default_var; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; while ( - (lambda_name_with_optional_default_var = lambda_name_with_optional_default_rule(p)) + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) ) { - res = lambda_name_with_optional_default_var; + res = lambda_param_no_default_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14201,49 +13970,527 @@ _loop0_84_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_84"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_75"); PyMem_Free(children); 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_84_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_75_type, seq); return seq; } -// _tmp_85: ',' lambda_kwds -static void * -_tmp_85_rule(Parser *p) +// _loop0_76: lambda_param_with_default +static asdl_seq * +_loop0_76_rule(Parser *p) { if (p->error_indicator) { return NULL; } - void * res = NULL; + void *res = NULL; int mark = p->mark; - { // ',' lambda_kwds - arg_ty d; - Token * literal; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (d = lambda_kwds_rule(p)) + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) ) { - res = d; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } } - goto done; + children[n++] = res; + mark = p->mark; } p->mark = mark; } - res = NULL; - done: - return res; + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_76"); + PyMem_Free(children); + 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_76_type, seq); + return seq; } -// _loop1_86: lambda_name_with_optional_default +// _loop0_77: lambda_param_with_default +static asdl_seq * +_loop0_77_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) + ) + { + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_77"); + PyMem_Free(children); + 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_77_type, seq); + return seq; +} + +// _loop1_78: lambda_param_no_default +static asdl_seq * +_loop1_78_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) + ) + { + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_78"); + PyMem_Free(children); + 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_78_type, seq); + return seq; +} + +// _loop0_79: lambda_param_with_default +static asdl_seq * +_loop0_79_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) + ) + { + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_79"); + PyMem_Free(children); + 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_79_type, seq); + return seq; +} + +// _loop1_80: lambda_param_with_default +static asdl_seq * +_loop1_80_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) + ) + { + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_80"); + PyMem_Free(children); + 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_80_type, seq); + return seq; +} + +// _loop1_81: lambda_param_no_default +static asdl_seq * +_loop1_81_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) + ) + { + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_81"); + PyMem_Free(children); + 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_81_type, seq); + return seq; +} + +// _loop1_82: lambda_param_no_default +static asdl_seq * +_loop1_82_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) + ) + { + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_82"); + PyMem_Free(children); + 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_82_type, seq); + return seq; +} + +// _loop0_83: lambda_param_no_default +static asdl_seq * +_loop0_83_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) + ) + { + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_83"); + PyMem_Free(children); + 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_83_type, seq); + return seq; +} + +// _loop1_84: lambda_param_with_default +static asdl_seq * +_loop1_84_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; + while ( + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) + ) + { + res = lambda_param_with_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + if (n == 0) { + PyMem_Free(children); + return NULL; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_84"); + PyMem_Free(children); + 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_84_type, seq); + return seq; +} + +// _loop0_85: lambda_param_no_default +static asdl_seq * +_loop0_85_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // lambda_param_no_default + arg_ty lambda_param_no_default_var; + while ( + (lambda_param_no_default_var = lambda_param_no_default_rule(p)) + ) + { + res = lambda_param_no_default_var; + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_85"); + PyMem_Free(children); + 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_85_type, seq); + return seq; +} + +// _loop1_86: lambda_param_with_default static asdl_seq * _loop1_86_rule(Parser *p) { @@ -14260,13 +14507,13 @@ _loop1_86_rule(Parser *p) } ssize_t children_capacity = 1; ssize_t n = 0; - { // lambda_name_with_optional_default - NameDefaultPair* lambda_name_with_optional_default_var; + { // lambda_param_with_default + NameDefaultPair* lambda_param_with_default_var; while ( - (lambda_name_with_optional_default_var = lambda_name_with_optional_default_rule(p)) + (lambda_param_with_default_var = lambda_param_with_default_rule(p)) ) { - res = lambda_name_with_optional_default_var; + res = lambda_param_with_default_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14296,73 +14543,9 @@ _loop1_86_rule(Parser *p) return seq; } -// _tmp_87: ',' lambda_kwds -static void * -_tmp_87_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // ',' lambda_kwds - arg_ty d; - Token * literal; - if ( - (literal = _PyPegen_expect_token(p, 12)) - && - (d = lambda_kwds_rule(p)) - ) - { - res = d; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_88: '=' expression -static void * -_tmp_88_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // '=' expression - expr_ty e; - Token * literal; - if ( - (literal = _PyPegen_expect_token(p, 22)) - && - (e = expression_rule(p)) - ) - { - res = e; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - return NULL; - } - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop0_90: ',' lambda_name_with_default +// _loop0_87: lambda_param_maybe_default static asdl_seq * -_loop0_90_rule(Parser *p) +_loop0_87_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14377,21 +14560,13 @@ _loop0_90_rule(Parser *p) } ssize_t children_capacity = 1; ssize_t n = 0; - { // ',' lambda_name_with_default - NameDefaultPair* elem; - Token * literal; + { // lambda_param_maybe_default + NameDefaultPair* lambda_param_maybe_default_var; while ( - (literal = _PyPegen_expect_token(p, 12)) - && - (elem = lambda_name_with_default_rule(p)) + (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) ) { - res = elem; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(children); - return NULL; - } + res = lambda_param_maybe_default_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14407,47 +14582,19 @@ _loop0_90_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_90"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_87"); PyMem_Free(children); 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_90_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_87_type, seq); return seq; } -// _gather_89: lambda_name_with_default _loop0_90 +// _loop1_88: lambda_param_maybe_default static asdl_seq * -_gather_89_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - asdl_seq * res = NULL; - int mark = p->mark; - { // lambda_name_with_default _loop0_90 - NameDefaultPair* elem; - asdl_seq * seq; - if ( - (elem = lambda_name_with_default_rule(p)) - && - (seq = _loop0_90_rule(p)) - ) - { - res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop0_92: ',' (lambda_plain_name !'=') -static asdl_seq * -_loop0_92_rule(Parser *p) +_loop1_88_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14462,21 +14609,13 @@ _loop0_92_rule(Parser *p) } ssize_t children_capacity = 1; ssize_t n = 0; - { // ',' (lambda_plain_name !'=') - void *elem; - Token * literal; + { // lambda_param_maybe_default + NameDefaultPair* lambda_param_maybe_default_var; while ( - (literal = _PyPegen_expect_token(p, 12)) - && - (elem = _tmp_142_rule(p)) + (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) ) { - res = elem; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(children); - return NULL; - } + res = lambda_param_maybe_default_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14490,49 +14629,25 @@ _loop0_92_rule(Parser *p) } p->mark = mark; } + if (n == 0) { + PyMem_Free(children); + return NULL; + } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_92"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_88"); PyMem_Free(children); 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_92_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_88_type, seq); return seq; } -// _gather_91: (lambda_plain_name !'=') _loop0_92 +// _loop1_89: ('or' conjunction) static asdl_seq * -_gather_91_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - asdl_seq * res = NULL; - int mark = p->mark; - { // (lambda_plain_name !'=') _loop0_92 - void *elem; - asdl_seq * seq; - if ( - (elem = _tmp_142_rule(p)) - && - (seq = _loop0_92_rule(p)) - ) - { - res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop1_93: ('or' conjunction) -static asdl_seq * -_loop1_93_rule(Parser *p) +_loop1_89_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14548,12 +14663,12 @@ _loop1_93_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('or' conjunction) - void *_tmp_143_var; + void *_tmp_138_var; while ( - (_tmp_143_var = _tmp_143_rule(p)) + (_tmp_138_var = _tmp_138_rule(p)) ) { - res = _tmp_143_var; + res = _tmp_138_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14573,19 +14688,19 @@ _loop1_93_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_93"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_89"); PyMem_Free(children); 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_93_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_89_type, seq); return seq; } -// _loop1_94: ('and' inversion) +// _loop1_90: ('and' inversion) static asdl_seq * -_loop1_94_rule(Parser *p) +_loop1_90_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14601,12 +14716,12 @@ _loop1_94_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('and' inversion) - void *_tmp_144_var; + void *_tmp_139_var; while ( - (_tmp_144_var = _tmp_144_rule(p)) + (_tmp_139_var = _tmp_139_rule(p)) ) { - res = _tmp_144_var; + res = _tmp_139_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -14626,19 +14741,19 @@ _loop1_94_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_94"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_90"); PyMem_Free(children); 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_94_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_90_type, seq); return seq; } -// _loop1_95: compare_op_bitwise_or_pair +// _loop1_91: compare_op_bitwise_or_pair static asdl_seq * -_loop1_95_rule(Parser *p) +_loop1_91_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14679,19 +14794,19 @@ _loop1_95_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_95"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_91"); PyMem_Free(children); 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_95_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_91_type, seq); return seq; } -// _tmp_96: '!=' +// _tmp_92: '!=' static void * -_tmp_96_rule(Parser *p) +_tmp_92_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14718,9 +14833,9 @@ _tmp_96_rule(Parser *p) return res; } -// _loop0_98: ',' slice +// _loop0_94: ',' slice static asdl_seq * -_loop0_98_rule(Parser *p) +_loop0_94_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14765,32 +14880,32 @@ _loop0_98_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_98"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_94"); PyMem_Free(children); 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_98_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_94_type, seq); return seq; } -// _gather_97: slice _loop0_98 +// _gather_93: slice _loop0_94 static asdl_seq * -_gather_97_rule(Parser *p) +_gather_93_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // slice _loop0_98 + { // slice _loop0_94 expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) && - (seq = _loop0_98_rule(p)) + (seq = _loop0_94_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -14803,9 +14918,9 @@ _gather_97_rule(Parser *p) return res; } -// _tmp_99: ':' expression? +// _tmp_95: ':' expression? static void * -_tmp_99_rule(Parser *p) +_tmp_95_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14835,9 +14950,9 @@ _tmp_99_rule(Parser *p) return res; } -// _tmp_100: tuple | group | genexp +// _tmp_96: tuple | group | genexp static void * -_tmp_100_rule(Parser *p) +_tmp_96_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14882,9 +14997,9 @@ _tmp_100_rule(Parser *p) return res; } -// _tmp_101: list | listcomp +// _tmp_97: list | listcomp static void * -_tmp_101_rule(Parser *p) +_tmp_97_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14918,9 +15033,9 @@ _tmp_101_rule(Parser *p) return res; } -// _tmp_102: dict | set | dictcomp | setcomp +// _tmp_98: dict | set | dictcomp | setcomp static void * -_tmp_102_rule(Parser *p) +_tmp_98_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -14976,9 +15091,9 @@ _tmp_102_rule(Parser *p) return res; } -// _loop1_103: STRING +// _loop1_99: STRING static asdl_seq * -_loop1_103_rule(Parser *p) +_loop1_99_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15019,19 +15134,19 @@ _loop1_103_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_103"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_99"); PyMem_Free(children); 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_103_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_99_type, seq); return seq; } -// _tmp_104: star_named_expression ',' star_named_expressions? +// _tmp_100: star_named_expression ',' star_named_expressions? static void * -_tmp_104_rule(Parser *p) +_tmp_100_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15064,9 +15179,9 @@ _tmp_104_rule(Parser *p) return res; } -// _tmp_105: yield_expr | named_expression +// _tmp_101: yield_expr | named_expression static void * -_tmp_105_rule(Parser *p) +_tmp_101_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15100,9 +15215,9 @@ _tmp_105_rule(Parser *p) return res; } -// _loop0_107: ',' kvpair +// _loop0_103: ',' kvpair static asdl_seq * -_loop0_107_rule(Parser *p) +_loop0_103_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15147,32 +15262,32 @@ _loop0_107_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_107"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_103"); PyMem_Free(children); 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_107_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_103_type, seq); return seq; } -// _gather_106: kvpair _loop0_107 +// _gather_102: kvpair _loop0_103 static asdl_seq * -_gather_106_rule(Parser *p) +_gather_102_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // kvpair _loop0_107 + { // kvpair _loop0_103 KeyValuePair* elem; asdl_seq * seq; if ( (elem = kvpair_rule(p)) && - (seq = _loop0_107_rule(p)) + (seq = _loop0_103_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15185,9 +15300,9 @@ _gather_106_rule(Parser *p) return res; } -// _loop1_108: for_if_clause +// _loop1_104: for_if_clause static asdl_seq * -_loop1_108_rule(Parser *p) +_loop1_104_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15228,19 +15343,19 @@ _loop1_108_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_108"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_104"); PyMem_Free(children); 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_108_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_104_type, seq); return seq; } -// _loop0_109: ('if' disjunction) +// _loop0_105: ('if' disjunction) static asdl_seq * -_loop0_109_rule(Parser *p) +_loop0_105_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15256,12 +15371,12 @@ _loop0_109_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('if' disjunction) - void *_tmp_145_var; + void *_tmp_140_var; while ( - (_tmp_145_var = _tmp_145_rule(p)) + (_tmp_140_var = _tmp_140_rule(p)) ) { - res = _tmp_145_var; + res = _tmp_140_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -15277,19 +15392,19 @@ _loop0_109_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_109"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_105"); PyMem_Free(children); 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_109_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_105_type, seq); return seq; } -// _loop0_110: ('if' disjunction) +// _loop0_106: ('if' disjunction) static asdl_seq * -_loop0_110_rule(Parser *p) +_loop0_106_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15305,12 +15420,12 @@ _loop0_110_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // ('if' disjunction) - void *_tmp_146_var; + void *_tmp_141_var; while ( - (_tmp_146_var = _tmp_146_rule(p)) + (_tmp_141_var = _tmp_141_rule(p)) ) { - res = _tmp_146_var; + res = _tmp_141_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -15326,19 +15441,19 @@ _loop0_110_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_110"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_106"); PyMem_Free(children); 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_110_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_106_type, seq); return seq; } -// _tmp_111: ',' args +// _tmp_107: ',' args static void * -_tmp_111_rule(Parser *p) +_tmp_107_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15368,9 +15483,9 @@ _tmp_111_rule(Parser *p) return res; } -// _tmp_112: ',' args +// _tmp_108: ',' args static void * -_tmp_112_rule(Parser *p) +_tmp_108_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15400,6 +15515,176 @@ _tmp_112_rule(Parser *p) return res; } +// _loop0_110: ',' kwarg_or_starred +static asdl_seq * +_loop0_110_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // ',' kwarg_or_starred + KeywordOrStarred* elem; + Token * literal; + while ( + (literal = _PyPegen_expect_token(p, 12)) + && + (elem = kwarg_or_starred_rule(p)) + ) + { + res = elem; + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(children); + return NULL; + } + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_110"); + PyMem_Free(children); + 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_110_type, seq); + return seq; +} + +// _gather_109: kwarg_or_starred _loop0_110 +static asdl_seq * +_gather_109_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + asdl_seq * res = NULL; + int mark = p->mark; + { // kwarg_or_starred _loop0_110 + KeywordOrStarred* elem; + asdl_seq * seq; + if ( + (elem = kwarg_or_starred_rule(p)) + && + (seq = _loop0_110_rule(p)) + ) + { + res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + +// _loop0_112: ',' kwarg_or_double_starred +static asdl_seq * +_loop0_112_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + void *res = NULL; + int mark = p->mark; + int start_mark = p->mark; + void **children = PyMem_Malloc(sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "Parser out of memory"); + return NULL; + } + ssize_t children_capacity = 1; + ssize_t n = 0; + { // ',' kwarg_or_double_starred + KeywordOrStarred* elem; + Token * literal; + while ( + (literal = _PyPegen_expect_token(p, 12)) + && + (elem = kwarg_or_double_starred_rule(p)) + ) + { + res = elem; + if (res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + PyMem_Free(children); + return NULL; + } + if (n == children_capacity) { + children_capacity *= 2; + children = PyMem_Realloc(children, children_capacity*sizeof(void *)); + if (!children) { + PyErr_Format(PyExc_MemoryError, "realloc None"); + return NULL; + } + } + children[n++] = res; + mark = p->mark; + } + p->mark = mark; + } + asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); + if (!seq) { + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_112"); + PyMem_Free(children); + 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_112_type, seq); + return seq; +} + +// _gather_111: kwarg_or_double_starred _loop0_112 +static asdl_seq * +_gather_111_rule(Parser *p) +{ + if (p->error_indicator) { + return NULL; + } + asdl_seq * res = NULL; + int mark = p->mark; + { // kwarg_or_double_starred _loop0_112 + KeywordOrStarred* elem; + asdl_seq * seq; + if ( + (elem = kwarg_or_double_starred_rule(p)) + && + (seq = _loop0_112_rule(p)) + ) + { + res = _PyPegen_seq_insert_in_front(p, elem, seq); + goto done; + } + p->mark = mark; + } + res = NULL; + done: + return res; +} + // _loop0_114: ',' kwarg_or_starred static asdl_seq * _loop0_114_rule(Parser *p) @@ -15570,179 +15855,9 @@ _gather_115_rule(Parser *p) return res; } -// _loop0_118: ',' kwarg_or_starred +// _loop0_117: (',' star_target) static asdl_seq * -_loop0_118_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void *res = NULL; - int mark = p->mark; - int start_mark = p->mark; - void **children = PyMem_Malloc(sizeof(void *)); - if (!children) { - PyErr_Format(PyExc_MemoryError, "Parser out of memory"); - return NULL; - } - ssize_t children_capacity = 1; - ssize_t n = 0; - { // ',' kwarg_or_starred - KeywordOrStarred* elem; - Token * literal; - while ( - (literal = _PyPegen_expect_token(p, 12)) - && - (elem = kwarg_or_starred_rule(p)) - ) - { - res = elem; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(children); - return NULL; - } - if (n == children_capacity) { - children_capacity *= 2; - children = PyMem_Realloc(children, children_capacity*sizeof(void *)); - if (!children) { - PyErr_Format(PyExc_MemoryError, "realloc None"); - return NULL; - } - } - children[n++] = res; - mark = p->mark; - } - p->mark = mark; - } - asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); - if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_118"); - PyMem_Free(children); - 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_118_type, seq); - return seq; -} - -// _gather_117: kwarg_or_starred _loop0_118 -static asdl_seq * -_gather_117_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - asdl_seq * res = NULL; - int mark = p->mark; - { // kwarg_or_starred _loop0_118 - KeywordOrStarred* elem; - asdl_seq * seq; - if ( - (elem = kwarg_or_starred_rule(p)) - && - (seq = _loop0_118_rule(p)) - ) - { - res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop0_120: ',' kwarg_or_double_starred -static asdl_seq * -_loop0_120_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void *res = NULL; - int mark = p->mark; - int start_mark = p->mark; - void **children = PyMem_Malloc(sizeof(void *)); - if (!children) { - PyErr_Format(PyExc_MemoryError, "Parser out of memory"); - return NULL; - } - ssize_t children_capacity = 1; - ssize_t n = 0; - { // ',' kwarg_or_double_starred - KeywordOrStarred* elem; - Token * literal; - while ( - (literal = _PyPegen_expect_token(p, 12)) - && - (elem = kwarg_or_double_starred_rule(p)) - ) - { - res = elem; - if (res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - PyMem_Free(children); - return NULL; - } - if (n == children_capacity) { - children_capacity *= 2; - children = PyMem_Realloc(children, children_capacity*sizeof(void *)); - if (!children) { - PyErr_Format(PyExc_MemoryError, "realloc None"); - return NULL; - } - } - children[n++] = res; - mark = p->mark; - } - p->mark = mark; - } - asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); - if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_120"); - PyMem_Free(children); - 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_120_type, seq); - return seq; -} - -// _gather_119: kwarg_or_double_starred _loop0_120 -static asdl_seq * -_gather_119_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - asdl_seq * res = NULL; - int mark = p->mark; - { // kwarg_or_double_starred _loop0_120 - KeywordOrStarred* elem; - asdl_seq * seq; - if ( - (elem = kwarg_or_double_starred_rule(p)) - && - (seq = _loop0_120_rule(p)) - ) - { - res = _PyPegen_seq_insert_in_front(p, elem, seq); - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _loop0_121: (',' star_target) -static asdl_seq * -_loop0_121_rule(Parser *p) +_loop0_117_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15758,12 +15873,12 @@ _loop0_121_rule(Parser *p) ssize_t children_capacity = 1; ssize_t n = 0; { // (',' star_target) - void *_tmp_147_var; + void *_tmp_142_var; while ( - (_tmp_147_var = _tmp_147_rule(p)) + (_tmp_142_var = _tmp_142_rule(p)) ) { - res = _tmp_147_var; + res = _tmp_142_var; if (n == children_capacity) { children_capacity *= 2; children = PyMem_Realloc(children, children_capacity*sizeof(void *)); @@ -15779,19 +15894,19 @@ _loop0_121_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_121"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_117"); PyMem_Free(children); 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_121_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_117_type, seq); return seq; } -// _loop0_123: ',' star_target +// _loop0_119: ',' star_target static asdl_seq * -_loop0_123_rule(Parser *p) +_loop0_119_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15836,32 +15951,32 @@ _loop0_123_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_123"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_119"); PyMem_Free(children); 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_123_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_119_type, seq); return seq; } -// _gather_122: star_target _loop0_123 +// _gather_118: star_target _loop0_119 static asdl_seq * -_gather_122_rule(Parser *p) +_gather_118_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // star_target _loop0_123 + { // star_target _loop0_119 expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) && - (seq = _loop0_123_rule(p)) + (seq = _loop0_119_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15874,9 +15989,9 @@ _gather_122_rule(Parser *p) return res; } -// _tmp_124: !'*' star_target +// _tmp_120: !'*' star_target static void * -_tmp_124_rule(Parser *p) +_tmp_120_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15901,9 +16016,9 @@ _tmp_124_rule(Parser *p) return res; } -// _loop0_126: ',' del_target +// _loop0_122: ',' del_target static asdl_seq * -_loop0_126_rule(Parser *p) +_loop0_122_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -15948,32 +16063,32 @@ _loop0_126_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_126"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_122"); PyMem_Free(children); 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_126_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_122_type, seq); return seq; } -// _gather_125: del_target _loop0_126 +// _gather_121: del_target _loop0_122 static asdl_seq * -_gather_125_rule(Parser *p) +_gather_121_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // del_target _loop0_126 + { // del_target _loop0_122 expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) && - (seq = _loop0_126_rule(p)) + (seq = _loop0_122_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -15986,9 +16101,9 @@ _gather_125_rule(Parser *p) return res; } -// _loop0_128: ',' target +// _loop0_124: ',' target static asdl_seq * -_loop0_128_rule(Parser *p) +_loop0_124_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16033,32 +16148,32 @@ _loop0_128_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_128"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_124"); PyMem_Free(children); 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_128_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop0_124_type, seq); return seq; } -// _gather_127: target _loop0_128 +// _gather_123: target _loop0_124 static asdl_seq * -_gather_127_rule(Parser *p) +_gather_123_rule(Parser *p) { if (p->error_indicator) { return NULL; } asdl_seq * res = NULL; int mark = p->mark; - { // target _loop0_128 + { // target _loop0_124 expr_ty elem; asdl_seq * seq; if ( (elem = target_rule(p)) && - (seq = _loop0_128_rule(p)) + (seq = _loop0_124_rule(p)) ) { res = _PyPegen_seq_insert_in_front(p, elem, seq); @@ -16071,9 +16186,9 @@ _gather_127_rule(Parser *p) return res; } -// _tmp_129: args | expression for_if_clauses +// _tmp_125: args | expression for_if_clauses static void * -_tmp_129_rule(Parser *p) +_tmp_125_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16110,9 +16225,9 @@ _tmp_129_rule(Parser *p) return res; } -// _tmp_130: '=' annotated_rhs +// _tmp_126: '=' annotated_rhs static void * -_tmp_130_rule(Parser *p) +_tmp_126_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16138,9 +16253,9 @@ _tmp_130_rule(Parser *p) return res; } -// _tmp_131: '=' | augassign +// _tmp_127: '=' | augassign static void * -_tmp_131_rule(Parser *p) +_tmp_127_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16174,9 +16289,9 @@ _tmp_131_rule(Parser *p) return res; } -// _tmp_132: yield_expr | star_expressions +// _tmp_128: yield_expr | star_expressions static void * -_tmp_132_rule(Parser *p) +_tmp_128_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16210,9 +16325,9 @@ _tmp_132_rule(Parser *p) return res; } -// _tmp_133: '[' | '(' | '{' +// _tmp_129: '[' | '(' | '{' static void * -_tmp_133_rule(Parser *p) +_tmp_129_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16257,9 +16372,9 @@ _tmp_133_rule(Parser *p) return res; } -// _loop0_134: param_no_default +// _loop0_130: param_no_default static asdl_seq * -_loop0_134_rule(Parser *p) +_loop0_130_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16296,19 +16411,19 @@ _loop0_134_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_134"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_130"); PyMem_Free(children); 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); + _PyPegen_insert_memo(p, start_mark, _loop0_130_type, seq); return seq; } -// _tmp_135: slash_with_default | param_with_default+ +// _tmp_131: slash_with_default | param_with_default+ static void * -_tmp_135_rule(Parser *p) +_tmp_131_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16327,12 +16442,12 @@ _tmp_135_rule(Parser *p) p->mark = mark; } { // param_with_default+ - asdl_seq * _loop1_148_var; + asdl_seq * _loop1_143_var; if ( - (_loop1_148_var = _loop1_148_rule(p)) + (_loop1_143_var = _loop1_143_rule(p)) ) { - res = _loop1_148_var; + res = _loop1_143_var; goto done; } p->mark = mark; @@ -16342,9 +16457,9 @@ _tmp_135_rule(Parser *p) return res; } -// _tmp_136: star_targets '=' +// _tmp_132: star_targets '=' static void * -_tmp_136_rule(Parser *p) +_tmp_132_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16374,9 +16489,9 @@ _tmp_136_rule(Parser *p) return res; } -// _tmp_137: '.' | '...' +// _tmp_133: '.' | '...' static void * -_tmp_137_rule(Parser *p) +_tmp_133_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16410,9 +16525,9 @@ _tmp_137_rule(Parser *p) return res; } -// _tmp_138: '.' | '...' +// _tmp_134: '.' | '...' static void * -_tmp_138_rule(Parser *p) +_tmp_134_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16446,9 +16561,9 @@ _tmp_138_rule(Parser *p) return res; } -// _tmp_139: '@' named_expression NEWLINE +// _tmp_135: '@' named_expression NEWLINE static void * -_tmp_139_rule(Parser *p) +_tmp_135_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16481,9 +16596,9 @@ _tmp_139_rule(Parser *p) return res; } -// _tmp_140: ',' star_expression +// _tmp_136: ',' star_expression static void * -_tmp_140_rule(Parser *p) +_tmp_136_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16513,9 +16628,9 @@ _tmp_140_rule(Parser *p) return res; } -// _tmp_141: ',' expression +// _tmp_137: ',' expression static void * -_tmp_141_rule(Parser *p) +_tmp_137_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16545,36 +16660,9 @@ _tmp_141_rule(Parser *p) return res; } -// _tmp_142: lambda_plain_name !'=' +// _tmp_138: 'or' conjunction static void * -_tmp_142_rule(Parser *p) -{ - if (p->error_indicator) { - return NULL; - } - void * res = NULL; - int mark = p->mark; - { // lambda_plain_name !'=' - arg_ty lambda_plain_name_var; - if ( - (lambda_plain_name_var = lambda_plain_name_rule(p)) - && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) - ) - { - res = lambda_plain_name_var; - goto done; - } - p->mark = mark; - } - res = NULL; - done: - return res; -} - -// _tmp_143: 'or' conjunction -static void * -_tmp_143_rule(Parser *p) +_tmp_138_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16604,9 +16692,9 @@ _tmp_143_rule(Parser *p) return res; } -// _tmp_144: 'and' inversion +// _tmp_139: 'and' inversion static void * -_tmp_144_rule(Parser *p) +_tmp_139_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16636,9 +16724,9 @@ _tmp_144_rule(Parser *p) return res; } -// _tmp_145: 'if' disjunction +// _tmp_140: 'if' disjunction static void * -_tmp_145_rule(Parser *p) +_tmp_140_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16668,9 +16756,9 @@ _tmp_145_rule(Parser *p) return res; } -// _tmp_146: 'if' disjunction +// _tmp_141: 'if' disjunction static void * -_tmp_146_rule(Parser *p) +_tmp_141_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16700,9 +16788,9 @@ _tmp_146_rule(Parser *p) return res; } -// _tmp_147: ',' star_target +// _tmp_142: ',' star_target static void * -_tmp_147_rule(Parser *p) +_tmp_142_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16732,9 +16820,9 @@ _tmp_147_rule(Parser *p) return res; } -// _loop1_148: param_with_default +// _loop1_143: param_with_default static asdl_seq * -_loop1_148_rule(Parser *p) +_loop1_143_rule(Parser *p) { if (p->error_indicator) { return NULL; @@ -16775,13 +16863,13 @@ _loop1_148_rule(Parser *p) } asdl_seq *seq = _Py_asdl_seq_new(n, p->arena); if (!seq) { - PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_148"); + PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_143"); PyMem_Free(children); 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_148_type, seq); + _PyPegen_insert_memo(p, start_mark, _loop1_143_type, seq); return seq; }