Fix multi-type usage in delimited patterns (#1740)

In the "end" pattern we weren't considering the multiple types.
This commit is contained in:
Guldoman
2024-11-27 20:53:34 +08:00
committed by takase1121
parent 3114f2103e
commit ac4995ee46
+8 -2
View File
@@ -283,7 +283,8 @@ function tokenizer.tokenize(incoming_syntax, text, state, resume)
-- continue trying to match the end pattern of a pair if we have a state set
if current_pattern_idx > 0 then
local p = current_syntax.patterns[current_pattern_idx]
local s, e = find_text(text, p, i, false, true)
local find_results = { find_text(text, p, i, false, true) }
local s, e = find_results[1], find_results[2]
local cont = true
-- If we're in subsyntax mode, always check to see if we end our syntax
@@ -305,7 +306,12 @@ function tokenizer.tokenize(incoming_syntax, text, state, resume)
-- continue on as normal.
if cont then
if s then
push_token(res, p.type, text:usub(i, e))
-- Push remaining token before the end delimiter
if s > i then
push_token(res, p.type, text:usub(i, s - 1))
end
-- Push the end delimiter
push_tokens(res, current_syntax, p, text, find_results)
set_subsyntax_pattern_idx(0)
i = e + 1
else