diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 9857bf78..8d3c70b2 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -1192,8 +1192,13 @@ pub fn parse_string_literal( // Close wrapper if termination_char == next_char && escape.is_empty() { - state.is_within_text_terminated_by = None; - break; + // Double wrapper + 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() { @@ -1267,15 +1272,6 @@ pub fn parse_string_literal( 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 '\n' if verbatim => { assert_eq!(escape, "", "verbatim strings should not have any escapes");