[−][src]Struct sqlparser::sqlparser::Parser
SQL Parser
Methods
impl Parser
[src]
pub fn new(tokens: Vec<Token>) -> Self
[src]
Parse the specified tokens
pub fn parse_sql(
dialect: &dyn Dialect,
sql: String
) -> Result<ASTNode, ParserError>
[src]
dialect: &dyn Dialect,
sql: String
) -> Result<ASTNode, ParserError>
Parse a SQL statement and produce an Abstract Syntax Tree (AST)
pub fn parse(&mut self) -> Result<ASTNode, ParserError>
[src]
Parse a new expression
pub fn parse_expr(&mut self, precedence: u8) -> Result<ASTNode, ParserError>
[src]
Parse tokens until the precedence changes
pub fn parse_default_expr(
&mut self,
precedence: u8
) -> Result<ASTNode, ParserError>
[src]
&mut self,
precedence: u8
) -> Result<ASTNode, ParserError>
Parse expression for DEFAULT clause in CREATE TABLE
pub fn parse_prefix(&mut self) -> Result<ASTNode, ParserError>
[src]
Parse an expression prefix
pub fn parse_function(&mut self, id: &str) -> Result<ASTNode, ParserError>
[src]
pub fn parse_case_expression(&mut self) -> Result<ASTNode, ParserError>
[src]
pub fn parse_cast_expression(&mut self) -> Result<ASTNode, ParserError>
[src]
Parse a SQL CAST function e.g. CAST(expr AS FLOAT)
pub fn parse_pg_cast(&mut self, expr: ASTNode) -> Result<ASTNode, ParserError>
[src]
Parse a postgresql casting style which is in the form of expr::datatype
pub fn parse_infix(
&mut self,
expr: ASTNode,
precedence: u8
) -> Result<Option<ASTNode>, ParserError>
[src]
&mut self,
expr: ASTNode,
precedence: u8
) -> Result<Option<ASTNode>, ParserError>
Parse an expression infix (typically an operator)
pub fn to_sql_operator(&self, tok: &Token) -> Result<SQLOperator, ParserError>
[src]
Convert a token operator to an AST operator
pub fn get_next_precedence(&self) -> Result<u8, ParserError>
[src]
Get the precedence of the next token
pub fn get_precedence(&self, tok: &Token) -> Result<u8, ParserError>
[src]
Get the precedence of a token
pub fn peek_token(&self) -> Option<Token>
[src]
Return first non-whitespace token that has not yet been processed
pub fn next_token(&mut self) -> Option<Token>
[src]
Get the next token skipping whitespace and increment the token index
pub fn next_token_no_skip(&mut self) -> Option<Token>
[src]
pub fn prev_token(&mut self) -> Option<Token>
[src]
Push back the last one non-whitespace token
#[must_use]
pub fn parse_keyword(&mut self, expected: &'static str) -> bool
[src]
Look for an expected keyword and consume it if it exists
#[must_use]
pub fn parse_keywords(&mut self, keywords: Vec<&'static str>) -> bool
[src]
Look for an expected sequence of keywords and consume them if they exist
pub fn expect_keyword(
&mut self,
expected: &'static str
) -> Result<(), ParserError>
[src]
&mut self,
expected: &'static str
) -> Result<(), ParserError>
Bail out if the current token is not an expected keyword, or consume it if it is
#[must_use]
pub fn consume_token(&mut self, expected: &Token) -> bool
[src]
Consume the next token if it matches the expected token, otherwise return false
pub fn expect_token(&mut self, expected: &Token) -> Result<(), ParserError>
[src]
Bail out if the current token is not an expected keyword, or consume it if it is
pub fn parse_create(&mut self) -> Result<ASTNode, ParserError>
[src]
Parse a SQL CREATE statement
pub fn parse_table_key(
&mut self,
constraint_name: &str
) -> Result<TableKey, ParserError>
[src]
&mut self,
constraint_name: &str
) -> Result<TableKey, ParserError>
pub fn parse_alter(&mut self) -> Result<ASTNode, ParserError>
[src]
pub fn parse_copy(&mut self) -> Result<ASTNode, ParserError>
[src]
Parse a copy statement
pub fn parse_literal_int(&mut self) -> Result<i64, ParserError>
[src]
Parse a literal integer/long
pub fn parse_literal_double(&mut self) -> Result<f64, ParserError>
[src]
Parse a literal double
pub fn parse_literal_string(&mut self) -> Result<String, ParserError>
[src]
Parse a literal string
pub fn parse_timezone_offset(&mut self) -> Result<i8, ParserError>
[src]
pub fn parse_timestamp_value(&mut self) -> Result<Value, ParserError>
[src]
pub fn parse_date(&mut self, year: i64) -> Result<NaiveDate, ParserError>
[src]
pub fn parse_time(&mut self) -> Result<NaiveTime, ParserError>
[src]
pub fn parse_data_type(&mut self) -> Result<SQLType, ParserError>
[src]
Parse a SQL datatype (in the context of a CREATE TABLE statement for example)
pub fn parse_compound_identifier(
&mut self,
separator: &Token
) -> Result<ASTNode, ParserError>
[src]
&mut self,
separator: &Token
) -> Result<ASTNode, ParserError>
pub fn parse_tablename(&mut self) -> Result<String, ParserError>
[src]
pub fn parse_column_names(&mut self) -> Result<Vec<String>, ParserError>
[src]
pub fn parse_precision(&mut self) -> Result<usize, ParserError>
[src]
pub fn parse_optional_precision(&mut self) -> Result<Option<usize>, ParserError>
[src]
pub fn parse_optional_precision_scale(
&mut self
) -> Result<(usize, Option<usize>), ParserError>
[src]
&mut self
) -> Result<(usize, Option<usize>), ParserError>
pub fn parse_delete(&mut self) -> Result<ASTNode, ParserError>
[src]
pub fn parse_select(&mut self) -> Result<ASTNode, ParserError>
[src]
Parse a SELECT statement
pub fn parse_insert(&mut self) -> Result<ASTNode, ParserError>
[src]
Parse an INSERT statement
pub fn parse_expr_list(&mut self) -> Result<Vec<ASTNode>, ParserError>
[src]
Parse a comma-delimited list of SQL expressions
pub fn parse_order_by_expr_list(
&mut self
) -> Result<Vec<SQLOrderByExpr>, ParserError>
[src]
&mut self
) -> Result<Vec<SQLOrderByExpr>, ParserError>
Parse a comma-delimited list of SQL ORDER BY expressions
pub fn parse_limit(&mut self) -> Result<Option<Box<ASTNode>>, ParserError>
[src]
Parse a LIMIT clause
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,