diff options
Diffstat (limited to 'xtask/src/ast_src.rs')
-rw-r--r-- | xtask/src/ast_src.rs | 114 |
1 files changed, 40 insertions, 74 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index f9cd12d0d..554afc76a 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -227,7 +227,6 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
227 | pub(crate) struct AstSrc<'a> { | 227 | pub(crate) struct AstSrc<'a> { |
228 | pub(crate) nodes: &'a [AstNodeSrc<'a>], | 228 | pub(crate) nodes: &'a [AstNodeSrc<'a>], |
229 | pub(crate) enums: &'a [AstEnumSrc<'a>], | 229 | pub(crate) enums: &'a [AstEnumSrc<'a>], |
230 | pub(crate) token_enums: &'a [AstEnumSrc<'a>], | ||
231 | } | 230 | } |
232 | 231 | ||
233 | pub(crate) struct AstNodeSrc<'a> { | 232 | pub(crate) struct AstNodeSrc<'a> { |
@@ -415,11 +414,11 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
415 | struct TupleType { T!['('], fields: [TypeRef], T![')'] } | 414 | struct TupleType { T!['('], fields: [TypeRef], T![')'] } |
416 | struct NeverType { T![!] } | 415 | struct NeverType { T![!] } |
417 | struct PathType { Path } | 416 | struct PathType { Path } |
418 | struct PointerType { Star, T![const], T![mut], TypeRef } | 417 | struct PointerType { T![*], T![const], T![mut], TypeRef } |
419 | struct ArrayType { T!['['], TypeRef, T![;], Expr, T![']'] } | 418 | struct ArrayType { T!['['], TypeRef, T![;], Expr, T![']'] } |
420 | struct SliceType { T!['['], TypeRef, T![']'] } | 419 | struct SliceType { T!['['], TypeRef, T![']'] } |
421 | struct ReferenceType { Amp, Lifetime, T![mut], TypeRef } | 420 | struct ReferenceType { T![&], T![lifetime], T![mut], TypeRef } |
422 | struct PlaceholderType { Underscore } | 421 | struct PlaceholderType { T![_] } |
423 | struct FnPointerType { Abi, T![unsafe], T![fn], ParamList, RetType } | 422 | struct FnPointerType { Abi, T![unsafe], T![fn], ParamList, RetType } |
424 | struct ForType { T![for], TypeParamList, TypeRef } | 423 | struct ForType { T![for], TypeParamList, TypeRef } |
425 | struct ImplTraitType: TypeBoundsOwner { T![impl] } | 424 | struct ImplTraitType: TypeBoundsOwner { T![impl] } |
@@ -447,33 +446,33 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
447 | iterable: Expr, | 446 | iterable: Expr, |
448 | } | 447 | } |
449 | struct WhileExpr: AttrsOwner, LoopBodyOwner { T![while], Condition } | 448 | struct WhileExpr: AttrsOwner, LoopBodyOwner { T![while], Condition } |
450 | struct ContinueExpr: AttrsOwner { T![continue], Lifetime } | 449 | struct ContinueExpr: AttrsOwner { T![continue], T![lifetime] } |
451 | struct BreakExpr: AttrsOwner { T![break], Lifetime, Expr } | 450 | struct BreakExpr: AttrsOwner { T![break], T![lifetime], Expr } |
452 | struct Label { Lifetime } | 451 | struct Label { T![lifetime] } |
453 | struct BlockExpr: AttrsOwner { Label, T![unsafe], Block } | 452 | struct BlockExpr: AttrsOwner { Label, T![unsafe], Block } |
454 | struct ReturnExpr: AttrsOwner { Expr } | 453 | struct ReturnExpr: AttrsOwner { Expr } |
455 | struct CallExpr: ArgListOwner { Expr } | 454 | struct CallExpr: ArgListOwner { Expr } |
456 | struct MethodCallExpr: AttrsOwner, ArgListOwner { | 455 | struct MethodCallExpr: AttrsOwner, ArgListOwner { |
457 | Expr, Dot, NameRef, TypeArgList, | 456 | Expr, T![.], NameRef, TypeArgList, |
458 | } | 457 | } |
459 | struct IndexExpr: AttrsOwner { T!['['], T![']'] } | 458 | struct IndexExpr: AttrsOwner { T!['['], T![']'] } |
460 | struct FieldExpr: AttrsOwner { Expr, Dot, NameRef } | 459 | struct FieldExpr: AttrsOwner { Expr, T![.], NameRef } |
461 | struct AwaitExpr: AttrsOwner { Expr, Dot, T![await] } | 460 | struct AwaitExpr: AttrsOwner { Expr, T![.], T![await] } |
462 | struct TryExpr: AttrsOwner { T![try], Expr } | 461 | struct TryExpr: AttrsOwner { T![try], Expr } |
463 | struct CastExpr: AttrsOwner { Expr, T![as], TypeRef } | 462 | struct CastExpr: AttrsOwner { Expr, T![as], TypeRef } |
464 | struct RefExpr: AttrsOwner { Amp, T![raw], T![mut], Expr } | 463 | struct RefExpr: AttrsOwner { T![&], T![raw], T![mut], Expr } |
465 | struct PrefixExpr: AttrsOwner { PrefixOp, Expr } | 464 | struct PrefixExpr: AttrsOwner { /*PrefixOp,*/ Expr } |
466 | struct BoxExpr: AttrsOwner { T![box], Expr } | 465 | struct BoxExpr: AttrsOwner { T![box], Expr } |
467 | struct RangeExpr: AttrsOwner { RangeOp } | 466 | struct RangeExpr: AttrsOwner { /*RangeOp*/ } |
468 | struct BinExpr: AttrsOwner { /*BinOp*/ } | 467 | struct BinExpr: AttrsOwner { /*BinOp*/ } |
469 | struct Literal { LiteralToken } | 468 | struct Literal { /*LiteralToken*/ } |
470 | 469 | ||
471 | struct MatchExpr: AttrsOwner { T![match], Expr, MatchArmList } | 470 | struct MatchExpr: AttrsOwner { T![match], Expr, MatchArmList } |
472 | struct MatchArmList: AttrsOwner { T!['{'], arms: [MatchArm], T!['}'] } | 471 | struct MatchArmList: AttrsOwner { T!['{'], arms: [MatchArm], T!['}'] } |
473 | struct MatchArm: AttrsOwner { | 472 | struct MatchArm: AttrsOwner { |
474 | pat: Pat, | 473 | pat: Pat, |
475 | guard: MatchGuard, | 474 | guard: MatchGuard, |
476 | FatArrow, | 475 | T![=>], |
477 | Expr, | 476 | Expr, |
478 | } | 477 | } |
479 | struct MatchGuard { T![if], Expr } | 478 | struct MatchGuard { T![if], Expr } |
@@ -482,22 +481,22 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
482 | struct RecordFieldList { | 481 | struct RecordFieldList { |
483 | T!['{'], | 482 | T!['{'], |
484 | fields: [RecordField], | 483 | fields: [RecordField], |
485 | Dotdot, | 484 | T![..], |
486 | spread: Expr, | 485 | spread: Expr, |
487 | T!['}'] | 486 | T!['}'] |
488 | } | 487 | } |
489 | struct RecordField: AttrsOwner { NameRef, Colon, Expr } | 488 | struct RecordField: AttrsOwner { NameRef, T![:], Expr } |
490 | 489 | ||
491 | struct OrPat { pats: [Pat] } | 490 | struct OrPat { pats: [Pat] } |
492 | struct ParenPat { T!['('], Pat, T![')'] } | 491 | struct ParenPat { T!['('], Pat, T![')'] } |
493 | struct RefPat { Amp, T![mut], Pat } | 492 | struct RefPat { T![&], T![mut], Pat } |
494 | struct BoxPat { T![box], Pat } | 493 | struct BoxPat { T![box], Pat } |
495 | struct BindPat: AttrsOwner, NameOwner { T![ref], T![mut], At, Pat } | 494 | struct BindPat: AttrsOwner, NameOwner { T![ref], T![mut], T![@], Pat } |
496 | struct PlaceholderPat { Underscore } | 495 | struct PlaceholderPat { T![_] } |
497 | struct DotDotPat { Dotdot } | 496 | struct DotDotPat { T![..] } |
498 | struct PathPat { Path } | 497 | struct PathPat { Path } |
499 | struct SlicePat { T!['['], args: [Pat], T![']'] } | 498 | struct SlicePat { T!['['], args: [Pat], T![']'] } |
500 | struct RangePat { RangeSeparator } | 499 | struct RangePat { /*RangeSeparator*/ } |
501 | struct LiteralPat { Literal } | 500 | struct LiteralPat { Literal } |
502 | struct MacroPat { MacroCall } | 501 | struct MacroPat { MacroCall } |
503 | 502 | ||
@@ -507,30 +506,30 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
507 | pats: [RecordInnerPat], | 506 | pats: [RecordInnerPat], |
508 | record_field_pats: [RecordFieldPat], | 507 | record_field_pats: [RecordFieldPat], |
509 | bind_pats: [BindPat], | 508 | bind_pats: [BindPat], |
510 | Dotdot, | 509 | T![..], |
511 | T!['}'] | 510 | T!['}'] |
512 | } | 511 | } |
513 | struct RecordFieldPat: AttrsOwner, NameOwner { Colon, Pat } | 512 | struct RecordFieldPat: AttrsOwner, NameOwner { T![:], Pat } |
514 | 513 | ||
515 | struct TupleStructPat { Path, T!['('], args: [Pat], T![')'] } | 514 | struct TupleStructPat { Path, T!['('], args: [Pat], T![')'] } |
516 | struct TuplePat { T!['('], args: [Pat], T![')'] } | 515 | struct TuplePat { T!['('], args: [Pat], T![')'] } |
517 | 516 | ||
518 | struct Visibility { T![pub], T![super], T![self], T![crate] } | 517 | struct Visibility { T![pub], T![super], T![self], T![crate] } |
519 | struct Name { Ident } | 518 | struct Name { T![ident] } |
520 | struct NameRef { NameRefToken } | 519 | struct NameRef { /*NameRefToken*/ } |
521 | 520 | ||
522 | struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner { | 521 | struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner { |
523 | Path, T![!], TokenTree, T![;] | 522 | Path, T![!], TokenTree, T![;] |
524 | } | 523 | } |
525 | struct Attr { Pound, T![!], T!['['], Path, T![=], input: AttrInput, T![']'] } | 524 | struct Attr { T![#], T![!], T!['['], Path, T![=], input: AttrInput, T![']'] } |
526 | struct TokenTree {} | 525 | struct TokenTree {} |
527 | struct TypeParamList { | 526 | struct TypeParamList { |
528 | LAngle, | 527 | T![<], |
529 | generic_params: [GenericParam], | 528 | generic_params: [GenericParam], |
530 | type_params: [TypeParam], | 529 | type_params: [TypeParam], |
531 | lifetime_params: [LifetimeParam], | 530 | lifetime_params: [LifetimeParam], |
532 | const_params: [ConstParam], | 531 | const_params: [ConstParam], |
533 | RAngle | 532 | T![>] |
534 | } | 533 | } |
535 | struct TypeParam: NameOwner, AttrsOwner, TypeBoundsOwner { | 534 | struct TypeParam: NameOwner, AttrsOwner, TypeBoundsOwner { |
536 | T![=], | 535 | T![=], |
@@ -540,12 +539,12 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
540 | T![=], | 539 | T![=], |
541 | default_val: Expr, | 540 | default_val: Expr, |
542 | } | 541 | } |
543 | struct LifetimeParam: AttrsOwner { Lifetime} | 542 | struct LifetimeParam: AttrsOwner { T![lifetime] } |
544 | struct TypeBound { Lifetime, /* Question, */ T![const], /* Question, */ TypeRef} | 543 | struct TypeBound { T![lifetime], /* Question, */ T![const], /* Question, */ TypeRef} |
545 | struct TypeBoundList { bounds: [TypeBound] } | 544 | struct TypeBoundList { bounds: [TypeBound] } |
546 | struct WherePred: TypeBoundsOwner { Lifetime, TypeRef } | 545 | struct WherePred: TypeBoundsOwner { T![lifetime], TypeRef } |
547 | struct WhereClause { T![where], predicates: [WherePred] } | 546 | struct WhereClause { T![where], predicates: [WherePred] } |
548 | struct Abi { String } | 547 | struct Abi { /*String*/ } |
549 | struct ExprStmt: AttrsOwner { Expr, T![;] } | 548 | struct ExprStmt: AttrsOwner { Expr, T![;] } |
550 | struct LetStmt: AttrsOwner, TypeAscriptionOwner { | 549 | struct LetStmt: AttrsOwner, TypeAscriptionOwner { |
551 | T![let], | 550 | T![let], |
@@ -567,17 +566,17 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
567 | params: [Param], | 566 | params: [Param], |
568 | T![')'] | 567 | T![')'] |
569 | } | 568 | } |
570 | struct SelfParam: TypeAscriptionOwner, AttrsOwner { Amp, Lifetime, T![self] } | 569 | struct SelfParam: TypeAscriptionOwner, AttrsOwner { T![&], T![lifetime], T![self] } |
571 | struct Param: TypeAscriptionOwner, AttrsOwner { | 570 | struct Param: TypeAscriptionOwner, AttrsOwner { |
572 | Pat, | 571 | Pat, |
573 | Dotdotdot | 572 | T![...] |
574 | } | 573 | } |
575 | struct UseItem: AttrsOwner, VisibilityOwner { | 574 | struct UseItem: AttrsOwner, VisibilityOwner { |
576 | T![use], | 575 | T![use], |
577 | UseTree, | 576 | UseTree, |
578 | } | 577 | } |
579 | struct UseTree { | 578 | struct UseTree { |
580 | Path, Star, UseTreeList, Alias | 579 | Path, T![*], UseTreeList, Alias |
581 | } | 580 | } |
582 | struct Alias: NameOwner { T![as] } | 581 | struct Alias: NameOwner { T![as] } |
583 | struct UseTreeList { T!['{'], use_trees: [UseTree], T!['}'] } | 582 | struct UseTreeList { T!['{'], use_trees: [UseTree], T!['}'] } |
@@ -594,21 +593,21 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
594 | qualifier: Path, | 593 | qualifier: Path, |
595 | } | 594 | } |
596 | struct PathSegment { | 595 | struct PathSegment { |
597 | Coloncolon, LAngle, NameRef, TypeArgList, ParamList, RetType, PathType, RAngle | 596 | T![::], T![<], NameRef, TypeArgList, ParamList, RetType, PathType, T![>] |
598 | } | 597 | } |
599 | struct TypeArgList { | 598 | struct TypeArgList { |
600 | Coloncolon, | 599 | T![::], |
601 | LAngle, | 600 | T![<], |
602 | generic_args: [GenericArg], | 601 | generic_args: [GenericArg], |
603 | type_args: [TypeArg], | 602 | type_args: [TypeArg], |
604 | lifetime_args: [LifetimeArg], | 603 | lifetime_args: [LifetimeArg], |
605 | assoc_type_args: [AssocTypeArg], | 604 | assoc_type_args: [AssocTypeArg], |
606 | const_args: [ConstArg], | 605 | const_args: [ConstArg], |
607 | RAngle | 606 | T![>] |
608 | } | 607 | } |
609 | struct TypeArg { TypeRef } | 608 | struct TypeArg { TypeRef } |
610 | struct AssocTypeArg : TypeBoundsOwner { NameRef, T![=], TypeRef } | 609 | struct AssocTypeArg : TypeBoundsOwner { NameRef, T![=], TypeRef } |
611 | struct LifetimeArg { Lifetime } | 610 | struct LifetimeArg { T![lifetime] } |
612 | struct ConstArg { Literal, T![=], BlockExpr } | 611 | struct ConstArg { Literal, T![=], BlockExpr } |
613 | 612 | ||
614 | struct MacroItems: ModuleItemOwner{ } | 613 | struct MacroItems: ModuleItemOwner{ } |
@@ -767,37 +766,4 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
767 | TupleFieldDefList, | 766 | TupleFieldDefList, |
768 | } | 767 | } |
769 | }, | 768 | }, |
770 | |||
771 | token_enums: &ast_enums! { | ||
772 | enum RangeSeparator { Dotdot, Dotdotdot, Dotdoteq} | ||
773 | |||
774 | enum PrefixOp { | ||
775 | Minus, | ||
776 | T![!], | ||
777 | Star | ||
778 | } | ||
779 | |||
780 | enum RangeOp { | ||
781 | Dotdot, | ||
782 | Dotdoteq | ||
783 | } | ||
784 | |||
785 | enum LiteralToken { | ||
786 | IntNumber, | ||
787 | FloatNumber, | ||
788 | String, | ||
789 | RawString, | ||
790 | // TrueKw, | ||
791 | // FalseKw, | ||
792 | ByteString, | ||
793 | RawByteString, | ||
794 | Char, | ||
795 | Byte | ||
796 | } | ||
797 | |||
798 | enum NameRefToken { | ||
799 | Ident, | ||
800 | IntNumber | ||
801 | } | ||
802 | }, | ||
803 | }; | 769 | }; |