diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-14 16:59:55 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-14 16:59:55 +0800 |
commit | 2a29458c86628a2af20da4ebeb39a8f81d4ea53a (patch) | |
tree | 92d337224429ab516ec2271b117319c5d5916452 /script/parser/compile.lua | |
parent | 321fc84cabff0252f25e94df14746b8e9cb3d190 (diff) | |
download | lua-language-server-2a29458c86628a2af20da4ebeb39a8f81d4ea53a.zip |
update parser
Diffstat (limited to 'script/parser/compile.lua')
-rw-r--r-- | script/parser/compile.lua | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/script/parser/compile.lua b/script/parser/compile.lua index 207664cc..d6c6a526 100644 --- a/script/parser/compile.lua +++ b/script/parser/compile.lua @@ -1,4 +1,6 @@ local guide = require 'parser.guide' +local parse = require 'parser.parse' +local newparser = require 'parser.newparser' local type = type local tableInsert = table.insert local pairs = pairs @@ -566,8 +568,12 @@ local function PostCompile() end end -return function (self, lua, mode, version, options) - local state, err = self:parse(lua, mode, version, options) +return function (lua, mode, version, options) + do + local state, err = newparser(lua, mode, version, options) + return state, err + end + local state, err = parse(lua, mode, version, options) if not state then return nil, err end @@ -576,11 +582,7 @@ return function (self, lua, mode, version, options) --end local clock = os.clock() pushError = state.pushError - if version == 'Lua 5.1' or version == 'LuaJIT' then - ENVMode = '@fenv' - else - ENVMode = '_ENV' - end + ENVMode = state.ENVMode Compiled = {} GoToTag = {} LocalCount = 0 @@ -590,7 +592,6 @@ return function (self, lua, mode, version, options) Root.state = state end Options = options - state.ENVMode = ENVMode if type(state.ast) == 'table' then Compile(state.ast) end |