diff options
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/codegen/rust.ungram | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 02f5aa732..aca23890c 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -1,3 +1,7 @@ | |||
1 | //*************************// | ||
2 | // Names, Paths and Macros // | ||
3 | //*************************// | ||
4 | |||
1 | Name = | 5 | Name = |
2 | 'ident' | 6 | 'ident' |
3 | 7 | ||
@@ -50,6 +54,10 @@ MacroStmts = | |||
50 | statements:Stmt* | 54 | statements:Stmt* |
51 | Expr? | 55 | Expr? |
52 | 56 | ||
57 | //*************************// | ||
58 | // Items // | ||
59 | //*************************// | ||
60 | |||
53 | SourceFile = | 61 | SourceFile = |
54 | 'shebang'? | 62 | 'shebang'? |
55 | Attr* | 63 | Attr* |
@@ -245,6 +253,10 @@ Visibility = | |||
245 | Attr = | 253 | Attr = |
246 | '#' '!'? '[' Path ('=' Literal | TokenTree)? ']' | 254 | '#' '!'? '[' Path ('=' Literal | TokenTree)? ']' |
247 | 255 | ||
256 | //****************************// | ||
257 | // Statements and Expressions // | ||
258 | //****************************// | ||
259 | |||
248 | Stmt = | 260 | Stmt = |
249 | ExprStmt | 261 | ExprStmt |
250 | | Item | 262 | | Item |
@@ -347,7 +359,7 @@ IndexExpr = | |||
347 | Attr* base:Expr '[' index:Expr ']' | 359 | Attr* base:Expr '[' index:Expr ']' |
348 | 360 | ||
349 | TupleExpr = | 361 | TupleExpr = |
350 | Attr* '(' Attr* (Expr (',' Expr)* ','?)? ')' | 362 | Attr* '(' Attr* fields:(Expr (',' Expr)* ','?)? ')' |
351 | 363 | ||
352 | RecordExpr = | 364 | RecordExpr = |
353 | Path RecordExprFieldList | 365 | Path RecordExprFieldList |
@@ -434,6 +446,10 @@ AwaitExpr = | |||
434 | BoxExpr = | 446 | BoxExpr = |
435 | Attr* 'box' Expr | 447 | Attr* 'box' Expr |
436 | 448 | ||
449 | //*************************// | ||
450 | // Types // | ||
451 | //*************************// | ||
452 | |||
437 | Type = | 453 | Type = |
438 | ArrayType | 454 | ArrayType |
439 | | DynTraitType | 455 | | DynTraitType |
@@ -495,6 +511,10 @@ TypeBound = | |||
495 | 'lifetime' | 511 | 'lifetime' |
496 | | '?'? Type | 512 | | '?'? Type |
497 | 513 | ||
514 | //************************// | ||
515 | // Patterns // | ||
516 | //************************// | ||
517 | |||
498 | Pat = | 518 | Pat = |
499 | IdentPat | 519 | IdentPat |
500 | | BoxPat | 520 | | BoxPat |
@@ -540,16 +560,16 @@ RecordPatField = | |||
540 | Attr* (NameRef ':')? Pat | 560 | Attr* (NameRef ':')? Pat |
541 | 561 | ||
542 | TupleStructPat = | 562 | TupleStructPat = |
543 | Path '(' args:(Pat (',' Pat)* ','?)? ')' | 563 | Path '(' fields:(Pat (',' Pat)* ','?)? ')' |
544 | 564 | ||
545 | TuplePat = | 565 | TuplePat = |
546 | '(' args:(Pat (',' Pat)* ','?)? ')' | 566 | '(' fields:(Pat (',' Pat)* ','?)? ')' |
547 | 567 | ||
548 | ParenPat = | 568 | ParenPat = |
549 | '(' Pat ')' | 569 | '(' Pat ')' |
550 | 570 | ||
551 | SlicePat = | 571 | SlicePat = |
552 | '[' args:(Pat (',' Pat)* ','?)? ']' | 572 | '[' (Pat (',' Pat)* ','?)? ']' |
553 | 573 | ||
554 | PathPat = | 574 | PathPat = |
555 | Path | 575 | Path |