Parse re-assignment

This commit is contained in:
Sofia 2026-03-14 16:06:08 +02:00
parent b3fec86fbd
commit af27da619d
2 changed files with 7 additions and 1 deletions

View File

@ -1,7 +1,7 @@
function max (a, b) function max (a, b)
local m = a local m = a
if a then if a then
local m = b m = b
end end
return m return m
end end

View File

@ -229,6 +229,12 @@ impl Parse for Statement {
name, name,
expr, expr,
)) ))
} else if let Some(Token::Word(_)) = peeked
&& stream.peek2() == Some(Token::Symbol('='))
{
let name = stream.parse()?;
stream.expect(Token::Symbol('='))?;
Ok(Self::Assignment(None, name, stream.parse()?))
} else { } else {
Err(stream.expecting_err("statement")) Err(stream.expecting_err("statement"))
} }