diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-10 03:12:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-10 03:12:05 +0800 |
commit | 4e0a890060aea1eb54b14b3a77cba8fc42ceeebb (patch) | |
tree | 0ba13f7a859f2ea850f09774936b15d3fb1d971c /script/parser | |
parent | 88b155930b1fe6a8cf086c55ea3b108c8b1f0e73 (diff) | |
download | lua-language-server-4e0a890060aea1eb54b14b3a77cba8fc42ceeebb.zip |
supports `---@type (string|integer)[]`
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/luadoc.lua | 11 |
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 |