diff --git a/Cargo.toml b/Cargo.toml index b329f81..aaddc44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mini-calc" -version = "2.0.0" +version = "2.1.0" license = "GPL-3.0-or-later" description = "A minimalistic configurable rust calculator" homepage = "https://calc.nwa2coco.fr" diff --git a/README.md b/README.md index 7e83146..fe9913d 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,7 @@ cargo install mini-calc - [X] Basic operation interpreter - [X] Advanced operation interpreter - [X] Identifiers (variable) interpreter -- [ ] Built-in - - [ ] ans +- [X] Built-in - [X] pi - [X] e - [ ] Config diff --git a/src/interpreting/interpreter.rs b/src/interpreting/interpreter.rs index 0655076..96f9bc9 100644 --- a/src/interpreting/interpreter.rs +++ b/src/interpreting/interpreter.rs @@ -31,8 +31,6 @@ pub fn interpret(ast: Ast, mut ram: &mut HashMap) -> Paramet Parameters::Identifier(s) => Parameters::Identifier(s), Parameters::Null => Parameters::Null, }; - ram.remove("ans"); - ram.insert("ans".to_string(),last.clone()); last.clone() } } diff --git a/src/main.rs b/src/main.rs index f567bb3..0ec9ed8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,22 +34,21 @@ fn main() { let mut ram: HashMap = HashMap::new(); ram.insert("pi".to_string(),Parameters::Float(PI)); ram.insert("e".to_string(), Parameters::Float(E)); - ram.insert("ans".to_string(), Parameters::Null); while let ReadResult::Input(line) = interface.read_line().unwrap() { match line.as_str().trim() { "info" => { - let message = Color::Purple.paint(" Calc v2.0.0 \n Author: Charlotte Thomas \n Written in Rust \n Repo: https://github.com/coco33920/calc\n"); + let message = Color::Purple.paint(" Calc v2.1.0 \n Author: Charlotte Thomas \n Written in Rust \n Repo: https://github.com/coco33920/calc\n"); println!("{}", message) } "exit" => break, "help" => { let message = Color::Purple.paint( - " Calc v2.0.0 Help \n > info : show infos \n > exit : exit the program \n > help : print this help \n > verbose : toggle the verbose \n > version : prints the version \n" + " Calc v2.1.0 Help \n > info : show infos \n > exit : exit the program \n > help : print this help \n > verbose : toggle the verbose \n > version : prints the version \n" ); println!("{}", message) } "version" => { - let message = Color::Purple.paint(" Calc v2.0.0\n"); + let message = Color::Purple.paint(" Calc v2.1.0\n"); println!("{}", message) } "verbose" => {