From ae95f749532c2252c671d1b3cab73d7e18cf777c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 1 Nov 2022 13:46:03 +0800 Subject: improve field attribute --- script/parser/luadoc.lua | 11 ++++++++--- 1 file 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 -- cgit v1.2.3