Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/parsing.rs')
-rw-r--r--crates/syntax/src/parsing.rs22
1 files changed, 1 insertions, 21 deletions
diff --git a/crates/syntax/src/parsing.rs b/crates/syntax/src/parsing.rs
index 971fa2700d..ac1d920d69 100644
--- a/crates/syntax/src/parsing.rs
+++ b/crates/syntax/src/parsing.rs
@@ -5,7 +5,7 @@ mod reparsing;
use rowan::TextRange;
-use crate::{syntax_node::GreenNode, AstNode, SyntaxError, SyntaxNode, SyntaxTreeBuilder};
+use crate::{syntax_node::GreenNode, SyntaxError, SyntaxTreeBuilder};
pub(crate) use crate::parsing::reparsing::incremental_reparse;
@@ -17,26 +17,6 @@ pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) {
(node, errors)
}
-/// Returns `text` parsed as a `T` provided there are no parse errors.
-pub(crate) fn parse_text_as<T: AstNode>(
- text: &str,
- entry_point: parser::ParserEntryPoint,
-) -> Result<T, ()> {
- let lexed = parser::LexedStr::new(text);
- if lexed.errors().next().is_some() {
- return Err(());
- }
- let parser_input = lexed.to_input();
- let parser_output = parser::parse(&parser_input, entry_point);
- let (node, errors, eof) = build_tree(lexed, parser_output, true);
-
- if !errors.is_empty() || !eof {
- return Err(());
- }
-
- SyntaxNode::new_root(node).first_child().and_then(T::cast).ok_or(())
-}
-
pub(crate) fn build_tree(
lexed: parser::LexedStr<'_>,
parser_output: parser::Output,