allow escaped !
in selectors
This commit is contained in:
parent
55bcd1d1dd
commit
a79c62c2fa
@ -364,6 +364,12 @@ impl<'a> Parser<'a> {
|
|||||||
found_curly = true;
|
found_curly = true;
|
||||||
break;
|
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
|
if peek_ident_no_interpolation(self.toks, false, self.span_before)?.node
|
||||||
== "optional"
|
== "optional"
|
||||||
|
@ -133,7 +133,8 @@ pub(crate) fn peek_escape(toks: &mut PeekMoreIterator<IntoIter<Token>>) -> SassR
|
|||||||
toks.peek_forward(1);
|
toks.peek_forward(1);
|
||||||
}
|
}
|
||||||
} else {
|
} 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))?;
|
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."
|
"a {foo: {bar: red", "Error: Expected identifier."
|
||||||
);
|
);
|
||||||
error!(toplevel_nullbyte, "\u{0}", "Error: expected selector.");
|
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"
|
"ul li#foo {\n foo: bar;\n}\n"
|
||||||
);
|
);
|
||||||
test!(escaped_space, "a\\ b {\n color: foo;\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!(
|
test!(
|
||||||
multiple_consecutive_immediate_child,
|
multiple_consecutive_immediate_child,
|
||||||
"> > foo {\n color: foo;\n}\n"
|
"> > foo {\n color: foo;\n}\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user