summaryrefslogtreecommitdiff
path: root/script-beta/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-31 15:44:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-31 15:44:41 +0800
commit09e873bf25f1dbaccd97d4fe7f608dde1fe68028 (patch)
treec2b6d6c2c595826ec15bdd717ba7343b5176afdb /script-beta/parser
parent709d4d828978ecd787dbbf108b04e985c4afc0a4 (diff)
downloadlua-language-server-09e873bf25f1dbaccd97d4fe7f608dde1fe68028.zip
doc.param 和 doc.return 支持 ?
Diffstat (limited to 'script-beta/parser')
-rw-r--r--script-beta/parser/luadoc.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/script-beta/parser/luadoc.lua b/script-beta/parser/luadoc.lua
index ca4ee25d..933ce1be 100644
--- a/script-beta/parser/luadoc.lua
+++ b/script-beta/parser/luadoc.lua
@@ -453,6 +453,10 @@ local function parseParam()
end
result.start = getStart()
result.extends = parseType(result)
+ if checkToken('symbol', '?', 1) then
+ nextToken()
+ result.optional = true
+ end
if not result.extends then
pushError {
type = 'LUADOC_MISS_PARAM_EXTENDS',
@@ -478,6 +482,10 @@ local function parseReturn()
if not result.start then
result.start = docType.start
end
+ if checkToken('symbol', '?', 1) then
+ nextToken()
+ docType.optional = true
+ end
result.returns[#result.returns+1] = docType
if not checkToken('symbol', ',', 1) then
break