summaryrefslogtreecommitdiffstats
path: root/src/parse
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-08 14:31:47 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-08 14:31:47 -0500
commit7b932969d69dc99b49f1a7a7ec7e5d87024bcfe2 (patch)
treebb2b69901986a8865d790d76bd6e49a3ad79ccb3 /src/parse
parent83de263441105e669acf79498788e1b66c6e3945 (diff)
downloadnbsh-7b932969d69dc99b49f1a7a7ec7e5d87024bcfe2.tar.gz
nbsh-7b932969d69dc99b49f1a7a7ec7e5d87024bcfe2.zip
there's no reason to eval at all in the main shell
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/ast.rs15
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();