summaryrefslogtreecommitdiff
path: root/src/parser/parser_stmt.c
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-28 01:19:20 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-28 01:19:20 +0000
commitda12345b6e3c297e530764c4424b7d9e6a1cb65e (patch)
treeb2cf2dda80c80c10425fee60fc31e17bc1de48b3 /src/parser/parser_stmt.c
parent6a28507b59c4a5b89562962817b45e517f442cd4 (diff)
Fix for #141
Diffstat (limited to 'src/parser/parser_stmt.c')
-rw-r--r--src/parser/parser_stmt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c
index ab5b89c..85e9825 100644
--- a/src/parser/parser_stmt.c
+++ b/src/parser/parser_stmt.c
@@ -1877,7 +1877,7 @@ ASTNode *parse_statement(ParserContext *ctx, Lexer *l)
lexer_next(&lookahead);
TokenType next_type = lexer_peek(&lookahead).type;
- if (next_type == TOK_SEMICOLON || next_type == TOK_DOTDOT)
+ if (next_type == TOK_SEMICOLON || next_type == TOK_DOTDOT || next_type == TOK_RBRACE)
{
Token t = lexer_next(l); // consume string
@@ -1894,8 +1894,7 @@ ASTNode *parse_statement(ParserContext *ctx, Lexer *l)
inner[t.len - 2] = 0;
}
- // ; means println (end of line), .. means print (continuation)
- int is_ln = (next_type == TOK_SEMICOLON);
+ int is_ln = (next_type == TOK_SEMICOLON || next_type == TOK_RBRACE);
char **used_syms = NULL;
int used_count = 0;
char *code =
@@ -1913,6 +1912,7 @@ ASTNode *parse_statement(ParserContext *ctx, Lexer *l)
lexer_next(l); // consume optional ;
}
}
+ // If TOK_RBRACE, do not consume it, so parse_block can see it and terminate loop.
ASTNode *n = ast_create(NODE_RAW_STMT);
// Append semicolon to Statement Expression to make it a valid statement