mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 03:07:20 +00:00
Use consume_and_return
when possible
This commit is contained in:
parent
6f44494910
commit
bf3110f6ce
1 changed files with 3 additions and 12 deletions
|
@ -260,18 +260,9 @@ impl<'a> Tokenizer<'a> {
|
|||
//println!("next_token: {:?}", chars.peek());
|
||||
match chars.peek() {
|
||||
Some(&ch) => match ch {
|
||||
' ' => {
|
||||
chars.next();
|
||||
Ok(Some(Token::Whitespace(Whitespace::Space)))
|
||||
}
|
||||
'\t' => {
|
||||
chars.next();
|
||||
Ok(Some(Token::Whitespace(Whitespace::Tab)))
|
||||
}
|
||||
'\n' => {
|
||||
chars.next();
|
||||
Ok(Some(Token::Whitespace(Whitespace::Newline)))
|
||||
}
|
||||
' ' => self.consume_and_return(chars, Token::Whitespace(Whitespace::Space)),
|
||||
'\t' => self.consume_and_return(chars, Token::Whitespace(Whitespace::Tab)),
|
||||
'\n' => self.consume_and_return(chars, Token::Whitespace(Whitespace::Newline)),
|
||||
'\r' => {
|
||||
// Emit a single Whitespace::Newline token for \r and \r\n
|
||||
chars.next();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue