zig-mode icon indicating copy to clipboard operation
zig-mode copied to clipboard

string highlighting doesn't stop if end quote is preceded by an escaped backslash

Open travv0 opened this issue 5 years ago • 3 comments

An example from std.os.windows, everything after the following line is highlighted as a string because it sees the end quote as escaped:

const prefix_u8 = "\\DosDevices\\";

travv0 avatar Oct 22 '20 18:10 travv0

Possibly related: if a multi-line string literal ends with an empty line, everything after that line is highlighted as a string. Example:

const test_str =
    \\I need the empty line
    \\
;

endragor avatar Oct 25 '20 15:10 endragor

Ah, you already fixed that. So nevermind :)

endragor avatar Oct 25 '20 15:10 endragor

Yeah, I got that fixed but my emacs knowledge wasn't enough for me to figure this one out. It seems like the function currently used for highlighting multiline strings might be overkill since you'd think a simple regex would do the trick, but it seems like there's some sort of "priority" to what gets highlighted so when I tried to highlight based on a regex match, it only matched strings that didn't have highlighted keywords in them.

travv0 avatar Oct 25 '20 15:10 travv0