diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-07-03 21:45:36 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-07-03 21:45:36 +0800 |
commit | d8e90e888591fc41b07572e097e33d7e8301e203 (patch) | |
tree | 372272a75d7da81d64618508f1b8ae94b12f16af /server/src/parser | |
parent | f9ca6b8dc707189dabd11f84940340d68527d99c (diff) | |
download | lua-language-server-d8e90e888591fc41b07572e097e33d7e8301e203.zip |
新功能不要复制过来
Diffstat (limited to 'server/src/parser')
-rw-r--r-- | server/src/parser/ast.lua | 52 |
1 files changed, 10 insertions, 42 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index e307f8b8..e07a0ba9 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -1223,22 +1223,16 @@ local Defs = { [2] = valueType, } end, - EmmyFunctionType = function (start, args, returns, finish) + EmmyFunctionType = function (start, ...) local result = { start = start, - finish = finish - 1, type = 'emmyFunctionType', - args = args, - returns = returns, + ... } + result.finish = result[#result] - 1 + result[#result] = nil return result end, - EmmyFunctionRtns = function (...) - return {...} - end, - EmmyFunctionArgs = function (...) - return {...} - end, EmmyAlias = function (name, emmyName, ...) return { type = 'emmyAlias', @@ -1249,10 +1243,9 @@ local Defs = { ... } end, - EmmyParam = function (argName, emmyName, option, ...) + EmmyParam = function (argName, emmyName, ...) local emmy = { type = 'emmyParam', - option = option, argName, emmyName, ... @@ -1261,14 +1254,13 @@ local Defs = { emmy.finish = emmy[#emmy].finish return emmy end, - EmmyReturn = function (start, type, finish, option) + EmmyReturn = function (...) local emmy = { type = 'emmyReturn', - option = option, - start = start, - finish = finish - 1, - [1] = type, + ... } + emmy.start = emmy[1].start + emmy.finish = emmy[#emmy].finish return emmy end, EmmyField = function (access, fieldName, ...) @@ -1333,33 +1325,9 @@ local Defs = { EmmyComment = function (...) return { type = 'emmyComment', - [1] = table.concat({...}), + [1] = table.concat({...}, ' '), } end, - EmmyOption = function (options) - if not options or options == '' then - return nil - end - local option = {} - for _, pair in ipairs(options) do - if pair.type == 'pair' then - local key = pair[1] - local value = pair[2] - if key.type == 'name' then - option[key[1]] = value[1] - end - end - end - return option - end, - EmmyTypeEnum = function (default, enum, comment) - enum.type = 'emmyEnum' - if default ~= '' then - enum.default = true - end - enum.comment = comment - return enum - end, -- 捕获错误 UnknownSymbol = function (start, symbol) |