From bad318aae8f07b864d98bdc71888c5a42b05a2a0 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 1 Feb 2020 23:22:36 -0500 Subject: [PATCH] Handle no space between colon when also missing semicolon --- src/lib.rs | 8 ++++++++ tests/styles.rs | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index aba7c2f..3de7201 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -527,6 +527,14 @@ pub(crate) fn eat_expr>( toks.next(); devour_whitespace(toks); return Ok(None); + } else { + // special edge case where there was no space between the colon + // and no semicolon following the style + // in a style `color:red`. todo: refactor + let mut v = values.clone().into_iter().peekable(); + let property = Style::parse_property(&mut v, scope, super_selector, String::new()); + let value = Style::parse_value(&mut v, scope, super_selector); + return Ok(Some(Expr::Style(Style { property, value }))); } } TokenKind::Symbol(Symbol::OpenCurlyBrace) => { diff --git a/tests/styles.rs b/tests/styles.rs index abae804..8e0369d 100644 --- a/tests/styles.rs +++ b/tests/styles.rs @@ -125,3 +125,8 @@ test!( "a {\n color:red;\n}\n", "a {\n color: red;\n}\n" ); +test!( + no_space_between_colon_no_semicolon, + "a {\n color:red\n}\n", + "a {\n color: red;\n}\n" +);