diff options
author | pommicket <pommicket@gmail.com> | 2023-06-15 11:09:19 +0100 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-06-15 11:09:19 +0100 |
commit | 7e40fc996be11d0ab1b4735872f5fb48f6a59aac (patch) | |
tree | fbdbc55d54efc62be087d5590a9c88fd379ec324 | |
parent | b929933b8261889b2b0275b5809c763d0c0f32b2 (diff) |
prevent /= from being parsed as regex literal
-rw-r--r-- | syntax.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1390,6 +1390,12 @@ static void syntax_highlight_javascript_like( || (is32_space(line[i-1]) && i + 1 < line_len && !is32_space(line[i+1])) // slash preceded by any of these characters || (line[i-1] <= 128 && strchr(";({[=,:", (char)line[i-1])); + + if (i + 1 < line_len && line[i+1] == '=') { + // slash is followed by equals, so this might be /= + is_regex = false; + } + if (is_regex) { in_string = true; string_is_regex = true; |