diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-18 01:40:43 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-18 01:40:43 -0500 |
commit | 4b76cb2100fdefecff79e2999b2a648eb149018b (patch) | |
tree | f6b06d49d2751a731ef27967815cc65b4aa066fc /src/parse | |
parent | d53e7af40835b06a391bd8780edaa0160eec2411 (diff) | |
download | nbsh-4b76cb2100fdefecff79e2999b2a648eb149018b.tar.gz nbsh-4b76cb2100fdefecff79e2999b2a648eb149018b.zip |
support redirects with subshells
Diffstat (limited to 'src/parse')
-rw-r--r-- | src/parse/ast.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs index bd177a4..e2d5840 100644 --- a/src/parse/ast.rs +++ b/src/parse/ast.rs @@ -155,8 +155,10 @@ impl Exe { fn build_ast(pair: pest::iterators::Pair<Rule>) -> Self { assert!(matches!(pair.as_rule(), Rule::subshell | Rule::exe)); if matches!(pair.as_rule(), Rule::subshell) { - let commands = pair.into_inner().next().unwrap(); + let mut iter = pair.into_inner(); + let commands = iter.next().unwrap(); assert!(matches!(commands.as_rule(), Rule::commands)); + let redirects = iter.map(Redirect::build_ast).collect(); return Self { exe: Word { parts: vec![WordPart::SingleQuoted( @@ -177,7 +179,7 @@ impl Exe { )], }, ], - redirects: vec![], + redirects, }; } let mut iter = pair.into_inner(); |