diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-31 19:12:38 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-31 19:12:38 +0100 |
commit | 38ab326aac70484cb951fe9389d788d525d41550 (patch) | |
tree | 0032223efeefca76340fb0a97f6f12d0e432a2a9 /xtask/src/codegen | |
parent | 5cade89d730b025082ff2df70aace259951a9ccf (diff) | |
parent | 98181087984157e27faba0b969e384f3c62c39d5 (diff) |
Merge #5631
5631: Finalize pattern grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'xtask/src/codegen')
-rw-r--r-- | xtask/src/codegen/rust.ungram | 129 |
1 files changed, 65 insertions, 64 deletions
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 2e3b45011..7685f4f06 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -1,3 +1,9 @@ | |||
1 | Name = | ||
2 | 'ident' | ||
3 | |||
4 | NameRef = | ||
5 | 'ident' | 'int_number' | ||
6 | |||
1 | Path = | 7 | Path = |
2 | (qualifier:Path '::')? segment:PathSegment | 8 | (qualifier:Path '::')? segment:PathSegment |
3 | 9 | ||
@@ -29,6 +35,21 @@ LifetimeArg = | |||
29 | ConstArg = | 35 | ConstArg = |
30 | Expr | 36 | Expr |
31 | 37 | ||
38 | MacroCall = | ||
39 | Attr* Path '!' Name? TokenTree ';'? | ||
40 | |||
41 | TokenTree = | ||
42 | '(' ')' | ||
43 | | '{' '}' | ||
44 | | '[' ']' | ||
45 | |||
46 | MacroItems = | ||
47 | Item* | ||
48 | |||
49 | MacroStmts = | ||
50 | statements:Stmt* | ||
51 | Expr? | ||
52 | |||
32 | SourceFile = | 53 | SourceFile = |
33 | 'shebang'? | 54 | 'shebang'? |
34 | Attr* | 55 | Attr* |
@@ -475,93 +496,73 @@ TypeBound = | |||
475 | 'lifetime' | 496 | 'lifetime' |
476 | | '?'? Type | 497 | | '?'? Type |
477 | 498 | ||
478 | OrPat = | 499 | Pat = |
479 | Pat* | 500 | IdentPat |
480 | 501 | | BoxPat | |
481 | ParenPat = | 502 | | DotDotPat |
482 | '(' Pat ')' | 503 | | LiteralPat |
483 | 504 | | MacroPat | |
484 | RefPat = | 505 | | OrPat |
485 | '&' 'mut'? Pat | 506 | | ParenPat |
507 | | PathPat | ||
508 | | WildcardPat | ||
509 | | RangePat | ||
510 | | RecordPat | ||
511 | | RefPat | ||
512 | | SlicePat | ||
513 | | TuplePat | ||
514 | | TupleStructPat | ||
486 | 515 | ||
487 | BoxPat = | 516 | LiteralPat = |
488 | 'box' Path | 517 | Literal |
489 | 518 | ||
490 | BindPat = | 519 | IdentPat = |
491 | Attr* 'ref'? 'mut'? Name ('@' Pat)? | 520 | Attr* 'ref'? 'mut'? Name ('@' Pat)? |
492 | 521 | ||
493 | PlaceholderPat = | 522 | WildcardPat = |
494 | '_' | 523 | '_' |
495 | 524 | ||
496 | DotDotPat = | ||
497 | '..' | ||
498 | |||
499 | PathPat = | ||
500 | Path | ||
501 | |||
502 | SlicePat = | ||
503 | '[' args:Pat* ']' | ||
504 | |||
505 | RangePat = | 525 | RangePat = |
506 | '..' | '..=' | 526 | start:Pat op:('..' | '..=') end:Pat |
507 | |||
508 | LiteralPat = | ||
509 | Literal | ||
510 | 527 | ||
511 | MacroPat = | 528 | RefPat = |
512 | MacroCall | 529 | '&' 'mut'? Pat |
513 | 530 | ||
514 | RecordPat = | 531 | RecordPat = |
515 | Path RecordFieldPatList | 532 | Path RecordPatFieldList |
516 | 533 | ||
517 | RecordFieldPatList = | 534 | RecordPatFieldList = |
518 | '{' | 535 | '{' |
519 | record_field_pats:RecordFieldPat* | 536 | fields:(RecordPatField (',' RecordPatField)* ','?) |
520 | BindPat* | ||
521 | '..'? | 537 | '..'? |
522 | '}' | 538 | '}' |
523 | 539 | ||
524 | RecordFieldPat = | 540 | RecordPatField = |
525 | Attr* NameRef ':' Pat | 541 | Attr* (NameRef ':')? Pat |
526 | 542 | ||
527 | TupleStructPat = | 543 | TupleStructPat = |
528 | Path '(' args:Pat* ')' | 544 | Path '(' args:(Pat (',' Pat)* ','?)? ')' |
529 | 545 | ||
530 | TuplePat = | 546 | TuplePat = |
531 | '(' args:Pat* ')' | 547 | '(' args:(Pat (',' Pat)* ','?)? ')' |
532 | 548 | ||
533 | Name = | 549 | ParenPat = |
534 | 'ident' | 550 | '(' Pat ')' |
535 | 551 | ||
536 | NameRef = | 552 | SlicePat = |
537 | 'ident' | 'int_number' | 553 | '[' args:(Pat (',' Pat)* ','?)? ']' |
538 | 554 | ||
539 | MacroCall = | 555 | PathPat = |
540 | Attr* Path '!' Name? TokenTree ';'? | 556 | Path |
541 | 557 | ||
542 | TokenTree = | 558 | OrPat = |
543 | '(' ')' | '{' '}' | '[' ']' | 559 | (Pat ('|' Pat)* '|'?) |
544 | 560 | ||
545 | MacroItems = | 561 | BoxPat = |
546 | Item* | 562 | 'box' Pat |
547 | 563 | ||
548 | MacroStmts = | 564 | DotDotPat = |
549 | statements:Stmt* | 565 | '..' |
550 | Expr? | ||
551 | 566 | ||
552 | Pat = | 567 | MacroPat = |
553 | OrPat | 568 | MacroCall |
554 | | ParenPat | ||
555 | | RefPat | ||
556 | | BoxPat | ||
557 | | BindPat | ||
558 | | PlaceholderPat | ||
559 | | DotDotPat | ||
560 | | PathPat | ||
561 | | RecordPat | ||
562 | | TupleStructPat | ||
563 | | TuplePat | ||
564 | | SlicePat | ||
565 | | RangePat | ||
566 | | LiteralPat | ||
567 | | MacroPat | ||