diff options
| author | Jonas Maier <> | 2026-03-07 12:43:38 +0100 |
|---|---|---|
| committer | Jonas Maier <> | 2026-03-07 12:43:38 +0100 |
| commit | 6504d8c244af90fad76d101406a47a1ac4b22e22 (patch) | |
| tree | f6278d31dae618c9547e06bf3b19db3b57410169 | |
| parent | 1d4e2ae6f557082cae1d468ccd9cd0c2c873c0cc (diff) | |
| download | pish-6504d8c244af90fad76d101406a47a1ac4b22e22.tar.gz | |
can declare but not yet use variables
| -rw-r--r-- | src/main.rs | 3 | ||||
| -rw-r--r-- | src/run/mod.rs | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 925c62c..1dd86bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,6 +25,7 @@ use linebuf::LineBuf; use raw::*; use crate::cursor::{Direction, move_cursor}; +use crate::parse::{Ast, PreExpansion}; use crate::run::CommandDispatch; macro_rules! print { @@ -64,6 +65,7 @@ pub struct Session { dispatch: CommandDispatch, prev_path: BString, vars: HashMap<BString, BString>, + funs: HashMap<BString, Ast<PreExpansion>>, /// n before end of history.len() /// 0 == not checking history @@ -205,6 +207,7 @@ fn event_loop() { prev_path: vec![b'.'], history_visit: 0, vars: HashMap::new(), + funs: HashMap::new(), }; print!("{}", se.prompt()); diff --git a/src/run/mod.rs b/src/run/mod.rs index db0ed05..4970792 100644 --- a/src/run/mod.rs +++ b/src/run/mod.rs @@ -208,7 +208,8 @@ impl Executor { } fn execute_fun_decl(&mut self, fd: parse::FunDecl<PostExpansion>) -> Result<(), ExecError> { - todo!() + self.se.lock().unwrap().funs.insert(fd.name, *fd.body.body); + Ok(()) } fn execute( |
