From 3cd4112bdc924c132cb0eab9d064511a215421ec Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:02:20 +0200 Subject: Finalize const&static grammar --- xtask/src/ast_src.rs | 4 ++-- xtask/src/codegen/rust.ungram | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'xtask/src') diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 94f4d17aa..56e3f4b0a 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -101,8 +101,8 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "EXTERN_CRATE", "MODULE", "USE", - "STATIC_DEF", - "CONST_DEF", + "STATIC", + "CONST", "TRAIT_DEF", "IMPL_DEF", "TYPE_ALIAS", diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index b653c14a7..ef7c3e50e 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -4,7 +4,7 @@ SourceFile = Item* Item = - ConstDef + Const | Enum | ExternBlock | ExternCrate @@ -12,7 +12,7 @@ Item = | ImplDef | MacroCall | Module -| StaticDef +| Static | Struct | TraitDef | TypeAlias @@ -112,6 +112,14 @@ Union = Attr* Visibility? 'union' Name GenericParamList? WhereClause? RecordFieldList +Const = + Attr* Visibility? 'default'? 'const' (Name | '_') ':' ascribed_type:TypeRef + '=' body:Expr ';' + +Static = + Attr* Visibility? 'static'? 'mut'? Name ':' ascribed_type:TypeRef + '=' body:Expr ';' + TraitDef = Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList (':' TypeBoundList?)? WhereClause @@ -120,14 +128,6 @@ TraitDef = AssocItemList = '{' AssocItem* '}' -ConstDef = - Attr* Visibility? 'default'? 'const' Name ':' ascribed_type:TypeRef - '=' body:Expr ';' - -StaticDef = - Attr* Visibility? 'static'? 'mut'? 'static' Name ':' ascribed_type:TypeRef - '=' body:Expr ';' - ImplDef = Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' GenericParamList? '!'? 'for' WhereClause? @@ -475,11 +475,11 @@ TypeRef = AssocItem = Fn | TypeAlias -| ConstDef +| Const | MacroCall ExternItem = - Fn | StaticDef + Fn | Static AttrInput = Literal -- cgit v1.2.3