diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-03-26 23:13:29 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-03-26 23:14:04 +0300 |
| commit | 9fb179ab999c3b98caabca09b30c409dc5dd3b3d (patch) | |
| tree | 087f849f78028950885b46fbbe1bae35f9c1a908 /src/parser.y | |
| parent | 373728f324b82d305748cfe3c853053fe2a9f761 (diff) | |
| download | ek-9fb179ab999c3b98caabca09b30c409dc5dd3b3d.tar.gz ek-9fb179ab999c3b98caabca09b30c409dc5dd3b3d.zip | |
start enums
Diffstat (limited to 'src/parser.y')
| -rw-r--r-- | src/parser.y | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/parser.y b/src/parser.y index 665a6a0..4ad4d8b 100644 --- a/src/parser.y +++ b/src/parser.y @@ -108,6 +108,7 @@ %token RBRACKET "]" %token AS "as" %token DOT "." +%token SCOPE "::" %token FATARROW "=>" /* precedence */ @@ -127,6 +128,7 @@ %left "as" "sizeof" "typeof" %right "'" "!" "~" %left "." "=>" "(" ")" +%left "::" /* why doesn't bison allow <*> for %nterm? would be so much easier */ %nterm <node> import binary_op unary_op arg arg_list decl_list call expr @@ -252,6 +254,7 @@ expr: id { $$ = $1; } | "(" var_init ")" { $$ = $2; } | "sizeof" expr { $$ = gen_sizeof($2); } | expr "as" type { $$ = gen_cast($1, $3); } + | id "::" type { $$ = gen_fetch($1, $3); } | "as" type { $$ = gen_as($2); } | embed { $$ = $1; } | lambda { $$ = $1; } @@ -553,7 +556,7 @@ type_template: "type" id "{" template_list "}" { } ; -enum_val: id { $$ = gen_val($1, gen_int(0)); } +enum_val: id { $$ = gen_val($1, NULL); } | id "=" expr { $$ = gen_val($1, $3); } ; |
