diff options
Diffstat (limited to 'server-beta/src/seacher/string.lua')
-rw-r--r-- | server-beta/src/seacher/string.lua | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/server-beta/src/seacher/string.lua b/server-beta/src/seacher/string.lua new file mode 100644 index 00000000..3f36ee59 --- /dev/null +++ b/server-beta/src/seacher/string.lua @@ -0,0 +1,43 @@ +local guide = require 'parser.guide' + +local m = {} + +function m:eachDef(source, callback) + local parent = source.parent + if not parent then + return + end + if parent.type ~= 'setindex' and parent.type ~= 'getindex' then + return + end + local node = parent.node + local key = guide.getKeyName(source) + self:eachField(node, key, function (src, mode) + if mode == 'set' then + callback(src, mode) + end + end) +end + +function m:eachRef(source, callback) + local parent = source.parent + if not parent then + return + end + if parent.type ~= 'setindex' and parent.type ~= 'getindex' then + return + end + local node = parent.node + local key = guide.getKeyName(source) + self:eachField(node, key, function (src, mode) + if mode == 'set' or mode == 'get' then + callback(src, mode) + end + end) +end + +function m:eachValue(source, callback) + callback(source) +end + +return m |