diff options
-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 {}) |