diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-11-01 13:46:03 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-11-01 13:46:03 +0800 |
commit | ae95f749532c2252c671d1b3cab73d7e18cf777c (patch) | |
tree | e422f684ee201cc4473e777985121a974f97bfeb | |
parent | 640fb9c3ec3164042d15fffecd88667a22d99f6f (diff) | |
download | lua-language-server-ae95f749532c2252c671d1b3cab73d7e18cf777c.zip |
improve field attribute
-rw-r--r-- | script/parser/luadoc.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 0e560b0d..040a9a9b 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -163,8 +163,9 @@ local function parseTokens(text, offset) Ci = 0 end -local function peekToken() - return TokenTypes[Ci+1], TokenContents[Ci+1] +local function peekToken(offset) + offset = offset or 1 + return TokenTypes[Ci + offset], TokenContents[Ci + offset] end ---@return string? tokenType @@ -992,8 +993,12 @@ local docSwitch = util.switch() if value == 'public' or value == 'protected' or value == 'private' - or value == 'public' or value == 'package' then + local tp2 = peekToken(1) + local tp3 = peekToken(2) + if tp2 == 'name' and not tp3 then + return false + end result.visible = value result.start = getStart() return true |