From 43c4f78eb3d2af7778bab6e51d77588bec62930d Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sun, 18 Jan 2026 15:57:40 +0000 Subject: Update docs + add '..<' + add typed embed. --- src/parser/parser_stmt.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/parser/parser_stmt.c') diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c index 6a0f50d..5307768 100644 --- a/src/parser/parser_stmt.c +++ b/src/parser/parser_stmt.c @@ -242,11 +242,12 @@ ASTNode *parse_match(ParserContext *ctx, Lexer *l) p_str = tmp; } - // Check for range pattern: value..end or value..=end - if (lexer_peek(l).type == TOK_DOTDOT || lexer_peek(l).type == TOK_DOTDOT_EQ) + // Check for range pattern: value..end, value..raw_stmt.content = e; + init = parse_embed(ctx, l); + + if (!type && init->type_info) + { + type = type_to_string(init->type_info); + } if (!type) { register_slice(ctx, "char"); @@ -1583,9 +1587,9 @@ ASTNode *parse_for(ParserContext *ctx, Lexer *l) { ASTNode *start_expr = parse_expression(ctx, l); int is_inclusive = 0; - if (lexer_peek(l).type == TOK_DOTDOT) + if (lexer_peek(l).type == TOK_DOTDOT || lexer_peek(l).type == TOK_DOTDOT_LT) { - lexer_next(l); // consume .. + lexer_next(l); // consume .. or ..< } else if (lexer_peek(l).type == TOK_DOTDOT_EQ) @@ -3327,7 +3331,7 @@ ASTNode *parse_struct(ParserContext *ctx, Lexer *l, int is_union) continue; } - // --- HANDLE 'use' (Struct Embedding) --- + // Handle 'use' (Struct Embedding) if (t.type == TOK_USE) { lexer_next(l); // eat use -- cgit v1.2.3