diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-02-15 20:10:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-02-15 20:10:00 +0800 |
commit | 12d6a9eb75f31b64cbc89eb3265805bc8dad01f0 (patch) | |
tree | 031a449c1222ef1705d34fbb22c11ef1ea388ee5 /script/parser | |
parent | bf8b18fe8d2f3cc470021e32b9d5f11ec765a643 (diff) | |
download | lua-language-server-12d6a9eb75f31b64cbc89eb3265805bc8dad01f0.zip |
cleanup
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/compile.lua | 24 | ||||
-rw-r--r-- | script/parser/grammar.lua | 23 |
2 files changed, 24 insertions, 23 deletions
diff --git a/script/parser/compile.lua b/script/parser/compile.lua index d6c6a526..752728d1 100644 --- a/script/parser/compile.lua +++ b/script/parser/compile.lua @@ -61,7 +61,7 @@ local vmMap = { addRef(node, obj) end local name = obj[1] - if specials[name] then + if specials[name] then addSpecial(name, obj) elseif Options and Options.special then local asName = Options.special[name] @@ -90,9 +90,9 @@ local vmMap = { for k, v in pairs(obj.node.node) do newNode[k] = v end - newNode.mirror = obj.node.node - newNode.dummy = true - newNode.parent = obj.args + newNode.mirror = obj.node.node + newNode.dummy = true + newNode.parent = obj.args obj.node.node.mirror = newNode tableInsert(obj.args, 1, newNode) Compiled[newNode] = true @@ -249,7 +249,7 @@ local vmMap = { addRef(node, obj) end local name = obj[1] - if specials[name] then + if specials[name] then addSpecial(name, obj) elseif Options and Options.special then local asName = Options.special[name] @@ -332,9 +332,9 @@ local vmMap = { if Version == 'Lua 5.4' or block == guide.getBlock(label) then pushError { - type = 'REDEFINED_LABEL', - start = obj.start, - finish = obj.finish, + type = 'REDEFINED_LABEL', + start = obj.start, + finish = obj.finish, relative = { { label.start, @@ -538,10 +538,10 @@ local function compileGoTo(obj) local ref = refs[j] if ref.finish > label.finish then pushError { - type = 'JUMP_LOCAL_SCOPE', - start = obj.start, - finish = obj.finish, - info = { + type = 'JUMP_LOCAL_SCOPE', + start = obj.start, + finish = obj.finish, + info = { loc = loc[1], }, relative = { diff --git a/script/parser/grammar.lua b/script/parser/grammar.lua index 154bd7ba..a28b7950 100644 --- a/script/parser/grammar.lua +++ b/script/parser/grammar.lua @@ -31,18 +31,19 @@ local RESERVED = { ['while'] = true, } -defs.nl = (m.P'\r\n' + m.S'\r\n') -defs.s = m.S' \t' -defs.S = - defs.s -defs.ea = '\a' -defs.eb = '\b' -defs.ef = '\f' -defs.en = '\n' -defs.er = '\r' -defs.et = '\t' -defs.ev = '\v' -defs['nil'] = m.Cp() / function () return nil end +defs.nl = (m.P'\r\n' + m.S'\r\n') +defs.s = m.S' \t' +defs.S = - defs.s +defs.ea = '\a' +defs.eb = '\b' +defs.ef = '\f' +defs.en = '\n' +defs.er = '\r' +defs.et = '\t' +defs.ev = '\v' +defs['nil'] = m.Cp() / function () return nil end defs['false'] = m.Cp() / function () return false end + defs.NotReserved = function (_, _, str) if RESERVED[str] then return false |