From 836162aba1e4b707c2a5a5a98c3af53c52c8185a Mon Sep 17 00:00:00 2001 From: gwenn Date: Sun, 25 Aug 2024 09:21:47 +0200 Subject: [PATCH] Fix typos --- examples/simple.y | 4 ++-- src/parser/ast/fmt.rs | 2 +- src/parser/ast/mod.rs | 10 +++++----- src/parser/parse.y | 4 ++-- third_party/lemon/lempar.rs | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/simple.y b/examples/simple.y index 835418d..34045ad 100644 --- a/examples/simple.y +++ b/examples/simple.y @@ -18,7 +18,7 @@ pub struct Context { #[derive(Debug)] pub enum Operator { Add, - Substract, + Subtract, Multiply, Divide, } @@ -115,7 +115,7 @@ fn init_logger() -> Result<(), SetLoggerError> { program ::= expr(A). { self.ctx.expr = Some(A); } %type expr { Expr } -expr(A) ::= expr(B) MINUS expr(C). { A = Expr::binary(Operator::Substract, B, C); } +expr(A) ::= expr(B) MINUS expr(C). { A = Expr::binary(Operator::Subtract, B, C); } expr(A) ::= expr(B) PLUS expr(C). { A = Expr::binary(Operator::Add, B, C); } expr(A) ::= expr(B) TIMES expr(C). { A = Expr::binary(Operator::Multiply, B, C); } expr(A) ::= expr(B) DIVIDE expr(C). { A = Expr::binary(Operator::Divide, B, C); } diff --git a/src/parser/ast/fmt.rs b/src/parser/ast/fmt.rs index 614ad7d..73cff74 100644 --- a/src/parser/ast/fmt.rs +++ b/src/parser/ast/fmt.rs @@ -809,7 +809,7 @@ impl ToTokens for Operator { Self::NotEquals => s.append(TK_NE, None), Self::Or => s.append(TK_OR, None), Self::RightShift => s.append(TK_RSHIFT, None), - Self::Substract => s.append(TK_MINUS, None), + Self::Subtract => s.append(TK_MINUS, None), } } } diff --git a/src/parser/ast/mod.rs b/src/parser/ast/mod.rs index d133b02..dd5ba51 100644 --- a/src/parser/ast/mod.rs +++ b/src/parser/ast/mod.rs @@ -249,7 +249,7 @@ pub enum Stmt { tbl_name: QualifiedName, /// `INDEXED` indexed: Option, - /// `SET` assigments + /// `SET` assignments sets: Vec, /// `FROM` from: Option, @@ -603,7 +603,7 @@ pub enum Operator { /// `>>` RightShift, /// `-` - Substract, + Subtract, } impl From for Operator { @@ -622,7 +622,7 @@ impl From for Operator { x if x == TK_LSHIFT as YYCODETYPE => Self::LeftShift, x if x == TK_RSHIFT as YYCODETYPE => Self::RightShift, x if x == TK_PLUS as YYCODETYPE => Self::Add, - x if x == TK_MINUS as YYCODETYPE => Self::Substract, + x if x == TK_MINUS as YYCODETYPE => Self::Subtract, x if x == TK_STAR as YYCODETYPE => Self::Multiply, x if x == TK_SLASH as YYCODETYPE => Self::Divide, x if x == TK_REM as YYCODETYPE => Self::Modulus, @@ -1583,7 +1583,7 @@ pub enum TriggerCmd { or_conflict: Option, /// table name tbl_name: Name, - /// `SET` assigments + /// `SET` assignments sets: Vec, /// `FROM` from: Option, @@ -1758,7 +1758,7 @@ pub struct FunctionTail { // https://sqlite.org/syntax/over-clause.html #[derive(Clone, Debug, PartialEq, Eq)] pub enum Over { - /// Window defintion + /// Window definition Window(Window), /// Window name Name(Name), diff --git a/src/parser/parse.y b/src/parser/parse.y index 1c8f142..b58b22c 100644 --- a/src/parser/parse.y +++ b/src/parser/parse.y @@ -236,7 +236,7 @@ columnname(A) ::= nm(X) typetoken(Y). {A = (X, Y);} // %token_class id ID|INDEXED. -// And "ids" is an identifer-or-string. +// And "ids" is an identifier-or-string. // %token_class ids ID|STRING. @@ -663,7 +663,7 @@ joinop(X) ::= JOIN_KW(A) nm(B) JOIN. joinop(X) ::= JOIN_KW(A) nm(B) nm(C) JOIN. {X = JoinOperator::from(A, Some(B), Some(C))?;/*X-overwrites-A*/} -// There is a parsing abiguity in an upsert statement that uses a +// There is a parsing ambiguity in an upsert statement that uses a // SELECT on the RHS of a the INSERT: // // INSERT INTO tab SELECT * FROM aaa JOIN bbb ON CONFLICT ... diff --git a/third_party/lemon/lempar.rs b/third_party/lemon/lempar.rs index 82d397e..614bd62 100644 --- a/third_party/lemon/lempar.rs +++ b/third_party/lemon/lempar.rs @@ -13,7 +13,7 @@ ** ** The "lemon" program processes an LALR(1) input grammar file, then uses ** this template to construct a parser. The "lemon" program inserts text -** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the +** at each "%%" line. Also, any "P-a-r-s-e" identifier prefix (without the ** interstitial "-" characters) contained in this template is changed into ** the value of the %name directive from the grammar. Otherwise, the content ** of this template is copied straight through into the generate parser