diff options
-rw-r--r-- | script/core/noder.lua | 22 | ||||
-rw-r--r-- | script/core/searcher.lua | 2 | ||||
-rw-r--r-- | script/files.lua | 6 | ||||
-rw-r--r-- | script/vm/docs.lua | 8 | ||||
-rw-r--r-- | script/vm/globals.lua | 8 | ||||
-rw-r--r-- | script/vm/init.lua | 1 |
6 files changed, 37 insertions, 10 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index c3679612..86bd311b 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -855,6 +855,26 @@ function m.getLastID(id) return lastID end +---测试id是否包含field,如果遇到函数调用则中断 +---@param id string +---@return boolean +function m.hasField(id) + local firstID = m.getFirstID(id) + if firstID == id then + return false + end + local nextChar = id:sub(#firstID + 1, #firstID + 1) + if nextChar ~= SPLIT_CHAR then + return false + end + local next2Char = id:sub(#firstID + 2, #firstID + 2) + if next2Char == RETURN_INDEX + or next2Char == PARAM_INDEX then + return false + end + return true +end + ---把形如 `@file:\\\XXXXX@gv:1|1`拆分成uri与id ---@param id string ---@return uri? string @@ -913,6 +933,7 @@ function m.compileNodes(source) if next(noders) then return noders end + log.debug('compileNodes:', guide.getUri(root)) guide.eachSource(root, function (src) m.pushSource(noders, src) m.compileNode(noders, src) @@ -920,6 +941,7 @@ function m.compileNodes(source) -- Special rule: ('').XX -> stringlib.XX pushBackward(noders, 'str:', 'dn:stringlib') pushBackward(noders, 'dn:string', 'dn:stringlib') + log.debug('compileNodes finish:', guide.getUri(root)) return noders end diff --git a/script/core/searcher.lua b/script/core/searcher.lua index f1dd9508..e7755598 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -186,7 +186,7 @@ local function crossSearch(status, uri, expect, mode) return end status.lock[uri] = true - await.delay() + --await.delay() if TRACE then log.debug('crossSearch', uri, expect) end diff --git a/script/files.lua b/script/files.lua index 3ee64229..a653b364 100644 --- a/script/files.lua +++ b/script/files.lua @@ -34,9 +34,9 @@ m.assocMatcher = nil m.globalVersion = 0 m.fileCount = 0 m.astCount = 0 -m.linesMap = setmetatable({}, { __mode = 'v' }) -m.originLinesMap = setmetatable({}, { __mode = 'v' }) -m.astMap = setmetatable({}, { __mode = 'v' }) +m.linesMap = {} --setmetatable({}, { __mode = 'v' }) +m.originLinesMap = {} --setmetatable({}, { __mode = 'v' }) +m.astMap = {} --setmetatable({}, { __mode = 'v' }) local uriMap = {} local function getUriKey(uri) diff --git a/script/vm/docs.lua b/script/vm/docs.lua index 632c8c85..5f1b0bdc 100644 --- a/script/vm/docs.lua +++ b/script/vm/docs.lua @@ -37,9 +37,11 @@ end files.watch(function (ev, uri) if ev == 'update' then - popDocs(uri) - await.delay() - pushDocs(uri) + await.call(function () + popDocs(uri) + await.delay() + pushDocs(uri) + end) end end) diff --git a/script/vm/globals.lua b/script/vm/globals.lua index 7a0eeb59..b16803b9 100644 --- a/script/vm/globals.lua +++ b/script/vm/globals.lua @@ -37,9 +37,11 @@ end files.watch(function (ev, uri) if ev == 'update' then - popGlobals(uri) - await.delay() - pushGlobals(uri) + await.call(function () + popGlobals(uri) + await.delay() + pushGlobals(uri) + end) end end) diff --git a/script/vm/init.lua b/script/vm/init.lua index 25ec91f9..705a7117 100644 --- a/script/vm/init.lua +++ b/script/vm/init.lua @@ -7,4 +7,5 @@ require 'vm.eachRef' require 'vm.getLinks' require 'vm.guideInterface' require 'vm.globals' +require 'vm.docs' return vm |