summaryrefslogtreecommitdiff
path: root/script/parser/luadoc.lua
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2022-03-06 21:40:34 +0800
committersumneko <sumneko@hotmail.com>2022-03-06 21:40:34 +0800
commitbd9566eb4c856d041e705be59e9b62b0a09d3ed4 (patch)
tree4e7454be8cd388a91c373b3ebf9cfe103455d39b /script/parser/luadoc.lua
parentaa6703f8e866cbc2cb50740000ad6ca1e46dd860 (diff)
downloadlua-language-server-bd9566eb4c856d041e705be59e9b62b0a09d3ed4.zip
update
Diffstat (limited to 'script/parser/luadoc.lua')
-rw-r--r--script/parser/luadoc.lua32
1 files changed, 15 insertions, 17 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index ccc38eac..d516643b 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -223,25 +223,24 @@ local function parseIndexField(tp, parent)
return nil
end
nextToken()
- local class = {
- type = tp,
- start = getStart(),
- finish = getFinish(),
- parent = parent,
- }
- local indexTP, index = nextToken()
- if indexTP ~= 'integer'
- and indexTP ~= 'string' then
- pushWarning {
- type = 'LUADOC_INDEX_MUST_INT',
+ local indexTP, index = peekToken()
+ if indexTP == 'name' then
+ local field = parseType(parent)
+ nextSymbolOrError ']'
+ return field
+ else
+ nextToken()
+ local class = {
+ type = tp,
start = getStart(),
finish = getFinish(),
+ parent = parent,
}
+ class[1] = index
+ nextSymbolOrError ']'
+ class.finish = getFinish()
+ return class
end
- class[1] = index
- nextSymbolOrError ']'
- class.finish = getFinish()
- return class
end
local function parseClass(parent)
@@ -427,7 +426,7 @@ end
local function parseTypeUnitLiteralTable()
local typeUnit = {
- type = 'doc.type.ltable',
+ type = 'doc.type.table',
start = getStart(),
fields = {},
}
@@ -527,7 +526,6 @@ function parseTypeUnit(parent, content)
result.parent = parent
while true do
local newResult = parseTypeUnitArray(parent, result)
- or parseTypeUnitTable(parent, result)
if not newResult then
break
end