rename: attribute -> pragma

This commit is contained in:
tocariimaa 2025-01-20 18:54:23 -03:00
parent 1b1653b593
commit ea9e8b7d0d
3 changed files with 9 additions and 9 deletions

View file

@ -32,7 +32,7 @@ enum AstType
AST_EXPRS, /* exprs */ AST_EXPRS, /* exprs */
AST_BINEXPR, /* bin */ AST_BINEXPR, /* bin */
AST_UNARY, /* unary */ AST_UNARY, /* unary */
AST_ATTRIBUTE, /* attribute */ AST_PRAGMA, /* pragma */
AST_DISCARD, AST_DISCARD,
}; };
@ -118,7 +118,7 @@ typedef struct {
/* Attributes for now can only be identifiers */ /* Attributes for now can only be identifiers */
Vec(Str) attrs; Vec(Str) attrs;
Ast *node; /* The decorated node */ Ast *node; /* The decorated node */
} AstAttribute; } AstPragma;
typedef struct { typedef struct {
Ast *expr; Ast *expr;
@ -141,7 +141,7 @@ struct Ast {
Vec(Ast *) stmts; Vec(Ast *) stmts;
Vec(Ast *) exprs; Vec(Ast *) exprs;
Str strlit; /* String literal */ Str strlit; /* String literal */
AstAttribute attribute; AstPragma attribute;
AstDiscard discard; AstDiscard discard;
}; };
Location loc; /* location in the source code of this node */ Location loc; /* location in the source code of this node */

View file

@ -329,9 +329,9 @@ discard_stmt(ParserState *ps)
} }
static Ast * static Ast *
parse_attribute(ParserState *ps) parse_pragma(ParserState *ps)
{ {
Ast *tree = make_tree(AST_ATTRIBUTE, ps->lexer->cur_loc); Ast *tree = make_tree(AST_PRAGMA, ps->lexer->cur_loc);
LexToken next = lex_scan(ps->lexer); LexToken next = lex_scan(ps->lexer);
lex_match(ps->lexer, &next, T_LBRACKET); lex_match(ps->lexer, &next, T_LBRACKET);
next = lex_scan(ps->lexer); next = lex_scan(ps->lexer);
@ -343,7 +343,7 @@ parse_attribute(ParserState *ps)
static Ast * static Ast *
decorated_decl(ParserState *ps) decorated_decl(ParserState *ps)
{ {
Ast *attr = parse_attribute(ps); Ast *attr = parse_pragma(ps);
LexToken next = lex_scan(ps->lexer); LexToken next = lex_scan(ps->lexer);
switch (next.id) { switch (next.id) {
case T_PROC: case T_PROC:

View file

@ -652,7 +652,7 @@ sema_discard(SemaCtx *sctx, Ast *expr, Location loc)
} }
static void static void
sema_attribute(SemaCtx *sctx, AstAttribute *attr) sema_pragma(SemaCtx *sctx, AstPragma *attr)
{ {
sema_node(sctx, attr->node); sema_node(sctx, attr->node);
} }
@ -841,8 +841,8 @@ sema_node(SemaCtx *sctx, Ast *node)
case AST_DISCARD: case AST_DISCARD:
sema_discard(sctx, node->discard.expr, node->loc); sema_discard(sctx, node->discard.expr, node->loc);
break; break;
case AST_ATTRIBUTE: case AST_PRAGMA:
sema_attribute(sctx, &node->attribute); sema_pragma(sctx, &node->attribute);
break; break;
case AST_BINEXPR: case AST_BINEXPR:
case AST_UNARY: case AST_UNARY: