Implement augmented assignment operators

Add support for +=, -=, *=, and /= operators. This is basically just
syntactic sugar, but it's still nice to have

    a += 1

compiles to the equivalent of

    a = a + 1

with all the same implications of scoping rules.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2024-10-07 10:23:15 -07:00
parent 8179611c23
commit 365bee0554
5 changed files with 111 additions and 36 deletions

View File

@@ -21,6 +21,12 @@ pub enum TokenKind {
Star,
Slash,
// Augmented assignment operators
PlusEq,
MinusEq,
StarEq,
SlashEq,
// Unary operators (not already covered)
Bang,