From a42f26502d22e270285e10af463996b22eec98ce Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 1 May 2019 22:39:47 +0800 Subject: Skip Dollars when bump raw token --- crates/ra_parser/src/parser.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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> { /// Advances the parser by one token unconditionally /// Mainly use in `token_tree` parsing pub(crate) fn bump_raw(&mut self) { - let kind = self.token_source.token_kind(self.token_pos); + let mut kind = self.token_source.token_kind(self.token_pos); + + // 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.token_kind(self.token_pos + i); + i += 1; + } + if kind == EOF { return; } -- cgit v1.2.3