hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/sfinae.y
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-19 12:38:43 +0200
committerhachem <im@hachem.wtf>2026-09-19 12:38:43 +0200
commita79c97e04562b171780a24cba2cb1a71acfa4bbb (patch)
tree412642f948a30eb220512c304b34d60356f23b42 /sfinae.y
parent74a8a2b10a0513f5346ec47aa9b463e30f2b972e (diff)
types: array, extent, tuple_size, integral_constant
Diffstat (limited to 'sfinae.y')
-rw-r--r--sfinae.y14
1 files changed, 14 insertions, 0 deletions
diff --git a/sfinae.y b/sfinae.y
index 5a590a2..5b5d1be 100644
--- a/sfinae.y
+++ b/sfinae.y
@@ -28,6 +28,11 @@ void yyerror(const char* message);
%token TOK_SUM
%token TOK_PRODUCT
%token TOK_QUOTIENT
+%token TOK_ARRAY
+%token TOK_EXTENT
+%token TOK_TUPLE_SIZE
+%token TOK_INTEGRAL_CONSTANT
+%token TOK_VALUE
%token <character> TOK_CHAR
%type <node> statements statement type value
@@ -62,6 +67,8 @@ type
{ $$ = node_leaf(TYPE_SIZE); }
| TOK_COLONCOLON TOK_REMOVE_CV '<' type '>'
{ $$ = node_unary(TYPE_REMOVE_CV, $4); }
+ | TOK_COLONCOLON TOK_ARRAY '<' type ',' value '>'
+ { $$ = node_binary(TYPE_ARRAY, $4, $6); }
| TOK_COLONCOLON TOK_DECLTYPE '(' value ')'
{ $$ = node_unary(TYPE_DECLTYPE, $4); }
;
@@ -75,6 +82,13 @@ value
{ $$ = node_binary(VALUE_PRODUCT, $4, $6); }
| TOK_COLONCOLON TOK_QUOTIENT '<' value ',' value '>'
{ $$ = node_binary(VALUE_QUOTIENT, $4, $6); }
+ | TOK_COLONCOLON TOK_EXTENT '<' type '>' TOK_COLONCOLON TOK_VALUE
+ { $$ = node_unary(VALUE_EXTENT, $4); }
+ | TOK_COLONCOLON TOK_TUPLE_SIZE '<' type '>' TOK_COLONCOLON TOK_VALUE
+ { $$ = node_unary(VALUE_TUPLE_SIZE, $4); }
+ | TOK_COLONCOLON TOK_INTEGRAL_CONSTANT '<' TOK_COLONCOLON TOK_SIZE_T ',' value '>'
+ TOK_COLONCOLON TOK_VALUE
+ { $$ = node_unary(VALUE_INTEGRAL_CONSTANT, $7); }
;
%%