Skip to content

Commit

Permalink
Merge pull request #63 from mimikun/fix/typo
Browse files Browse the repository at this point in the history
fix: typo
  • Loading branch information
Ph0enixKM committed May 17, 2024
2 parents e4db16d + 8f6870a commit ab0aa81
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/modules/expression/binop/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl SyntaxModule<ParserMetadata> 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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/shorthand/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl SyntaxModule<ParserMetadata> 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(())
Expand Down
2 changes: 1 addition & 1 deletion src/modules/variable/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/variable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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(())
}
Expand Down
18 changes: 9 additions & 9 deletions src/tests/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn very_complex_arithmetic() {
}

#[test]
fn paranthesis() {
fn parenthesis() {
let code = "
let x = 21
let y = 2
Expand Down Expand Up @@ -724,7 +724,7 @@ fn silent() {
main {
silent {
echo \"Hello World\"
$non-existant command$?
$non-existent command$?
}
}
";
Expand All @@ -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
}
Expand Down Expand Up @@ -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");
}
Expand All @@ -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");
}
Expand Down

0 comments on commit ab0aa81

Please sign in to comment.