From 734c035b991c9d46788c0b884a5ee68e2bfe9ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 9 Jan 2019 13:24:38 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=AD=E6=B3=95=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/parser/ast.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'server/src/parser/ast.lua') 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 -- cgit v1.2.3