mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-03 04:37:21 +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)))
|
Ok(Some(Token::SingleQuotedString(s)))
|
||||||
}
|
}
|
||||||
// string
|
// delimited (quoted) identifier
|
||||||
'"' => {
|
'"' => {
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
chars.next(); // consume
|
let quote_start = chars.next().unwrap(); // consumes the opening quote
|
||||||
while let Some(&ch) = chars.peek() {
|
while let Some(ch) = chars.next() {
|
||||||
match ch {
|
match ch {
|
||||||
'"' => {
|
'"' => break,
|
||||||
chars.next(); // consume
|
_ => s.push(ch),
|
||||||
break;
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
chars.next(); // consume
|
|
||||||
s.push(ch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(Some(Token::make_word(&s, Some('"'))))
|
Ok(Some(Token::make_word(&s, Some(quote_start))))
|
||||||
}
|
}
|
||||||
// numbers
|
// numbers
|
||||||
'0'...'9' => {
|
'0'...'9' => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue