syntax: warn against malformed patterns and disable them (#2029)

(cherry picked from commit 3501f3d0bb6ee399ecb7cdf04cff8cf138b1ca02)
This commit is contained in:
Takase
2025-05-18 22:55:29 +08:00
committed by takase1121
parent 026d2a4271
commit 590367a6e5
2 changed files with 49 additions and 0 deletions
+1
View File
@@ -203,6 +203,7 @@ function tokenizer.tokenize(incoming_syntax, text, state, resume)
local target, res = p.pattern or p.regex, { 1, offset - 1 }
local p_idx = close and 2 or 1
local code = type(target) == "table" and target[p_idx] or target
if p.disabled then return end
if p.whole_line == nil then p.whole_line = { } end
if p.whole_line[p_idx] == nil then