diff options
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 69a679d04..123002825 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -60,6 +60,7 @@ pub use crate::{ | |||
60 | 60 | ||
61 | use crate::yellow::GreenNode; | 61 | use crate::yellow::GreenNode; |
62 | 62 | ||
63 | /// File represents a parse tree for a single Rust file. | ||
63 | #[derive(Clone, Debug, Hash, PartialEq, Eq)] | 64 | #[derive(Clone, Debug, Hash, PartialEq, Eq)] |
64 | pub struct File { | 65 | pub struct File { |
65 | root: SyntaxNode, | 66 | root: SyntaxNode, |
@@ -92,9 +93,11 @@ impl File { | |||
92 | text_utils::replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert); | 93 | text_utils::replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert); |
93 | File::parse(&text) | 94 | File::parse(&text) |
94 | } | 95 | } |
96 | /// Typed AST representation of the parse tree. | ||
95 | pub fn ast(&self) -> ast::Root { | 97 | pub fn ast(&self) -> ast::Root { |
96 | ast::Root::cast(self.syntax()).unwrap() | 98 | ast::Root::cast(self.syntax()).unwrap() |
97 | } | 99 | } |
100 | /// Untyped homogeneous representation of the parse tree. | ||
98 | pub fn syntax(&self) -> SyntaxNodeRef { | 101 | pub fn syntax(&self) -> SyntaxNodeRef { |
99 | self.root.borrowed() | 102 | self.root.borrowed() |
100 | } | 103 | } |