summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-06-15 11:09:19 +0100
committerpommicket <pommicket@gmail.com>2023-06-15 11:09:19 +0100
commit7e40fc996be11d0ab1b4735872f5fb48f6a59aac (patch)
treefbdbc55d54efc62be087d5590a9c88fd379ec324
parentb929933b8261889b2b0275b5809c763d0c0f32b2 (diff)
prevent /= from being parsed as regex literal
-rw-r--r--syntax.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/syntax.c b/syntax.c
index e7ee69d..1a5e1cf 100644
--- a/syntax.c
+++ b/syntax.c
@@ -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;