summaryrefslogtreecommitdiff
path: root/server/src/parser
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/parser')
-rw-r--r--server/src/parser/ast.lua52
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)