summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-02-15 20:10:00 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-02-15 20:10:00 +0800
commit12d6a9eb75f31b64cbc89eb3265805bc8dad01f0 (patch)
tree031a449c1222ef1705d34fbb22c11ef1ea388ee5 /script/parser
parentbf8b18fe8d2f3cc470021e32b9d5f11ec765a643 (diff)
downloadlua-language-server-12d6a9eb75f31b64cbc89eb3265805bc8dad01f0.zip
cleanup
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/compile.lua24
-rw-r--r--script/parser/grammar.lua23
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