From 4321a383f2186d4cf5fb69053779829b8ebeea79 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 2 May 2020 12:49:42 -0400 Subject: [PATCH] eat whitespace after silent comments --- src/utils/read_until.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/utils/read_until.rs b/src/utils/read_until.rs index 8fb3436..2732642 100644 --- a/src/utils/read_until.rs +++ b/src/utils/read_until.rs @@ -69,7 +69,10 @@ pub(crate) fn read_until_closing_curly_brace>( '/' => { let next = toks.next().unwrap(); match toks.peek().unwrap().kind { - '/' => read_until_newline(toks), + '/' => { + read_until_newline(toks); + devour_whitespace(toks); + } _ => t.push(next), }; continue; @@ -162,7 +165,10 @@ pub(crate) fn read_until_semicolon_or_closing_curly_brace { let next = toks.next().unwrap(); match toks.peek().unwrap().kind { - '/' => read_until_newline(toks), + '/' => { + read_until_newline(toks); + devour_whitespace(toks); + } _ => t.push(next), }; continue; @@ -215,6 +221,7 @@ pub(crate) fn read_until_closing_square_brace>( let mut t = Vec::new(); let mut scope = 0; while let Some(tok) = toks.next() { + // TODO: comments match tok.kind { ']' => { if scope < 1 {