diff options
Diffstat (limited to 'crates/syntax/src/ast/generated/nodes.rs')
-rw-r--r-- | crates/syntax/src/ast/generated/nodes.rs | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs index 30d11b146..0ad75214f 100644 --- a/crates/syntax/src/ast/generated/nodes.rs +++ b/crates/syntax/src/ast/generated/nodes.rs | |||
@@ -128,7 +128,6 @@ pub struct MacroCall { | |||
128 | pub(crate) syntax: SyntaxNode, | 128 | pub(crate) syntax: SyntaxNode, |
129 | } | 129 | } |
130 | impl ast::AttrsOwner for MacroCall {} | 130 | impl ast::AttrsOwner for MacroCall {} |
131 | impl ast::NameOwner for MacroCall {} | ||
132 | impl MacroCall { | 131 | impl MacroCall { |
133 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 132 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
134 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | 133 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
@@ -273,6 +272,20 @@ impl Impl { | |||
273 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } | 272 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } |
274 | } | 273 | } |
275 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 274 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
275 | pub struct MacroRules { | ||
276 | pub(crate) syntax: SyntaxNode, | ||
277 | } | ||
278 | impl ast::AttrsOwner for MacroRules {} | ||
279 | impl ast::NameOwner for MacroRules {} | ||
280 | impl ast::VisibilityOwner for MacroRules {} | ||
281 | impl MacroRules { | ||
282 | pub fn macro_rules_token(&self) -> Option<SyntaxToken> { | ||
283 | support::token(&self.syntax, T![macro_rules]) | ||
284 | } | ||
285 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
286 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
287 | } | ||
288 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
276 | pub struct Module { | 289 | pub struct Module { |
277 | pub(crate) syntax: SyntaxNode, | 290 | pub(crate) syntax: SyntaxNode, |
278 | } | 291 | } |
@@ -1318,6 +1331,7 @@ pub enum Item { | |||
1318 | Fn(Fn), | 1331 | Fn(Fn), |
1319 | Impl(Impl), | 1332 | Impl(Impl), |
1320 | MacroCall(MacroCall), | 1333 | MacroCall(MacroCall), |
1334 | MacroRules(MacroRules), | ||
1321 | Module(Module), | 1335 | Module(Module), |
1322 | Static(Static), | 1336 | Static(Static), |
1323 | Struct(Struct), | 1337 | Struct(Struct), |
@@ -1374,7 +1388,6 @@ pub enum AssocItem { | |||
1374 | TypeAlias(TypeAlias), | 1388 | TypeAlias(TypeAlias), |
1375 | } | 1389 | } |
1376 | impl ast::AttrsOwner for AssocItem {} | 1390 | impl ast::AttrsOwner for AssocItem {} |
1377 | impl ast::NameOwner for AssocItem {} | ||
1378 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1391 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1379 | pub enum ExternItem { | 1392 | pub enum ExternItem { |
1380 | Fn(Fn), | 1393 | Fn(Fn), |
@@ -1383,7 +1396,6 @@ pub enum ExternItem { | |||
1383 | TypeAlias(TypeAlias), | 1396 | TypeAlias(TypeAlias), |
1384 | } | 1397 | } |
1385 | impl ast::AttrsOwner for ExternItem {} | 1398 | impl ast::AttrsOwner for ExternItem {} |
1386 | impl ast::NameOwner for ExternItem {} | ||
1387 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1399 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1388 | pub enum GenericParam { | 1400 | pub enum GenericParam { |
1389 | ConstParam(ConstParam), | 1401 | ConstParam(ConstParam), |
@@ -1666,6 +1678,17 @@ impl AstNode for Impl { | |||
1666 | } | 1678 | } |
1667 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1679 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1668 | } | 1680 | } |
1681 | impl AstNode for MacroRules { | ||
1682 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_RULES } | ||
1683 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1684 | if Self::can_cast(syntax.kind()) { | ||
1685 | Some(Self { syntax }) | ||
1686 | } else { | ||
1687 | None | ||
1688 | } | ||
1689 | } | ||
1690 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1691 | } | ||
1669 | impl AstNode for Module { | 1692 | impl AstNode for Module { |
1670 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } | 1693 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } |
1671 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1694 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -3060,6 +3083,9 @@ impl From<Impl> for Item { | |||
3060 | impl From<MacroCall> for Item { | 3083 | impl From<MacroCall> for Item { |
3061 | fn from(node: MacroCall) -> Item { Item::MacroCall(node) } | 3084 | fn from(node: MacroCall) -> Item { Item::MacroCall(node) } |
3062 | } | 3085 | } |
3086 | impl From<MacroRules> for Item { | ||
3087 | fn from(node: MacroRules) -> Item { Item::MacroRules(node) } | ||
3088 | } | ||
3063 | impl From<Module> for Item { | 3089 | impl From<Module> for Item { |
3064 | fn from(node: Module) -> Item { Item::Module(node) } | 3090 | fn from(node: Module) -> Item { Item::Module(node) } |
3065 | } | 3091 | } |
@@ -3084,8 +3110,8 @@ impl From<Use> for Item { | |||
3084 | impl AstNode for Item { | 3110 | impl AstNode for Item { |
3085 | fn can_cast(kind: SyntaxKind) -> bool { | 3111 | fn can_cast(kind: SyntaxKind) -> bool { |
3086 | match kind { | 3112 | match kind { |
3087 | CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL | MACRO_CALL | MODULE | 3113 | CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL | MACRO_CALL | MACRO_RULES |
3088 | | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true, | 3114 | | MODULE | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true, |
3089 | _ => false, | 3115 | _ => false, |
3090 | } | 3116 | } |
3091 | } | 3117 | } |
@@ -3098,6 +3124,7 @@ impl AstNode for Item { | |||
3098 | FN => Item::Fn(Fn { syntax }), | 3124 | FN => Item::Fn(Fn { syntax }), |
3099 | IMPL => Item::Impl(Impl { syntax }), | 3125 | IMPL => Item::Impl(Impl { syntax }), |
3100 | MACRO_CALL => Item::MacroCall(MacroCall { syntax }), | 3126 | MACRO_CALL => Item::MacroCall(MacroCall { syntax }), |
3127 | MACRO_RULES => Item::MacroRules(MacroRules { syntax }), | ||
3101 | MODULE => Item::Module(Module { syntax }), | 3128 | MODULE => Item::Module(Module { syntax }), |
3102 | STATIC => Item::Static(Static { syntax }), | 3129 | STATIC => Item::Static(Static { syntax }), |
3103 | STRUCT => Item::Struct(Struct { syntax }), | 3130 | STRUCT => Item::Struct(Struct { syntax }), |
@@ -3118,6 +3145,7 @@ impl AstNode for Item { | |||
3118 | Item::Fn(it) => &it.syntax, | 3145 | Item::Fn(it) => &it.syntax, |
3119 | Item::Impl(it) => &it.syntax, | 3146 | Item::Impl(it) => &it.syntax, |
3120 | Item::MacroCall(it) => &it.syntax, | 3147 | Item::MacroCall(it) => &it.syntax, |
3148 | Item::MacroRules(it) => &it.syntax, | ||
3121 | Item::Module(it) => &it.syntax, | 3149 | Item::Module(it) => &it.syntax, |
3122 | Item::Static(it) => &it.syntax, | 3150 | Item::Static(it) => &it.syntax, |
3123 | Item::Struct(it) => &it.syntax, | 3151 | Item::Struct(it) => &it.syntax, |
@@ -3582,6 +3610,11 @@ impl std::fmt::Display for Impl { | |||
3582 | std::fmt::Display::fmt(self.syntax(), f) | 3610 | std::fmt::Display::fmt(self.syntax(), f) |
3583 | } | 3611 | } |
3584 | } | 3612 | } |
3613 | impl std::fmt::Display for MacroRules { | ||
3614 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3615 | std::fmt::Display::fmt(self.syntax(), f) | ||
3616 | } | ||
3617 | } | ||
3585 | impl std::fmt::Display for Module { | 3618 | impl std::fmt::Display for Module { |
3586 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3619 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3587 | std::fmt::Display::fmt(self.syntax(), f) | 3620 | std::fmt::Display::fmt(self.syntax(), f) |