diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-09 13:24:38 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-09 13:24:38 +0800 |
commit | 734c035b991c9d46788c0b884a5ee68e2bfe9ce2 (patch) | |
tree | 8d9c85356cee7f857b5f8ce7bf359a18740f6e38 /server/src | |
parent | 61b6316c49d8754cc4ea106e231d52ed474dcafc (diff) | |
download | lua-language-server-734c035b991c9d46788c0b884a5ee68e2bfe9ce2.zip |
更新语法检查
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/parser/ast.lua | 28 | ||||
-rw-r--r-- | server/src/parser/grammar.lua | 1 |
2 files changed, 29 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 diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua index a89426bd..cd6be11d 100644 --- a/server/src/parser/grammar.lua +++ b/server/src/parser/grammar.lua @@ -479,6 +479,7 @@ Set <- (SimpleList ASSIGN ExpList?) -> Set Call <- Simple + -> SimpleCall LocalFunction <- Sp ({} LOCAL FunctionNamedBody {}) |