aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-05-26 13:45:47 +0100
committergingerBill <bill@gingerbill.org>2022-05-26 13:45:47 +0100
commit66b5a35ec352b74e66ad866640669d920e9d0849 (patch)
treeb32db42c645b4685bb6ff5cbb1f5ed5cfe823ace /src/parser.cpp
parentf3f6c12a7cc6dca745ae40744a5220878ff9261e (diff)
Add `simd_to_bits`; correct fix typo causing issue with parapoly
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index d19e249e5..5280fd4b0 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -360,6 +360,7 @@ Ast *clone_ast(Ast *node) {
case Ast_ArrayType:
n->ArrayType.count = clone_ast(n->ArrayType.count);
n->ArrayType.elem = clone_ast(n->ArrayType.elem);
+ n->ArrayType.tag = clone_ast(n->ArrayType.tag);
break;
case Ast_DynamicArrayType:
n->DynamicArrayType.elem = clone_ast(n->DynamicArrayType.elem);
@@ -2127,7 +2128,18 @@ Ast *parse_operand(AstFile *f, bool lhs) {
Token name = expect_token(f, Token_Ident);
if (name.string == "type") {
return ast_helper_type(f, token, parse_type(f));
- } else if (name.string == "soa" || name.string == "simd") {
+ } else if ( name.string == "simd") {
+ Ast *tag = ast_basic_directive(f, token, name);
+ Ast *original_type = parse_type(f);
+ Ast *type = unparen_expr(original_type);
+ switch (type->kind) {
+ case Ast_ArrayType: type->ArrayType.tag = tag; break;
+ default:
+ syntax_error(type, "Expected a fixed array type after #%.*s, got %.*s", LIT(name.string), LIT(ast_strings[type->kind]));
+ break;
+ }
+ return original_type;
+ } else if (name.string == "soa") {
Ast *tag = ast_basic_directive(f, token, name);
Ast *original_type = parse_type(f);
Ast *type = unparen_expr(original_type);