diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-01 18:45:56 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-01 18:45:56 +0100 |
commit | 12629d5e4f2d949eedb707dedad4d75eff09e683 (patch) | |
tree | bbd0e531ac05cac0a511acbfa6ad24a977b63124 /crates | |
parent | 817a38538f69d5383942476a6066ca98d6f7d1cb (diff) | |
parent | a42f26502d22e270285e10af463996b22eec98ce (diff) |
Merge #1222
1222: Skip Dollars when bump raw token r=matklad a=edwin0cheng
This PR fixed a bug while parsing token_tree, it should skip all L_DOLLAR AND R_DOLLAR.
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_parser/src/parser.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ra_parser/src/parser.rs b/crates/ra_parser/src/parser.rs index 99b976c4f..8eff930db 100644 --- a/crates/ra_parser/src/parser.rs +++ b/crates/ra_parser/src/parser.rs | |||
@@ -129,7 +129,15 @@ impl<'t> Parser<'t> { | |||
129 | /// Advances the parser by one token unconditionally | 129 | /// Advances the parser by one token unconditionally |
130 | /// Mainly use in `token_tree` parsing | 130 | /// Mainly use in `token_tree` parsing |
131 | pub(crate) fn bump_raw(&mut self) { | 131 | pub(crate) fn bump_raw(&mut self) { |
132 | let kind = self.token_source.token_kind(self.token_pos); | 132 | let mut kind = self.token_source.token_kind(self.token_pos); |
133 | |||
134 | // Skip dollars, do_bump will eat these later | ||
135 | let mut i = 0; | ||
136 | while kind == SyntaxKind::L_DOLLAR || kind == SyntaxKind::R_DOLLAR { | ||
137 | kind = self.token_source.token_kind(self.token_pos + i); | ||
138 | i += 1; | ||
139 | } | ||
140 | |||
133 | if kind == EOF { | 141 | if kind == EOF { |
134 | return; | 142 | return; |
135 | } | 143 | } |