From 1766aae145c6925a33e427f2fe6ef2a56c301665 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:56:53 +0200 Subject: Rename EnumVariant -> Variant --- xtask/src/codegen/rust.ungram | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'xtask/src/codegen/rust.ungram') diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 9c6797cb7..48d4f4b4a 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -100,12 +100,12 @@ FieldList = Enum = Attr* Visibility? 'enum' Name GenericParamList? WhereClause? - variant_list:EnumVariantList + VariantList -EnumVariantList = - '{' variants:EnumVariant* '}' +VariantList = + '{' Variant* '}' -EnumVariant = +Variant = Attr* Visibility? Name FieldList ('=' Expr)? Union = -- cgit v1.2.3 From 6b25f640a6ad8e2322b5cc0664223b742459336d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:57:58 +0200 Subject: Finalize Enum grammar --- xtask/src/codegen/rust.ungram | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xtask/src/codegen/rust.ungram') diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 48d4f4b4a..b653c14a7 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -103,7 +103,7 @@ Enum = VariantList VariantList = - '{' Variant* '}' + '{' (Variant (',' Variant)* ','?)? '}' Variant = Attr* Visibility? Name FieldList ('=' Expr)? -- cgit v1.2.3 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/codegen/rust.ungram | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'xtask/src/codegen/rust.ungram') 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