summaryrefslogtreecommitdiff
path: root/script/parser/luadoc.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-10 03:12:05 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-10 03:12:05 +0800
commit4e0a890060aea1eb54b14b3a77cba8fc42ceeebb (patch)
tree0ba13f7a859f2ea850f09774936b15d3fb1d971c /script/parser/luadoc.lua
parent88b155930b1fe6a8cf086c55ea3b108c8b1f0e73 (diff)
downloadlua-language-server-4e0a890060aea1eb54b14b3a77cba8fc42ceeebb.zip
supports `---@type (string|integer)[]`
Diffstat (limited to 'script/parser/luadoc.lua')
-rw-r--r--script/parser/luadoc.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 6adbfa68..f9cd3db0 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -598,6 +598,16 @@ local function parseBoolean(parent)
return boolean
end
+local function parseParen(parent)
+ if not checkToken('symbol', '(', 1) then
+ return
+ end
+ nextToken()
+ local tp = parseType(parent)
+ nextSymbolOrError(')')
+ return tp
+end
+
function parseTypeUnit(parent)
local result = parseFunction(parent)
or parseTable(parent)
@@ -605,6 +615,7 @@ function parseTypeUnit(parent)
or parseInteger(parent)
or parseBoolean(parent)
or parseDots('doc.type.name', parent)
+ or parseParen(parent)
if not result then
local literal = checkToken('symbol', '`', 1)
if literal then