@@ -11,23 +11,23 @@ ItemKind =
1111 | Fn:{ header:FnHeader "fn" decl:FnDecl body:Block }
1212 | TypeAlias:{ "type" name:IDENT generics:Generics? where_clause:WhereClause? "=" ty:Type ";" }
1313 // unstable(existential_type):
14- | ExistentialType:{ "existential" "type" name:IDENT generics:Generics? where_clause:WhereClause? ":" bounds:TypeBound* % "+" "+"? ";" }
15- | Enum:{ "enum" name:IDENT generics:Generics? where_clause:WhereClause? "{" variants:EnumVariant* % "," ","? "}" }
14+ | ExistentialType:{ "existential" "type" name:IDENT generics:Generics? where_clause:WhereClause? ":" bounds:TypeBound* %% "+" ";" }
15+ | Enum:{ "enum" name:IDENT generics:Generics? where_clause:WhereClause? "{" variants:EnumVariant* %% "," "}" }
1616 | Struct:{ "struct" name:IDENT generics:Generics? body:StructBody }
17- | Union:{ "union" name:IDENT generics:Generics? where_clause:WhereClause? "{" fields:RecordField* % "," ","? "}" }
17+ | Union:{ "union" name:IDENT generics:Generics? where_clause:WhereClause? "{" fields:RecordField* %% "," "}" }
1818 | Trait:{
1919 unsafety:"unsafe"?
2020 // unstable(optin_builtin_traits):
2121 auto:"auto"?
2222 "trait" name:IDENT generics:Generics?
23- { ":" superbounds:TypeBound* % "+" "+"? }?
23+ { ":" superbounds:TypeBound* %% "+" }?
2424 where_clause:WhereClause? "{" trait_items:TraitItem* "}"
2525 }
2626 // unstable(trait_alias):
2727 | TraitAlias:{
2828 "trait" name:IDENT generics:Generics?
29- { ":" superbounds:TypeBound* % "+" "+"? }?
30- where_clause:WhereClause? "=" bounds:TypeBound* % "+" "+"? ";"
29+ { ":" superbounds:TypeBound* %% "+" }?
30+ where_clause:WhereClause? "=" bounds:TypeBound* %% "+" ";"
3131 }
3232 | Impl:{
3333 // unstable(specialization):
@@ -43,7 +43,7 @@ ItemKind =
4343
4444UseTree =
4545 | Glob:{ prefix:UseTreePrefix? "*" }
46- | Nested:{ prefix:UseTreePrefix? "{" children:UseTree* % "," ","? "}" }
46+ | Nested:{ prefix:UseTreePrefix? "{" children:UseTree* %% "," "}" }
4747 | Simple:{ path:Path { "as" rename:IDENT }? }
4848 ;
4949UseTreePrefix =
@@ -65,7 +65,7 @@ TraitItem = attrs:OuterAttr* kind:TraitItemKind;
6565TraitItemKind =
6666 | Const:{ "const" name:IDENT ":" ty:Type { "=" default:Expr }? ";" }
6767 | Fn:{ header:FnHeader "fn" decl:FnDecl { default_body:Block | ";" } }
68- | Type:{ "type" name:IDENT generics:Generics? { ":" bounds:TypeBound* % "+" "+"? }? where_clause:WhereClause? { "=" default:Type }? ";" }
68+ | Type:{ "type" name:IDENT generics:Generics? { ":" bounds:TypeBound* %% "+" }? where_clause:WhereClause? { "=" default:Type }? ";" }
6969 | MacroCall:ItemMacroCall
7070 ;
7171
@@ -80,16 +80,16 @@ ImplItemKind =
8080 | Fn:{ header:FnHeader "fn" decl:FnDecl body:Block }
8181 | Type:{ "type" name:IDENT generics:Generics? where_clause:WhereClause? "=" ty:Type ";" }
8282 // unstable(existential_type):
83- | ExistentialType:{ "existential" "type" name:IDENT generics:Generics? where_clause:WhereClause? ":" bounds:TypeBound* % "+" "+"? ";" }
83+ | ExistentialType:{ "existential" "type" name:IDENT generics:Generics? where_clause:WhereClause? ":" bounds:TypeBound* %% "+" ";" }
8484 | MacroCall:ItemMacroCall
8585 ;
8686
8787FnHeader = constness:"const"? unsafety:"unsafe"? asyncness:"async"? { "extern" abi:Abi }?;
88- FnDecl = name:IDENT generics:Generics? "(" args:FnArgs? ","? " )" { "->" ret_ty:Type }? where_clause:WhereClause?;
88+ FnDecl = name:IDENT generics:Generics? "(" args:FnArgs? ")" { "->" ret_ty:Type }? where_clause:WhereClause?;
8989
9090// FIXME(eddyb) find a way to express this `A* B?` pattern better
9191FnArgs =
92- | Regular:FnArg+ % ","
92+ | Regular:FnArg+ %% ","
9393 | Variadic:"..."
9494 | RegularAndVariadic:{ args:FnArg+ % "," "," "..." }
9595 ;
@@ -102,16 +102,16 @@ FnArg =
102102EnumVariant = attrs:OuterAttr* name:IDENT kind:EnumVariantKind { "=" discr:Expr }?;
103103EnumVariantKind =
104104 | Unit:{}
105- | Tuple:{ "(" fields:TupleField* % "," ","? ")" }
106- | Record:{ "{" fields:RecordField* % "," ","? "}" }
105+ | Tuple:{ "(" fields:TupleField* %% "," ")" }
106+ | Record:{ "{" fields:RecordField* %% "," "}" }
107107 ;
108108
109109// FIXME(eddyb) could maybe be shared more with `EnumVariantKind`?
110110// The problem is the semicolons for `Unit` and `Tuple`, and the where clauses.
111111StructBody =
112112 | Unit:{ where_clause:WhereClause? ";" }
113- | Tuple:{ "(" fields:TupleField* % "," ","? ")" where_clause:WhereClause? ";" }
114- | Record:{ where_clause:WhereClause? "{" fields:RecordField* % "," ","? "}" }
113+ | Tuple:{ "(" fields:TupleField* %% "," ")" where_clause:WhereClause? ";" }
114+ | Record:{ where_clause:WhereClause? "{" fields:RecordField* %% "," "}" }
115115 ;
116116
117117TupleField = attrs:OuterAttr* vis:Vis? ty:Type;
0 commit comments