From c584fa0c42d339139cf61876faa4450e776ea3e3 Mon Sep 17 00:00:00 2001 From: Charlotte Thomas Date: Tue, 14 May 2024 22:10:53 +0200 Subject: [PATCH] fix #43 (#44) bump to 2.13.2 --- CHANGELOG.md | 3 +++ Cargo.lock | 2 +- Cargo.toml | 2 +- src/configuration/loader.rs | 2 +- src/lexing/lexer.rs | 10 +++++++++- src/main.rs | 4 +--- src/parsing/ast.rs | 2 +- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b2b97b..b4ed4bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# Version 2.13.2 : Bug fix +Fix #43 + # Version 2.13.1 : Bug fix Fix the issue of the function never used (moved implementation to the test module) diff --git a/Cargo.lock b/Cargo.lock index a466ca6..760f1af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -221,7 +221,7 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mini-calc" -version = "2.13.1" +version = "2.13.2" dependencies = [ "ansi_term", "atty", diff --git a/Cargo.toml b/Cargo.toml index 6657409..c067829 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mini-calc" -version = "2.13.1" +version = "2.13.2" license = "GPL-3.0-or-later" description = "A fully-featured minimalistic configurable rust calculator" homepage = "https://calc.nwa2coco.fr" diff --git a/src/configuration/loader.rs b/src/configuration/loader.rs index f508dc7..f5fd6e7 100644 --- a/src/configuration/loader.rs +++ b/src/configuration/loader.rs @@ -131,7 +131,7 @@ pub fn load_color(string: String) -> Color { pub fn replace_variable(str: String) -> String { str.replace("%author%", "Charlotte Thomas") - .replace("%version%", "v2.13.1") + .replace("%version%", "v2.13.2") .to_string() } diff --git a/src/lexing/lexer.rs b/src/lexing/lexer.rs index fcb7cb7..0280987 100644 --- a/src/lexing/lexer.rs +++ b/src/lexing/lexer.rs @@ -115,7 +115,15 @@ pub fn lex(input: String) -> Vec { let length = input.len(); while current_pos < input.len() { - let current_character: char = chars.get(current_pos).unwrap().to_ascii_lowercase(); + let peeking_char = chars.get(current_pos); + let current_character: char; + match peeking_char { + None => { + current_pos += 1; + continue; + } + Some(t) => current_character = t.to_ascii_lowercase(), + } if !is_an_allowed_char(current_character) { current_pos += 1; continue; diff --git a/src/main.rs b/src/main.rs index 576ed97..a16269a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -262,7 +262,7 @@ fn handle_config(line: &str, config: Config) -> (String, Option) { fn main() { let mut args: Args = env::args(); - let version: String = "v2.13.1".to_string(); + let version: String = "v2.13.2".to_string(); if args.len() > 1 || !atty::is(Stream::Stdin) { let mut a = vec![]; @@ -293,7 +293,6 @@ fn main() { exit(0); } - if arg_final == "-u" || arg_final == "--update" { if cfg!(target_os = "windows") { Command::new("cmd") @@ -311,7 +310,6 @@ fn main() { exit(0); } - let lexed = lex(arg_final); let mut parser = init_calc_parser(&lexed); let parsed = parser.parse(); diff --git a/src/parsing/ast.rs b/src/parsing/ast.rs index 0da6f95..9ae87fd 100644 --- a/src/parsing/ast.rs +++ b/src/parsing/ast.rs @@ -271,7 +271,7 @@ impl Parameters { #[cfg(test)] mod test { use crate::parsing::ast::{Ast, Parameters}; - + impl Ast { pub fn new(p: Parameters) -> Self { Ast::Node {