From 80e50cae0066b2c662607841fa20dd84f024ad4e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 5 Nov 2018 15:47:59 +0300 Subject: Switch ra_syntax to 2015 edition --- crates/ra_syntax/Cargo.toml | 2 +- crates/ra_syntax/src/lib.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml index 043c9bacd..6c2e012ee 100644 --- a/crates/ra_syntax/Cargo.toml +++ b/crates/ra_syntax/Cargo.toml @@ -1,5 +1,5 @@ [package] -edition = "2018" +edition = "2015" name = "ra_syntax" version = "0.1.0" authors = ["Aleksey Kladov "] diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 8996eb921..acc2d9603 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs @@ -60,6 +60,7 @@ pub use crate::{ use crate::yellow::GreenNode; +/// File represents a parse tree for a single Rust file. #[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct File { root: SyntaxNode, @@ -92,9 +93,11 @@ impl File { text_utils::replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert); File::parse(&text) } + /// Typed AST representation of the parse tree. pub fn ast(&self) -> ast::Root { ast::Root::cast(self.syntax()).unwrap() } + /// Untyped homogeneous representation of the parse tree. pub fn syntax(&self) -> SyntaxNodeRef { self.root.borrowed() } -- cgit v1.2.3