Remove quotes from interpolation (naively)

This commit is contained in:
ConnorSkees 2020-01-27 17:15:02 -05:00
parent 1c5c8e0650
commit 7975d468f1
2 changed files with 18 additions and 0 deletions

View File

@ -48,6 +48,9 @@ pub(crate) fn eat_interpolation<I: Iterator<Item = Token>>(
while let Some(tok) = tokens.next() { while let Some(tok) = tokens.next() {
match tok.kind { match tok.kind {
TokenKind::Symbol(Symbol::CloseCurlyBrace) => break, TokenKind::Symbol(Symbol::CloseCurlyBrace) => break,
TokenKind::Symbol(Symbol::SingleQuote) | TokenKind::Symbol(Symbol::DoubleQuote) => {
continue
}
TokenKind::Symbol(Symbol::OpenCurlyBrace) => { TokenKind::Symbol(Symbol::OpenCurlyBrace) => {
todo!("invalid character in interpolation") todo!("invalid character in interpolation")
} }

View File

@ -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)] #[cfg(test)]
mod test_mixins { mod test_mixins {
use super::*; use super::*;