diff options
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/ast_src.rs | 8 | ||||
-rw-r--r-- | xtask/src/codegen/rust.ungram | 129 |
2 files changed, 69 insertions, 68 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 762d9265e..2ff029158 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -126,13 +126,13 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
126 | "PAREN_PAT", | 126 | "PAREN_PAT", |
127 | "REF_PAT", | 127 | "REF_PAT", |
128 | "BOX_PAT", | 128 | "BOX_PAT", |
129 | "BIND_PAT", | 129 | "IDENT_PAT", |
130 | "PLACEHOLDER_PAT", | 130 | "WILDCARD_PAT", |
131 | "DOT_DOT_PAT", | 131 | "DOT_DOT_PAT", |
132 | "PATH_PAT", | 132 | "PATH_PAT", |
133 | "RECORD_PAT", | 133 | "RECORD_PAT", |
134 | "RECORD_FIELD_PAT_LIST", | 134 | "RECORD_PAT_FIELD_LIST", |
135 | "RECORD_FIELD_PAT", | 135 | "RECORD_PAT_FIELD", |
136 | "TUPLE_STRUCT_PAT", | 136 | "TUPLE_STRUCT_PAT", |
137 | "TUPLE_PAT", | 137 | "TUPLE_PAT", |
138 | "SLICE_PAT", | 138 | "SLICE_PAT", |
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 | ||