Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bufferhe4d committed Nov 12, 2024
1 parent fc9041d commit 7b21812
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ pub enum TokenKind {
DoublePipe, // ||
Exclamation, // !
Question, // ?
PlusEqual, // +=
MinusEqual, // -=
StarEqual, // *=
PlusEqual, // +=
MinusEqual, // -=
StarEqual, // *=
// Literal, // "thing"
}

Expand Down
26 changes: 14 additions & 12 deletions src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,11 @@ impl Expr {
// assignment or augmented assignment
// lhs = rhs | lhs += rhs | lhs -= rhs | lhs *= rhs
Some(Token {
kind: TokenKind::Equal | TokenKind::PlusEqual | TokenKind::MinusEqual | TokenKind::StarEqual,
kind:
TokenKind::Equal
| TokenKind::PlusEqual
| TokenKind::MinusEqual
| TokenKind::StarEqual,
span,
}) => {
let token = tokens.bump(ctx).unwrap();
Expand All @@ -454,16 +458,14 @@ impl Expr {

match token.kind {
// regular assignment
TokenKind::Equal => {
Expr::new(
ctx,
ExprKind::Assignment {
lhs: Box::new(self),
rhs: Box::new(rhs),
},
span,
)
},
TokenKind::Equal => Expr::new(
ctx,
ExprKind::Assignment {
lhs: Box::new(self),
rhs: Box::new(rhs),
},
span,
),
// augmented assignments
TokenKind::PlusEqual | TokenKind::MinusEqual | TokenKind::StarEqual => {
let op = match token.kind {
Expand Down Expand Up @@ -494,7 +496,7 @@ impl Expr {
},
span,
)
},
}
_ => unreachable!(),
}
}
Expand Down

0 comments on commit 7b21812

Please sign in to comment.