diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 220 |
1 files changed, 219 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 94842a514..3471d5226 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -793,6 +793,31 @@ impl AstNode for ExternCrateItem { | |||
793 | 793 | ||
794 | impl ExternCrateItem {} | 794 | impl ExternCrateItem {} |
795 | 795 | ||
796 | // FalseKw | ||
797 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
798 | #[repr(transparent)] | ||
799 | pub struct FalseKw { | ||
800 | pub(crate) syntax: SyntaxNode, | ||
801 | } | ||
802 | unsafe impl TransparentNewType for FalseKw { | ||
803 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
804 | } | ||
805 | |||
806 | impl AstNode for FalseKw { | ||
807 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
808 | match syntax.kind() { | ||
809 | FALSE_KW => Some(FalseKw::from_repr(syntax.into_repr())), | ||
810 | _ => None, | ||
811 | } | ||
812 | } | ||
813 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
814 | fn to_owned(&self) -> TreeArc<FalseKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
815 | } | ||
816 | |||
817 | |||
818 | impl ast::AstToken for FalseKw {} | ||
819 | impl FalseKw {} | ||
820 | |||
796 | // FieldExpr | 821 | // FieldExpr |
797 | #[derive(Debug, PartialEq, Eq, Hash)] | 822 | #[derive(Debug, PartialEq, Eq, Hash)] |
798 | #[repr(transparent)] | 823 | #[repr(transparent)] |
@@ -849,6 +874,31 @@ impl AstNode for FieldPatList { | |||
849 | 874 | ||
850 | impl FieldPatList {} | 875 | impl FieldPatList {} |
851 | 876 | ||
877 | // FloatNumber | ||
878 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
879 | #[repr(transparent)] | ||
880 | pub struct FloatNumber { | ||
881 | pub(crate) syntax: SyntaxNode, | ||
882 | } | ||
883 | unsafe impl TransparentNewType for FloatNumber { | ||
884 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
885 | } | ||
886 | |||
887 | impl AstNode for FloatNumber { | ||
888 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
889 | match syntax.kind() { | ||
890 | FLOAT_NUMBER => Some(FloatNumber::from_repr(syntax.into_repr())), | ||
891 | _ => None, | ||
892 | } | ||
893 | } | ||
894 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
895 | fn to_owned(&self) -> TreeArc<FloatNumber> { TreeArc::cast(self.syntax.to_owned()) } | ||
896 | } | ||
897 | |||
898 | |||
899 | impl ast::AstToken for FloatNumber {} | ||
900 | impl FloatNumber {} | ||
901 | |||
852 | // FnDef | 902 | // FnDef |
853 | #[derive(Debug, PartialEq, Eq, Hash)] | 903 | #[derive(Debug, PartialEq, Eq, Hash)] |
854 | #[repr(transparent)] | 904 | #[repr(transparent)] |
@@ -1130,6 +1180,31 @@ impl AstNode for IndexExpr { | |||
1130 | 1180 | ||
1131 | impl IndexExpr {} | 1181 | impl IndexExpr {} |
1132 | 1182 | ||
1183 | // IntNumber | ||
1184 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1185 | #[repr(transparent)] | ||
1186 | pub struct IntNumber { | ||
1187 | pub(crate) syntax: SyntaxNode, | ||
1188 | } | ||
1189 | unsafe impl TransparentNewType for IntNumber { | ||
1190 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1191 | } | ||
1192 | |||
1193 | impl AstNode for IntNumber { | ||
1194 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1195 | match syntax.kind() { | ||
1196 | INT_NUMBER => Some(IntNumber::from_repr(syntax.into_repr())), | ||
1197 | _ => None, | ||
1198 | } | ||
1199 | } | ||
1200 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1201 | fn to_owned(&self) -> TreeArc<IntNumber> { TreeArc::cast(self.syntax.to_owned()) } | ||
1202 | } | ||
1203 | |||
1204 | |||
1205 | impl ast::AstToken for IntNumber {} | ||
1206 | impl IntNumber {} | ||
1207 | |||
1133 | // ItemList | 1208 | // ItemList |
1134 | #[derive(Debug, PartialEq, Eq, Hash)] | 1209 | #[derive(Debug, PartialEq, Eq, Hash)] |
1135 | #[repr(transparent)] | 1210 | #[repr(transparent)] |
@@ -1327,7 +1402,75 @@ impl AstNode for Literal { | |||
1327 | } | 1402 | } |
1328 | 1403 | ||
1329 | 1404 | ||
1330 | impl Literal {} | 1405 | impl Literal { |
1406 | pub fn literal_expr(&self) -> Option<&LiteralExpr> { | ||
1407 | super::child_opt(self) | ||
1408 | } | ||
1409 | } | ||
1410 | |||
1411 | // LiteralExpr | ||
1412 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1413 | #[repr(transparent)] | ||
1414 | pub struct LiteralExpr { | ||
1415 | pub(crate) syntax: SyntaxNode, | ||
1416 | } | ||
1417 | unsafe impl TransparentNewType for LiteralExpr { | ||
1418 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1419 | } | ||
1420 | |||
1421 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
1422 | pub enum LiteralExprKind<'a> { | ||
1423 | String(&'a String), | ||
1424 | ByteString(&'a ByteString), | ||
1425 | RawString(&'a RawString), | ||
1426 | RawByteString(&'a RawByteString), | ||
1427 | Char(&'a Char), | ||
1428 | Byte(&'a Byte), | ||
1429 | IntNumber(&'a IntNumber), | ||
1430 | FloatNumber(&'a FloatNumber), | ||
1431 | TrueKw(&'a TrueKw), | ||
1432 | FalseKw(&'a FalseKw), | ||
1433 | } | ||
1434 | |||
1435 | impl AstNode for LiteralExpr { | ||
1436 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1437 | match syntax.kind() { | ||
1438 | | STRING | ||
1439 | | BYTE_STRING | ||
1440 | | RAW_STRING | ||
1441 | | RAW_BYTE_STRING | ||
1442 | | CHAR | ||
1443 | | BYTE | ||
1444 | | INT_NUMBER | ||
1445 | | FLOAT_NUMBER | ||
1446 | | TRUE_KW | ||
1447 | | FALSE_KW => Some(LiteralExpr::from_repr(syntax.into_repr())), | ||
1448 | _ => None, | ||
1449 | } | ||
1450 | } | ||
1451 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1452 | fn to_owned(&self) -> TreeArc<LiteralExpr> { TreeArc::cast(self.syntax.to_owned()) } | ||
1453 | } | ||
1454 | |||
1455 | impl LiteralExpr { | ||
1456 | pub fn kind(&self) -> LiteralExprKind { | ||
1457 | match self.syntax.kind() { | ||
1458 | STRING => LiteralExprKind::String(String::cast(&self.syntax).unwrap()), | ||
1459 | BYTE_STRING => LiteralExprKind::ByteString(ByteString::cast(&self.syntax).unwrap()), | ||
1460 | RAW_STRING => LiteralExprKind::RawString(RawString::cast(&self.syntax).unwrap()), | ||
1461 | RAW_BYTE_STRING => LiteralExprKind::RawByteString(RawByteString::cast(&self.syntax).unwrap()), | ||
1462 | CHAR => LiteralExprKind::Char(Char::cast(&self.syntax).unwrap()), | ||
1463 | BYTE => LiteralExprKind::Byte(Byte::cast(&self.syntax).unwrap()), | ||
1464 | INT_NUMBER => LiteralExprKind::IntNumber(IntNumber::cast(&self.syntax).unwrap()), | ||
1465 | FLOAT_NUMBER => LiteralExprKind::FloatNumber(FloatNumber::cast(&self.syntax).unwrap()), | ||
1466 | TRUE_KW => LiteralExprKind::TrueKw(TrueKw::cast(&self.syntax).unwrap()), | ||
1467 | FALSE_KW => LiteralExprKind::FalseKw(FalseKw::cast(&self.syntax).unwrap()), | ||
1468 | _ => unreachable!(), | ||
1469 | } | ||
1470 | } | ||
1471 | } | ||
1472 | |||
1473 | impl LiteralExpr {} | ||
1331 | 1474 | ||
1332 | // LoopExpr | 1475 | // LoopExpr |
1333 | #[derive(Debug, PartialEq, Eq, Hash)] | 1476 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -2406,6 +2549,56 @@ impl AstNode for RangePat { | |||
2406 | 2549 | ||
2407 | impl RangePat {} | 2550 | impl RangePat {} |
2408 | 2551 | ||
2552 | // RawByteString | ||
2553 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
2554 | #[repr(transparent)] | ||
2555 | pub struct RawByteString { | ||
2556 | pub(crate) syntax: SyntaxNode, | ||
2557 | } | ||
2558 | unsafe impl TransparentNewType for RawByteString { | ||
2559 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
2560 | } | ||
2561 | |||
2562 | impl AstNode for RawByteString { | ||
2563 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
2564 | match syntax.kind() { | ||
2565 | RAW_BYTE_STRING => Some(RawByteString::from_repr(syntax.into_repr())), | ||
2566 | _ => None, | ||
2567 | } | ||
2568 | } | ||
2569 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2570 | fn to_owned(&self) -> TreeArc<RawByteString> { TreeArc::cast(self.syntax.to_owned()) } | ||
2571 | } | ||
2572 | |||
2573 | |||
2574 | impl ast::AstToken for RawByteString {} | ||
2575 | impl RawByteString {} | ||
2576 | |||
2577 | // RawString | ||
2578 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
2579 | #[repr(transparent)] | ||
2580 | pub struct RawString { | ||
2581 | pub(crate) syntax: SyntaxNode, | ||
2582 | } | ||
2583 | unsafe impl TransparentNewType for RawString { | ||
2584 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
2585 | } | ||
2586 | |||
2587 | impl AstNode for RawString { | ||
2588 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
2589 | match syntax.kind() { | ||
2590 | RAW_STRING => Some(RawString::from_repr(syntax.into_repr())), | ||
2591 | _ => None, | ||
2592 | } | ||
2593 | } | ||
2594 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2595 | fn to_owned(&self) -> TreeArc<RawString> { TreeArc::cast(self.syntax.to_owned()) } | ||
2596 | } | ||
2597 | |||
2598 | |||
2599 | impl ast::AstToken for RawString {} | ||
2600 | impl RawString {} | ||
2601 | |||
2409 | // RefExpr | 2602 | // RefExpr |
2410 | #[derive(Debug, PartialEq, Eq, Hash)] | 2603 | #[derive(Debug, PartialEq, Eq, Hash)] |
2411 | #[repr(transparent)] | 2604 | #[repr(transparent)] |
@@ -2919,6 +3112,31 @@ impl ast::AttrsOwner for TraitDef {} | |||
2919 | impl ast::DocCommentsOwner for TraitDef {} | 3112 | impl ast::DocCommentsOwner for TraitDef {} |
2920 | impl TraitDef {} | 3113 | impl TraitDef {} |
2921 | 3114 | ||
3115 | // TrueKw | ||
3116 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3117 | #[repr(transparent)] | ||
3118 | pub struct TrueKw { | ||
3119 | pub(crate) syntax: SyntaxNode, | ||
3120 | } | ||
3121 | unsafe impl TransparentNewType for TrueKw { | ||
3122 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3123 | } | ||
3124 | |||
3125 | impl AstNode for TrueKw { | ||
3126 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3127 | match syntax.kind() { | ||
3128 | TRUE_KW => Some(TrueKw::from_repr(syntax.into_repr())), | ||
3129 | _ => None, | ||
3130 | } | ||
3131 | } | ||
3132 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3133 | fn to_owned(&self) -> TreeArc<TrueKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
3134 | } | ||
3135 | |||
3136 | |||
3137 | impl ast::AstToken for TrueKw {} | ||
3138 | impl TrueKw {} | ||
3139 | |||
2922 | // TryExpr | 3140 | // TryExpr |
2923 | #[derive(Debug, PartialEq, Eq, Hash)] | 3141 | #[derive(Debug, PartialEq, Eq, Hash)] |
2924 | #[repr(transparent)] | 3142 | #[repr(transparent)] |