mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
create Chars struct instead of using Peekable
This commit is contained in:
parent
7ff4133327
commit
69a140a820
5 changed files with 64 additions and 59 deletions
|
@ -35,40 +35,30 @@ impl SQLTokenizer<AcmeToken> for AcmeTokenizer {
|
|||
unimplemented!()
|
||||
}
|
||||
|
||||
fn peek_token(&mut self) -> Result<Option<SQLToken<AcmeToken>>, TokenizerError<AcmeToken>> {
|
||||
fn next_token(&mut self) -> Result<Option<SQLToken<AcmeToken>>, TokenizerError> {
|
||||
// let mut arc = self.ansi_tokenizer.lock().unwrap();
|
||||
// match arc.peek_char() {
|
||||
// Some(&ch) => match ch {
|
||||
// '!' => {
|
||||
// arc.next_char(); // consume the first `!`
|
||||
// match arc.peek_char() {
|
||||
// Some(&ch) => match ch {
|
||||
// '!' => {
|
||||
// arc.next_char(); // consume the second `!`
|
||||
// Ok(Some(SQLToken::Custom(AcmeToken::Factorial)))
|
||||
// },
|
||||
// _ => Err(TokenizerError::UnexpectedChar(ch,Position::new(0,0)))
|
||||
// },
|
||||
// None => Ok(Some(SQLToken::Not))
|
||||
// }
|
||||
// }
|
||||
// _ => arc.next_token()
|
||||
// }
|
||||
// _ => arc.next_token()
|
||||
// }
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn next_token(&mut self) -> Result<Option<SQLToken<AcmeToken>>, TokenizerError<AcmeToken>> {
|
||||
let mut arc = self.ansi_tokenizer.lock().unwrap();
|
||||
match arc.peek_char() {
|
||||
Some(&ch) => match ch {
|
||||
'!' => {
|
||||
arc.next_char(); // consume the first `!`
|
||||
match arc.peek_char() {
|
||||
Some(&ch) => match ch {
|
||||
'!' => {
|
||||
arc.next_char(); // consume the second `!`
|
||||
Ok(Some(SQLToken::Custom(AcmeToken::Factorial)))
|
||||
},
|
||||
_ => Err(TokenizerError::UnexpectedChar(ch,Position::new(0,0)))
|
||||
},
|
||||
None => Ok(Some(SQLToken::Not))
|
||||
}
|
||||
}
|
||||
_ => arc.next_token()
|
||||
}
|
||||
_ => arc.next_token()
|
||||
}
|
||||
}
|
||||
|
||||
fn peek_char(&mut self) -> Option<&char> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn next_char(&mut self) -> Option<&char> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
struct AcmeParser {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue