mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-11 22:42:02 +00:00
Merge pull request #80 from benesch/between-expr
Support nested expressions in BETWEEN
This commit is contained in:
commit
d80f9f3a7a
2 changed files with 54 additions and 2 deletions
|
@ -508,9 +508,12 @@ impl Parser {
|
|||
|
||||
/// Parses `BETWEEN <low> AND <high>`, assuming the `BETWEEN` keyword was already consumed
|
||||
pub fn parse_between(&mut self, expr: ASTNode, negated: bool) -> Result<ASTNode, ParserError> {
|
||||
let low = self.parse_prefix()?;
|
||||
// Stop parsing subexpressions for <low> and <high> on tokens with
|
||||
// precedence lower than that of `BETWEEN`, such as `AND`, `IS`, etc.
|
||||
let prec = self.get_precedence(&Token::make_keyword("BETWEEN"))?;
|
||||
let low = self.parse_subexpr(prec)?;
|
||||
self.expect_keyword("AND")?;
|
||||
let high = self.parse_prefix()?;
|
||||
let high = self.parse_subexpr(prec)?;
|
||||
Ok(ASTNode::SQLBetween {
|
||||
expr: Box::new(expr),
|
||||
negated,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue