Fix blocks
This commit is contained in:
parent
91e7dcb6d0
commit
7282e9f05e
@ -386,7 +386,7 @@ fn block(text: &str) -> ParseResult<Block> {
|
|||||||
let make_expr = |e| Statement { id: ItemId::new(0), kind: StatementKind::Expression(e) };
|
let make_expr = |e| Statement { id: ItemId::new(0), kind: StatementKind::Expression(e) };
|
||||||
delimited(ws(tag("{")),
|
delimited(ws(tag("{")),
|
||||||
delimited(opt(many0(statement_sep)),
|
delimited(opt(many0(statement_sep)),
|
||||||
separated_nonempty_list(many1(statement_sep),
|
separated_list(many1(statement_sep),
|
||||||
map(expression, make_expr)
|
map(expression, make_expr)
|
||||||
),
|
),
|
||||||
opt(many0(statement_sep))
|
opt(many0(statement_sep))
|
||||||
@ -498,7 +498,7 @@ fn declaration(text: &str) -> ParseResult<Declaration> {
|
|||||||
|
|
||||||
fn func_declaration(text: &str) -> ParseResult<Declaration> {
|
fn func_declaration(text: &str) -> ParseResult<Declaration> {
|
||||||
use Declaration::*;
|
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 {
|
map(p, |(signature, maybe_block)| match maybe_block {
|
||||||
Some(block) => FuncDecl(signature, block),
|
Some(block) => FuncDecl(signature, block),
|
||||||
None => FuncSig(signature),
|
None => FuncSig(signature),
|
||||||
|
Loading…
Reference in New Issue
Block a user