summaryrefslogtreecommitdiff
path: root/script/core/noder.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-11 16:51:15 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-11 16:51:15 +0800
commitf10dd2af22efeb5330f2da23d615ff7bc213b1eb (patch)
tree087ae8628570dd93ec6c9df0c7d02e3397a376d7 /script/core/noder.lua
parentd93c5645334b392284a7a171e66d1b82a997a841 (diff)
downloadlua-language-server-f10dd2af22efeb5330f2da23d615ff7bc213b1eb.zip
stash
Diffstat (limited to 'script/core/noder.lua')
-rw-r--r--script/core/noder.lua22
1 files changed, 22 insertions, 0 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