mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-01 19:57:30 +00:00
Simplify quoted identifier tokenization
This commit is contained in:
parent
2e9da53ed3
commit
b3693bfa63
1 changed files with 6 additions and 12 deletions
|
@ -290,23 +290,17 @@ impl<'a> Tokenizer<'a> {
|
|||
}
|
||||
Ok(Some(Token::SingleQuotedString(s)))
|
||||
}
|
||||
// string
|
||||
// delimited (quoted) identifier
|
||||
'"' => {
|
||||
let mut s = String::new();
|
||||
chars.next(); // consume
|
||||
while let Some(&ch) = chars.peek() {
|
||||
let quote_start = chars.next().unwrap(); // consumes the opening quote
|
||||
while let Some(ch) = chars.next() {
|
||||
match ch {
|
||||
'"' => {
|
||||
chars.next(); // consume
|
||||
break;
|
||||
}
|
||||
_ => {
|
||||
chars.next(); // consume
|
||||
s.push(ch);
|
||||
}
|
||||
'"' => break,
|
||||
_ => s.push(ch),
|
||||
}
|
||||
}
|
||||
Ok(Some(Token::make_word(&s, Some('"'))))
|
||||
Ok(Some(Token::make_word(&s, Some(quote_start))))
|
||||
}
|
||||
// numbers
|
||||
'0'...'9' => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue