summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-04-26 14:11:14 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-04-26 14:11:14 +0800
commit76c7098956305de4ca0be6f260c10ab8f8c6fa04 (patch)
tree99fea5fdb048f407f5bbfa77a0a4b4c591fbdb11 /script/parser
parent881e16b99cc1dd35d0e50af4b14d43635d0a474d (diff)
downloadlua-language-server-76c7098956305de4ca0be6f260c10ab8f8c6fa04.zip
lock parsing resume
fix #2056
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/luadoc.lua19
1 files changed, 6 insertions, 13 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 2f5a8ad3..c022adcb 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -700,6 +700,8 @@ local function parseResume(parent)
return result
end
+local lockResume = false
+
function parseType(parent)
local result = {
type = 'doc.type',
@@ -778,20 +780,10 @@ function parseType(parent)
return false
end
- local checkResume = true
- local nsymbol, ncontent = peekToken()
- if nsymbol == 'symbol' then
- if ncontent == ','
- or ncontent == ':'
- or ncontent == '|'
- or ncontent == ')'
- or ncontent == '}' then
- checkResume = false
- end
- end
-
- if checkResume then
+ if not lockResume then
+ lockResume = true
while pushResume() do end
+ lockResume = false
end
if #result.types == 0 then
@@ -2051,6 +2043,7 @@ return function (state)
if not comment then
break
end
+ lockResume = false
local doc, rests = buildLuaDoc(comment)
if doc then
insertDoc(doc, comment)