diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-20 13:50:29 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-20 13:50:29 +0000 |
commit | 96899f8278b787280bd07d9ac9dce29a610ce40d (patch) | |
tree | d02a22f02908fd3c89e50845a06a89b997220fc2 /crates/ra_syntax/src/parsing.rs | |
parent | 5b617e3bf8252887a3eb1ce76d4b62cbee74e551 (diff) | |
parent | 86a67dce25f11ba9803a5727f77c02fd1f49e2c0 (diff) |
Merge #861
861: Move parsing to a separate module r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/parsing.rs')
-rw-r--r-- | crates/ra_syntax/src/parsing.rs | 25 |
1 files changed, 25 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..761accd7b --- /dev/null +++ b/crates/ra_syntax/src/parsing.rs | |||
@@ -0,0 +1,25 @@ | |||
1 | #[macro_use] | ||
2 | mod token_set; | ||
3 | mod builder; | ||
4 | mod lexer; | ||
5 | mod parser_impl; | ||
6 | mod parser_api; | ||
7 | mod grammar; | ||
8 | mod reparsing; | ||
9 | |||
10 | use crate::{ | ||
11 | SyntaxError, | ||
12 | parsing::builder::GreenBuilder, | ||
13 | syntax_node::GreenNode, | ||
14 | }; | ||
15 | |||
16 | pub use self::lexer::{tokenize, Token}; | ||
17 | |||
18 | pub(crate) use self::reparsing::incremental_reparse; | ||
19 | |||
20 | pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) { | ||
21 | let tokens = tokenize(&text); | ||
22 | let (green, errors) = | ||
23 | parser_impl::parse_with(GreenBuilder::new(), text, &tokens, grammar::root); | ||
24 | (green, errors) | ||
25 | } | ||