Support #byte directive for asm templates

This commit is contained in:
gingerBill
2026-08-17 13:21:40 +01:00
parent c2dfcb3c28
commit 55377f71ef
5 changed files with 77 additions and 0 deletions

View File

@@ -551,6 +551,9 @@ gb_internal Ast *clone_ast(Ast *node, AstFile *f) {
n->AsmMemoryOperand.disp = clone_ast(n->AsmMemoryOperand.disp, f);
n->AsmMemoryOperand.type = clone_ast(n->AsmMemoryOperand.type, f);
break;
case Ast_AsmDirective:
n->AsmDirective.operands = clone_ast_array(n->AsmDirective.operands, f);
break;
}
return n;
}
@@ -2573,6 +2576,17 @@ gb_internal Ast *parse_asm_instruction(AstFile *f) {
label_decl->AsmLabelDecl.name = name;
return label_decl;
}
case Token_Hash:
{
Token token = expect_token(f, Token_Hash);
Token name = expect_token(f, Token_Ident);
auto operands = parse_asm_operands(f);
Ast *dir = alloc_ast_node(f, Ast_AsmDirective);
dir->AsmDirective.token = token;
dir->AsmDirective.name = name;
dir->AsmDirective.operands = operands;
return dir;
}
}
syntax_error(f->curr_token, "Expected an asm instruction, got '%.*s'", LIT(f->curr_token.string));
advance_token(f);