Skip to content

Commit

Permalink
add multiply/divide assign operators
Browse files Browse the repository at this point in the history
  • Loading branch information
andogq committed Aug 22, 2024
1 parent 621b77f commit 592c096
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/repr/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ pub enum Token {
AddAssign,
#[token("-=")]
MinusAssign,
#[token("*=")]
MulAssign,
#[token("/=")]
DivAssign,
#[token("->")]
ThinArrow,
#[token(":")]
Expand Down Expand Up @@ -141,6 +145,8 @@ impl Display for Token {
Token::Eq => write!(f, "="),
Token::AddAssign => write!(f, "+="),
Token::MinusAssign => write!(f, "-="),
Token::MulAssign => write!(f, "*="),
Token::DivAssign => write!(f, "/="),
Token::ThinArrow => write!(f, "->"),
Token::Colon => write!(f, ":"),
Token::SemiColon => write!(f, ";"),
Expand Down
2 changes: 2 additions & 0 deletions src/stage/parse/expression/e_assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pub fn parse_op_assign(
let operation = match tokens.next_token().unwrap() {
Token::AddAssign => InfixOperation::Plus,
Token::MinusAssign => InfixOperation::Minus,
Token::MulAssign => InfixOperation::Multiply,
Token::DivAssign => InfixOperation::Divide,
token => {
return Err(ParseError::UnexpectedToken(token));
}
Expand Down

0 comments on commit 592c096

Please sign in to comment.