Fix popping subsyntaxes that end consecutively (#1246)

This commit is contained in:
xwii 2022-12-28 08:24:52 +08:00 committed by GitHub
parent 8603644726
commit 271a804986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -283,13 +283,15 @@ function tokenizer.tokenize(incoming_syntax, text, state)
-- General end of syntax check. Applies in the case where -- General end of syntax check. Applies in the case where
-- we're ending early in the middle of a delimiter, or -- we're ending early in the middle of a delimiter, or
-- just normally, upon finding a token. -- just normally, upon finding a token.
if subsyntax_info then while subsyntax_info do
local s, e = find_text(text, subsyntax_info, i, true, true) local s, e = find_text(text, subsyntax_info, i, true, true)
if s then if s then
push_token(res, subsyntax_info.type, text:usub(i, e)) push_token(res, subsyntax_info.type, text:usub(i, e))
-- On finding unescaped delimiter, pop it. -- On finding unescaped delimiter, pop it.
pop_subsyntax() pop_subsyntax()
i = e + 1 i = e + 1
else
break
end end
end end