Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
levkk committed Oct 28, 2024
1 parent 7b4db01 commit 711735d
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions rwf/src/view/template/language/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ pub enum Expression {
left: Box<Expression>,
op: Op,
right: Box<Expression>,

// Provides context where the expression is in the source code.
start_token: TokenWithContext,
},

Unary {
Expand Down Expand Up @@ -317,8 +314,6 @@ impl Expression {
pub fn parse(
iter: &mut Peekable<impl Iterator<Item = TokenWithContext>>,
) -> Result<Self, Error> {
let start_token = iter.peek().ok_or(Error::Eof("start token"))?.clone();

// Get the left term, if one exists.
// TODO: support unary operations.
let left = Self::term(iter)?;
Expand Down Expand Up @@ -346,7 +341,6 @@ impl Expression {
left: Box::new(left),
op,
right: Box::new(right),
start_token,
}),

// We have an operator.
Expand All @@ -364,28 +358,24 @@ impl Expression {
left: Box::new(right),
right: Box::new(right2),
op: second_op,
start_token: start_token.clone(),
};

Ok(Expression::Binary {
left: Box::new(left),
right: Box::new(expr),
op,
start_token,
})
} else {
let left = Expression::Binary {
left: Box::new(left),
right: Box::new(right),
op,
start_token: start_token.clone(),
};

Ok(Expression::Binary {
left: Box::new(left),
right: Box::new(right2),
op: second_op,
start_token,
})
}
}
Expand Down

0 comments on commit 711735d

Please sign in to comment.