fix assuming multiline string tokens end with '\n'

This commit is contained in:
pfg 2021-10-03 16:32:30 -04:00
parent a92b144260
commit 5d8f8cdca5

View File

@ -990,9 +990,15 @@ fn tokenizeAndPrintRaw(
}, },
.multiline_string_literal_line => { .multiline_string_literal_line => {
try out.writeAll("<span class=\"tok-str\">"); if (src[token.loc.end - 1] == '\n') {
try writeEscaped(out, src[token.loc.start .. token.loc.end - 1]); try out.writeAll("<span class=\"tok-str\">");
try out.writeAll("</span>" ++ end_line ++ "\n" ++ start_line); try writeEscaped(out, src[token.loc.start .. token.loc.end - 1]);
try out.writeAll("</span>" ++ end_line ++ "\n" ++ start_line);
} else {
try out.writeAll("<span class=\"tok-str\">");
try writeEscaped(out, src[token.loc.start..token.loc.end]);
try out.writeAll("</span>");
}
}, },
.builtin => { .builtin => {