@@ -153,7 +153,7 @@ Some productions are defined by exclusion of particular Unicode characters:
153
153
~~~~ {.notrust .ebnf .gram}
154
154
comment : block_comment | line_comment ;
155
155
block_comment : "/*" block_comment_body * '*' + '/' ;
156
- block_comment_body : ( block_comment | character) * ;
156
+ block_comment_body : [ block_comment | character] * ;
157
157
line_comment : "//" non_eol * ;
158
158
~~~~
159
159
@@ -205,6 +205,7 @@ The keywords are the following strings:
205
205
~~~~ {.notrust .keyword}
206
206
as
207
207
break
208
+ crate
208
209
do
209
210
else enum extern
210
211
false fn for
@@ -496,16 +497,16 @@ All of the above extensions are expressions with values.
496
497
## Macros
497
498
498
499
~~~~ {.notrust .ebnf .gram}
499
- expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')'
500
- macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';'
500
+ expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ;
501
+ macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';' ;
501
502
matcher : '(' matcher * ')' | '[' matcher * ']'
502
503
| '{' matcher * '}' | '$' ident ':' ident
503
504
| '$' '(' matcher * ')' sep_token? [ '*' | '+' ]
504
- | non_special_token
505
+ | non_special_token ;
505
506
transcriber : '(' transcriber * ')' | '[' transcriber * ']'
506
507
| '{' transcriber * '}' | '$' ident
507
508
| '$' '(' transcriber * ')' sep_token? [ '*' | '+' ]
508
- | non_special_token
509
+ | non_special_token ;
509
510
~~~~
510
511
511
512
User-defined syntax extensions are called "macros",
@@ -802,7 +803,7 @@ use_decl : "pub" ? "use" ident [ '=' path
802
803
803
804
path_glob : ident [ "::" path_glob ] ?
804
805
| '*'
805
- | '{' ident [ ',' ident ] * '}'
806
+ | '{' ident [ ',' ident ] * '}' ;
806
807
~~~~
807
808
808
809
A _ use declaration_ creates one or more local name bindings synonymous
@@ -1457,7 +1458,7 @@ impl Seq<bool> for u32 {
1457
1458
### External blocks
1458
1459
1459
1460
~~~~ {.notrust .ebnf .gram}
1460
- extern_block_item : "extern" '{' extern_block '} ;
1461
+ extern_block_item : "extern" '{' extern_block '}' ;
1461
1462
extern_block : [ foreign_fn ] * ;
1462
1463
~~~~
1463
1464
@@ -1683,7 +1684,7 @@ import public items from their destination, not private items.
1683
1684
1684
1685
~~~~ {.notrust .ebnf .gram}
1685
1686
attribute : '#' '[' attr_list ']' ;
1686
- attr_list : attr [ ',' attr_list ]*
1687
+ attr_list : attr [ ',' attr_list ]* ;
1687
1688
attr : ident [ '=' literal
1688
1689
| '(' attr_list ')' ] ? ;
1689
1690
~~~~
@@ -2331,7 +2332,7 @@ struct_expr : expr_path '{' ident ':' expr
2331
2332
[ ".." expr ] '}' |
2332
2333
expr_path '(' expr
2333
2334
[ ',' expr ] * ')' |
2334
- expr_path
2335
+ expr_path ;
2335
2336
~~~~
2336
2337
2337
2338
There are several forms of structure expressions.
@@ -2382,7 +2383,7 @@ Point3d {y: 0, z: 10, .. base};
2382
2383
~~~~ {.notrust .ebnf .gram}
2383
2384
block_expr : '{' [ view_item ] *
2384
2385
[ stmt ';' | item ] *
2385
- [ expr ] '}'
2386
+ [ expr ] '}' ;
2386
2387
~~~~
2387
2388
2388
2389
A _ block expression_ is similar to a module in terms of the declarations that
@@ -2409,7 +2410,7 @@ or dynamically dispatching if the left-hand-side expression is an indirect [obje
2409
2410
### Field expressions
2410
2411
2411
2412
~~~~ {.notrust .ebnf .gram}
2412
- field_expr : expr '.' ident
2413
+ field_expr : expr '.' ident ;
2413
2414
~~~~
2414
2415
2415
2416
A _ field expression_ consists of an expression followed by a single dot and an identifier,
@@ -2431,9 +2432,9 @@ it is automatically dereferenced to make the field access possible.
2431
2432
### Vector expressions
2432
2433
2433
2434
~~~~ {.notrust .ebnf .gram}
2434
- vec_expr : '[' "mut" ? vec_elems? ']'
2435
+ vec_expr : '[' "mut" ? vec_elems? ']' ;
2435
2436
2436
- vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
2437
+ vec_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
2437
2438
~~~~
2438
2439
2439
2440
A [ _ vector_ ] ( #vector-types ) _ expression_ is written by enclosing zero or
@@ -2453,7 +2454,7 @@ as a [literal](#literals) or a [static item](#static-items).
2453
2454
### Index expressions
2454
2455
2455
2456
~~~~ {.notrust .ebnf .gram}
2456
- idx_expr : expr '[' expr ']'
2457
+ idx_expr : expr '[' expr ']' ;
2457
2458
~~~~
2458
2459
2459
2460
[ Vector] ( #vector-types ) -typed expressions can be indexed by writing a
@@ -2875,7 +2876,7 @@ then any `else` block is executed.
2875
2876
~~~~ {.notrust .ebnf .gram}
2876
2877
match_expr : "match" expr '{' match_arm [ '|' match_arm ] * '}' ;
2877
2878
2878
- match_arm : match_pat '=>' [ expr "," | '{' block '}' ] ;
2879
+ match_arm : match_pat "=>" [ expr "," | '{' block '}' ] ;
2879
2880
2880
2881
match_pat : pat [ ".." pat ] ? [ "if" expr ] ;
2881
2882
~~~~
0 commit comments