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:
@@ -33,6 +33,8 @@ pub enum BinaryOp {
|
||||
Mul, // `*`
|
||||
Div, // `/`
|
||||
Rem, // `%`
|
||||
// Assignment (lowest precedence, right-associative)
|
||||
Assign, // `=`
|
||||
}
|
||||
|
||||
// ── Types ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user