diff options
Diffstat (limited to 'src/parse/ast.rs')
-rw-r--r-- | src/parse/ast.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs index 534c87e..089c9f8 100644 --- a/src/parse/ast.rs +++ b/src/parse/ast.rs @@ -147,6 +147,8 @@ 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(); + assert!(matches!(commands.as_rule(), Rule::commands)); return Self { exe: Word { parts: vec![WordPart::SingleQuoted( @@ -163,12 +165,7 @@ impl Exe { }, Word { parts: vec![WordPart::SingleQuoted( - pair.as_str() - .strip_prefix('(') - .unwrap() - .strip_suffix(')') - .unwrap() - .to_string(), + commands.as_str().to_string(), )], }, ], |