From 863f1fc0350fff0d7b7e2a376d82ccaaf301f4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 22 Oct 2019 21:00:24 +0800 Subject: =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/seacher/string.lua | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 server-beta/src/seacher/string.lua (limited to 'server-beta/src/seacher/string.lua') 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 -- cgit v1.2.3