summaryrefslogtreecommitdiff
path: root/server/src/parser
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-18 21:48:05 +0800
committersumneko <sumneko@hotmail.com>2019-04-18 21:48:05 +0800
commit1a889f53a34fdb2ae77bfe7189a5e00a2e723187 (patch)
treed3f68da1b2f8ee9af8e37512c22af98b876047dc /server/src/parser
parent92e1b16ba3e6749602f2ea2dcb64a73f11653caa (diff)
downloadlua-language-server-1a889f53a34fdb2ae77bfe7189a5e00a2e723187.zip
更新一下
Diffstat (limited to 'server/src/parser')
-rw-r--r--server/src/parser/ast.lua19
-rw-r--r--server/src/parser/grammar.lua10
2 files changed, 13 insertions, 16 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 35118d35..dd6c6cfc 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -1124,10 +1124,7 @@ local Defs = {
[2] = extends,
}
end,
- EmmyType = function (typeDef, ...)
- if ... then
- typeDef.enum = {...}
- end
+ EmmyType = function (typeDef)
return typeDef
end,
EmmyCommonType = function (...)
@@ -1152,18 +1149,20 @@ local Defs = {
...
}
end,
- EmmyAlias = function (name, emmyName)
+ EmmyAlias = function (name, emmyName, ...)
return {
type = 'emmyAlias',
- [1] = name,
- [2] = emmyName,
+ name,
+ emmyName,
+ ...
}
end,
- EmmyParam = function (argName, emmyName)
+ EmmyParam = function (argName, emmyName, ...)
return {
type = 'emmyParam',
- [1] = argName,
- [2] = emmyName,
+ argName,
+ emmyName,
+ ...
}
end,
EmmyReturn = function (...)
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index 97d60402..d5c375f0 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -536,9 +536,7 @@ EmmyIncomplete <- MustEmmyName
EmmyClass <- (MustEmmyName EmmyParentClass?)
EmmyParentClass <- %s* ':' %s* MustEmmyName
-EmmyType <- (EmmyTypeDef EmmyTypeEnums*)
- -> EmmyType
-EmmyTypeDef <- EmmyFunctionType
+EmmyType <- EmmyFunctionType
/ EmmyArrayType
/ EmmyTableType
/ EmmyCommonType
@@ -549,11 +547,11 @@ EmmyTypeName <- EmmyFunctionType
/ EmmyArrayType
/ EmmyTableType
/ MustEmmyName
-EmmyTypeEnums <- %s+ '|' %s+ String
+EmmyTypeEnums <- %s* '|' %s* String
-EmmyAlias <- MustEmmyName %s+ EmmyType
+EmmyAlias <- MustEmmyName %s+ EmmyType EmmyTypeEnums*
-EmmyParam <- MustEmmyName %s+ EmmyType
+EmmyParam <- MustEmmyName %s+ EmmyType EmmyTypeEnums*
EmmyReturn <- EmmyType