Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/lib.rs')
-rw-r--r--crates/syntax/src/lib.rs56
1 files changed, 1 insertions, 55 deletions
diff --git a/crates/syntax/src/lib.rs b/crates/syntax/src/lib.rs
index 65a6b7ac4e..d6b1cce45f 100644
--- a/crates/syntax/src/lib.rs
+++ b/crates/syntax/src/lib.rs
@@ -40,6 +40,7 @@ pub mod ast;
pub mod fuzz;
pub mod utils;
pub mod ted;
+pub mod hacks;
use std::{marker::PhantomData, sync::Arc};
@@ -167,61 +168,6 @@ impl SourceFile {
}
}
-// FIXME: `parse` functions shouldn't hang directly from AST nodes, and they
-// shouldn't return `Result`.
-//
-// We need a dedicated module for parser entry points, and they should always
-// return `Parse`.
-
-impl ast::Path {
- /// Returns `text`, parsed as a path, but only if it has no errors.
- pub fn parse(text: &str) -> Result<Self, ()> {
- parsing::parse_text_as(text, parser::ParserEntryPoint::Path)
- }
-}
-
-impl ast::Pat {
- /// Returns `text`, parsed as a pattern, but only if it has no errors.
- pub fn parse(text: &str) -> Result<Self, ()> {
- parsing::parse_text_as(text, parser::ParserEntryPoint::Pattern)
- }
-}
-
-impl ast::Expr {
- /// Returns `text`, parsed as an expression, but only if it has no errors.
- pub fn parse(text: &str) -> Result<Self, ()> {
- parsing::parse_text_as(text, parser::ParserEntryPoint::Expr)
- }
-}
-
-impl ast::Item {
- /// Returns `text`, parsed as an item, but only if it has no errors.
- pub fn parse(text: &str) -> Result<Self, ()> {
- parsing::parse_text_as(text, parser::ParserEntryPoint::Item)
- }
-}
-
-impl ast::Type {
- /// Returns `text`, parsed as an type reference, but only if it has no errors.
- pub fn parse(text: &str) -> Result<Self, ()> {
- parsing::parse_text_as(text, parser::ParserEntryPoint::Type)
- }
-}
-
-impl ast::Attr {
- /// Returns `text`, parsed as an attribute, but only if it has no errors.
- pub fn parse(text: &str) -> Result<Self, ()> {
- parsing::parse_text_as(text, parser::ParserEntryPoint::Attr)
- }
-}
-
-impl ast::Stmt {
- /// Returns `text`, parsed as statement, but only if it has no errors.
- pub fn parse(text: &str) -> Result<Self, ()> {
- parsing::parse_text_as(text, parser::ParserEntryPoint::StatementOptionalSemi)
- }
-}
-
/// Matches a `SyntaxNode` against an `ast` type.
///
/// # Example: