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.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/syntax/src/parsing.rs b/crates/syntax/src/parsing.rs index 420f4938e5..a1ca3b3279 100644 --- a/crates/syntax/src/parsing.rs +++ b/crates/syntax/src/parsing.rs @@ -18,6 +18,19 @@ pub(crate) fn parse_text(text: &str, edition: parser::Edition) -> (GreenNode, Ve (node, errors) } +pub(crate) fn parse_text_at( + text: &str, + entry: parser::TopEntryPoint, + edition: parser::Edition, +) -> (GreenNode, Vec<SyntaxError>) { + let _p = tracing::span!(tracing::Level::INFO, "parse_text_at").entered(); + let lexed = parser::LexedStr::new(text); + let parser_input = lexed.to_input(); + let parser_output = entry.parse(&parser_input, edition); + let (node, errors, _eof) = build_tree(lexed, parser_output); + (node, errors) +} + pub(crate) fn build_tree( lexed: parser::LexedStr<'_>, parser_output: parser::Output, |