File tree Expand file tree Collapse file tree 1 file changed +6
-25
lines changed Expand file tree Collapse file tree 1 file changed +6
-25
lines changed Original file line number Diff line number Diff line change @@ -263,18 +263,17 @@ pub fn split_name(name: &str) -> Option<Vec<(PrimComponent, &str)>> {
263263 continue ;
264264 }
265265 // 1-letter planet notation
266- if sub_name
267- . strip_prefix ( 'f' )
268- . unwrap_or ( sub_name)
269- . strip_suffix ( [ 'i' , 'p' ] )
270- . unwrap_or ( sub_name)
266+ let unforked = sub_name. strip_prefix ( 'f' ) . unwrap_or ( sub_name) ;
267+ if unforked
268+ . strip_suffix ( [ 'i' , 'p' , 'f' ] )
269+ . unwrap_or ( unforked)
271270 . chars ( )
272271 . all ( |c| "gd" . contains ( c) )
273- && sub_name != "fi"
274272 {
275273 for ( i, c) in sub_name. char_indices ( ) {
276274 let prim = match c {
277- 'f' => Primitive :: Fork ,
275+ 'f' if i == 0 => Primitive :: Fork ,
276+ 'f' => Primitive :: Fix ,
278277 'g' => Primitive :: Gap ,
279278 'd' => Primitive :: Dip ,
280279 'i' => Primitive :: Identity ,
@@ -286,24 +285,6 @@ pub fn split_name(name: &str) -> Option<Vec<(PrimComponent, &str)>> {
286285 start += len;
287286 continue ' outer;
288287 }
289- // Dip fix
290- if sub_name
291- . strip_suffix ( 'f' )
292- . unwrap_or ( sub_name)
293- . chars ( )
294- . all ( |c| c == 'd' )
295- {
296- for ( i, c) in sub_name. char_indices ( ) {
297- let prim = match c {
298- 'd' => Primitive :: Dip ,
299- 'f' => Primitive :: Fix ,
300- _ => unreachable ! ( ) ,
301- } ;
302- prims. push ( ( prim. into ( ) , & sub_name[ i..i + 1 ] ) )
303- }
304- start += len;
305- continue ' outer;
306- }
307288 // Aliases
308289 if let Some ( ps) = Primitive :: get_multi_alias ( sub_name) {
309290 prims. extend ( ps. iter ( ) . map ( |( p, s) | ( * p, * s) ) ) ;
You can’t perform that action at this time.
0 commit comments