diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-07-21 01:55:56 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-07-21 01:55:56 +0200 |
| commit | 44d6e8a27294e5ca7300ab11900011b73d9336d4 (patch) | |
| tree | d21addb0dec93fa8fa376bbd11076b17f3412173 /boot/parser.yy | |
| parent | 6b131c925dee7a5f97516edd581e051e08bb52d8 (diff) | |
| download | elna-44d6e8a27294e5ca7300ab11900011b73d9336d4.tar.gz | |
Implement slices
Diffstat (limited to 'boot/parser.yy')
| -rw-r--r-- | boot/parser.yy | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/boot/parser.yy b/boot/parser.yy index aad5769..bc2ddb5 100644 --- a/boot/parser.yy +++ b/boot/parser.yy @@ -112,6 +112,7 @@ along with GCC; see the file COPYING3. If not see DEFER "defer" CASE "case" OF "of" + TO "to" PIPE "|" %token OR "or" AND "&" XOR "xor" EQUALS "=" NOT_EQUAL "<>" LESS_THAN "<" GREATER_THAN ">" LESS_EQUAL "<=" GREATER_EQUAL ">=" @@ -372,6 +373,8 @@ type_expressions: designator_expression: simple_expression "[" expression "]" { $$ = new boot::array_access_expression(boot::make_position(@$), $1, $3); } + | simple_expression "[" expression "to" expression "]" + { $$ = new boot::slicing_expression(boot::make_position(@$), $1, $3, $5); } | simple_expression "." identifier { $$ = new boot::field_access_expression(boot::make_position(@$), $1, std::move(*$3)); } | simple_expression "^" @@ -446,6 +449,10 @@ type_expression: { $$ = new boot::array_type_expression(boot::make_position(@$), $4, $2); } + | "[" "]" type_expression + { + $$ = new boot::slice_type_expression(boot::make_position(@$), $3); + } | "const" type_expression { $$ = new boot::constant_type_expression(boot::make_position(@$), $2); |
