allow escaped quotes to start idents

This commit is contained in:
ConnorSkees 2020-03-29 23:00:39 -04:00
parent 2885eec853
commit 2a3f13bea0
2 changed files with 13 additions and 1 deletions

View File

@ -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();

View File

@ -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"
);