From 1c5800dee89b14406e816accf41c597e7860aff8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 10 Sep 2019 14:27:08 +0300 Subject: "Fix" mbe to work with decomposed tokens We regressed $i * 2 where $i = 1 + 1, need to fix that! --- crates/ra_parser/src/parser.rs | 57 ------------------------------------------ 1 file changed, 57 deletions(-) (limited to 'crates/ra_parser/src') 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> { self.steps.set(steps + 1); self.token_source.lookahead_nth(n).kind - - // // It is because the Dollar will appear between nth - // // Following code skips through it - // let mut non_dollars_count = 0; - // let mut i = 0; - - // loop { - // let token = self.token_source.lookahead_nth(i); - // let mut kind = token.kind; - // if let Some((composited, step)) = self.is_composite(token, i) { - // kind = composited; - // i += step; - // } else { - // i += 1; - // } - - // match kind { - // EOF => return EOF, - // SyntaxKind::L_DOLLAR | SyntaxKind::R_DOLLAR => {} - // _ if non_dollars_count == n => return kind, - // _ => non_dollars_count += 1, - // } - // } } /// Checks if the current token is `kind`. @@ -185,25 +162,6 @@ impl<'t> Parser<'t> { assert!(self.eat(kind)); } - /// Advances the parser by one token unconditionally - /// Mainly use in `token_tree` parsing - #[allow(unused)] - fn bump_raw(&mut self) { - let mut kind = self.token_source.current().kind; - - // Skip dollars, do_bump will eat these later - let mut i = 0; - while kind == SyntaxKind::L_DOLLAR || kind == SyntaxKind::R_DOLLAR { - kind = self.token_source.lookahead_nth(i).kind; - i += 1; - } - - if kind == EOF { - return; - } - self.do_bump(kind, 1); - } - /// Advances the parser by one token with composite puncts handled pub(crate) fn bump_any(&mut self) { let kind = self.nth(0); @@ -277,21 +235,6 @@ impl<'t> Parser<'t> { self.events.push(event) } - #[allow(unused)] - fn eat_dollars(&mut self) { - loop { - match self.token_source.current().kind { - k @ SyntaxKind::L_DOLLAR | k @ SyntaxKind::R_DOLLAR => { - self.token_source.bump(); - self.push_event(Event::Token { kind: k, n_raw_tokens: 1 }); - } - _ => { - return; - } - } - } - } - pub(crate) fn eat_l_dollars(&mut self) -> usize { let mut ate_count = 0; loop { -- cgit v1.2.3