Early implementation of scripting elements

This commit is contained in:
2025-03-05 01:36:58 -05:00
parent 5dd9ee96ad
commit 1b3e2c0887
28 changed files with 1384 additions and 371 deletions

View File

@@ -10,8 +10,6 @@ pub mod prompt;
pub mod builtin;
pub mod expand;
use libc::PIPE_BUF;
use nix::unistd::setpgid;
use signal::sig_setup;
use crate::prelude::*;
@@ -22,32 +20,13 @@ pub fn main() {
loop {
log!(TRACE, "Entered loop");
let mut line = match prompt::read_line(&mut shenv) {
let line = match prompt::read_line(&mut shenv) {
Ok(line) => line,
Err(e) => {
eprintln!("{}",e);
continue;
}
};
if let Some(line_exp) = expand_aliases(&line, &mut shenv) {
line = line_exp;
}
let input = Rc::new(line);
log!(INFO, "New input: {:?}", input);
let token_stream = Lexer::new(input).lex();
log!(DEBUG, token_stream);
log!(DEBUG, token_stream);
log!(TRACE, "Token stream: {:?}", token_stream);
match Parser::new(token_stream).parse() {
Err(e) => {
eprintln!("{}",e);
}
Ok(syn_tree) => {
if let Err(e) = Executor::new(syn_tree, &mut shenv).walk() {
eprintln!("{}",e);
}
}
}
log!(TRACE, "Finished iteration");
let _ = exec_input(line, &mut shenv).eprint();
}
}