diff options
Diffstat (limited to 'sfinae.y')
| -rw-r--r-- | sfinae.y | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -23,6 +23,8 @@ void yyerror(const char* message); %token TOK_COMMIT %token TOK_DECLARE %token TOK_UNDECLARE +%token TOK_ENABLE_IF +%token TOK_SEQUENCE %token TOK_NAME %token TOK_VALUE_OF %token TOK_VOID @@ -50,7 +52,7 @@ void yyerror(const char* message); %token <character> TOK_CHAR %type <name> name char_list -%type <node> statements statement type value condition +%type <node> statements statement sequence sequence_items type value condition %% @@ -75,6 +77,23 @@ statement { $$ = node_named(STMT_DECLARE, &$4, $6); } | TOK_COLONCOLON TOK_UNDECLARE '<' name '>' TOK_COLONCOLON TOK_COMMIT { $$ = node_named(STMT_UNDECLARE, &$4, NULL); } + | TOK_COLONCOLON TOK_ENABLE_IF '<' condition ',' sequence '>' TOK_COLONCOLON TOK_COMMIT + { $$ = node_block(STMT_ENABLE_IF, $4, $6); } + ; + +// the statements inside are committed one by one, without the semicolons +sequence + : TOK_COLONCOLON TOK_SEQUENCE '<' sequence_items '>' + { $$ = $4; } + ; + +sequence_items + : /* nothing */ + { $$ = NULL; } + | statement + { $$ = $1; } + | sequence_items ',' statement + { $$ = node_append($1, $3); } ; name |
