diff options
Diffstat (limited to 'crates/ra_syntax/src/parsing.rs')
-rw-r--r-- | crates/ra_syntax/src/parsing.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/parsing.rs b/crates/ra_syntax/src/parsing.rs new file mode 100644 index 000000000..2c92d554e --- /dev/null +++ b/crates/ra_syntax/src/parsing.rs | |||
@@ -0,0 +1,24 @@ | |||
1 | #[macro_use] | ||
2 | mod token_set; | ||
3 | mod builder; | ||
4 | mod lexer; | ||
5 | mod parser_impl; | ||
6 | mod parser_api; | ||
7 | mod reparsing; | ||
8 | mod grammar; | ||
9 | |||
10 | use crate::{ | ||
11 | parsing::builder::GreenBuilder, | ||
12 | syntax_node::{GreenNode, SyntaxError}, | ||
13 | }; | ||
14 | |||
15 | pub use self::lexer::{tokenize, Token}; | ||
16 | |||
17 | pub(crate) use self::reparsing::incremental_reparse; | ||
18 | |||
19 | pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) { | ||
20 | let tokens = tokenize(&text); | ||
21 | let (green, errors) = | ||
22 | parser_impl::parse_with(GreenBuilder::new(), text, &tokens, grammar::root); | ||
23 | (green, errors) | ||
24 | } | ||