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.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index 465607f55..7f8da66af 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -11,7 +11,7 @@
11//! 11//!
12//! The most interesting modules here are `syntax_node` (which defines concrete 12//! The most interesting modules here are `syntax_node` (which defines concrete
13//! syntax tree) and `ast` (which defines abstract syntax tree on top of the 13//! syntax tree) and `ast` (which defines abstract syntax tree on top of the
14//! CST). The actual parser live in a separate `ra_parser` crate, though the 14//! CST). The actual parser live in a separate `parser` crate, though the
15//! lexer lives in this crate. 15//! lexer lives in this crate.
16//! 16//!
17//! See `api_walkthrough` test in this file for a quick API tour! 17//! See `api_walkthrough` test in this file for a quick API tour!
@@ -53,7 +53,7 @@ pub use crate::{
53 SyntaxNodeChildren, SyntaxToken, SyntaxTreeBuilder, 53 SyntaxNodeChildren, SyntaxToken, SyntaxTreeBuilder,
54 }, 54 },
55}; 55};
56pub use ra_parser::{SyntaxKind, T}; 56pub use parser::{SyntaxKind, T};
57pub use rowan::{SmolStr, SyntaxText, TextRange, TextSize, TokenAtOffset, WalkEvent}; 57pub use rowan::{SmolStr, SyntaxText, TextRange, TextSize, TokenAtOffset, WalkEvent};
58 58
59/// `Parse` is the result of the parsing: a syntax tree and a collection of 59/// `Parse` is the result of the parsing: a syntax tree and a collection of
@@ -169,35 +169,35 @@ impl SourceFile {
169impl ast::Path { 169impl ast::Path {
170 /// Returns `text`, parsed as a path, but only if it has no errors. 170 /// Returns `text`, parsed as a path, but only if it has no errors.
171 pub fn parse(text: &str) -> Result<Self, ()> { 171 pub fn parse(text: &str) -> Result<Self, ()> {
172 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Path) 172 parsing::parse_text_fragment(text, parser::FragmentKind::Path)
173 } 173 }
174} 174}
175 175
176impl ast::Pat { 176impl ast::Pat {
177 /// Returns `text`, parsed as a pattern, but only if it has no errors. 177 /// Returns `text`, parsed as a pattern, but only if it has no errors.
178 pub fn parse(text: &str) -> Result<Self, ()> { 178 pub fn parse(text: &str) -> Result<Self, ()> {
179 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Pattern) 179 parsing::parse_text_fragment(text, parser::FragmentKind::Pattern)
180 } 180 }
181} 181}
182 182
183impl ast::Expr { 183impl ast::Expr {
184 /// Returns `text`, parsed as an expression, but only if it has no errors. 184 /// Returns `text`, parsed as an expression, but only if it has no errors.
185 pub fn parse(text: &str) -> Result<Self, ()> { 185 pub fn parse(text: &str) -> Result<Self, ()> {
186 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Expr) 186 parsing::parse_text_fragment(text, parser::FragmentKind::Expr)
187 } 187 }
188} 188}
189 189
190impl ast::Item { 190impl ast::Item {
191 /// Returns `text`, parsed as an item, but only if it has no errors. 191 /// Returns `text`, parsed as an item, but only if it has no errors.
192 pub fn parse(text: &str) -> Result<Self, ()> { 192 pub fn parse(text: &str) -> Result<Self, ()> {
193 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Item) 193 parsing::parse_text_fragment(text, parser::FragmentKind::Item)
194 } 194 }
195} 195}
196 196
197impl ast::Type { 197impl ast::Type {
198 /// Returns `text`, parsed as an type reference, but only if it has no errors. 198 /// Returns `text`, parsed as an type reference, but only if it has no errors.
199 pub fn parse(text: &str) -> Result<Self, ()> { 199 pub fn parse(text: &str) -> Result<Self, ()> {
200 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Type) 200 parsing::parse_text_fragment(text, parser::FragmentKind::Type)
201 } 201 }
202} 202}
203 203