Fix a few typos in comment lines (#1316)

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
hulk 2024-06-30 19:06:20 +08:00 committed by GitHub
parent 376889ae5d
commit 0b1a413e64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -108,7 +108,7 @@ mod recursion {
} }
} }
/// Guard that increass the remaining depth by 1 on drop /// Guard that increases the remaining depth by 1 on drop
pub struct DepthGuard { pub struct DepthGuard {
remaining_depth: Rc<Cell<usize>>, remaining_depth: Rc<Cell<usize>>,
} }
@ -194,7 +194,7 @@ const DEFAULT_REMAINING_DEPTH: usize = 50;
/// nested such that the following declaration is possible: /// nested such that the following declaration is possible:
/// `ARRAY<ARRAY<INT>>` /// `ARRAY<ARRAY<INT>>`
/// But the tokenizer recognizes the `>>` as a ShiftRight token. /// But the tokenizer recognizes the `>>` as a ShiftRight token.
/// We work-around that limitation when parsing a data type by accepting /// We work around that limitation when parsing a data type by accepting
/// either a `>` or `>>` token in such cases, remembering which variant we /// either a `>` or `>>` token in such cases, remembering which variant we
/// matched. /// matched.
/// In the latter case having matched a `>>`, the parent type will not look to /// In the latter case having matched a `>>`, the parent type will not look to
@ -1075,7 +1075,7 @@ impl<'a> Parser<'a> {
let expr = self.parse_subexpr(Self::PLUS_MINUS_PREC)?; let expr = self.parse_subexpr(Self::PLUS_MINUS_PREC)?;
Ok(Expr::Prior(Box::new(expr))) Ok(Expr::Prior(Box::new(expr)))
} }
// Here `w` is a word, check if it's a part of a multi-part // Here `w` is a word, check if it's a part of a multipart
// identifier, a function call, or a simple identifier: // identifier, a function call, or a simple identifier:
_ => match self.peek_token().token { _ => match self.peek_token().token {
Token::LParen | Token::Period => { Token::LParen | Token::Period => {
@ -2009,7 +2009,7 @@ impl<'a> Parser<'a> {
/// 4. INTERVAL '1:1:1.1' HOUR (5) TO SECOND (5) /// 4. INTERVAL '1:1:1.1' HOUR (5) TO SECOND (5)
/// 5. INTERVAL '1.1' SECOND (2, 2) /// 5. INTERVAL '1.1' SECOND (2, 2)
/// 6. INTERVAL '1:1' HOUR (5) TO MINUTE (5) /// 6. INTERVAL '1:1' HOUR (5) TO MINUTE (5)
/// 7. (MySql & BigQuey only): INTERVAL 1 DAY /// 7. (MySql & BigQuery only): INTERVAL 1 DAY
/// ``` /// ```
/// ///
/// Note that we do not currently attempt to parse the quoted value. /// Note that we do not currently attempt to parse the quoted value.
@ -2749,7 +2749,7 @@ impl<'a> Parser<'a> {
match token.token { match token.token {
Token::Word(Word { Token::Word(Word {
value, value,
// path segments in SF dot notation can be unquoted or double quoted // path segments in SF dot notation can be unquoted or double-quoted
quote_style: quote_style @ (Some('"') | None), quote_style: quote_style @ (Some('"') | None),
// some experimentation suggests that snowflake permits // some experimentation suggests that snowflake permits
// any keyword here unquoted. // any keyword here unquoted.
@ -2948,7 +2948,7 @@ impl<'a> Parser<'a> {
Token::Word(w) if w.keyword == Keyword::NOT => match self.peek_nth_token(1).token { Token::Word(w) if w.keyword == Keyword::NOT => match self.peek_nth_token(1).token {
// The precedence of NOT varies depending on keyword that // The precedence of NOT varies depending on keyword that
// follows it. If it is followed by IN, BETWEEN, or LIKE, // follows it. If it is followed by IN, BETWEEN, or LIKE,
// it takes on the precedence of those tokens. Otherwise it // it takes on the precedence of those tokens. Otherwise, it
// is not an infix operator, and therefore has zero // is not an infix operator, and therefore has zero
// precedence. // precedence.
Token::Word(w) if w.keyword == Keyword::IN => Ok(Self::BETWEEN_PREC), Token::Word(w) if w.keyword == Keyword::IN => Ok(Self::BETWEEN_PREC),
@ -3251,7 +3251,7 @@ impl<'a> Parser<'a> {
} }
/// If the current token is the `expected` keyword, consume the token. /// If the current token is the `expected` keyword, consume the token.
/// Otherwise return an error. /// Otherwise, return an error.
pub fn expect_keyword(&mut self, expected: Keyword) -> Result<(), ParserError> { pub fn expect_keyword(&mut self, expected: Keyword) -> Result<(), ParserError> {
if self.parse_keyword(expected) { if self.parse_keyword(expected) {
Ok(()) Ok(())
@ -4508,7 +4508,7 @@ impl<'a> Parser<'a> {
self.peek_token(), self.peek_token(),
); );
}; };
// Many dialects support the non standard `IF EXISTS` clause and allow // Many dialects support the non-standard `IF EXISTS` clause and allow
// specifying multiple objects to delete in a single statement // specifying multiple objects to delete in a single statement
let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
let names = self.parse_comma_separated(|p| p.parse_object_name(false))?; let names = self.parse_comma_separated(|p| p.parse_object_name(false))?;
@ -4822,7 +4822,7 @@ impl<'a> Parser<'a> {
continue; continue;
} }
_ => { _ => {
// Put back the semi-colon, this is the end of the DECLARE statement. // Put back the semicolon, this is the end of the DECLARE statement.
self.prev_token(); self.prev_token();
} }
} }
@ -7278,7 +7278,7 @@ impl<'a> Parser<'a> {
// ignore the <separator> and treat the multiple strings as // ignore the <separator> and treat the multiple strings as
// a single <literal>." // a single <literal>."
Token::SingleQuotedString(s) => Ok(Some(Ident::with_quote('\'', s))), Token::SingleQuotedString(s) => Ok(Some(Ident::with_quote('\'', s))),
// Support for MySql dialect double quoted string, `AS "HOUR"` for example // Support for MySql dialect double-quoted string, `AS "HOUR"` for example
Token::DoubleQuotedString(s) => Ok(Some(Ident::with_quote('\"', s))), Token::DoubleQuotedString(s) => Ok(Some(Ident::with_quote('\"', s))),
_ => { _ => {
if after_as { if after_as {