From 8f6870a9dcd2404231f593ab6322df7845b1ce06 Mon Sep 17 00:00:00 2001 From: Yuto Tanaka Date: Fri, 17 May 2024 21:35:02 +0900 Subject: [PATCH] fix: typo --- README.md | 2 +- src/modules/expression/binop/sub.rs | 2 +- src/modules/shorthand/sub.rs | 2 +- src/modules/variable/get.rs | 2 +- src/modules/variable/mod.rs | 6 +++--- src/tests/validity.rs | 18 +++++++++--------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 86cc370f..63888f06 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # Amber -Programming language that compiles to Bash. It's a high level programming language that makes it easy to create shell scripts. It's particulary well suited for cloud services. +Programming language that compiles to Bash. It's a high level programming language that makes it easy to create shell scripts. It's particularly well suited for cloud services. > [!Warning] > This software is not ready for extended usage. diff --git a/src/modules/expression/binop/sub.rs b/src/modules/expression/binop/sub.rs index 52c59c94..0e099076 100644 --- a/src/modules/expression/binop/sub.rs +++ b/src/modules/expression/binop/sub.rs @@ -32,7 +32,7 @@ impl SyntaxModule for Sub { let tok = meta.get_current_token(); token(meta, "-")?; syntax(meta, &mut *self.right)?; - let error = "Substract operation can only substract numbers"; + let error = "Subtract operation can only subtract numbers"; let l_type = self.left.get_type(); let r_type = self.right.get_type(); let predicate = |kind| matches!(kind, Type::Num); diff --git a/src/modules/shorthand/sub.rs b/src/modules/shorthand/sub.rs index 978c6308..b920217d 100644 --- a/src/modules/shorthand/sub.rs +++ b/src/modules/shorthand/sub.rs @@ -38,7 +38,7 @@ impl SyntaxModule for ShorthandSub { self.global_id = variable.global_id; self.is_ref = variable.is_ref; self.expr.parse(meta)?; - let message = "Substract operation can only substract numbers"; + let message = "Subtract operation can only subtract numbers"; let predicate = |kind| matches!(kind, Type::Num); expression_arms_of_type(meta, &self.kind, &self.expr.get_type(), predicate, tok, message)?; Ok(()) diff --git a/src/modules/variable/get.rs b/src/modules/variable/get.rs index e3502b01..3ea2217b 100644 --- a/src/modules/variable/get.rs +++ b/src/modules/variable/get.rs @@ -66,7 +66,7 @@ impl TranslateModule for VariableGet { let ref_prefix = if self.is_ref { "!" } else { "" }; let res = format!("${{{ref_prefix}{name}}}"); // Text variables need to be encapsulated in string literals - // Otherwise, they will be "spreaded" into tokens + // Otherwise, they will be "spread" into tokens let quote = meta.gen_quote(); match (self.is_ref, &self.kind) { (false, Type::Array(_)) => match *self.index { diff --git a/src/modules/variable/mod.rs b/src/modules/variable/mod.rs index 2bbc7cd2..dfe154f8 100644 --- a/src/modules/variable/mod.rs +++ b/src/modules/variable/mod.rs @@ -64,14 +64,14 @@ pub fn handle_identifier_name(meta: &mut ParserMetadata, name: &str, tok: Option if name.chars().take(2).all(|chr| chr == '_') && name.len() > 2 { let new_name = name.get(1..).unwrap(); return error!(meta, tok => { - message: format!("Indentifier '{name}' is not allowed"), + message: format!("Identifier '{name}' is not allowed"), comment: format!("Identifiers with double underscores are reserved for the compiler.\nConsider using '{new_name}' instead.") }) } if is_camel_case(name) && !meta.context.cc_flags.contains(&CCFlags::AllowCamelCase) { let flag = get_ccflag_name(CCFlags::AllowCamelCase); let msg = Message::new_warn_at_token(meta, tok.clone()) - .message(format!("Indentifier '{name}' is not in snake case")) + .message(format!("Identifier '{name}' is not in snake case")) .comment([ "We recommend using snake case with either all uppercase or all lowercase letters for consistency.", format!("To disable this warning use '{flag}' compiler flag").as_str() @@ -80,7 +80,7 @@ pub fn handle_identifier_name(meta: &mut ParserMetadata, name: &str, tok: Option } // Validate if the variable name is a keyword if variable_name_keywords().contains(&name) { - return error!(meta, tok, format!("Indentifier '{name}' is a reserved keyword")) + return error!(meta, tok, format!("Identifier '{name}' is a reserved keyword")) } Ok(()) } diff --git a/src/tests/validity.rs b/src/tests/validity.rs index 52452532..d54149fa 100644 --- a/src/tests/validity.rs +++ b/src/tests/validity.rs @@ -111,7 +111,7 @@ fn very_complex_arithmetic() { } #[test] -fn paranthesis() { +fn parenthesis() { let code = " let x = 21 let y = 2 @@ -724,7 +724,7 @@ fn silent() { main { silent { echo \"Hello World\" - $non-existant command$? + $non-existent command$? } } "; @@ -734,7 +734,7 @@ fn silent() { #[test] fn status() { let code = " - silent $non-existant command$ failed { + silent $non-existent command$ failed { echo status echo status } @@ -805,12 +805,12 @@ fn chained_modifiers() { let code = " unsafe silent { echo \"Hello World\" - $non-existant command$ + $non-existent command$ } // Test for expression - let _ = silent unsafe $non-existant command$ + let _ = silent unsafe $non-existent command$ // Test for single statement - silent unsafe $non-existant command$ + silent unsafe $non-existent command$ "; test_amber!(code, "Hello World"); } @@ -820,12 +820,12 @@ fn chained_modifiers_commands() { let code = " unsafe silent { echo \"Hello World\" - $non-existant command$ + $non-existent command$ } // Test for expression - let _ = silent unsafe $non-existant command$ + let _ = silent unsafe $non-existent command$ // Test for single statement - silent unsafe $non-existant command$ + silent unsafe $non-existent command$ "; test_amber!(code, "Hello World"); }