diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-08-29 15:40:08 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-08-29 15:40:08 +0800 |
commit | 762eb513114ce7dc5a4d1512a910112d1711db32 (patch) | |
tree | 875a511dc29610a843928e0b55ff0b2a42e951fa /server/src/parser/ast.lua | |
parent | c7598c95032a2bb40860b9320418e73bea1b7f43 (diff) | |
download | lua-language-server-762eb513114ce7dc5a4d1512a910112d1711db32.zip |
更新LuaParser
Diffstat (limited to 'server/src/parser/ast.lua')
-rw-r--r-- | server/src/parser/ast.lua | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index a67a16cb..8ac4e0f4 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -410,6 +410,10 @@ local Defs = { type = 'ERR_ESC', start = pos-1, finish = pos, + version = {'Lua 5.2', 'Lua 5.3', 'Lua 5.4', 'LuaJIT'}, + info = { + version = State.Version, + } } return char end @@ -424,6 +428,10 @@ local Defs = { type = 'ERR_ESC', start = pos-3, finish = pos-2, + version = {'Lua 5.3', 'Lua 5.4', 'LuaJIT'}, + info = { + version = State.Version, + } } return char end @@ -751,7 +759,7 @@ local Defs = { checkMissEnd(start) return obj end, - RTTable = function (_, _, start, ...) + Table = function (start, ...) local args = {...} local max = #args local finish = args[max] - 1 @@ -790,7 +798,7 @@ local Defs = { start = arg end end - return true, table + return table end, NewField = function (key, value) return { @@ -1880,22 +1888,12 @@ local Defs = { end, } -return function (self, lua, mode, version) - Errs = {} - State= { - Break = 0, - Label = {{}}, - Dots = {true}, - Version = version, - Lua = lua, - } - local suc, res, err = xpcall(self.grammar, debug.traceback, self, lua, mode, Defs) - if not suc then - return nil, res - end - if not res then - pushError(err) - return nil, Errs - end - return res, Errs +local function init(state, errs) + State = state + Errs = errs end + +return { + defs = Defs, + init = init, +} |