From 08ad622130ad703a7fcb4120559ebcf9cc163185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 7 Dec 2018 17:48:51 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=AD=E6=B3=95=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/parser/ast.lua | 10 ++++++++-- server/src/parser/grammar.lua | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'server/src') diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index 77edeb5e..6de13aa4 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -85,18 +85,24 @@ local defs = { exp.index = true return exp end, - Call = function (arg) + Call = function (start, arg, finish) if arg == nil then return { - type = 'call' + type = 'call', + start = start, + finish = finish - 1, } end if arg.type == 'list' then arg.type = 'call' + arg.start = start + arg.finish = finish - 1 return arg end local obj = { type = 'call', + start = start, + finish = finish - 1, [1] = arg, } return obj diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua index 0f533862..4c087024 100644 --- a/server/src/parser/grammar.lua +++ b/server/src/parser/grammar.lua @@ -261,10 +261,10 @@ Prefix <- PL Exp PR / Name Suffix <- DOT Name / COLON Name - / Table -> Call - / String -> Call + / Sp ({} Table {}) -> Call + / Sp ({} String {}) -> Call / BL Exp -> Index BR - / PL (ExpList -> Call) PR + / Sp ({} PL ExpList PR {}) -> Call ExpList <- (Exp (COMMA Exp)*)? -> List -- cgit v1.2.3