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)
local m = a
if a then
local m = b
m = b
end
return m
end

View File

@ -229,6 +229,12 @@ impl Parse for Statement {
name,
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 {
Err(stream.expecting_err("statement"))
}