diff options
author | Aleksey Kladov <[email protected]> | 2020-04-10 09:35:39 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-10 15:10:28 +0100 |
commit | 779f06ed77e868b9409a1724f736a045415d4922 (patch) | |
tree | 07bc6a57f62adce315ca5779329b66990c4f9a16 /xtask | |
parent | 548f562ddad3bca515b304f82e110aeb319591e3 (diff) |
Convert more tokens
Diffstat (limited to 'xtask')
-rw-r--r-- | xtask/src/ast_src.rs | 66 | ||||
-rw-r--r-- | xtask/src/codegen/gen_syntax.rs | 2 |
2 files changed, 19 insertions, 49 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 943c91e23..f9cd12d0d 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -354,7 +354,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
354 | } | 354 | } |
355 | struct EnumVariant: VisibilityOwner, NameOwner, DocCommentsOwner, AttrsOwner { | 355 | struct EnumVariant: VisibilityOwner, NameOwner, DocCommentsOwner, AttrsOwner { |
356 | FieldDefList, | 356 | FieldDefList, |
357 | Eq, | 357 | T![=], |
358 | Expr | 358 | Expr |
359 | } | 359 | } |
360 | 360 | ||
@@ -380,7 +380,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
380 | struct ConstDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { | 380 | struct ConstDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { |
381 | T![default], | 381 | T![default], |
382 | T![const], | 382 | T![const], |
383 | Eq, | 383 | T![=], |
384 | body: Expr, | 384 | body: Expr, |
385 | T![;] | 385 | T![;] |
386 | } | 386 | } |
@@ -388,7 +388,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
388 | struct StaticDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { | 388 | struct StaticDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { |
389 | T![static], | 389 | T![static], |
390 | T![mut], | 390 | T![mut], |
391 | Eq, | 391 | T![=], |
392 | body: Expr, | 392 | body: Expr, |
393 | T![;] | 393 | T![;] |
394 | } | 394 | } |
@@ -396,7 +396,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
396 | struct TypeAliasDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeBoundsOwner { | 396 | struct TypeAliasDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeBoundsOwner { |
397 | T![default], | 397 | T![default], |
398 | T![type], | 398 | T![type], |
399 | Eq, | 399 | T![=], |
400 | TypeRef, | 400 | TypeRef, |
401 | T![;] | 401 | T![;] |
402 | } | 402 | } |
@@ -406,14 +406,14 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
406 | T![const], | 406 | T![const], |
407 | T![unsafe], | 407 | T![unsafe], |
408 | T![impl], | 408 | T![impl], |
409 | Excl, | 409 | T![!], |
410 | T![for], | 410 | T![for], |
411 | ItemList, | 411 | ItemList, |
412 | } | 412 | } |
413 | 413 | ||
414 | struct ParenType { T!['('], TypeRef, T![')'] } | 414 | struct ParenType { T!['('], TypeRef, T![')'] } |
415 | struct TupleType { T!['('], fields: [TypeRef], T![')'] } | 415 | struct TupleType { T!['('], fields: [TypeRef], T![')'] } |
416 | struct NeverType { Excl } | 416 | struct NeverType { T![!] } |
417 | struct PathType { Path } | 417 | struct PathType { Path } |
418 | struct PointerType { Star, T![const], T![mut], TypeRef } | 418 | struct PointerType { Star, T![const], T![mut], TypeRef } |
419 | struct ArrayType { T!['['], TypeRef, T![;], Expr, T![']'] } | 419 | struct ArrayType { T!['['], TypeRef, T![;], Expr, T![']'] } |
@@ -465,7 +465,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
465 | struct PrefixExpr: AttrsOwner { PrefixOp, Expr } | 465 | struct PrefixExpr: AttrsOwner { PrefixOp, Expr } |
466 | struct BoxExpr: AttrsOwner { T![box], Expr } | 466 | struct BoxExpr: AttrsOwner { T![box], Expr } |
467 | struct RangeExpr: AttrsOwner { RangeOp } | 467 | struct RangeExpr: AttrsOwner { RangeOp } |
468 | struct BinExpr: AttrsOwner { BinOp } | 468 | struct BinExpr: AttrsOwner { /*BinOp*/ } |
469 | struct Literal { LiteralToken } | 469 | struct Literal { LiteralToken } |
470 | 470 | ||
471 | struct MatchExpr: AttrsOwner { T![match], Expr, MatchArmList } | 471 | struct MatchExpr: AttrsOwner { T![match], Expr, MatchArmList } |
@@ -520,9 +520,9 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
520 | struct NameRef { NameRefToken } | 520 | struct NameRef { NameRefToken } |
521 | 521 | ||
522 | struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner { | 522 | struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner { |
523 | Path, Excl, TokenTree, T![;] | 523 | Path, T![!], TokenTree, T![;] |
524 | } | 524 | } |
525 | struct Attr { Pound, Excl, T!['['], Path, Eq, input: AttrInput, T![']'] } | 525 | struct Attr { Pound, T![!], T!['['], Path, T![=], input: AttrInput, T![']'] } |
526 | struct TokenTree {} | 526 | struct TokenTree {} |
527 | struct TypeParamList { | 527 | struct TypeParamList { |
528 | LAngle, | 528 | LAngle, |
@@ -533,11 +533,11 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
533 | RAngle | 533 | RAngle |
534 | } | 534 | } |
535 | struct TypeParam: NameOwner, AttrsOwner, TypeBoundsOwner { | 535 | struct TypeParam: NameOwner, AttrsOwner, TypeBoundsOwner { |
536 | Eq, | 536 | T![=], |
537 | default_type: TypeRef, | 537 | default_type: TypeRef, |
538 | } | 538 | } |
539 | struct ConstParam: NameOwner, AttrsOwner, TypeAscriptionOwner { | 539 | struct ConstParam: NameOwner, AttrsOwner, TypeAscriptionOwner { |
540 | Eq, | 540 | T![=], |
541 | default_val: Expr, | 541 | default_val: Expr, |
542 | } | 542 | } |
543 | struct LifetimeParam: AttrsOwner { Lifetime} | 543 | struct LifetimeParam: AttrsOwner { Lifetime} |
@@ -550,11 +550,11 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
550 | struct LetStmt: AttrsOwner, TypeAscriptionOwner { | 550 | struct LetStmt: AttrsOwner, TypeAscriptionOwner { |
551 | T![let], | 551 | T![let], |
552 | Pat, | 552 | Pat, |
553 | Eq, | 553 | T![=], |
554 | initializer: Expr, | 554 | initializer: Expr, |
555 | T![;], | 555 | T![;], |
556 | } | 556 | } |
557 | struct Condition { T![let], Pat, Eq, Expr } | 557 | struct Condition { T![let], Pat, T![=], Expr } |
558 | struct Block: AttrsOwner, ModuleItemOwner { | 558 | struct Block: AttrsOwner, ModuleItemOwner { |
559 | T!['{'], | 559 | T!['{'], |
560 | statements: [Stmt], | 560 | statements: [Stmt], |
@@ -607,9 +607,9 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
607 | RAngle | 607 | RAngle |
608 | } | 608 | } |
609 | struct TypeArg { TypeRef } | 609 | struct TypeArg { TypeRef } |
610 | struct AssocTypeArg : TypeBoundsOwner { NameRef, Eq, TypeRef } | 610 | struct AssocTypeArg : TypeBoundsOwner { NameRef, T![=], TypeRef } |
611 | struct LifetimeArg { Lifetime } | 611 | struct LifetimeArg { Lifetime } |
612 | struct ConstArg { Literal, Eq, BlockExpr } | 612 | struct ConstArg { Literal, T![=], BlockExpr } |
613 | 613 | ||
614 | struct MacroItems: ModuleItemOwner{ } | 614 | struct MacroItems: ModuleItemOwner{ } |
615 | 615 | ||
@@ -630,7 +630,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
630 | } | 630 | } |
631 | 631 | ||
632 | struct MetaItem { | 632 | struct MetaItem { |
633 | Path, Eq, AttrInput, nested_meta_items: [MetaItem] | 633 | Path, T![=], AttrInput, nested_meta_items: [MetaItem] |
634 | } | 634 | } |
635 | 635 | ||
636 | struct MacroDef { | 636 | struct MacroDef { |
@@ -771,41 +771,9 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
771 | token_enums: &ast_enums! { | 771 | token_enums: &ast_enums! { |
772 | enum RangeSeparator { Dotdot, Dotdotdot, Dotdoteq} | 772 | enum RangeSeparator { Dotdot, Dotdotdot, Dotdoteq} |
773 | 773 | ||
774 | enum BinOp { | ||
775 | Pipepipe, | ||
776 | Ampamp, | ||
777 | Eqeq, | ||
778 | Neq, | ||
779 | Lteq, | ||
780 | Gteq, | ||
781 | LAngle, | ||
782 | RAngle, | ||
783 | Plus, | ||
784 | Star, | ||
785 | Minus, | ||
786 | Slash, | ||
787 | Percent, | ||
788 | Shl, | ||
789 | Shr, | ||
790 | Caret, | ||
791 | Pipe, | ||
792 | Amp, | ||
793 | Eq, | ||
794 | Pluseq, | ||
795 | Slasheq, | ||
796 | Stareq, | ||
797 | Percenteq, | ||
798 | Shreq, | ||
799 | Shleq, | ||
800 | Minuseq, | ||
801 | Pipeeq, | ||
802 | Ampeq, | ||
803 | Careteq, | ||
804 | } | ||
805 | |||
806 | enum PrefixOp { | 774 | enum PrefixOp { |
807 | Minus, | 775 | Minus, |
808 | Excl, | 776 | T![!], |
809 | Star | 777 | Star |
810 | } | 778 | } |
811 | 779 | ||
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index a903d1da7..4c9e447a3 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs | |||
@@ -535,6 +535,8 @@ impl Field<'_> { | |||
535 | "')'" => "r_paren", | 535 | "')'" => "r_paren", |
536 | "'['" => "l_brack", | 536 | "'['" => "l_brack", |
537 | "']'" => "r_brack", | 537 | "']'" => "r_brack", |
538 | "=" => "eq", | ||
539 | "!" => "excl", | ||
538 | _ => name, | 540 | _ => name, |
539 | }; | 541 | }; |
540 | format_ident!("{}_token", name) | 542 | format_ident!("{}_token", name) |