diff options
Diffstat (limited to 'xtask/src/codegen/rust.ungram')
-rw-r--r-- | xtask/src/codegen/rust.ungram | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 449b0242f..760a8dd95 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -8,14 +8,14 @@ Item = | |||
8 | | EnumDef | 8 | | EnumDef |
9 | | ExternBlock | 9 | | ExternBlock |
10 | | ExternCrate | 10 | | ExternCrate |
11 | | FnDef | 11 | | Fn |
12 | | ImplDef | 12 | | ImplDef |
13 | | MacroCall | 13 | | MacroCall |
14 | | Module | 14 | | Module |
15 | | StaticDef | 15 | | StaticDef |
16 | | StructDef | 16 | | StructDef |
17 | | TraitDef | 17 | | TraitDef |
18 | | TypeAliasDef | 18 | | TypeAlias |
19 | | UnionDef | 19 | | UnionDef |
20 | | Use | 20 | | Use |
21 | 21 | ||
@@ -42,15 +42,40 @@ UseTree = | |||
42 | UseTreeList = | 42 | UseTreeList = |
43 | '{' (UseTree (',' UseTree)* ','?)? '}' | 43 | '{' (UseTree (',' UseTree)* ','?)? '}' |
44 | 44 | ||
45 | FnDef = | 45 | Fn = |
46 | Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList? | 46 | Attr* Visibility? |
47 | ParamList RetType? | 47 | 'default'? ('async' | 'const')? 'unsafe'? Abi? |
48 | 'fn' Name TypeParamList? ParamList RetType? | ||
48 | WhereClause? | 49 | WhereClause? |
49 | (body:BlockExpr | ';') | 50 | (body:BlockExpr | ';') |
50 | 51 | ||
52 | Abi = | ||
53 | 'extern' 'string'? | ||
54 | |||
55 | ParamList = | ||
56 | '('( | ||
57 | (Param (',' Param)* ','?)? | ||
58 | | SelfParam ','? | ||
59 | | SelfParam ',' (Param (',' Param)* ','?) | ||
60 | )')' | ||
61 | |||
62 | SelfParam = | ||
63 | Attr* ( | ||
64 | ('&' 'lifetime'?)? 'mut'? 'self' | ||
65 | | 'mut'? 'self' ':' ascribed_type:TypeRef | ||
66 | ) | ||
67 | |||
68 | Param = | ||
69 | Attr* Pat (':' ascribed_type:TypeRef) | ||
70 | | '...' | ||
71 | |||
51 | RetType = | 72 | RetType = |
52 | '->' TypeRef | 73 | '->' TypeRef |
53 | 74 | ||
75 | TypeAlias = | ||
76 | Attr* Visibility? 'default'? 'type' Name TypeParamList? (':' TypeBoundList?)? WhereClause? | ||
77 | '=' TypeRef ';' | ||
78 | |||
54 | StructDef = | 79 | StructDef = |
55 | Attr* Visibility? 'struct' Name TypeParamList? ( | 80 | Attr* Visibility? 'struct' Name TypeParamList? ( |
56 | WhereClause? (RecordFieldDefList | ';') | 81 | WhereClause? (RecordFieldDefList | ';') |
@@ -103,10 +128,6 @@ StaticDef = | |||
103 | Attr* Visibility? 'static'? 'mut'? 'static' Name ':' ascribed_type:TypeRef | 128 | Attr* Visibility? 'static'? 'mut'? 'static' Name ':' ascribed_type:TypeRef |
104 | '=' body:Expr ';' | 129 | '=' body:Expr ';' |
105 | 130 | ||
106 | TypeAliasDef = | ||
107 | Attr* Visibility? 'default'? 'type' Name TypeParamList? WhereClause? (':' TypeBoundList?)? | ||
108 | '=' TypeRef ';' | ||
109 | |||
110 | ImplDef = | 131 | ImplDef = |
111 | Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for' | 132 | Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for' |
112 | WhereClause? | 133 | WhereClause? |
@@ -388,9 +409,6 @@ WherePred = | |||
388 | WhereClause = | 409 | WhereClause = |
389 | 'where' predicates:WherePred* | 410 | 'where' predicates:WherePred* |
390 | 411 | ||
391 | Abi = | ||
392 | 'string' | ||
393 | |||
394 | ExprStmt = | 412 | ExprStmt = |
395 | Attr* Expr ';' | 413 | Attr* Expr ';' |
396 | 414 | ||
@@ -398,16 +416,6 @@ LetStmt = | |||
398 | Attr* 'let' Pat (':' ascribed_type:TypeRef) | 416 | Attr* 'let' Pat (':' ascribed_type:TypeRef) |
399 | '=' initializer:Expr ';' | 417 | '=' initializer:Expr ';' |
400 | 418 | ||
401 | ParamList = | ||
402 | '(' SelfParam Param* ')' | ||
403 | |||
404 | SelfParam = | ||
405 | Attr* ('&' 'lifetime'?)? 'mut'? 'self' (':' ascribed_type:TypeRef) | ||
406 | |||
407 | Param = | ||
408 | Attr* Pat (':' ascribed_type:TypeRef) | ||
409 | | '...' | ||
410 | |||
411 | Path = | 419 | Path = |
412 | (qualifier:Path '::')? segment:PathSegment | 420 | (qualifier:Path '::')? segment:PathSegment |
413 | 421 | ||
@@ -465,13 +473,13 @@ TypeRef = | |||
465 | | DynTraitType | 473 | | DynTraitType |
466 | 474 | ||
467 | AssocItem = | 475 | AssocItem = |
468 | FnDef | 476 | Fn |
469 | | TypeAliasDef | 477 | | TypeAlias |
470 | | ConstDef | 478 | | ConstDef |
471 | | MacroCall | 479 | | MacroCall |
472 | 480 | ||
473 | ExternItem = | 481 | ExternItem = |
474 | FnDef | StaticDef | 482 | Fn | StaticDef |
475 | 483 | ||
476 | AttrInput = | 484 | AttrInput = |
477 | Literal | 485 | Literal |