xitep commented on code in PR #2214:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2214#discussion_r2827747525
##########
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:
of course! you are right! (for some reason i assumed a string underlying
`Keyword` :facepalm:) with that, of course, the new method makes no sense.
--
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]