diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 28 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 10 |
2 files changed, 38 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index de506d7cd..1a03ae56c 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -3789,6 +3789,34 @@ impl AstNode for TypeRef { | |||
3789 | } | 3789 | } |
3790 | impl TypeRef {} | 3790 | impl TypeRef {} |
3791 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3791 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3792 | pub struct UnionDef { | ||
3793 | pub(crate) syntax: SyntaxNode, | ||
3794 | } | ||
3795 | impl AstNode for UnionDef { | ||
3796 | fn can_cast(kind: SyntaxKind) -> bool { | ||
3797 | match kind { | ||
3798 | UNION_DEF => true, | ||
3799 | _ => false, | ||
3800 | } | ||
3801 | } | ||
3802 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
3803 | if Self::can_cast(syntax.kind()) { | ||
3804 | Some(Self { syntax }) | ||
3805 | } else { | ||
3806 | None | ||
3807 | } | ||
3808 | } | ||
3809 | fn syntax(&self) -> &SyntaxNode { | ||
3810 | &self.syntax | ||
3811 | } | ||
3812 | } | ||
3813 | impl ast::VisibilityOwner for UnionDef {} | ||
3814 | impl ast::NameOwner for UnionDef {} | ||
3815 | impl ast::TypeParamsOwner for UnionDef {} | ||
3816 | impl ast::AttrsOwner for UnionDef {} | ||
3817 | impl ast::DocCommentsOwner for UnionDef {} | ||
3818 | impl UnionDef {} | ||
3819 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
3792 | pub struct UseItem { | 3820 | pub struct UseItem { |
3793 | pub(crate) syntax: SyntaxNode, | 3821 | pub(crate) syntax: SyntaxNode, |
3794 | } | 3822 | } |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 88d1dc109..c16bed891 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -126,6 +126,7 @@ Grammar( | |||
126 | "SOURCE_FILE", | 126 | "SOURCE_FILE", |
127 | 127 | ||
128 | "STRUCT_DEF", | 128 | "STRUCT_DEF", |
129 | "UNION_DEF", | ||
129 | "ENUM_DEF", | 130 | "ENUM_DEF", |
130 | "FN_DEF", | 131 | "FN_DEF", |
131 | "RET_TYPE", | 132 | "RET_TYPE", |
@@ -285,6 +286,15 @@ Grammar( | |||
285 | "DocCommentsOwner" | 286 | "DocCommentsOwner" |
286 | ] | 287 | ] |
287 | ), | 288 | ), |
289 | "UnionDef": ( | ||
290 | traits: [ | ||
291 | "VisibilityOwner", | ||
292 | "NameOwner", | ||
293 | "TypeParamsOwner", | ||
294 | "AttrsOwner", | ||
295 | "DocCommentsOwner" | ||
296 | ] | ||
297 | ), | ||
288 | "RecordFieldDefList": (collections: [("fields", "RecordFieldDef")]), | 298 | "RecordFieldDefList": (collections: [("fields", "RecordFieldDef")]), |
289 | "RecordFieldDef": ( | 299 | "RecordFieldDef": ( |
290 | traits: [ | 300 | traits: [ |