aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/ast_src.rs8
-rw-r--r--xtask/src/codegen/rust.ungram129
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 @@
1Name =
2 'ident'
3
4NameRef =
5 'ident' | 'int_number'
6
1Path = 7Path =
2 (qualifier:Path '::')? segment:PathSegment 8 (qualifier:Path '::')? segment:PathSegment
3 9
@@ -29,6 +35,21 @@ LifetimeArg =
29ConstArg = 35ConstArg =
30 Expr 36 Expr
31 37
38MacroCall =
39 Attr* Path '!' Name? TokenTree ';'?
40
41TokenTree =
42 '(' ')'
43| '{' '}'
44| '[' ']'
45
46MacroItems =
47 Item*
48
49MacroStmts =
50 statements:Stmt*
51 Expr?
52
32SourceFile = 53SourceFile =
33 'shebang'? 54 'shebang'?
34 Attr* 55 Attr*
@@ -475,93 +496,73 @@ TypeBound =
475 'lifetime' 496 'lifetime'
476| '?'? Type 497| '?'? Type
477 498
478OrPat = 499Pat =
479 Pat* 500 IdentPat
480 501| BoxPat
481ParenPat = 502| DotDotPat
482 '(' Pat ')' 503| LiteralPat
483 504| MacroPat
484RefPat = 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
487BoxPat = 516LiteralPat =
488 'box' Path 517 Literal
489 518
490BindPat = 519IdentPat =
491 Attr* 'ref'? 'mut'? Name ('@' Pat)? 520 Attr* 'ref'? 'mut'? Name ('@' Pat)?
492 521
493PlaceholderPat = 522WildcardPat =
494 '_' 523 '_'
495 524
496DotDotPat =
497 '..'
498
499PathPat =
500 Path
501
502SlicePat =
503 '[' args:Pat* ']'
504
505RangePat = 525RangePat =
506 '..' | '..=' 526 start:Pat op:('..' | '..=') end:Pat
507
508LiteralPat =
509 Literal
510 527
511MacroPat = 528RefPat =
512 MacroCall 529 '&' 'mut'? Pat
513 530
514RecordPat = 531RecordPat =
515 Path RecordFieldPatList 532 Path RecordPatFieldList
516 533
517RecordFieldPatList = 534RecordPatFieldList =
518 '{' 535 '{'
519 record_field_pats:RecordFieldPat* 536 fields:(RecordPatField (',' RecordPatField)* ','?)
520 BindPat*
521 '..'? 537 '..'?
522 '}' 538 '}'
523 539
524RecordFieldPat = 540RecordPatField =
525 Attr* NameRef ':' Pat 541 Attr* (NameRef ':')? Pat
526 542
527TupleStructPat = 543TupleStructPat =
528 Path '(' args:Pat* ')' 544 Path '(' args:(Pat (',' Pat)* ','?)? ')'
529 545
530TuplePat = 546TuplePat =
531 '(' args:Pat* ')' 547 '(' args:(Pat (',' Pat)* ','?)? ')'
532 548
533Name = 549ParenPat =
534 'ident' 550 '(' Pat ')'
535 551
536NameRef = 552SlicePat =
537 'ident' | 'int_number' 553 '[' args:(Pat (',' Pat)* ','?)? ']'
538 554
539MacroCall = 555PathPat =
540 Attr* Path '!' Name? TokenTree ';'? 556 Path
541 557
542TokenTree = 558OrPat =
543 '(' ')' | '{' '}' | '[' ']' 559 (Pat ('|' Pat)* '|'?)
544 560
545MacroItems = 561BoxPat =
546 Item* 562 'box' Pat
547 563
548MacroStmts = 564DotDotPat =
549 statements:Stmt* 565 '..'
550 Expr?
551 566
552Pat = 567MacroPat =
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