diff --git a/schala-lang/language/src/parser.rs b/schala-lang/language/src/parser.rs index 2a2bb62..3febe98 100644 --- a/schala-lang/language/src/parser.rs +++ b/schala-lang/language/src/parser.rs @@ -386,7 +386,7 @@ fn block(text: &str) -> ParseResult { let make_expr = |e| Statement { id: ItemId::new(0), kind: StatementKind::Expression(e) }; delimited(ws(tag("{")), delimited(opt(many0(statement_sep)), - separated_nonempty_list(many1(statement_sep), + separated_list(many1(statement_sep), map(expression, make_expr) ), opt(many0(statement_sep)) @@ -498,7 +498,7 @@ fn declaration(text: &str) -> ParseResult { fn func_declaration(text: &str) -> ParseResult { use Declaration::*; - let p = tuple((func_signature, opt(block))); + let p = tuple((func_signature, ws(opt(block)))); map(p, |(signature, maybe_block)| match maybe_block { Some(block) => FuncDecl(signature, block), None => FuncSig(signature),