From 2984da672e0c73d56501c6b6e4d19fd28152b5eb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 11:42:51 +0200 Subject: Split ItemList & AssocItemList --- xtask/src/ast_src.rs | 1 + xtask/src/codegen/rust.ungram | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'xtask/src') diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 83449437b..d2a408e77 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -186,6 +186,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "TUPLE_FIELD_DEF", "ENUM_VARIANT_LIST", "ITEM_LIST", + "ASSOC_ITEM_LIST", "ATTR", "META_ITEM", // not an item actually "USE_TREE", diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index a93cb3815..d0518cead 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -19,6 +19,13 @@ Item = | UnionDef | UseItem +Module = + Attr* Visibility? 'mod' Name + (ItemList | ';') + +ItemList = + '{' Item* '}' + FnDef = Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList? ParamList RetType? @@ -67,17 +74,10 @@ EnumVariant = TraitDef = Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name TypeParamList (':' TypeBoundList?)? WhereClause - ItemList + AssocItemList -Module = - Attr* Visibility? 'mod' Name - (ItemList | ';') - -ItemList = - '{' - AssocItem* - Item* - '}' +AssocItemList = + '{' AssocItem* '}' ConstDef = Attr* Visibility? 'default'? 'const' Name ':' ascribed_type:TypeRef @@ -94,7 +94,7 @@ TypeAliasDef = ImplDef = Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for' WhereClause? - ItemList + AssocItemList ParenType = '(' TypeRef ')' @@ -467,6 +467,7 @@ AssocItem = FnDef | TypeAliasDef | ConstDef +| MacroCall ExternItem = FnDef | StaticDef -- cgit v1.2.3 From 7d09e5ed618b9b9d6e00b57b24db0b9c8a8c12d7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 11:44:22 +0200 Subject: Finish Module grammar --- xtask/src/codegen/rust.ungram | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xtask/src') diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index d0518cead..470ac8c8f 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -24,7 +24,7 @@ Module = (ItemList | ';') ItemList = - '{' Item* '}' + '{' Attr* Item* '}' FnDef = Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList? -- cgit v1.2.3