mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-11-01 07:34:18 +00:00
Refactoring
This commit is contained in:
parent
2e20b15c2e
commit
037ebb0f73
4 changed files with 22 additions and 17 deletions
|
|
@ -22,7 +22,7 @@ impl<TokenType> ANSISQLParser<TokenType> where TokenType: Debug + PartialEq {
|
|||
impl<TokenType, ExprType> SQLParser<TokenType, ExprType> for ANSISQLParser<TokenType>
|
||||
where TokenType: Debug + PartialEq, ExprType: Debug {
|
||||
|
||||
fn parse_prefix(&mut self, chars: &mut CharSeq) -> Result<Box<SQLExpr<ExprType>>, ParserError<TokenType>> {
|
||||
fn parse_prefix(&mut self, chars: &mut CharSeq) -> Result<Option<Box<SQLExpr<ExprType>>>, ParserError<TokenType>> {
|
||||
|
||||
match self.tokenizer.lock().unwrap().next_token(chars)? {
|
||||
Some(SQLToken::Keyword(ref k)) => match k.to_uppercase().as_ref() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
use std::cmp::PartialEq;
|
||||
use std::fmt::Debug;
|
||||
use std::iter::Peekable;
|
||||
use std::str::Chars;
|
||||
|
||||
use super::super::tokenizer::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
use std::cmp::PartialEq;
|
||||
use std::fmt::Debug;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use super::tokenizer::*;
|
||||
|
||||
|
|
@ -110,7 +108,7 @@ pub trait SQLParser<TokenType, ExprType>
|
|||
where TokenType: Debug + PartialEq, ExprType: Debug {
|
||||
|
||||
/// parse the prefix and stop once an infix operator is reached
|
||||
fn parse_prefix(&mut self, chars: &mut CharSeq) -> Result<Box<SQLExpr<ExprType>>, ParserError<TokenType>> ;
|
||||
fn parse_prefix(&mut self, chars: &mut CharSeq) -> Result<Option<Box<SQLExpr<ExprType>>>, ParserError<TokenType>> ;
|
||||
/// parse the next infix expression, returning None if the precedence has changed
|
||||
fn parse_infix(&mut self, chars: &mut CharSeq, left: &SQLExpr<ExprType>, precedence: usize) -> Result<Option<Box<SQLExpr<ExprType>>>, ParserError<TokenType>>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue