summaryrefslogtreecommitdiff
path: root/server/src/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-28 16:21:08 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-28 16:21:08 +0800
commit12c658d8f569c52e88b09aadbd221387364276f4 (patch)
treec9d917b6ddebdf9443f88a188fa5839d1a243ca7 /server/src/parser
parent9e875d4ea8ac60939f51771485084c539e66e040 (diff)
downloadlua-language-server-12c658d8f569c52e88b09aadbd221387364276f4.zip
允许不占用return
Diffstat (limited to 'server/src/parser')
-rw-r--r--server/src/parser/ast.lua6
-rw-r--r--server/src/parser/grammar.lua3
2 files changed, 5 insertions, 4 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index c14328f0..b9cc9b47 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -1245,12 +1245,12 @@ local Defs = {
emmy.finish = emmy[#emmy].finish
return emmy
end,
- EmmyReturn = function (type, option)
+ EmmyReturn = function (start, type, finish, option)
local emmy = {
type = 'emmyReturn',
option = option,
- start = type.start,
- finish = type.finish,
+ start = start,
+ finish = finish - 1,
[1] = type,
}
return emmy
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index da850250..e0db8988 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -569,7 +569,8 @@ EmmyParam <- MustEmmyName %s* EmmyType %s* EmmyOption %s* EmmyTypeEnum*
EmmyOption <- Table?
-> EmmyOption
-EmmyReturn <- EmmyType EmmyOption
+EmmyReturn <- {} %nil {} Table -> EmmyOption
+ / {} EmmyType {} EmmyOption
EmmyField <- (EmmyFieldAccess MustEmmyName %s* EmmyType)
EmmyFieldAccess <- ({'public'} Cut %s*)