rename: attribute -> pragma
This commit is contained in:
parent
1b1653b593
commit
ea9e8b7d0d
3 changed files with 9 additions and 9 deletions
|
@ -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 */
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue