aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-30 10:51:20 +0100
committerGitHub <[email protected]>2020-07-30 10:51:20 +0100
commit74864d560b9293174c82fdee2b9d15991ebf075f (patch)
treef76a250431629a36d225d456ed41f393aaa9a579 /xtask
parent72ffd851dd5b0fcdf3aa072131ba11009878b4ae (diff)
parent7d09e5ed618b9b9d6e00b57b24db0b9c8a8c12d7 (diff)
Merge #5582
5582: Finish Module grammar r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/ast_src.rs1
-rw-r--r--xtask/src/codegen/rust.ungram23
2 files changed, 13 insertions, 11 deletions
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 {
186 "TUPLE_FIELD_DEF", 186 "TUPLE_FIELD_DEF",
187 "ENUM_VARIANT_LIST", 187 "ENUM_VARIANT_LIST",
188 "ITEM_LIST", 188 "ITEM_LIST",
189 "ASSOC_ITEM_LIST",
189 "ATTR", 190 "ATTR",
190 "META_ITEM", // not an item actually 191 "META_ITEM", // not an item actually
191 "USE_TREE", 192 "USE_TREE",
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index a93cb3815..470ac8c8f 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -19,6 +19,13 @@ Item =
19| UnionDef 19| UnionDef
20| UseItem 20| UseItem
21 21
22Module =
23 Attr* Visibility? 'mod' Name
24 (ItemList | ';')
25
26ItemList =
27 '{' Attr* Item* '}'
28
22FnDef = 29FnDef =
23 Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList? 30 Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList?
24 ParamList RetType? 31 ParamList RetType?
@@ -67,17 +74,10 @@ EnumVariant =
67TraitDef = 74TraitDef =
68 Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name TypeParamList 75 Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name TypeParamList
69 (':' TypeBoundList?)? WhereClause 76 (':' TypeBoundList?)? WhereClause
70 ItemList 77 AssocItemList
71 78
72Module = 79AssocItemList =
73 Attr* Visibility? 'mod' Name 80 '{' AssocItem* '}'
74 (ItemList | ';')
75
76ItemList =
77 '{'
78 AssocItem*
79 Item*
80 '}'
81 81
82ConstDef = 82ConstDef =
83 Attr* Visibility? 'default'? 'const' Name ':' ascribed_type:TypeRef 83 Attr* Visibility? 'default'? 'const' Name ':' ascribed_type:TypeRef
@@ -94,7 +94,7 @@ TypeAliasDef =
94ImplDef = 94ImplDef =
95 Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for' 95 Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for'
96 WhereClause? 96 WhereClause?
97 ItemList 97 AssocItemList
98 98
99ParenType = 99ParenType =
100 '(' TypeRef ')' 100 '(' TypeRef ')'
@@ -467,6 +467,7 @@ AssocItem =
467 FnDef 467 FnDef
468| TypeAliasDef 468| TypeAliasDef
469| ConstDef 469| ConstDef
470| MacroCall
470 471
471ExternItem = 472ExternItem =
472 FnDef | StaticDef 473 FnDef | StaticDef