diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-02-16 15:22:45 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-02-16 15:22:45 +0800 |
commit | 30bc6d37b823cab58114ea09c3f6388c6ef30b02 (patch) | |
tree | 18fa3cf12eafe6b06bf2eb60b08302311a3b2698 /script/parser | |
parent | 8f2c4227753f300e717fa218d915c281dbc3e175 (diff) | |
parent | 12d6a9eb75f31b64cbc89eb3265805bc8dad01f0 (diff) | |
download | lua-language-server-30bc6d37b823cab58114ea09c3f6388c6ef30b02.zip |
Merge commit '12d6a9eb75f31b64cbc89eb3265805bc8dad01f0' into 3.0
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 |