From 3dce34aaf83c67836c94a526cb90eba8f36e3985 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:52:02 +0200 Subject: Introduce GenericParam --- xtask/src/codegen/rust.ungram | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'xtask/src/codegen/rust.ungram') 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 = ExternItem = Fn | Static | MacroCall +GenericParamList = + '<' (GenericParam (',' GenericParam)* ','?)? '>' + +GenericParam = + LifetimeParam +| TypeParam +| ConstParam + +TypeParam = + Attr* Name (':' TypeBoundList?)? + ('=' default_type:TypeRef)? + +ConstParam = + Attr* 'const' Name ':' ascribed_type:TypeRef + ('=' default_val:Expr)? + +LifetimeParam = + Attr* 'lifetime' + ParenType = '(' TypeRef ')' @@ -400,24 +419,6 @@ MacroStmts = Attr = '#' '!'? '[' Path ('=' input:AttrInput)? ']' -GenericParamList = - '<' - TypeParam* - LifetimeParam* - ConstParam* - '>' - -TypeParam = - Attr* Name (':' TypeBoundList?)? - ('=' default_type:TypeRef)? - -ConstParam = - Attr* 'const' Name ':' ascribed_type:TypeRef - ('=' default_val:Expr)? - -LifetimeParam = - Attr* 'lifetime' - TypeBound = 'lifetime' | 'const'? TypeRef -- cgit v1.2.3