diff options
-rw-r--r-- | script-beta/parser/luadoc.lua | 13 | ||||
-rw-r--r-- | test-beta/crossfile/hover.lua | 6 |
2 files changed, 13 insertions, 6 deletions
diff --git a/script-beta/parser/luadoc.lua b/script-beta/parser/luadoc.lua index 05dfcbe6..6cdd7491 100644 --- a/script-beta/parser/luadoc.lua +++ b/script-beta/parser/luadoc.lua @@ -4,7 +4,7 @@ local lines = require 'parser.lines' local guide = require 'parser.guide' local TokenTypes, TokenStarts, TokenFinishs, TokenContents -local Ci, Offset, pushError +local Ci, Offset, pushError, Ct local parseType local Parser = re.compile([[ Main <- (Token / Sp)* @@ -111,7 +111,12 @@ Symbol <- ({} { end, }) +local function trim(str) + return str:match '^%s*(%S+)%s*$' +end + local function parseTokens(text, offset) + Ct = offset Ci = 0 Offset = offset TokenTypes = {} @@ -629,6 +634,12 @@ local function parseResume() local result = { type = 'doc.resume' } + + if checkToken('symbol', '>', 1) then + nextToken() + result.default = true + end + local tp = peekToken() if tp ~= 'string' then pushError { diff --git a/test-beta/crossfile/hover.lua b/test-beta/crossfile/hover.lua index a049a66a..c743f7a5 100644 --- a/test-beta/crossfile/hover.lua +++ b/test-beta/crossfile/hover.lua @@ -294,7 +294,6 @@ TEST { } } -do return end TEST { { path = 'a.lua', @@ -312,10 +311,7 @@ TEST { hover = { label = 'function f(x: string)', name = 'f', - args = EXISTS, - rawEnum = EXISTS, - enum = [[ - + description = [[ x: string | '选项1' -- 注释1 |>'选项2' -- 注释2]] |