aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast.rs7
-rw-r--r--crates/ra_syntax/src/ast/generated.rs29
-rw-r--r--crates/ra_syntax/src/grammar.ron1
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
28pub trait AstToken: AstNode {
29 fn text(&self) -> &SmolStr {
30 // self.syntax().leaf_text().unwrap()
31 unimplemented!()
32 }
33}
34
35pub trait TypeAscriptionOwner: AstNode { 28pub 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 4afe1a146..1dc5d810d 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -4367,32 +4367,3 @@ impl WhileExpr {
4367 } 4367 }
4368} 4368}
4369 4369
4370// Whitespace
4371#[derive(Debug, PartialEq, Eq, Hash)]
4372#[repr(transparent)]
4373pub struct Whitespace {
4374 pub(crate) syntax: SyntaxNode,
4375}
4376unsafe impl TransparentNewType for Whitespace {
4377 type Repr = rowan::SyntaxNode<RaTypes>;
4378}
4379
4380impl AstNode for Whitespace {
4381 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4382 match syntax.kind() {
4383 WHITESPACE => Some(Whitespace::from_repr(syntax.into_repr())),
4384 _ => None,
4385 }
4386 }
4387 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4388}
4389
4390impl ToOwned for Whitespace {
4391 type Owned = TreeArc<Whitespace>;
4392 fn to_owned(&self) -> TreeArc<Whitespace> { TreeArc::cast(self.syntax.to_owned()) }
4393}
4394
4395
4396impl ast::AstToken for Whitespace {}
4397impl Whitespace {}
4398
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 6d7a5a1cb..efc06c218 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -663,6 +663,5 @@ Grammar(
663 "TypeArg": (options: ["TypeRef"]), 663 "TypeArg": (options: ["TypeRef"]),
664 "AssocTypeArg": (options: ["NameRef", "TypeRef"]), 664 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),
665 "LifetimeArg": (), 665 "LifetimeArg": (),
666 "Whitespace": ( traits: ["AstToken"] ),
667 }, 666 },
668) 667)