From b0c3c3047361c63c7f0c0587ec98964c6a7c4a98 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, 21 Apr 2021 21:46:55 +0800 Subject: cleanup --- script/core/linker.lua | 6 ++++-- script/core/searcher.lua | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'script') diff --git a/script/core/linker.lua b/script/core/linker.lua index bb81709d..3185ecda 100644 --- a/script/core/linker.lua +++ b/script/core/linker.lua @@ -6,6 +6,7 @@ local Linkers local LastIDCache = {} local SPLIT_CHAR = '\x1F' local SPLIT_REGEX = SPLIT_CHAR .. '.-$' +local INDEX_CHAR = '\x1E' ---是否是全局变量(包括 _G.XXX 形式) ---@param source parser.guide.object @@ -84,7 +85,7 @@ local function getKey(source) elseif source.type == 'function' then return source.start, nil elseif source.type == 'select' then - return ('%d%s%d'):format(source.start, SPLIT_CHAR, source.index) + return ('%d%s%s%d'):format(source.start, SPLIT_CHAR, INDEX_CHAR, source.index) elseif source.type == 'doc.class.name' or source.type == 'doc.type.name' or source.type == 'doc.alias.name' then @@ -265,7 +266,7 @@ local function checkBackward(source, id) if source.returnIndex then for _, src in ipairs(parent.bindSources) do if src.type == 'function' then - local fullID = ('%s%s%s'):format(getID(src), SPLIT_CHAR, source.returnIndex) + local fullID = ('%s%s%s%s'):format(getID(src), SPLIT_CHAR, INDEX_CHAR, source.returnIndex) list[#list+1] = fullID end end @@ -324,6 +325,7 @@ end local m = {} m.SPLIT_CHAR = SPLIT_CHAR +m.INDEX_CHAR = INDEX_CHAR ---根据ID来获取所有的link ---@param root parser.guide.object diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 069def94..c3d61199 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -166,7 +166,7 @@ function m.searchRefsByID(status, uri, expect, mode) if not parentID then return end - search(parentID, linker.SPLIT_CHAR .. returnIndex) + search(parentID, linker.SPLIT_CHAR .. linker.INDEX_CHAR .. returnIndex) end local function checkForward(link, field) -- cgit v1.2.3