summaryrefslogtreecommitdiff
path: root/src/parser/parser_core.c
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-14 14:25:11 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-14 14:25:11 +0000
commita918df69269a39ef7350a645b5db025d66ecb18a (patch)
tree4ecb93f26e7e3ee2e256dd215c214b966df2d905 /src/parser/parser_core.c
parentdf70f5bea676eb27e0ada10116d62f8c242c03a1 (diff)
Moving from to for improved error handling.
Diffstat (limited to 'src/parser/parser_core.c')
-rw-r--r--src/parser/parser_core.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/parser/parser_core.c b/src/parser/parser_core.c
index 1a47275..7d5bc32 100644
--- a/src/parser/parser_core.c
+++ b/src/parser/parser_core.c
@@ -76,7 +76,7 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l)
Token attr = lexer_next(l);
if (attr.type != TOK_IDENT && attr.type != TOK_COMPTIME)
{
- zpanic("Expected attribute name after @");
+ zpanic_at(attr, "Expected attribute name after @");
}
if (0 == strncmp(attr.start, "must_use", 8) && 8 == attr.len)
@@ -98,7 +98,7 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l)
}
if (lexer_next(l).type != TOK_RPAREN)
{
- zpanic("Expected ) after deprecated message");
+ zpanic_at(lexer_peek(l), "Expected ) after deprecated message");
}
}
}
@@ -164,12 +164,12 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l)
}
if (lexer_next(l).type != TOK_RPAREN)
{
- zpanic("Expected ) after section name");
+ zpanic_at(lexer_peek(l), "Expected ) after section name");
}
}
else
{
- zpanic("@section requires a name: @section(\"name\")");
+ zpanic_at(lexer_peek(l), "@section requires a name: @section(\"name\")");
}
}
else if (0 == strncmp(attr.start, "packed", 6) && 6 == attr.len)
@@ -188,12 +188,12 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l)
}
if (lexer_next(l).type != TOK_RPAREN)
{
- zpanic("Expected ) after align value");
+ zpanic_at(lexer_peek(l), "Expected ) after align value");
}
}
else
{
- zpanic("@align requires a value: @align(N)");
+ zpanic_at(lexer_peek(l), "@align requires a value: @align(N)");
}
}
else if (0 == strncmp(attr.start, "derive", 6) && 6 == attr.len)
@@ -206,7 +206,7 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l)
Token t = lexer_next(l);
if (t.type != TOK_IDENT)
{
- zpanic("Expected trait name in @derive");
+ zpanic_at(t, "Expected trait name in @derive");
}
if (derived_count < 32)
{
@@ -223,12 +223,12 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l)
}
if (lexer_next(l).type != TOK_RPAREN)
{
- zpanic("Expected ) after derive traits");
+ zpanic_at(lexer_peek(l), "Expected ) after derive traits");
}
}
else
{
- zpanic("@derive requires traits: @derive(Debug, Clone)");
+ zpanic_at(lexer_peek(l), "@derive requires traits: @derive(Debug, Clone)");
}
}
else
@@ -372,7 +372,7 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l)
lexer_next(l);
if (lexer_peek(l).type != TOK_LBRACE)
{
- zpanic("Expected { after raw");
+ zpanic_at(lexer_peek(l), "Expected { after raw");
}
lexer_next(l);
@@ -384,7 +384,7 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l)
Token t = lexer_next(l);
if (t.type == TOK_EOF)
{
- zpanic("Unexpected EOF in raw block");
+ zpanic_at(t, "Unexpected EOF in raw block");
}
if (t.type == TOK_LBRACE)
{