aboutsummaryrefslogtreecommitdiff
path: root/boot/parser.yy
diff options
context:
space:
mode:
Diffstat (limited to 'boot/parser.yy')
-rw-r--r--boot/parser.yy7
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);