mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Switch ra_syntax to 2015 edition
This commit is contained in:
parent
420725f256
commit
80e50cae00
2 changed files with 4 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
edition = "2018"
|
edition = "2015"
|
||||||
name = "ra_syntax"
|
name = "ra_syntax"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||||
|
|
|
@ -60,6 +60,7 @@ pub use crate::{
|
||||||
|
|
||||||
use crate::yellow::GreenNode;
|
use crate::yellow::GreenNode;
|
||||||
|
|
||||||
|
/// File represents a parse tree for a single Rust file.
|
||||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
pub struct File {
|
pub struct File {
|
||||||
root: SyntaxNode,
|
root: SyntaxNode,
|
||||||
|
@ -92,9 +93,11 @@ impl File {
|
||||||
text_utils::replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert);
|
text_utils::replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert);
|
||||||
File::parse(&text)
|
File::parse(&text)
|
||||||
}
|
}
|
||||||
|
/// Typed AST representation of the parse tree.
|
||||||
pub fn ast(&self) -> ast::Root {
|
pub fn ast(&self) -> ast::Root {
|
||||||
ast::Root::cast(self.syntax()).unwrap()
|
ast::Root::cast(self.syntax()).unwrap()
|
||||||
}
|
}
|
||||||
|
/// Untyped homogeneous representation of the parse tree.
|
||||||
pub fn syntax(&self) -> SyntaxNodeRef {
|
pub fn syntax(&self) -> SyntaxNodeRef {
|
||||||
self.root.borrowed()
|
self.root.borrowed()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue