From cde52efcf2e97b263914dba48f46e532c9d4cd97 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 15 Mar 2020 01:43:58 -0700 Subject: [PATCH] Fix??? block --- schala-lang/language/src/parser.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/schala-lang/language/src/parser.rs b/schala-lang/language/src/parser.rs index 704e05d..a3d1b3e 100644 --- a/schala-lang/language/src/parser.rs +++ b/schala-lang/language/src/parser.rs @@ -346,9 +346,13 @@ fn expr_or_block(text: &str) -> ParseResult { fn block(text: &str) -> ParseResult { //TODO fix this so it can handle nested statements + let make_expr = |e| Statement { id: ItemId::new(0), kind: StatementKind::Expression(e) }; delimited(ws(tag("{")), - separated_nonempty_list(statement_sep, - map(expression, |e| Statement { id: ItemId::new(0), kind: StatementKind::Expression(e) }) + delimited(opt(many0(statement_sep)), + separated_nonempty_list(many1(statement_sep), + map(expression, make_expr) + ), + opt(many0(statement_sep)) ), ws(tag("}")))(text) }