Skip to content

Commit 0b10e84

Browse files
committed
Remove new codes
1 parent 9a71416 commit 0b10e84

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

src/elements/command/simple/parser.rs

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,15 @@ impl SimpleCommand {
2121
}
2222
}
2323

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-
4224
fn eat_word(&mut self, feeder: &mut Feeder, core: &mut ShellCore)
4325
-> Result<bool, ParseError> {
4426
let w = match Word::parse(feeder, core)? {
4527
Some(w) => w,
4628
_ => return Ok(false),
4729
};
4830

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);
5533
}
5634
self.text += &w.text;
5735
self.words.push(w);
@@ -72,21 +50,13 @@ impl SimpleCommand {
7250

7351
loop {
7452
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-
8253
if ! ans.eat_word(feeder, core)? {
8354
break;
8455
}
8556
}
8657

8758
if ans.words.len() + ans.redirects.len() + ans.substitutions.len() > 0 {
8859
feeder.pop_backup();
89-
dbg!("{:?}", &ans);
9060
Ok(Some(ans))
9161
}else{
9262
feeder.rewind();

0 commit comments

Comments
 (0)