hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/sfinae.y
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-19 16:20:14 +0200
committerhachem <im@hachem.wtf>2026-09-19 16:20:14 +0200
commitcd2a86435e5e413630e0ab0caa48d900e49ea275 (patch)
tree559a1bfc52a853b61fe07e0b7aa17eca977f5fd2 /sfinae.y
parent0a9605b6b13f2e066a69662f5802b397f8b89424 (diff)
feat: tuples baby
Diffstat (limited to 'sfinae.y')
-rw-r--r--sfinae.y14
1 files changed, 13 insertions, 1 deletions
diff --git a/sfinae.y b/sfinae.y
index aa7650b..9fe994c 100644
--- a/sfinae.y
+++ b/sfinae.y
@@ -33,6 +33,7 @@ void yyerror(const char* message);
%token TOK_BYTE
%token TOK_SIZE_T
%token TOK_CHAR_T
+%token TOK_TUPLE
%token TOK_REMOVE_CV
%token TOK_DECLTYPE
%token TOK_DIFFERENCE
@@ -54,7 +55,7 @@ void yyerror(const char* message);
%token <character> TOK_CHAR
%type <name> name char_list
-%type <node> statements statement sequence sequence_items type value condition
+%type <node> statements statement sequence sequence_items type type_list value condition
%%
@@ -143,6 +144,17 @@ type
{ $$ = node_leaf(TYPE_CHAR); }
| TOK_COLONCOLON TOK_INTEGRAL_CONSTANT '<' TOK_COLONCOLON TOK_CHAR_T ',' value '>'
{ $$ = node_unary(TYPE_CHAR_CONSTANT, $7); }
+ | TOK_COLONCOLON TOK_TUPLE '<' type_list '>'
+ { $$ = node_unary(TYPE_TUPLE, $4); }
+ ;
+
+type_list
+ : /* nothing */
+ { $$ = NULL; }
+ | type
+ { $$ = $1; }
+ | type_list ',' type
+ { $$ = node_append($1, $3); }
;
value