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


##########
src/parser/mod.rs:
##########
@@ -4521,16 +4521,29 @@ impl<'a> Parser<'a> {
     /// consumed and returns false
     #[must_use]
     pub fn parse_keywords(&mut self, keywords: &[Keyword]) -> bool {
-        let index = self.index;
-        for &keyword in keywords {
-            if !self.parse_keyword(keyword) {
-                // println!("parse_keywords aborting .. did not find {:?}", 
keyword);
-                // reset index and return immediately
-                self.index = index;
-                return false;
+        self.parse_keywords_(keywords).is_some()
+    }
+
+    /// Just like [Self::parse_keywords], but - upon success - returns the
+    /// token index of the first keyword.
+    #[must_use]
+    fn parse_keywords_(&mut self, keywords: &[Keyword]) -> Option<usize> {

Review Comment:
   i struggled with a good name; thanks for the 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: [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