From 9fd92801328aa001991818adb8d0e245349e2cff Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Fri, 16 Aug 2024 00:07:09 +0200 Subject: [PATCH] Fix incorrect parsing of $exec. --- src/compiler/parse_global.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index d38eaf62d..58663d856 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -2654,11 +2654,12 @@ static Decl *parse_exec(ParseContext *c) // Get the `,` CONSUME_OR_RET(TOKEN_COMMA, poisoned_decl); CONSUME_OR_RET(TOKEN_LBRACE, poisoned_decl); - while (try_consume(c, TOKEN_COMMA)) + do { + if (tok_is(c, TOKEN_RBRACE)) break; ASSIGN_EXPR_OR_RET(Expr *expr, parse_constant_expr(c), poisoned_decl); vec_add(decl->exec_decl.args, expr); - } + } while (try_consume(c, TOKEN_COMMA)); CONSUME_OR_RET(TOKEN_RBRACE, poisoned_decl); if (try_consume(c, TOKEN_RPAREN)) goto END; CONSUME_OR_RET(TOKEN_COMMA, poisoned_decl);