diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/parsing/parser_api.rs | 6 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/parser_impl.rs | 10 |
2 files changed, 7 insertions, 9 deletions
diff --git a/crates/ra_syntax/src/parsing/parser_api.rs b/crates/ra_syntax/src/parsing/parser_api.rs index 813ae494c..aed23a6a4 100644 --- a/crates/ra_syntax/src/parsing/parser_api.rs +++ b/crates/ra_syntax/src/parsing/parser_api.rs | |||
@@ -4,7 +4,7 @@ use crate::{ | |||
4 | SyntaxKind::{self, ERROR}, | 4 | SyntaxKind::{self, ERROR}, |
5 | parsing::{ | 5 | parsing::{ |
6 | token_set::TokenSet, | 6 | token_set::TokenSet, |
7 | parser_impl::ParserImpl | 7 | parser_impl::ParserImpl, |
8 | }, | 8 | }, |
9 | }; | 9 | }; |
10 | 10 | ||
@@ -17,9 +17,7 @@ use crate::{ | |||
17 | /// tree, but rather a flat stream of events of the form | 17 | /// tree, but rather a flat stream of events of the form |
18 | /// "start expression, consume number literal, | 18 | /// "start expression, consume number literal, |
19 | /// finish expression". See `Event` docs for more. | 19 | /// finish expression". See `Event` docs for more. |
20 | pub(crate) struct Parser<'t>( | 20 | pub(crate) struct Parser<'t>(pub(super) ParserImpl<'t>); |
21 | pub(super) ParserImpl<crate::parsing::parser_impl::input::ParserInput<'t>>, | ||
22 | ); | ||
23 | 21 | ||
24 | impl<'t> Parser<'t> { | 22 | impl<'t> Parser<'t> { |
25 | /// Returns the kind of the current token. | 23 | /// Returns the kind of the current token. |
diff --git a/crates/ra_syntax/src/parsing/parser_impl.rs b/crates/ra_syntax/src/parsing/parser_impl.rs index c0d2b6ec1..96de32fc2 100644 --- a/crates/ra_syntax/src/parsing/parser_impl.rs +++ b/crates/ra_syntax/src/parsing/parser_impl.rs | |||
@@ -54,7 +54,7 @@ pub(super) fn parse_with<S: TreeSink>( | |||
54 | ) -> S::Tree { | 54 | ) -> S::Tree { |
55 | let mut events = { | 55 | let mut events = { |
56 | let input = input::ParserInput::new(text, tokens); | 56 | let input = input::ParserInput::new(text, tokens); |
57 | let parser_impl = ParserImpl::new(input); | 57 | let parser_impl = ParserImpl::new(&input); |
58 | let mut parser_api = Parser(parser_impl); | 58 | let mut parser_api = Parser(parser_impl); |
59 | parser(&mut parser_api); | 59 | parser(&mut parser_api); |
60 | parser_api.0.into_events() | 60 | parser_api.0.into_events() |
@@ -65,15 +65,15 @@ pub(super) fn parse_with<S: TreeSink>( | |||
65 | /// Implementation details of `Parser`, extracted | 65 | /// Implementation details of `Parser`, extracted |
66 | /// to a separate struct in order not to pollute | 66 | /// to a separate struct in order not to pollute |
67 | /// the public API of the `Parser`. | 67 | /// the public API of the `Parser`. |
68 | pub(super) struct ParserImpl<S> { | 68 | pub(super) struct ParserImpl<'a> { |
69 | token_source: S, | 69 | token_source: &'a dyn TokenSource, |
70 | pos: InputPosition, | 70 | pos: InputPosition, |
71 | events: Vec<Event>, | 71 | events: Vec<Event>, |
72 | steps: Cell<u32>, | 72 | steps: Cell<u32>, |
73 | } | 73 | } |
74 | 74 | ||
75 | impl<S: TokenSource> ParserImpl<S> { | 75 | impl<'a> ParserImpl<'a> { |
76 | fn new(token_source: S) -> ParserImpl<S> { | 76 | fn new(token_source: &'a dyn TokenSource) -> ParserImpl<'a> { |
77 | ParserImpl { | 77 | ParserImpl { |
78 | token_source, | 78 | token_source, |
79 | pos: InputPosition::new(), | 79 | pos: InputPosition::new(), |