Skip to content

Commit

Permalink
fix: Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
can-keklik committed Sep 2, 2024
1 parent a25fb88 commit 301a74f
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions lykiadb-lang/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,29 +552,18 @@ impl<'a> Parser<'a> {
fn cmp_between(
&mut self,
subject: Box<Expr>,
not: bool,
falsy: bool,
) -> ParseResult<Box<Expr>> {
let lower = self.term()?;

self.expected(skw!(And))?;
let upper = self.term()?;

if not {
return Ok(Box::new(Expr::Between {
subject: subject.clone(),
lower,
upper: upper.clone(),
kind: RangeKind::NotBetween,
span: subject.get_span().merge(&upper.get_span()),
id: self.get_expr_id(),
}));
}

Ok(Box::new(Expr::Between {
subject: subject.clone(),
lower,
upper: upper.clone(),
kind: RangeKind::Between,
kind: if falsy { RangeKind::NotBetween } else { RangeKind::Between },
span: subject.get_span().merge(&upper.get_span()),
id: self.get_expr_id(),
}))
Expand Down

0 comments on commit 301a74f

Please sign in to comment.