diff options
Diffstat (limited to 'src/parse/ast.rs')
-rw-r--r-- | src/parse/ast.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs index f9f7483..55a71f4 100644 --- a/src/parse/ast.rs +++ b/src/parse/ast.rs @@ -25,14 +25,8 @@ impl Commands { )) } - pub fn eval(self, env: &Env) -> super::Commands { - super::Commands { - pipelines: self - .pipelines - .into_iter() - .map(|pipeline| pipeline.eval(env)) - .collect(), - } + pub fn pipelines(&self) -> &[Pipeline] { + &self.pipelines } pub fn input_string(&self) -> &str { @@ -71,10 +65,13 @@ impl Pipeline { pub fn eval(self, env: &Env) -> super::Pipeline { super::Pipeline { exes: self.exes.into_iter().map(|exe| exe.eval(env)).collect(), - input_string: self.input_string, } } + pub fn input_string(&self) -> &str { + &self.input_string + } + fn build_ast(pipeline: pest::iterators::Pair<Rule>) -> Self { assert!(matches!(pipeline.as_rule(), Rule::pipeline)); let input_string = pipeline.as_str().to_string(); |