Parse function params

This commit is contained in:
Sofia 2026-03-14 15:57:07 +02:00
parent 044d2b9d25
commit 5ed3edd433
2 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,4 @@
function max () function max (a, b)
local m = a local m = a
-- if b > a then -- if b > a then
-- m = b -- m = b

View File

@ -142,7 +142,15 @@ impl Parse for Function {
let name = stream.parse::<Node<String>>().ok(); let name = stream.parse::<Node<String>>().ok();
stream.expect(Token::Symbol('('))?; stream.expect(Token::Symbol('('))?;
let params = Vec::new(); let mut params = Vec::new();
if let Ok(param) = stream.parse() {
params.push(param);
while stream.peek() == Some(Token::Symbol(',')) {
stream.next();
params.push(stream.parse()?);
}
}
stream.expect(Token::Symbol(')'))?; stream.expect(Token::Symbol(')'))?;