hexchars escaped in strings don't recieve trailing space

This commit is contained in:
ConnorSkees 2020-03-31 11:52:28 -04:00
parent 84b6ca9180
commit 526b4aa15f
2 changed files with 6 additions and 1 deletions

View File

@ -596,7 +596,7 @@ pub(crate) fn parse_quoted_string<I: Iterator<Item = Token>>(
} }
let c = std::char::from_u32(u32::from_str_radix(&n, 16).unwrap()).unwrap(); let c = std::char::from_u32(u32::from_str_radix(&n, 16).unwrap()).unwrap();
if c.is_control() && c != '\t' && c != '\0' { if c.is_control() && c != '\t' && c != '\0' {
s.push_str(&format!("\\{} ", n.to_ascii_lowercase())); s.push_str(&format!("\\{}", n.to_ascii_lowercase()));
} else { } else {
s.push(c); s.push(c);
} }

View File

@ -106,3 +106,8 @@ test!(
"a {\n color: \"\\g\";\n}\n", "a {\n color: \"\\g\";\n}\n",
"a {\n color: \"g\";\n}\n" "a {\n color: \"g\";\n}\n"
); );
test!(
escapes_hex_in_string_no_trailing_space,
"a {\n color: \"\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\l\\m\\n\\o\\p\\q\\r\\s\\t\\u\\v\\w\\x\\y\\z\";\n}\n",
"a {\n color: \"\\b\\c\\d\\e\\fghijklmnopqrstuvwxyz\";\n}\n"
);