@@ -230,21 +230,8 @@ fn pest_pair_to_builder_arg(
230230 Ok ( BuilderArg :: Literal ( value) )
231231 }
232232 Rule :: wildcard => {
233- let full_name = arg_content_pair. as_str ( ) ;
234- let name_only =
235- full_name
236- . strip_prefix ( "?" )
237- . ok_or_else ( || ProcessorError :: Semantic {
238- message : format ! ( "Invalid wildcard format for BuilderArg: {}" , full_name) ,
239- span : Some ( get_span ( arg_content_pair) ) ,
240- } ) ?;
241- if name_only. is_empty ( ) {
242- return Err ( ProcessorError :: Semantic {
243- message : "Wildcard name cannot be empty after '?' for BuilderArg" . to_string ( ) ,
244- span : Some ( get_span ( arg_content_pair) ) ,
245- } ) ;
246- }
247- Ok ( BuilderArg :: WildcardLiteral ( name_only. to_string ( ) ) )
233+ let name = arg_content_pair. as_str ( ) . strip_prefix ( "?" ) . unwrap ( ) ;
234+ Ok ( BuilderArg :: WildcardLiteral ( name. to_string ( ) ) )
248235 }
249236 Rule :: anchored_key => {
250237 let mut inner_ak_pairs = arg_content_pair. clone ( ) . into_inner ( ) ;
@@ -259,14 +246,7 @@ fn pest_pair_to_builder_arg(
259246
260247 let pod_self_or_wc_str = match pod_id_pair. as_rule ( ) {
261248 Rule :: wildcard => {
262- let name = pod_id_pair. as_str ( ) . strip_prefix ( "?" ) . unwrap_or_default ( ) ;
263- if name. is_empty ( ) {
264- return Err ( ProcessorError :: Semantic {
265- message : "Wildcard name for pod_id cannot be empty after '?'"
266- . to_string ( ) ,
267- span : Some ( get_span ( & pod_id_pair) ) ,
268- } ) ;
269- }
249+ let name = pod_id_pair. as_str ( ) . strip_prefix ( "?" ) . unwrap ( ) ;
270250 SelfOrWildcardStr :: Wildcard ( name. to_string ( ) )
271251 }
272252 Rule :: self_keyword => SelfOrWildcardStr :: SELF ,
@@ -283,31 +263,23 @@ fn pest_pair_to_builder_arg(
283263 }
284264 } ;
285265
286- let key_part_pair = inner_ak_pairs . next ( ) . ok_or_else ( || {
287- println ! ( " inner_ak_pairs: {:?}" , inner_ak_pairs . clone ( ) ) ;
288- ProcessorError :: MissingElement {
289- element_type : "key part ([?KeyVar] or [ \" key_str \" ]) for BuilderArg"
290- . to_string ( ) ,
291- context : format ! (
292- "anchored key {} in {}" ,
293- pod_id_pair . as_str ( ) ,
294- context_stmt_name
295- ) ,
296- span : Some ( get_span ( arg_content_pair ) ) ,
297- }
298- } ) ?;
266+ let key_part_pair =
267+ inner_ak_pairs
268+ . next ( )
269+ . ok_or_else ( || ProcessorError :: MissingElement {
270+ element_type : "key part ([?KeyVar] or [ \" key_str \" ]) for BuilderArg"
271+ . to_string ( ) ,
272+ context : format ! (
273+ "anchored key {} in {}" ,
274+ pod_id_pair . as_str ( ) ,
275+ context_stmt_name
276+ ) ,
277+ span : Some ( get_span ( arg_content_pair ) ) ,
278+ } ) ?;
299279
300280 let key_or_wildcard_str = match key_part_pair. as_rule ( ) {
301281 Rule :: wildcard => {
302- let key_wildcard_name =
303- key_part_pair. as_str ( ) . strip_prefix ( "?" ) . unwrap_or_default ( ) ;
304- if key_wildcard_name. is_empty ( ) {
305- return Err ( ProcessorError :: Semantic {
306- message : "Wildcard name for key_part cannot be empty after '?'"
307- . to_string ( ) ,
308- span : Some ( get_span ( & key_part_pair) ) ,
309- } ) ;
310- }
282+ let key_wildcard_name = key_part_pair. as_str ( ) . strip_prefix ( "?" ) . unwrap ( ) ;
311283 KeyOrWildcardStr :: Wildcard ( key_wildcard_name. to_string ( ) )
312284 }
313285 Rule :: literal_string => {
0 commit comments