@@ -21,37 +21,15 @@ impl SimpleCommand {
21
21
}
22
22
}
23
23
24
- pub fn eat_substitution_as_arg ( & mut self , feeder : & mut Feeder , core : & mut ShellCore )
25
- -> Result < bool , ParseError > {
26
- if let Some ( s) = Substitution :: parse ( feeder, core, true ) ? {
27
- self . text += & s. text ;
28
- self . substitutions_as_args
29
- . push ( SubsArgType :: Subs ( Box :: new ( s) ) ) ;
30
- return Ok ( true ) ;
31
- }
32
-
33
- if let Some ( w) = Word :: parse ( feeder, core) ? {
34
- self . text += & w. text ;
35
- self . substitutions_as_args . push ( SubsArgType :: Other ( w) ) ;
36
- return Ok ( true ) ;
37
- }
38
-
39
- Ok ( false )
40
- }
41
-
42
24
fn eat_word ( & mut self , feeder : & mut Feeder , core : & mut ShellCore )
43
25
-> Result < bool , ParseError > {
44
26
let w = match Word :: parse ( feeder, core) ? {
45
27
Some ( w) => w,
46
28
_ => return Ok ( false ) ,
47
29
} ;
48
30
49
- if self . words . is_empty ( ) {
50
- if utils:: reserved ( & w. text ) {
51
- return Ok ( false ) ;
52
- }
53
-
54
- self . command_name = w. text . clone ( ) ;
31
+ if self . words . is_empty ( ) && utils:: reserved ( & w. text ) {
32
+ return Ok ( false ) ;
55
33
}
56
34
self . text += & w. text ;
57
35
self . words . push ( w) ;
@@ -72,21 +50,13 @@ impl SimpleCommand {
72
50
73
51
loop {
74
52
command:: eat_redirects ( feeder, core, & mut ans. redirects , & mut ans. text ) ?;
75
-
76
- if core. subst_builtins . contains_key ( & ans. command_name ) {
77
- if ans. eat_substitution_as_arg ( feeder, core) ? {
78
- continue ;
79
- }
80
- }
81
-
82
53
if ! ans. eat_word ( feeder, core) ? {
83
54
break ;
84
55
}
85
56
}
86
57
87
58
if ans. words . len ( ) + ans. redirects . len ( ) + ans. substitutions . len ( ) > 0 {
88
59
feeder. pop_backup ( ) ;
89
- dbg ! ( "{:?}" , & ans) ;
90
60
Ok ( Some ( ans) )
91
61
} else {
92
62
feeder. rewind ( ) ;
0 commit comments