aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-30 17:52:02 +0100
committerAleksey Kladov <[email protected]>2020-07-30 17:52:02 +0100
commit3dce34aaf83c67836c94a526cb90eba8f36e3985 (patch)
tree43f1d76098133aa12a1f228c8dc3ec9503bebc8e /xtask/src
parent917c89c103597d09e95bdee273633f79123dd19e (diff)
Introduce GenericParam
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/ast_src.rs1
-rw-r--r--xtask/src/codegen/rust.ungram37
2 files changed, 20 insertions, 18 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index c7087a14e..114898e38 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -204,6 +204,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
204 "LET_STMT", 204 "LET_STMT",
205 "EXPR_STMT", 205 "EXPR_STMT",
206 "GENERIC_PARAM_LIST", 206 "GENERIC_PARAM_LIST",
207 "GENERIC_PARAM",
207 "LIFETIME_PARAM", 208 "LIFETIME_PARAM",
208 "TYPE_PARAM", 209 "TYPE_PARAM",
209 "CONST_PARAM", 210 "CONST_PARAM",
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index cdd3adf45..4025f7f96 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -154,6 +154,25 @@ ExternItemList =
154ExternItem = 154ExternItem =
155 Fn | Static | MacroCall 155 Fn | Static | MacroCall
156 156
157GenericParamList =
158 '<' (GenericParam (',' GenericParam)* ','?)? '>'
159
160GenericParam =
161 LifetimeParam
162| TypeParam
163| ConstParam
164
165TypeParam =
166 Attr* Name (':' TypeBoundList?)?
167 ('=' default_type:TypeRef)?
168
169ConstParam =
170 Attr* 'const' Name ':' ascribed_type:TypeRef
171 ('=' default_val:Expr)?
172
173LifetimeParam =
174 Attr* 'lifetime'
175
157ParenType = 176ParenType =
158 '(' TypeRef ')' 177 '(' TypeRef ')'
159 178
@@ -400,24 +419,6 @@ MacroStmts =
400Attr = 419Attr =
401 '#' '!'? '[' Path ('=' input:AttrInput)? ']' 420 '#' '!'? '[' Path ('=' input:AttrInput)? ']'
402 421
403GenericParamList =
404 '<'
405 TypeParam*
406 LifetimeParam*
407 ConstParam*
408 '>'
409
410TypeParam =
411 Attr* Name (':' TypeBoundList?)?
412 ('=' default_type:TypeRef)?
413
414ConstParam =
415 Attr* 'const' Name ':' ascribed_type:TypeRef
416 ('=' default_val:Expr)?
417
418LifetimeParam =
419 Attr* 'lifetime'
420
421TypeBound = 422TypeBound =
422 'lifetime' | 'const'? TypeRef 423 'lifetime' | 'const'? TypeRef
423 424