alamb commented on code in PR #1618: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1618#discussion_r1898503435
########## src/parser/mod.rs: ########## @@ -3641,22 +3671,31 @@ impl<'a> Parser<'a> { #[must_use] pub fn parse_keyword(&mut self, expected: Keyword) -> bool { if self.peek_keyword(expected) { - self.next_token_ref(); + self.advance_token(); true } else { false } } + /// If the current token is the `expected` keyword, consume it and returns + /// + /// See [`Self::parse_keyword_token_ref`] to avoid the copy. #[must_use] pub fn parse_keyword_token(&mut self, expected: Keyword) -> Option<TokenWithSpan> { self.parse_keyword_token_ref(expected).cloned() } + /// If the current token is the `expected` keyword, consume it and returns a reference to the next token. + /// + // TODO remove this in favor of advance?? Review Comment: That is a good question -- yes I think I meant changing this API somehow so it doesn't end up preserving a mutable borrow to return the option. I will see if I can find a better way It is probably better to remove the comment though for now to avoid leaving a mess in the codebase: ```suggestion ``` -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org