Parsing union
This commit is contained in:
@@ -692,7 +692,7 @@ parse_assign_expr() {
|
||||
}
|
||||
|
||||
CORE_Static Ast_Decl *
|
||||
parse_struct(Token *pos) {
|
||||
parse_struct(Token *pos, Ast_Kind kind) {
|
||||
Scratch_Scope scratch(pctx->scratch);
|
||||
|
||||
token_match(OPEN_SCOPE);
|
||||
@@ -711,7 +711,7 @@ parse_struct(Token *pos) {
|
||||
token_expect(CLOSE_SCOPE);
|
||||
|
||||
finalize_decl_scope(scope);
|
||||
Ast_Decl *result = ast_struct(pos, scope);
|
||||
Ast_Decl *result = ast_struct(pos, scope, kind);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -853,9 +853,12 @@ parse_decl(B32 is_global) {
|
||||
set_flag(flags, AST_STRICT);
|
||||
}
|
||||
|
||||
// @note parse struct binding
|
||||
if (token_match_keyword(pctx->keyword_struct)) {
|
||||
result = parse_struct(tname);
|
||||
result = parse_struct(tname, AST_STRUCT);
|
||||
}
|
||||
|
||||
else if (token_match_keyword(pctx->keyword_union)) {
|
||||
result = parse_struct(tname, AST_UNION);
|
||||
}
|
||||
|
||||
else if (token_match_keyword(pctx->keyword_enum)) {
|
||||
|
||||
Reference in New Issue
Block a user