allow escaped quotes to start idents
This commit is contained in:
parent
2885eec853
commit
2a3f13bea0
10
src/utils.rs
10
src/utils.rs
@ -224,6 +224,10 @@ pub(crate) fn read_until_semicolon_or_closing_curly_brace<I: Iterator<Item = Tok
|
||||
';' => {
|
||||
break;
|
||||
}
|
||||
'\\' => {
|
||||
t.push(toks.next().unwrap());
|
||||
t.push(toks.next().unwrap());
|
||||
}
|
||||
'"' | '\'' => {
|
||||
let quote = toks.next().unwrap();
|
||||
t.push(quote.clone());
|
||||
@ -258,6 +262,10 @@ pub(crate) fn read_until_semicolon_or_open_or_closing_curly_brace<I: Iterator<It
|
||||
';' => {
|
||||
break;
|
||||
}
|
||||
'\\' => {
|
||||
t.push(toks.next().unwrap());
|
||||
t.push(toks.next().unwrap());
|
||||
}
|
||||
'"' | '\'' => {
|
||||
let quote = toks.next().unwrap();
|
||||
t.push(quote.clone());
|
||||
@ -306,7 +314,7 @@ pub(crate) fn eat_variable_value<I: Iterator<Item = Token>>(
|
||||
let mut raw = read_until_semicolon_or_closing_curly_brace(toks)
|
||||
.into_iter()
|
||||
.peekable();
|
||||
if toks.peek().unwrap().kind == ';' {
|
||||
if toks.peek().is_some() && toks.peek().unwrap().kind == ';' {
|
||||
toks.next();
|
||||
}
|
||||
let mut x = Vec::new();
|
||||
|
@ -87,3 +87,7 @@ test!(
|
||||
does_not_combine_idents_with_leading_hyphen_all,
|
||||
"a {\n color: -a -b -c;\n}\n"
|
||||
);
|
||||
test!(
|
||||
alllows_escaped_quote_at_start_of_ident,
|
||||
"a {\n color: \\\"c\\\";\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user