diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 17:52:02 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 17:52:02 +0100 |
commit | 3dce34aaf83c67836c94a526cb90eba8f36e3985 (patch) | |
tree | 43f1d76098133aa12a1f228c8dc3ec9503bebc8e /xtask/src/codegen | |
parent | 917c89c103597d09e95bdee273633f79123dd19e (diff) |
Introduce GenericParam
Diffstat (limited to 'xtask/src/codegen')
-rw-r--r-- | xtask/src/codegen/rust.ungram | 37 |
1 files changed, 19 insertions, 18 deletions
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 = | |||
154 | ExternItem = | 154 | ExternItem = |
155 | Fn | Static | MacroCall | 155 | Fn | Static | MacroCall |
156 | 156 | ||
157 | GenericParamList = | ||
158 | '<' (GenericParam (',' GenericParam)* ','?)? '>' | ||
159 | |||
160 | GenericParam = | ||
161 | LifetimeParam | ||
162 | | TypeParam | ||
163 | | ConstParam | ||
164 | |||
165 | TypeParam = | ||
166 | Attr* Name (':' TypeBoundList?)? | ||
167 | ('=' default_type:TypeRef)? | ||
168 | |||
169 | ConstParam = | ||
170 | Attr* 'const' Name ':' ascribed_type:TypeRef | ||
171 | ('=' default_val:Expr)? | ||
172 | |||
173 | LifetimeParam = | ||
174 | Attr* 'lifetime' | ||
175 | |||
157 | ParenType = | 176 | ParenType = |
158 | '(' TypeRef ')' | 177 | '(' TypeRef ')' |
159 | 178 | ||
@@ -400,24 +419,6 @@ MacroStmts = | |||
400 | Attr = | 419 | Attr = |
401 | '#' '!'? '[' Path ('=' input:AttrInput)? ']' | 420 | '#' '!'? '[' Path ('=' input:AttrInput)? ']' |
402 | 421 | ||
403 | GenericParamList = | ||
404 | '<' | ||
405 | TypeParam* | ||
406 | LifetimeParam* | ||
407 | ConstParam* | ||
408 | '>' | ||
409 | |||
410 | TypeParam = | ||
411 | Attr* Name (':' TypeBoundList?)? | ||
412 | ('=' default_type:TypeRef)? | ||
413 | |||
414 | ConstParam = | ||
415 | Attr* 'const' Name ':' ascribed_type:TypeRef | ||
416 | ('=' default_val:Expr)? | ||
417 | |||
418 | LifetimeParam = | ||
419 | Attr* 'lifetime' | ||
420 | |||
421 | TypeBound = | 422 | TypeBound = |
422 | 'lifetime' | 'const'? TypeRef | 423 | 'lifetime' | 'const'? TypeRef |
423 | 424 | ||