diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-08-12 16:15:00 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-12 16:15:00 +0100 |
commit | 3d6889cba72a9d02199f7adaa2ecc69bc30af834 (patch) | |
tree | a17351b1e3addea0a719f38990fea9289b6ef65e /crates/ra_syntax/src/parsing/text_token_source.rs | |
parent | a573e088ac64eeeb19e4fc74be2ff019be510477 (diff) | |
parent | 50a02eb3593591a02677e1b56f24d7ff0459b9d0 (diff) |
Merge #5727
5727: Rename ra_parser -> parser
r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/parsing/text_token_source.rs')
-rw-r--r-- | crates/ra_syntax/src/parsing/text_token_source.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/parsing/text_token_source.rs b/crates/ra_syntax/src/parsing/text_token_source.rs index 97aa3e795..df866dc2b 100644 --- a/crates/ra_syntax/src/parsing/text_token_source.rs +++ b/crates/ra_syntax/src/parsing/text_token_source.rs | |||
@@ -1,10 +1,10 @@ | |||
1 | //! See `TextTokenSource` docs. | 1 | //! See `TextTokenSource` docs. |
2 | 2 | ||
3 | use ra_parser::TokenSource; | 3 | use parser::TokenSource; |
4 | 4 | ||
5 | use crate::{parsing::lexer::Token, SyntaxKind::EOF, TextRange, TextSize}; | 5 | use crate::{parsing::lexer::Token, SyntaxKind::EOF, TextRange, TextSize}; |
6 | 6 | ||
7 | /// Implementation of `ra_parser::TokenSource` that takes tokens from source code text. | 7 | /// Implementation of `parser::TokenSource` that takes tokens from source code text. |
8 | pub(crate) struct TextTokenSource<'t> { | 8 | pub(crate) struct TextTokenSource<'t> { |
9 | text: &'t str, | 9 | text: &'t str, |
10 | /// token and its start position (non-whitespace/comment tokens) | 10 | /// token and its start position (non-whitespace/comment tokens) |
@@ -20,15 +20,15 @@ pub(crate) struct TextTokenSource<'t> { | |||
20 | token_offset_pairs: Vec<(Token, TextSize)>, | 20 | token_offset_pairs: Vec<(Token, TextSize)>, |
21 | 21 | ||
22 | /// Current token and position | 22 | /// Current token and position |
23 | curr: (ra_parser::Token, usize), | 23 | curr: (parser::Token, usize), |
24 | } | 24 | } |
25 | 25 | ||
26 | impl<'t> TokenSource for TextTokenSource<'t> { | 26 | impl<'t> TokenSource for TextTokenSource<'t> { |
27 | fn current(&self) -> ra_parser::Token { | 27 | fn current(&self) -> parser::Token { |
28 | self.curr.0 | 28 | self.curr.0 |
29 | } | 29 | } |
30 | 30 | ||
31 | fn lookahead_nth(&self, n: usize) -> ra_parser::Token { | 31 | fn lookahead_nth(&self, n: usize) -> parser::Token { |
32 | mk_token(self.curr.1 + n, &self.token_offset_pairs) | 32 | mk_token(self.curr.1 + n, &self.token_offset_pairs) |
33 | } | 33 | } |
34 | 34 | ||
@@ -49,7 +49,7 @@ impl<'t> TokenSource for TextTokenSource<'t> { | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | fn mk_token(pos: usize, token_offset_pairs: &[(Token, TextSize)]) -> ra_parser::Token { | 52 | fn mk_token(pos: usize, token_offset_pairs: &[(Token, TextSize)]) -> parser::Token { |
53 | let (kind, is_jointed_to_next) = match token_offset_pairs.get(pos) { | 53 | let (kind, is_jointed_to_next) = match token_offset_pairs.get(pos) { |
54 | Some((token, offset)) => ( | 54 | Some((token, offset)) => ( |
55 | token.kind, | 55 | token.kind, |
@@ -60,7 +60,7 @@ fn mk_token(pos: usize, token_offset_pairs: &[(Token, TextSize)]) -> ra_parser:: | |||
60 | ), | 60 | ), |
61 | None => (EOF, false), | 61 | None => (EOF, false), |
62 | }; | 62 | }; |
63 | ra_parser::Token { kind, is_jointed_to_next } | 63 | parser::Token { kind, is_jointed_to_next } |
64 | } | 64 | } |
65 | 65 | ||
66 | impl<'t> TextTokenSource<'t> { | 66 | impl<'t> TextTokenSource<'t> { |