iffyio commented on code in PR #1990:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1990#discussion_r2251821836


##########
src/parser/mod.rs:
##########
@@ -11229,6 +11229,30 @@ impl<'a> Parser<'a> {
         }
     }
 
+    /// Parse an optionally signed integer literal.
+    fn parse_signed_integer(&mut self) -> Result<i64, ParserError> {
+        let next_token = self.next_token();
+        let (sign, number_token) = match next_token.token {
+            Token::Minus => {
+                let number_token = self.next_token();
+                (-1, number_token)
+            }
+            Token::Plus => {
+                let number_token = self.next_token();
+                (1, number_token)
+            }
+            _ => (1, next_token),
+        };

Review Comment:
   was the pattern in the previous comment example insufficient? I think the 
current approach to optionally multiply by negative makes things slightly 
longer to follow what the code is trying to achieve.
   
   fyi note ideally we use `next_token_ref` since that avoid cloning, 
especially given that `parse::<i64>` does not require an owned value



-- 
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

Reply via email to