allow whitespace between ! and important

This commit is contained in:
ConnorSkees 2020-03-31 22:00:38 -04:00
parent faf9cf8818
commit 978fbaade0
4 changed files with 10 additions and 2 deletions

View File

@ -61,7 +61,8 @@ impl If {
let cond = read_until_open_curly_brace(toks);
toks.next();
devour_whitespace(toks);
branches.push(Branch::new(cond, read_until_closing_curly_brace(toks)));
branches
.push(Branch::new(cond, read_until_closing_curly_brace(toks)));
toks.next();
devour_whitespace(toks);
}

View File

@ -211,6 +211,7 @@ impl Value {
}
'!' => {
toks.next();
devour_whitespace(toks);
if toks.peek().unwrap().kind == '=' {
toks.next();
devour_whitespace(toks);
@ -545,6 +546,7 @@ impl Value {
}
'!' => {
toks.next();
devour_whitespace(toks);
let v = eat_ident(toks, scope, super_selector)?;
if v.to_ascii_lowercase().as_str() == "important" {
Ok(Value::Important)

View File

@ -178,4 +178,4 @@ test!(
removes_paren_around_item_in_list,
"a {\n color: 1 (foo bar);\n}\n",
"a {\n color: 1 foo bar;\n}\n"
);
);

View File

@ -96,3 +96,8 @@ test!(
"a {\n color: inspect((((((a))))));\n}\n",
"a {\n color: a;\n}\n"
);
test!(
allow_spaces_after_exclamation_point,
"a {\n color: foo ! important;\n}\n",
"a {\n color: foo !important;\n}\n"
);