mod execute; mod parse; mod prompt; use execute::interpret; use rustyline::error::ReadlineError; use rustyline::{Editor, Result}; use crate::prompt::Prompt; fn main() -> Result<()> { let mut rl = Editor::<()>::new()?; let mut prompt = Prompt::new(); loop { let readline = rl.readline(&prompt.get_prompt()); match readline { Ok(line) => { if let Err(err) = interpret(&line) { println!("{}", err); } } Err(ReadlineError::Interrupted) => { println!("CTRL-C"); break; } Err(ReadlineError::Eof) => { println!("CTRL-D"); break; } Err(err) => { println!("Error: {:?}", err); break; } } } Ok(()) }