diff options
author | Aleksey Kladov <[email protected]> | 2019-09-10 12:27:08 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-09-10 13:56:05 +0100 |
commit | 1c5800dee89b14406e816accf41c597e7860aff8 (patch) | |
tree | 5977cce69d65da94d2b818c70ba10ecbc8634cab /crates/ra_parser | |
parent | 40170885e799ebdefb24ed00865cd1c7800af491 (diff) |
"Fix" mbe to work with decomposed tokens
We regressed $i * 2 where $i = 1 + 1, need to fix that!
Diffstat (limited to 'crates/ra_parser')
-rw-r--r-- | crates/ra_parser/src/parser.rs | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/crates/ra_parser/src/parser.rs b/crates/ra_parser/src/parser.rs index a27cdc2ea..e7281123b 100644 --- a/crates/ra_parser/src/parser.rs +++ b/crates/ra_parser/src/parser.rs | |||
@@ -50,29 +50,6 @@ impl<'t> Parser<'t> { | |||
50 | self.steps.set(steps + 1); | 50 | self.steps.set(steps + 1); |
51 | 51 | ||
52 | self.token_source.lookahead_nth(n).kind | 52 | self.token_source.lookahead_nth(n).kind |
53 | |||
54 | // // It is because the Dollar will appear between nth | ||
55 | // // Following code skips through it | ||
56 | // let mut non_dollars_count = 0; | ||
57 | // let mut i = 0; | ||
58 | |||
59 | // loop { | ||
60 | // let token = self.token_source.lookahead_nth(i); | ||
61 | // let mut kind = token.kind; | ||
62 | // if let Some((composited, step)) = self.is_composite(token, i) { | ||
63 | // kind = composited; | ||
64 | // i += step; | ||
65 | // } else { | ||
66 | // i += 1; | ||
67 | // } | ||
68 | |||
69 | // match kind { | ||
70 | // EOF => return EOF, | ||
71 | // SyntaxKind::L_DOLLAR | SyntaxKind::R_DOLLAR => {} | ||
72 | // _ if non_dollars_count == n => return kind, | ||
73 | // _ => non_dollars_count += 1, | ||
74 | // } | ||
75 | // } | ||
76 | } | 53 | } |
77 | 54 | ||
78 | /// Checks if the current token is `kind`. | 55 | /// Checks if the current token is `kind`. |
@@ -185,25 +162,6 @@ impl<'t> Parser<'t> { | |||
185 | assert!(self.eat(kind)); | 162 | assert!(self.eat(kind)); |
186 | } | 163 | } |
187 | 164 | ||
188 | /// Advances the parser by one token unconditionally | ||
189 | /// Mainly use in `token_tree` parsing | ||
190 | #[allow(unused)] | ||
191 | fn bump_raw(&mut self) { | ||
192 | let mut kind = self.token_source.current().kind; | ||
193 | |||
194 | // Skip dollars, do_bump will eat these later | ||
195 | let mut i = 0; | ||
196 | while kind == SyntaxKind::L_DOLLAR || kind == SyntaxKind::R_DOLLAR { | ||
197 | kind = self.token_source.lookahead_nth(i).kind; | ||
198 | i += 1; | ||
199 | } | ||
200 | |||
201 | if kind == EOF { | ||
202 | return; | ||
203 | } | ||
204 | self.do_bump(kind, 1); | ||
205 | } | ||
206 | |||
207 | /// Advances the parser by one token with composite puncts handled | 165 | /// Advances the parser by one token with composite puncts handled |
208 | pub(crate) fn bump_any(&mut self) { | 166 | pub(crate) fn bump_any(&mut self) { |
209 | let kind = self.nth(0); | 167 | let kind = self.nth(0); |
@@ -277,21 +235,6 @@ impl<'t> Parser<'t> { | |||
277 | self.events.push(event) | 235 | self.events.push(event) |
278 | } | 236 | } |
279 | 237 | ||
280 | #[allow(unused)] | ||
281 | fn eat_dollars(&mut self) { | ||
282 | loop { | ||
283 | match self.token_source.current().kind { | ||
284 | k @ SyntaxKind::L_DOLLAR | k @ SyntaxKind::R_DOLLAR => { | ||
285 | self.token_source.bump(); | ||
286 | self.push_event(Event::Token { kind: k, n_raw_tokens: 1 }); | ||
287 | } | ||
288 | _ => { | ||
289 | return; | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | |||
295 | pub(crate) fn eat_l_dollars(&mut self) -> usize { | 238 | pub(crate) fn eat_l_dollars(&mut self) -> usize { |
296 | let mut ate_count = 0; | 239 | let mut ate_count = 0; |
297 | loop { | 240 | loop { |