diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 7 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 29 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 1 |
3 files changed, 0 insertions, 37 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 9a44afc67..ffd115cef 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -25,13 +25,6 @@ pub trait AstNode: | |||
25 | fn syntax(&self) -> &SyntaxNode; | 25 | fn syntax(&self) -> &SyntaxNode; |
26 | } | 26 | } |
27 | 27 | ||
28 | pub trait AstToken: AstNode { | ||
29 | fn text(&self) -> &SmolStr { | ||
30 | // self.syntax().leaf_text().unwrap() | ||
31 | unimplemented!() | ||
32 | } | ||
33 | } | ||
34 | |||
35 | pub trait TypeAscriptionOwner: AstNode { | 28 | pub trait TypeAscriptionOwner: AstNode { |
36 | fn ascribed_type(&self) -> Option<&TypeRef> { | 29 | fn ascribed_type(&self) -> Option<&TypeRef> { |
37 | child_opt(self) | 30 | child_opt(self) |
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 435d90116..c2e89de15 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -4375,32 +4375,3 @@ impl WhileExpr { | |||
4375 | } | 4375 | } |
4376 | } | 4376 | } |
4377 | 4377 | ||
4378 | // Whitespace | ||
4379 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
4380 | #[repr(transparent)] | ||
4381 | pub struct Whitespace { | ||
4382 | pub(crate) syntax: SyntaxNode, | ||
4383 | } | ||
4384 | unsafe impl TransparentNewType for Whitespace { | ||
4385 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
4386 | } | ||
4387 | |||
4388 | impl AstNode for Whitespace { | ||
4389 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
4390 | match syntax.kind() { | ||
4391 | WHITESPACE => Some(Whitespace::from_repr(syntax.into_repr())), | ||
4392 | _ => None, | ||
4393 | } | ||
4394 | } | ||
4395 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
4396 | } | ||
4397 | |||
4398 | impl ToOwned for Whitespace { | ||
4399 | type Owned = TreeArc<Whitespace>; | ||
4400 | fn to_owned(&self) -> TreeArc<Whitespace> { TreeArc::cast(self.syntax.to_owned()) } | ||
4401 | } | ||
4402 | |||
4403 | |||
4404 | impl ast::AstToken for Whitespace {} | ||
4405 | impl Whitespace {} | ||
4406 | |||
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 3d97bea7f..dc0de5808 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -664,6 +664,5 @@ Grammar( | |||
664 | "TypeArg": (options: ["TypeRef"]), | 664 | "TypeArg": (options: ["TypeRef"]), |
665 | "AssocTypeArg": (options: ["NameRef", "TypeRef"]), | 665 | "AssocTypeArg": (options: ["NameRef", "TypeRef"]), |
666 | "LifetimeArg": (), | 666 | "LifetimeArg": (), |
667 | "Whitespace": ( traits: ["AstToken"] ), | ||
668 | }, | 667 | }, |
669 | ) | 668 | ) |