51 lines
1.3 KiB
C
51 lines
1.3 KiB
C
|
|
function Decl *
|
|
decl_new(Parser *p, Decl_Kind kind, Token *token, Intern_String name){
|
|
Decl *result = arena_push_struct(&p->main_arena, Decl);
|
|
memory_zero(result, sizeof(Decl));
|
|
|
|
result->token = token;
|
|
result->kind = kind;
|
|
result->name = name;
|
|
return result;
|
|
}
|
|
|
|
function Decl_Enum_Child *
|
|
decl_enum_child(Parser *p, Token *token, Expr *expr){
|
|
Decl_Enum_Child *result = arena_push_struct(&p->main_arena, Decl_Enum_Child);
|
|
memory_zero(result, sizeof(Decl_Enum_Child));
|
|
result->expr = expr;
|
|
result->token = token;
|
|
return result;
|
|
}
|
|
|
|
function Decl *
|
|
decl_enum(Parser *p, Token *token, Intern_String name){
|
|
Decl *result = decl_new(p, DK_Enum, token, name);
|
|
return result;
|
|
}
|
|
|
|
function Decl *
|
|
decl_struct(Parser *p, Token *token, Intern_String name){
|
|
Decl *result = decl_new(p, DK_Struct, token, name);
|
|
return result;
|
|
}
|
|
function Decl *
|
|
decl_union(Parser *p, Token *token, Intern_String name){
|
|
Decl *result = decl_new(p, DK_Union, token, name);
|
|
return result;
|
|
}
|
|
|
|
function void
|
|
decl_aggregate_push(Decl *a, Decl *b){
|
|
SLLQueuePush(a->aggregate_val.first, a->aggregate_val.last, b);
|
|
}
|
|
function void
|
|
decl_function_push(Decl *a, Decl *b){
|
|
SLLQueuePush(a->func_val.first, a->func_val.last, b);
|
|
}
|
|
function void
|
|
decl_enum_push(Decl *a, Decl_Enum_Child *b){
|
|
SLLQueuePush(a->enum_val.first, a->enum_val.last, b);
|
|
}
|