diff options
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs | 19 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar.ron | 29 |
2 files changed, 27 insertions, 21 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index a4b116941..31f5ecc44 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs | |||
@@ -180,3 +180,22 @@ impl<R: TreeRoot> AstNode<R> for Trait<R> { | |||
180 | impl<R: TreeRoot> ast::NameOwner<R> for Trait<R> {} | 180 | impl<R: TreeRoot> ast::NameOwner<R> for Trait<R> {} |
181 | impl<R: TreeRoot> Trait<R> {} | 181 | impl<R: TreeRoot> Trait<R> {} |
182 | 182 | ||
183 | // TypeItem | ||
184 | #[derive(Debug, Clone, Copy)] | ||
185 | pub struct TypeItem<R: TreeRoot = Arc<SyntaxRoot>> { | ||
186 | syntax: SyntaxNode<R>, | ||
187 | } | ||
188 | |||
189 | impl<R: TreeRoot> AstNode<R> for TypeItem<R> { | ||
190 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
191 | match syntax.kind() { | ||
192 | TYPE_ITEM => Some(TypeItem { syntax }), | ||
193 | _ => None, | ||
194 | } | ||
195 | } | ||
196 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
197 | } | ||
198 | |||
199 | impl<R: TreeRoot> ast::NameOwner<R> for TypeItem<R> {} | ||
200 | impl<R: TreeRoot> TypeItem<R> {} | ||
201 | |||
diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron index 3fe8fdf0b..d4e8c53d3 100644 --- a/crates/libsyntax2/src/grammar.ron +++ b/crates/libsyntax2/src/grammar.ron | |||
@@ -219,27 +219,14 @@ Grammar( | |||
219 | ["functions", "Function"] | 219 | ["functions", "Function"] |
220 | ] | 220 | ] |
221 | ), | 221 | ), |
222 | "Function": ( | 222 | "Function": ( traits: ["NameOwner"] ), |
223 | traits: ["NameOwner"] | 223 | "Struct": ( traits: ["NameOwner"] ), |
224 | ), | 224 | "Enum": ( traits: ["NameOwner"] ), |
225 | "Struct": ( | 225 | "Trait": ( traits: ["NameOwner"] ), |
226 | traits: ["NameOwner"] | 226 | "Module": ( traits: ["NameOwner"] ), |
227 | ), | 227 | "ConstItem": ( traits: ["NameOwner"] ), |
228 | "Enum": ( | 228 | "StaticItem": ( traits: ["NameOwner"] ), |
229 | traits: ["NameOwner"] | 229 | "TypeItem": ( traits: ["NameOwner"] ), |
230 | ), | ||
231 | "Trait": ( | ||
232 | traits: ["NameOwner"] | ||
233 | ), | ||
234 | "Module": ( | ||
235 | traits: ["NameOwner"] | ||
236 | ), | ||
237 | "ConstItem": ( | ||
238 | traits: ["NameOwner"] | ||
239 | ), | ||
240 | "StaticItem": ( | ||
241 | traits: ["NameOwner"] | ||
242 | ), | ||
243 | "Name": (), | 230 | "Name": (), |
244 | }, | 231 | }, |
245 | ) | 232 | ) |