1
1
Fork 0
mirror of https://github.com/azur1s/bobbylisp.git synced 2024-10-16 02:37:40 -05:00

change func syntax

This commit is contained in:
azur 2023-03-04 19:46:25 +07:00
parent 0a6e04ae5f
commit 6f11fa8ccc
2 changed files with 3 additions and 2 deletions

2
a.hlm
View file

@ -1,4 +1,4 @@
func add x: num -> num = x + 1; func add (x: num) num = x + 1;
println( println(
{ {

View file

@ -445,13 +445,14 @@ pub fn exprs_parser() -> impl P<Vec<Spanned<PExpr>>> {
pub fn stmt_parser() -> impl P<Spanned<PStmt>> { pub fn stmt_parser() -> impl P<Spanned<PStmt>> {
let func = just(Token::Func) let func = just(Token::Func)
.ignore_then(symbol_parser()) .ignore_then(symbol_parser())
.then_ignore(just(Token::Open(Delim::Paren)))
.then( .then(
symbol_parser() symbol_parser()
.then_ignore(just(Token::Colon)) .then_ignore(just(Token::Colon))
.then(type_parser()) .then(type_parser())
.separated_by(just(Token::Comma)) .separated_by(just(Token::Comma))
) )
.then_ignore(just(Token::Arrow)) .then_ignore(just(Token::Close(Delim::Paren)))
.then(type_parser()) .then(type_parser())
.then_ignore(just(Token::Assign)) .then_ignore(just(Token::Assign))
.then(expr_parser().map(Box::new)) .then(expr_parser().map(Box::new))