diff --git a/compiler/ast.h b/compiler/ast.h index 9791168..6089578 100644 --- a/compiler/ast.h +++ b/compiler/ast.h @@ -32,7 +32,7 @@ enum AstType AST_EXPRS, /* exprs */ AST_BINEXPR, /* bin */ AST_UNARY, /* unary */ - AST_ATTRIBUTE, /* attribute */ + AST_PRAGMA, /* pragma */ AST_DISCARD, }; @@ -118,7 +118,7 @@ typedef struct { /* Attributes for now can only be identifiers */ Vec(Str) attrs; Ast *node; /* The decorated node */ -} AstAttribute; +} AstPragma; typedef struct { Ast *expr; @@ -141,7 +141,7 @@ struct Ast { Vec(Ast *) stmts; Vec(Ast *) exprs; Str strlit; /* String literal */ - AstAttribute attribute; + AstPragma attribute; AstDiscard discard; }; Location loc; /* location in the source code of this node */ diff --git a/compiler/parse.c b/compiler/parse.c index 25a0319..cd99a57 100644 --- a/compiler/parse.c +++ b/compiler/parse.c @@ -329,9 +329,9 @@ discard_stmt(ParserState *ps) } 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); lex_match(ps->lexer, &next, T_LBRACKET); next = lex_scan(ps->lexer); @@ -343,7 +343,7 @@ parse_attribute(ParserState *ps) static Ast * decorated_decl(ParserState *ps) { - Ast *attr = parse_attribute(ps); + Ast *attr = parse_pragma(ps); LexToken next = lex_scan(ps->lexer); switch (next.id) { case T_PROC: diff --git a/compiler/sema.c b/compiler/sema.c index 405f524..8a88462 100644 --- a/compiler/sema.c +++ b/compiler/sema.c @@ -652,7 +652,7 @@ sema_discard(SemaCtx *sctx, Ast *expr, Location loc) } static void -sema_attribute(SemaCtx *sctx, AstAttribute *attr) +sema_pragma(SemaCtx *sctx, AstPragma *attr) { sema_node(sctx, attr->node); } @@ -841,8 +841,8 @@ sema_node(SemaCtx *sctx, Ast *node) case AST_DISCARD: sema_discard(sctx, node->discard.expr, node->loc); break; - case AST_ATTRIBUTE: - sema_attribute(sctx, &node->attribute); + case AST_PRAGMA: + sema_pragma(sctx, &node->attribute); break; case AST_BINEXPR: case AST_UNARY: