mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-01 10:25:41 +00:00
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 <edwin0cheng@gmail.com>
This commit is contained in:
commit
12629d5e4f
@ -129,7 +129,15 @@ impl<'t> Parser<'t> {
|
|||||||
/// Advances the parser by one token unconditionally
|
/// Advances the parser by one token unconditionally
|
||||||
/// Mainly use in `token_tree` parsing
|
/// Mainly use in `token_tree` parsing
|
||||||
pub(crate) fn bump_raw(&mut self) {
|
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 {
|
if kind == EOF {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user