summaryrefslogtreecommitdiff
path: root/server/src/parser/ast.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-09 13:24:38 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-09 13:24:38 +0800
commit734c035b991c9d46788c0b884a5ee68e2bfe9ce2 (patch)
tree8d9c85356cee7f857b5f8ce7bf359a18740f6e38 /server/src/parser/ast.lua
parent61b6316c49d8754cc4ea106e231d52ed474dcafc (diff)
downloadlua-language-server-734c035b991c9d46788c0b884a5ee68e2bfe9ce2.zip
更新语法检查
Diffstat (limited to 'server/src/parser/ast.lua')
-rw-r--r--server/src/parser/ast.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 903c8921..db0dabd1 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -351,6 +351,34 @@ local Defs = {
return first
end
end,
+ SimpleCall = function (simple)
+ if not simple then
+ return nil
+ end
+ if simple.type ~= 'simple' then
+ pushError {
+ type = 'EXP_IN_ACTION',
+ start = simple.start,
+ finish = simple.finish,
+ }
+ return simple
+ end
+ local last = simple[#simple]
+ if last.type == 'call' then
+ return simple
+ end
+ local colon = simple[#simple-1]
+ if colon and colon.type == ':' then
+ -- 型如 `obj:method`,将错误让给MISS_SYMBOL
+ return simple
+ end
+ pushError {
+ type = 'EXP_IN_ACTION',
+ start = simple[1].start,
+ finish = last.finish,
+ }
+ return simple
+ end,
Exp = function (first, ...)
if not ... then
return first