Skip to content

Commit ae95f74

Browse files
committed
improve field attribute
1 parent 640fb9c commit ae95f74

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

script/parser/luadoc.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ local function parseTokens(text, offset)
163163
Ci = 0
164164
end
165165

166-
local function peekToken()
167-
return TokenTypes[Ci+1], TokenContents[Ci+1]
166+
local function peekToken(offset)
167+
offset = offset or 1
168+
return TokenTypes[Ci + offset], TokenContents[Ci + offset]
168169
end
169170

170171
---@return string? tokenType
@@ -992,8 +993,12 @@ local docSwitch = util.switch()
992993
if value == 'public'
993994
or value == 'protected'
994995
or value == 'private'
995-
or value == 'public'
996996
or value == 'package' then
997+
local tp2 = peekToken(1)
998+
local tp3 = peekToken(2)
999+
if tp2 == 'name' and not tp3 then
1000+
return false
1001+
end
9971002
result.visible = value
9981003
result.start = getStart()
9991004
return true

0 commit comments

Comments
 (0)