From 27d041865d17a4055e7e6b3e297656d6f35a0f3b Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sat, 24 Jan 2026 00:09:29 +0000 Subject: Welcome to 'def' + changed 'const' --- src/parser/parser_core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/parser/parser_core.c') diff --git a/src/parser/parser_core.c b/src/parser/parser_core.c index 464c905..8410203 100644 --- a/src/parser/parser_core.c +++ b/src/parser/parser_core.c @@ -267,6 +267,10 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l) s = ast_create(NODE_RAW_STMT); s->raw_stmt.content = content; } + else if (t.type == TOK_DEF) + { + s = parse_def(ctx, l); + } else if (t.type == TOK_IDENT) { // Inline function: inline fn name(...) { } @@ -337,9 +341,13 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l) { s = parse_var_decl(ctx, l); } + else if (t.len == 3 && strncmp(t.start, "def", 3) == 0) + { + s = parse_def(ctx, l); + } else if (t.len == 5 && strncmp(t.start, "const", 5) == 0) { - s = parse_const(ctx, l); + zpanic_at(t, "'const' for declarations is deprecated. Use 'def' for constants or 'var x: const T' for read-only variables."); } else if (t.len == 6 && strncmp(t.start, "extern", 6) == 0) { -- cgit v1.2.3