From 7975d468f1d2f9cfb2f6f9bc8da8657726d77e35 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Mon, 27 Jan 2020 17:15:02 -0500 Subject: [PATCH] Remove quotes from interpolation (naively) --- src/utils.rs | 3 +++ tests/main.rs | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/utils.rs b/src/utils.rs index e990b41..e29ea65 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -48,6 +48,9 @@ pub(crate) fn eat_interpolation>( while let Some(tok) = tokens.next() { match tok.kind { TokenKind::Symbol(Symbol::CloseCurlyBrace) => break, + TokenKind::Symbol(Symbol::SingleQuote) | TokenKind::Symbol(Symbol::DoubleQuote) => { + continue + } TokenKind::Symbol(Symbol::OpenCurlyBrace) => { todo!("invalid character in interpolation") } diff --git a/tests/main.rs b/tests/main.rs index 84dfeeb..53e2cae 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -520,6 +520,21 @@ mod test_misc { ); } +#[cfg(test)] +mod test_interpolation { + use super::*; + test!( + removes_double_quotes, + "a {\n color: #{\"red\"};\n}\n", + "a {\n color: red;\n}\n" + ); + test!( + removes_single_quotes, + "a {\n color: #{'red'};\n}\n", + "a {\n color: red;\n}\n" + ); +} + #[cfg(test)] mod test_mixins { use super::*;