allow at-rules other than else to follow @ if

This commit is contained in:
ConnorSkees 2020-04-20 10:57:35 -04:00
parent aaf37bf4c4
commit 4ca6e304a5
2 changed files with 10 additions and 0 deletions

View File

@ -50,6 +50,11 @@ impl If {
loop { loop {
if toks.peek().is_some() { if toks.peek().is_some() {
if toks.peek().unwrap().kind == '@' { if toks.peek().unwrap().kind == '@' {
let first_char = toks.peek_forward(1).unwrap().kind;
toks.peek_backward(1).unwrap();
if first_char != 'e' && first_char != 'E' {
break;
}
toks.next(); toks.next();
} else { } else {
break; break;

View File

@ -67,3 +67,8 @@ test!(
"a {\n @if true {\n color: red\n }\n}\n", "a {\n @if true {\n color: red\n }\n}\n",
"a {\n color: red;\n}\n" "a {\n color: red;\n}\n"
); );
test!(
atrule_other_than_else_immediately_following,
"a {\n @if true {\n b {\n background: gray;\n }\n }\n\n @if true {\n b {\n background: gray;\n }\n }\n}\n",
"a b {\n background: gray;\n}\na b {\n background: gray;\n}\n"
);