aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-02-20 20:05:59 +0000
committerAleksey Kladov <[email protected]>2019-02-20 20:05:59 +0000
commit61992dc1cd4956038e3c15439c1203f21e05af06 (patch)
tree0523a030376c0f7792cfc8341b3cfd80f48bde9f /crates/ra_syntax/src
parent4c1f9b8d4e9ab9ba3b16d2b03f3c8bcc7f61706e (diff)
simplify
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/parsing.rs4
-rw-r--r--crates/ra_syntax/src/parsing/grammar.rs2
-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.rs25
-rw-r--r--crates/ra_syntax/src/parsing/reparsing.rs2
5 files changed, 4 insertions, 29 deletions
diff --git a/crates/ra_syntax/src/parsing.rs b/crates/ra_syntax/src/parsing.rs
index 5de6ff8c1..941ec501e 100644
--- a/crates/ra_syntax/src/parsing.rs
+++ b/crates/ra_syntax/src/parsing.rs
@@ -4,7 +4,7 @@ mod builder;
4mod lexer; 4mod lexer;
5mod event; 5mod event;
6mod input; 6mod input;
7mod parser_api; 7mod parser;
8mod grammar; 8mod grammar;
9mod reparsing; 9mod reparsing;
10 10
@@ -14,7 +14,7 @@ use crate::{
14 builder::GreenBuilder, 14 builder::GreenBuilder,
15 input::ParserInput, 15 input::ParserInput,
16 event::EventProcessor, 16 event::EventProcessor,
17 parser_api::Parser, 17 parser::Parser,
18 }, 18 },
19 syntax_node::GreenNode, 19 syntax_node::GreenNode,
20}; 20};
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 @@
1pub(super) mod event;
2pub(super) mod input;
3
4use 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
12pub(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};