mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-11 22:42:02 +00:00
commit
7aff70772b
3 changed files with 53 additions and 0 deletions
|
@ -191,6 +191,7 @@ impl Parser {
|
|||
}
|
||||
"CASE" => self.parse_case_expression(),
|
||||
"CAST" => self.parse_cast_expression(),
|
||||
"EXISTS" => self.parse_exists_expression(),
|
||||
"NOT" => Ok(ASTNode::SQLUnary {
|
||||
operator: SQLOperator::Not,
|
||||
expr: Box::new(self.parse_subexpr(Self::UNARY_NOT_PREC)?),
|
||||
|
@ -404,6 +405,14 @@ impl Parser {
|
|||
})
|
||||
}
|
||||
|
||||
/// Parse a SQL EXISTS expression e.g. `WHERE EXISTS(SELECT ...)`.
|
||||
pub fn parse_exists_expression(&mut self) -> Result<ASTNode, ParserError> {
|
||||
self.expect_token(&Token::LParen)?;
|
||||
let exists_node = ASTNode::SQLExists(Box::new(self.parse_query()?));
|
||||
self.expect_token(&Token::RParen)?;
|
||||
Ok(exists_node)
|
||||
}
|
||||
|
||||
/// Parse an operator following an expression
|
||||
pub fn parse_infix(&mut self, expr: ASTNode, precedence: u8) -> Result<ASTNode, ParserError> {
|
||||
debug!("parsing infix");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue