aboutsummaryrefslogtreecommitdiff
path: root/src/parser.y
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-04-03 16:00:34 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-04-03 16:00:34 +0300
commit2ca159fb5c2a52f33c499eef1fa50a98a863b0f0 (patch)
treec9497ad8372a047bcff366c189c8969ed84f0406 /src/parser.y
parent4642bedb436981e92e3312f06bfcb2eb34074596 (diff)
downloadek-2ca159fb5c2a52f33c499eef1fa50a98a863b0f0.tar.gz
ek-2ca159fb5c2a52f33c499eef1fa50a98a863b0f0.zip
initial union testing
Diffstat (limited to 'src/parser.y')
-rw-r--r--src/parser.y4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parser.y b/src/parser.y
index 329e072..64f9ef1 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -448,7 +448,7 @@ type: id { $$ = gen_type(AST_TYPE_ID, $1, NULL, NULL); }
$$->_type.next = $2;
}
| id "(" type_list ")" {
- $$ = gen_type(AST_TYPE_STRUCT, $1, $3, NULL);
+ $$ = gen_type(AST_TYPE_GENERIC, $1, $3, NULL);
}
| "'" type {
$$ = gen_type(AST_TYPE_POINTER, NULL, NULL, NULL);
@@ -596,6 +596,7 @@ top: ";" { $$ = gen_empty(); }
| enum { $$ = $1; }
| proc { $$ = $1; }
| struct { $$ = $1; }
+ | union { $$ = $1; }
| macro { $$ = $1; }
| "const" top_if { $$ = $2; ast_set_flags($$, AST_FLAG_CONST); }
| import ";" { $$ = $1; }
@@ -603,6 +604,7 @@ top: ";" { $$ = gen_empty(); }
| type_template { $$ = $1; }
| "pub" enum { $$ = $2; ast_set_flags($2, AST_FLAG_PUBLIC); }
| "pub" struct { $$ = $2; ast_set_flags($2, AST_FLAG_PUBLIC); }
+ | "pub" union { $$ = $2; ast_set_flags($2, AST_FLAG_PUBLIC); }
| "pub" proc { $$ = $2; ast_set_flags($2, AST_FLAG_PUBLIC); }
| "pub" macro { $$ = $2; ast_set_flags($2, AST_FLAG_PUBLIC); }
| "pub" import ";" { $$ = $2; ast_set_flags($2, AST_FLAG_PUBLIC); }