Fix: add assignment as right-associative expression

`=` was missing from the Pratt table, causing `a = b;` to fail with
"expected `;`, found `=`". Assignment is now BinaryOp::Assign with
binding power (2, 2) — lowest precedence, right-associative — so
`a = b = c` parses as `a = (b = c)`.
This commit is contained in:
2026-03-10 18:10:35 +01:00
parent 546dc119d0
commit 1a4e464d5e
4 changed files with 100 additions and 24 deletions

View File

@@ -33,6 +33,8 @@ pub enum BinaryOp {
Mul, // `*`
Div, // `/`
Rem, // `%`
// Assignment (lowest precedence, right-associative)
Assign, // `=`
}
// ── Types ──────────────────────────────────────────────────────────────────────