diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-24 00:09:51 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-24 00:09:51 +0000 |
| commit | 9608435f5b1b12985d7ee3f66e25041eac8b241c (patch) | |
| tree | 0f309cf2d6c64f865c1ed892f78faa8833ee01a9 /src/parser | |
| parent | 27d041865d17a4055e7e6b3e297656d6f35a0f3b (diff) | |
Better formatting
Diffstat (limited to 'src/parser')
| -rw-r--r-- | src/parser/parser_core.c | 3 | ||||
| -rw-r--r-- | src/parser/parser_decl.c | 5 | ||||
| -rw-r--r-- | src/parser/parser_expr.c | 5 | ||||
| -rw-r--r-- | src/parser/parser_stmt.c | 3 |
4 files changed, 11 insertions, 5 deletions
diff --git a/src/parser/parser_core.c b/src/parser/parser_core.c index 8410203..7468bfb 100644 --- a/src/parser/parser_core.c +++ b/src/parser/parser_core.c @@ -347,7 +347,8 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l) } else if (t.len == 5 && strncmp(t.start, "const", 5) == 0) { - zpanic_at(t, "'const' for declarations is deprecated. Use 'def' for constants or 'var x: const T' for read-only variables."); + 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) { diff --git a/src/parser/parser_decl.c b/src/parser/parser_decl.c index 87b15ad..7e0cc5b 100644 --- a/src/parser/parser_decl.c +++ b/src/parser/parser_decl.c @@ -727,7 +727,8 @@ ASTNode *parse_def(ParserContext *ctx, Lexer *l) // Use is_def flag for manifest constants add_symbol(ctx, ns, type_str ? type_str : "unknown", type_obj); Symbol *sym_entry = find_symbol_entry(ctx, ns); - if (sym_entry) { + if (sym_entry) + { sym_entry->is_def = 1; // is_const_value set only if literal } @@ -762,7 +763,7 @@ ASTNode *parse_def(ParserContext *ctx, Lexer *l) free(s->type_info); } s->type_info = type_new(TYPE_INT); - s->type_info->is_const = 1; + s->type_info->is_const = 1; } } } diff --git a/src/parser/parser_expr.c b/src/parser/parser_expr.c index 9d21e77..c848072 100644 --- a/src/parser/parser_expr.c +++ b/src/parser/parser_expr.c @@ -3423,7 +3423,10 @@ ASTNode *parse_expr_prec(ParserContext *ctx, Lexer *l, Precedence min_prec) Symbol *s = find_symbol_entry(ctx, operand->var_ref.name); if (s && s->is_def) { - zpanic_at(t, "Cannot take address of manifest constant '%s' (use 'var' if you need an address)", operand->var_ref.name); + zpanic_at(t, + "Cannot take address of manifest constant '%s' (use 'var' if you need an " + "address)", + operand->var_ref.name); } } diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c index bc1849d..73ae249 100644 --- a/src/parser/parser_stmt.c +++ b/src/parser/parser_stmt.c @@ -1963,7 +1963,8 @@ ASTNode *parse_statement(ParserContext *ctx, Lexer *l) if (strncmp(tk.start, "const", 5) == 0 && tk.len == 5) { - zpanic_at(tk, "'const' for declarations is deprecated. Use 'def' for constants or 'var x: const T' for read-only variables."); + zpanic_at(tk, "'const' for declarations is deprecated. Use 'def' for constants or 'var " + "x: const T' for read-only variables."); } if (strncmp(tk.start, "return", 6) == 0 && tk.len == 6) { |
