Fix??? block

This commit is contained in:
greg 2020-03-15 01:43:58 -07:00
parent e0a4ea1675
commit cde52efcf2
1 changed files with 6 additions and 2 deletions

View File

@ -346,9 +346,13 @@ fn expr_or_block(text: &str) -> ParseResult<Block> {
fn block(text: &str) -> ParseResult<Block> {
//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)
}