From b8627365c0abe5a9d40c91f81b2aef7ea869faad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 22 Mar 2023 16:15:16 +0800 Subject: don't treat half string in comment as string fix #2013 --- script/parser/luadoc.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'script/parser') diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 545f9d95..2f5a8ad3 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -1501,21 +1501,22 @@ end local function trimTailComment(text) local comment = text if text:sub(1, 1) == '@' then - comment = text:sub(2) + comment = util.trim(text:sub(2)) end if text:sub(1, 1) == '#' then - comment = text:sub(2) + comment = util.trim(text:sub(2)) end if text:sub(1, 2) == '--' then - comment = text:sub(3) + comment = util.trim(text:sub(3)) end - if comment:find '^%s*[\'"[]' then + if comment:find '^%s*[\'"[]' + and comment:find '[\'"%]]%s*$' then local state = compile(comment:gsub('^%s+', ''), 'String') if state and state.ast then comment = state.ast[1] end end - return comment + return util.trim(comment) end local function buildLuaDoc(comment) -- cgit v1.2.3