From 74f0e86b93b39d0eb93e989e9ea6c46f50dd63bf Mon Sep 17 00:00:00 2001 From: azur Date: Sat, 4 Mar 2023 19:46:25 +0700 Subject: [PATCH] change func syntax --- a.hlm | 2 +- src/read/parse.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/a.hlm b/a.hlm index da14833..522d747 100644 --- a/a.hlm +++ b/a.hlm @@ -1,4 +1,4 @@ -func add x: num -> num = x + 1; +func add (x: num) num = x + 1; println( { diff --git a/src/read/parse.rs b/src/read/parse.rs index 2e89698..20167ad 100644 --- a/src/read/parse.rs +++ b/src/read/parse.rs @@ -445,13 +445,14 @@ pub fn exprs_parser() -> impl P>> { pub fn stmt_parser() -> impl P> { let func = just(Token::Func) .ignore_then(symbol_parser()) + .then_ignore(just(Token::Open(Delim::Paren))) .then( symbol_parser() .then_ignore(just(Token::Colon)) .then(type_parser()) .separated_by(just(Token::Comma)) ) - .then_ignore(just(Token::Arrow)) + .then_ignore(just(Token::Close(Delim::Paren))) .then(type_parser()) .then_ignore(just(Token::Assign)) .then(expr_parser().map(Box::new))