Fix string parsing.
This commit is contained in:
parent
d23d1159ab
commit
41caa233bb
@ -1192,8 +1192,13 @@ pub fn parse_string_literal(
|
|||||||
|
|
||||||
// Close wrapper
|
// Close wrapper
|
||||||
if termination_char == next_char && escape.is_empty() {
|
if termination_char == next_char && escape.is_empty() {
|
||||||
state.is_within_text_terminated_by = None;
|
// Double wrapper
|
||||||
break;
|
if stream.peek_next().map_or(false, |c| c == termination_char) {
|
||||||
|
eat_next(stream, pos);
|
||||||
|
} else {
|
||||||
|
state.is_within_text_terminated_by = None;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if first_char.is_none() {
|
if first_char.is_none() {
|
||||||
@ -1267,15 +1272,6 @@ pub fn parse_string_literal(
|
|||||||
result.push(next_char)
|
result.push(next_char)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double wrapper
|
|
||||||
_ if termination_char == next_char
|
|
||||||
&& escape.is_empty()
|
|
||||||
&& stream.peek_next().map_or(false, |c| c == termination_char) =>
|
|
||||||
{
|
|
||||||
eat_next(stream, pos);
|
|
||||||
result.push(termination_char)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verbatim
|
// Verbatim
|
||||||
'\n' if verbatim => {
|
'\n' if verbatim => {
|
||||||
assert_eq!(escape, "", "verbatim strings should not have any escapes");
|
assert_eq!(escape, "", "verbatim strings should not have any escapes");
|
||||||
|
Loading…
Reference in New Issue
Block a user