aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r--crates/ra_syntax/src/lib.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index 9f8066c70..330f68053 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -61,9 +61,8 @@ pub use crate::{
61 61
62use crate::yellow::GreenNode; 62use crate::yellow::GreenNode;
63 63
64// TODO: pick a single name for everything. SourceFileNode maybe? 64/// `SourceFileNode` represents a parse tree for a single Rust file.
65/// File represents a parse tree for a single Rust file. 65pub use crate::ast::SourceFileNode;
66pub type SourceFileNode = ast::RootNode;
67 66
68impl SourceFileNode { 67impl SourceFileNode {
69 fn new(green: GreenNode, errors: Vec<SyntaxError>) -> SourceFileNode { 68 fn new(green: GreenNode, errors: Vec<SyntaxError>) -> SourceFileNode {
@@ -71,8 +70,8 @@ impl SourceFileNode {
71 if cfg!(debug_assertions) { 70 if cfg!(debug_assertions) {
72 utils::validate_block_structure(root.borrowed()); 71 utils::validate_block_structure(root.borrowed());
73 } 72 }
74 assert_eq!(root.kind(), SyntaxKind::ROOT); 73 assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
75 ast::RootNode { syntax: root } 74 ast::SourceFileNode { syntax: root }
76 } 75 }
77 pub fn parse(text: &str) -> SourceFileNode { 76 pub fn parse(text: &str) -> SourceFileNode {
78 let tokens = tokenize(&text); 77 let tokens = tokenize(&text);
@@ -94,7 +93,7 @@ impl SourceFileNode {
94 SourceFileNode::parse(&text) 93 SourceFileNode::parse(&text)
95 } 94 }
96 /// Typed AST representation of the parse tree. 95 /// Typed AST representation of the parse tree.
97 pub fn ast(&self) -> ast::Root { 96 pub fn ast(&self) -> ast::SourceFile {
98 self.borrowed() 97 self.borrowed()
99 } 98 }
100 /// Untyped homogeneous representation of the parse tree. 99 /// Untyped homogeneous representation of the parse tree.