Simpliy how collecting token from src

This commit is contained in:
Edwin Cheng 2019-05-28 00:28:46 +08:00
parent c8c9230dd2
commit 98aac6b751
3 changed files with 39 additions and 72 deletions

View file

@ -298,11 +298,7 @@ fn delim_to_str(d: tt::Delimiter, closing: bool) -> SmolStr {
impl<'a> TreeSink for TtTreeSink<'a> {
fn token(&mut self, kind: SyntaxKind, n_tokens: u8) {
if kind == L_DOLLAR || kind == R_DOLLAR {
if let Some(_) = self.cursor.end() {
self.cursor = self.cursor.bump();
} else {
self.cursor = self.cursor.subtree().unwrap();
}
self.cursor = self.cursor.bump_subtree();
return;
}