diff options
Diffstat (limited to 'boot/parse.c')
| -rw-r--r-- | boot/parse.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/boot/parse.c b/boot/parse.c index cd5f019..264cf45 100644 --- a/boot/parse.c +++ b/boot/parse.c @@ -223,7 +223,11 @@ parser_block_node(struct Parser* p, struct Parser_Error* error) while (!parser_probe(p, TOKEN_CURLY_CLOSE)) { struct Statement* statement = CHECK_RETURN(parser_statement(p, error), struct Block_Node); - CHECK_RETURN(parser_end_statement(p, error), struct Block_Node); + + // statement ending token isn't required when the block ends on the same line, + // as in e.g.: `if (true) { print("yes") }` + if (!parser_probe(p, TOKEN_CURLY_CLOSE)) + CHECK_RETURN(parser_end_statement(p, error), struct Block_Node); if (!head) { head = statement; |
