diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-09 17:41:45 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-09 17:41:45 +0300 |
| commit | b29d61c06c275a6c99e8ae56e860d439fba839d4 (patch) | |
| tree | 09461e70b9d1e51db976ed43545f76071f26c1c8 | |
| parent | c5888f3060fd3050b8eb5fe47f5f9b6c02f9baa2 (diff) | |
| download | ek-b29d61c06c275a6c99e8ae56e860d439fba839d4.tar.gz ek-b29d61c06c275a6c99e8ae56e860d439fba839d4.zip | |
allow empty blocks
| -rw-r--r-- | src/parser.y | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parser.y b/src/parser.y index 4d27657..f4e6eb0 100644 --- a/src/parser.y +++ b/src/parser.y @@ -469,7 +469,7 @@ statelet } statement - : statelet + : statelet ";" | switch | while | do_while @@ -482,10 +482,9 @@ statement | enum | macro | ID ":" { $$ = gen_label($[ID], NULL, src_loc(@$)); } - | { $$ = gen_empty(src_loc(@$)); } rev_statements - : rev_statements ";" statement { $$ = $3; $3->n = $1; } + : rev_statements statement { $$ = $2; $2->n = $1; } | statement statements @@ -493,6 +492,7 @@ statements body : "{" statements "}" { $$ = gen_block($2, NULL, src_loc(@$)); } + | "{" "}" { $$ = gen_block(gen_empty(src_loc(@$)), NULL, src_loc(@$)); } rev_references : rev_references "," id { $$ = $3; $$->n = $1; } |
