summaryrefslogtreecommitdiff
path: root/script/parser/luadoc.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-06 19:02:23 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-06 19:02:23 +0800
commit26e0310a410820650832f8576154c9b7ee183324 (patch)
tree3979fdaa48bdc223c2af9dd17b3f7a5f4764b8f6 /script/parser/luadoc.lua
parent91ab8e7b4c3c17da0a1bcdfb02a38c23cc786910 (diff)
downloadlua-language-server-26e0310a410820650832f8576154c9b7ee183324.zip
support unary operator
Diffstat (limited to 'script/parser/luadoc.lua')
-rw-r--r--script/parser/luadoc.lua18
1 files changed, 13 insertions, 5 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index a94f89cd..2237b232 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -819,8 +819,9 @@ local docSwitch = util.switch()
: case 'class'
: call(function ()
local result = {
- type = 'doc.class',
- fields = {},
+ type = 'doc.class',
+ fields = {},
+ operators = {},
}
result.class = parseName('doc.class.name', result)
if not result.class then
@@ -1386,8 +1387,8 @@ local docSwitch = util.switch()
local ret = parseType(result)
if ret then
- result.ret = ret
- result.finish = ret.finish
+ result.extends = ret
+ result.finish = ret.finish
end
return result
@@ -1497,8 +1498,10 @@ local function isContinuedDoc(lastDoc, nextDoc)
return false
end
if lastDoc.type == 'doc.class'
- or lastDoc.type == 'doc.field' then
+ or lastDoc.type == 'doc.field'
+ or lastDoc.type == 'doc.operator' then
if nextDoc.type ~= 'doc.field'
+ and nextDoc.type ~= 'doc.operator'
and nextDoc.type ~= 'doc.comment'
and nextDoc.type ~= 'doc.overload' then
return false
@@ -1650,6 +1653,11 @@ local function bindClassAndFields(binded)
class.fields[#class.fields+1] = doc
doc.class = class
end
+ elseif doc.type == 'doc.operator' then
+ if class then
+ class.operators[#class.operators+1] = doc
+ doc.class = class
+ end
end
end
end