From bd426b9fab1885b4a187c3bc02f0c3dbb7caba15 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Wed, 1 Apr 2020 19:35:04 -0400 Subject: [PATCH] better heuristics when no space between colon and style --- src/lib.rs | 6 +++++- tests/misc.rs | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 5c12be3..33fd261 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -546,7 +546,11 @@ pub(crate) fn eat_expr>( return Ok(Some(Expr::VariableDecl(name, Box::new(val)))); } } else { - todo!() + values.push(tok); + // HACK: we add the name back in, but lose the position information + // potentially requires refactoring heuristics for + // no space between colon and style value + values.extend(name.chars().map(|c| Token::new(Pos::new(), c))); } } '/' => { diff --git a/tests/misc.rs b/tests/misc.rs index 6df5012..0637b29 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -105,3 +105,8 @@ test!( values_after_important, "a {\n color: foo bar !important hux baz;\n}\n" ); +test!( + no_space_between_colon_and_style_variable, + "$base-color: #036;\na {\n color:lighten($base-color, 5%);\n}", + "a {\n color: #004080;\n}\n" +);