properly handle escaped newlines in quoted strings

This commit is contained in:
ConnorSkees 2020-05-16 17:20:53 -04:00
parent 09e6568c39
commit 2db3398fe2
2 changed files with 7 additions and 1 deletions

View File

@ -302,7 +302,8 @@ pub(crate) fn parse_quoted_string<I: Iterator<Item = Token>>(
};
if first.kind == '\n' {
return Err(("Expected escape sequence.", first.pos()).into());
toks.next();
continue;
}
if first.kind.is_ascii_hexdigit() {

View File

@ -172,3 +172,8 @@ error!(
escape_sequence_does_not_fit_inside_char,
"a {\n color: \\110000;\n}\n", "Error: Invalid escape sequence."
);
test!(
escaped_newline_in_quoted_string,
"a {\n color: \"foo\\\nbar\";\n}\n",
"a {\n color: \"foobar\";\n}\n"
);