File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1547,7 +1547,9 @@ it is automatically derferenced to make the field access possible.
1547
1547
### Vector expressions
1548
1548
1549
1549
~~~~~~~~ {.ebnf .gram}
1550
- vec_expr : '[' "mut" ? [ expr [ ',' expr ] * ] ? ']'
1550
+ vec_expr : '[' "mut"? vec_elems? ']'
1551
+
1552
+ vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
1551
1553
~~~~~~~~
1552
1554
1553
1555
A [ _ vector_ ] ( #vector-types ) _ expression_ is written by enclosing zero or
@@ -1557,8 +1559,10 @@ indicate that the elements of the resulting vector may be mutated.
1557
1559
When no mutability is specified, the vector is immutable.
1558
1560
1559
1561
~~~~
1562
+ []
1560
1563
[1, 2, 3, 4];
1561
1564
["a", "b", "c", "d"];
1565
+ [0, ..128]; // vector with 128 zeros
1562
1566
[mut 0u8, 0u8, 0u8, 0u8];
1563
1567
~~~~
1564
1568
@@ -1890,7 +1894,7 @@ let x: int = add(1, 2);
1890
1894
1891
1895
~~~~~~~~ {.abnf .gram}
1892
1896
ident_list : [ ident [ ',' ident ]* ] ? ;
1893
- lambda_expr : '|' ident_list '| expr ;
1897
+ lambda_expr : '|' ident_list '|' expr ;
1894
1898
~~~~~~~~
1895
1899
1896
1900
A _ lambda expression_ (a.k.a. "anonymous function expression") defines a function and denotes it as a value,
You can’t perform that action at this time.
0 commit comments