allow escaped !
in selectors
This commit is contained in:
parent
55bcd1d1dd
commit
a79c62c2fa
@ -364,6 +364,12 @@ impl<'a> Parser<'a> {
|
||||
found_curly = true;
|
||||
break;
|
||||
}
|
||||
'\\' => {
|
||||
string.push('\\');
|
||||
if let Some(Token { kind, .. }) = self.toks.next() {
|
||||
string.push(kind);
|
||||
}
|
||||
}
|
||||
'!' => {
|
||||
if peek_ident_no_interpolation(self.toks, false, self.span_before)?.node
|
||||
== "optional"
|
||||
|
@ -133,7 +133,8 @@ pub(crate) fn peek_escape(toks: &mut PeekMoreIterator<IntoIter<Token>>) -> SassR
|
||||
toks.peek_forward(1);
|
||||
}
|
||||
} else {
|
||||
value = toks.peek_forward(1).unwrap().kind as u32;
|
||||
value = first.kind as u32;
|
||||
toks.advance_cursor();
|
||||
}
|
||||
|
||||
let c = std::char::from_u32(value).ok_or(("Invalid escape sequence.", span))?;
|
||||
|
@ -245,3 +245,4 @@ error!(
|
||||
"a {foo: {bar: red", "Error: Expected identifier."
|
||||
);
|
||||
error!(toplevel_nullbyte, "\u{0}", "Error: expected selector.");
|
||||
error!(double_escaped_bang_at_toplevel, "\\!\\!", "Error: expected \"{\".");
|
||||
|
@ -350,6 +350,11 @@ test!(
|
||||
"ul li#foo {\n foo: bar;\n}\n"
|
||||
);
|
||||
test!(escaped_space, "a\\ b {\n color: foo;\n}\n");
|
||||
test!(
|
||||
escaped_bang,
|
||||
"\\! {\n color: red;\n}\n",
|
||||
"\\! {\n color: red;\n}\n"
|
||||
);
|
||||
test!(
|
||||
multiple_consecutive_immediate_child,
|
||||
"> > foo {\n color: foo;\n}\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user