xitep commented on code in PR #2214:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2214#discussion_r2821592152


##########
src/parser/mod.rs:
##########
@@ -4543,7 +4543,13 @@ impl<'a> Parser<'a> {
     ///
     /// Returns true if the current token matches the expected keyword.
     pub fn peek_keyword(&self, expected: Keyword) -> bool {
-        matches!(&self.peek_token_ref().token, Token::Word(w) if expected == 
w.keyword)
+        self.peek_keyword_one_of(&[expected])
+    }
+
+    #[must_use]
+    /// Checks whether the current token is one of the expected keywords 
without consuming it.
+    fn peek_keyword_one_of(&self, expected: &[Keyword]) -> bool {
+        matches!(&self.peek_token_ref().token, Token::Word(w) if 
expected.contains(&w.keyword))

Review Comment:
   yes, `self.peek_one_of_keywords().is_some()` would do instead of this new 
method. except this method avoids the clone of the token. i don't have a strong 
preference, but i'd find the clone wasteful. wdyt?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to