diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/parser/guide.lua | 12 | ||||
-rw-r--r-- | script/parser/luadoc.lua | 5 |
2 files changed, 15 insertions, 2 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 16aea8f1..b2b1e583 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -99,6 +99,7 @@ m.childMap = { ['doc.generic'] = {'#generics', 'comment'}, ['doc.generic.object'] = {'generic', 'extends', 'comment'}, ['doc.vararg'] = {'vararg', 'comment'}, + ['doc.type.array'] = {'node'}, ['doc.type.table'] = {'node', 'key', 'value', 'comment'}, ['doc.type.function'] = {'#args', '#returns', 'comment'}, ['doc.type.typeliteral'] = {'node'}, @@ -1670,6 +1671,16 @@ local function stepRefOfGenericCrossTable(status, doc, typeName) return function (obj) return nil end + elseif typeUnit.type == 'doc.type.array' then + return function (obj) + local childStatus = m.status(status) + m.searchRefs(childStatus, obj, 'def') + for _, res in ipairs(childStatus.results) do + if res.type == 'doc.type.array' then + return res.node + end + end + end end end return function (obj) @@ -1702,6 +1713,7 @@ local function stepRefOfGeneric(status, typeUnit, args, mode) end local docArg = m.getParentType(typeName, 'doc.type.arg') or m.getParentType(typeName, 'doc.param') + or m.getParentType(typeName, 'doc.type.array') if not docArg then goto CONTINUE end diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index f30d47b4..7684ac1f 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -256,7 +256,7 @@ local function nextSymbolOrError(symbol) return false end -local function parseTypeUnitArray(node) +local function parseTypeUnitArray(parent, node) if not checkToken('symbol', '[]', 1) then return nil end @@ -266,6 +266,7 @@ local function parseTypeUnitArray(node) start = node.start, finish = getFinish(), node = node, + parent = parent, } node.parent = result return result @@ -413,7 +414,7 @@ local function parseTypeUnit(parent, content) end result.parent = parent while true do - local newResult = parseTypeUnitArray(result) + local newResult = parseTypeUnitArray(parent, result) or parseTypeUnitTable(parent, result) if not newResult then break |