iffyio commented on code in PR #2280:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2280#discussion_r2964980281
##########
src/tokenizer.rs:
##########
@@ -1627,6 +1627,8 @@ impl<'a> Tokenizer<'a> {
chars.next();
match chars.peek() {
Some('>') => self.consume_for_binop(chars,
"<=>", Token::Spaceship),
+ Some('+') => Ok(Some(Token::LtEq)),
+ Some('-') => Ok(Some(Token::LtEq)),
Review Comment:
```suggestion
Some('+') | Some('-') =>
Ok(Some(Token::LtEq)),
```
Could we include a comment flagging why these two operators are specially
overridden here?
##########
src/tokenizer.rs:
##########
@@ -1646,13 +1648,13 @@ impl<'a> Tokenizer<'a> {
}
}
Some('<') => self.consume_for_binop(chars, "<<",
Token::ShiftLeft),
+ Some('+') => Ok(Some(Token::Lt)),
Some('-') if self.dialect.supports_geometric_types()
=> {
- chars.next(); // consume
- match chars.peek() {
- Some('>') => {
- self.consume_for_binop(chars, "<->",
Token::TwoWayArrow)
- }
- _ => self.start_binop_opt(chars, "<-", None),
+ if chars.peekable.clone().nth(1) == Some('>') {
+ chars.next(); // consume
Review Comment:
```suggestion
chars.next(); // consume `-`
```
otherwise it looks on first read like we're consuming `>` which seemed
incorrect
##########
src/tokenizer.rs:
##########
@@ -1646,13 +1648,13 @@ impl<'a> Tokenizer<'a> {
}
}
Some('<') => self.consume_for_binop(chars, "<<",
Token::ShiftLeft),
+ Some('+') => Ok(Some(Token::Lt)),
Review Comment:
similarly it would be nice to flag the special cases in a comment
--
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]