diff --git a/examples/test.lua b/examples/test.lua index 027df47..d8a5243 100644 --- a/examples/test.lua +++ b/examples/test.lua @@ -1,4 +1,4 @@ -function max () +function max (a, b) local m = a -- if b > a then -- m = b diff --git a/src/ast.rs b/src/ast.rs index 3d46fa8..d8c238c 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -142,7 +142,15 @@ impl Parse for Function { let name = stream.parse::>().ok(); 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(')'))?;