summaryrefslogtreecommitdiff
path: root/server/src/parser/grammar.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-29 15:27:38 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-29 15:27:38 +0800
commitf0bfb047bfb81b6f11400939ad736b7267e08938 (patch)
tree2b4d706f82485164363987bc9740d0ebd92787f8 /server/src/parser/grammar.lua
parent4586d62c06751d99199044375393dc1595375491 (diff)
downloadlua-language-server-f0bfb047bfb81b6f11400939ad736b7267e08938.zip
emmyfunction 支持多返回值
Diffstat (limited to 'server/src/parser/grammar.lua')
-rw-r--r--server/src/parser/grammar.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index e0db8988..c20f5b32 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -593,10 +593,15 @@ EmmyArrayType <- (MustEmmyName '[]')
EmmyTableType <- ({} 'table' Cut '<' %s* EmmyType %s* ',' %s* EmmyType %s* '>' {})
-> EmmyTableType
-EmmyFunctionType<- ({} 'fun' Cut %s* EmmyFunctionArgs? %s* EmmyFunctionRtn? {})
+EmmyFunctionType<- ({} 'fun' Cut %s* EmmyFunctionArgs %s* EmmyFunctionRtns {})
-> EmmyFunctionType
-EmmyFunctionArgs<- '(' %s* EmmyFunctionArg %s* (',' %s* EmmyFunctionArg %s*)* ')'
-EmmyFunctionRtn <- ':' %s* EmmyType
+EmmyFunctionArgs<- ('(' %s* EmmyFunctionArg %s* (',' %s* EmmyFunctionArg %s*)* ')')
+ -> EmmyFunctionArgs
+ / '(' %nil ')'?
+ / %nil
+EmmyFunctionRtns<- (':' %s* EmmyType (%s* ',' %s* EmmyType)*)
+ -> EmmyFunctionRtns
+ / %nil
EmmyFunctionArg <- MustEmmyName %s* ':' %s* EmmyType
EmmySee <- {} MustEmmyName %s* '#' %s* MustEmmyName {}