summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-29 17:06:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-29 17:06:16 +0800
commitf4a4fc63cf14f038a07068292909432f28f0c2a7 (patch)
treedddbaf6c9bf5367202f2807a8e599f3254ceb67a /script
parentec613851607c1fdeb256afa195d79760bb2e66c6 (diff)
downloadlua-language-server-f4a4fc63cf14f038a07068292909432f28f0c2a7.zip
fix
Diffstat (limited to 'script')
-rw-r--r--script/core/matchkey.lua5
-rw-r--r--script/parser/newparser.lua10
2 files changed, 11 insertions, 4 deletions
diff --git a/script/core/matchkey.lua b/script/core/matchkey.lua
index eb67dac6..3c6a54a8 100644
--- a/script/core/matchkey.lua
+++ b/script/core/matchkey.lua
@@ -12,16 +12,17 @@ local function isValidFirstChar(input, other)
if first == other:sub(1, 1):upper() then
return true
end
- local pos, char = other:find(first, 2, true)
+ local pos = other:find(first, 2, true)
if not pos and uppers[first] then
-- word after symbol?
if other:find('%A' .. first:lower(), 2) then
return true
end
end
- if not char then
+ if not pos then
return false
end
+ local char = other:sub(pos, pos)
-- symbol?
if not uppers[char] then
return true
diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua
index d63d8f62..8b5fe034 100644
--- a/script/parser/newparser.lua
+++ b/script/parser/newparser.lua
@@ -1958,7 +1958,8 @@ local function isChunkFinishToken(token)
end
if tp == 'for'
or tp == 'in'
- or tp == 'loop' then
+ or tp == 'loop'
+ or tp == 'function' then
return token == 'end'
end
if tp == 'if'
@@ -1970,6 +1971,9 @@ local function isChunkFinishToken(token)
or token == 'else'
or token == 'elseif'
end
+ if tp == 'repeat' then
+ return token == 'until'
+ end
return true
end
@@ -1988,7 +1992,9 @@ local function parseActions()
end
local action, failed = parseAction()
if failed then
- break
+ if not skipUnknownSymbol() then
+ break
+ end
end
if action then
if action.type == 'return' then