diff options
author | Aleksey Kladov <[email protected]> | 2019-02-20 20:05:59 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-02-20 20:05:59 +0000 |
commit | 61992dc1cd4956038e3c15439c1203f21e05af06 (patch) | |
tree | 0523a030376c0f7792cfc8341b3cfd80f48bde9f /crates/ra_syntax/src/parsing | |
parent | 4c1f9b8d4e9ab9ba3b16d2b03f3c8bcc7f61706e (diff) |
simplify
Diffstat (limited to 'crates/ra_syntax/src/parsing')
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/parser.rs (renamed from crates/ra_syntax/src/parsing/parser_api.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/parser_impl.rs | 25 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/reparsing.rs | 2 |
4 files changed, 2 insertions, 27 deletions
diff --git a/crates/ra_syntax/src/parsing/grammar.rs b/crates/ra_syntax/src/parsing/grammar.rs index bcdcd9f57..7ca9c223c 100644 --- a/crates/ra_syntax/src/parsing/grammar.rs +++ b/crates/ra_syntax/src/parsing/grammar.rs | |||
@@ -41,7 +41,7 @@ use crate::{ | |||
41 | SyntaxKind::{self, *}, | 41 | SyntaxKind::{self, *}, |
42 | parsing::{ | 42 | parsing::{ |
43 | token_set::TokenSet, | 43 | token_set::TokenSet, |
44 | parser_api::{CompletedMarker, Marker, Parser} | 44 | parser::{CompletedMarker, Marker, Parser} |
45 | }, | 45 | }, |
46 | }; | 46 | }; |
47 | 47 | ||
diff --git a/crates/ra_syntax/src/parsing/parser_api.rs b/crates/ra_syntax/src/parsing/parser.rs index 988fcb518..988fcb518 100644 --- a/crates/ra_syntax/src/parsing/parser_api.rs +++ b/crates/ra_syntax/src/parsing/parser.rs | |||
diff --git a/crates/ra_syntax/src/parsing/parser_impl.rs b/crates/ra_syntax/src/parsing/parser_impl.rs deleted file mode 100644 index 6eed0e656..000000000 --- a/crates/ra_syntax/src/parsing/parser_impl.rs +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | pub(super) mod event; | ||
2 | pub(super) mod input; | ||
3 | |||
4 | use crate::parsing::{ | ||
5 | TreeSink, TokenSource, | ||
6 | lexer::Token, | ||
7 | parser_api::Parser, | ||
8 | parser_impl::event::EventProcessor, | ||
9 | }; | ||
10 | |||
11 | /// Parse a sequence of tokens into the representative node tree | ||
12 | pub(super) fn parse_with<S: TreeSink>( | ||
13 | sink: S, | ||
14 | text: &str, | ||
15 | tokens: &[Token], | ||
16 | parser: fn(&mut Parser), | ||
17 | ) -> S::Tree { | ||
18 | let mut events = { | ||
19 | let input = input::ParserInput::new(text, tokens); | ||
20 | let mut parser_api = Parser::new(&input); | ||
21 | parser(&mut parser_api); | ||
22 | parser_api.finish() | ||
23 | }; | ||
24 | EventProcessor::new(sink, text, tokens, &mut events).process().finish() | ||
25 | } | ||
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs index f45326dff..674b15f9a 100644 --- a/crates/ra_syntax/src/parsing/reparsing.rs +++ b/crates/ra_syntax/src/parsing/reparsing.rs | |||
@@ -6,7 +6,7 @@ use crate::{ | |||
6 | parsing::{ | 6 | parsing::{ |
7 | grammar, parse_with, | 7 | grammar, parse_with, |
8 | builder::GreenBuilder, | 8 | builder::GreenBuilder, |
9 | parser_api::Parser, | 9 | parser::Parser, |
10 | lexer::{tokenize, Token}, | 10 | lexer::{tokenize, Token}, |
11 | } | 11 | } |
12 | }; | 12 | }; |