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