summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-28 10:14:03 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-28 10:14:03 +0800
commit3d7cb724b13e75a7e4dab9b6bcf24e1f1f1de2b0 (patch)
treeda32fb36e9df428908add1c37e9047fb7e1b16d6 /server/src
parent9496ea32f58e8d3ca7455f36ea3f2bfaa270f07d (diff)
downloadlua-language-server-3d7cb724b13e75a7e4dab9b6bcf24e1f1f1de2b0.zip
支持多行注释
Diffstat (limited to 'server/src')
-rw-r--r--server/src/parser/ast.lua2
-rw-r--r--server/src/parser/grammar.lua6
2 files changed, 5 insertions, 3 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index e2add23e..f9a6d53d 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -1316,7 +1316,7 @@ local Defs = {
EmmyComment = function (...)
return {
type = 'emmyComment',
- [1] = table.concat({...}, ' '),
+ [1] = table.concat({...}),
}
end,
EmmyOption = function (options)
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index 5a408d90..c53597dd 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -517,9 +517,11 @@ grammar 'Emmy' [[
Emmy <- EmmySp '---@' EmmyBody ShortComment
/ EmmyComments
EmmySp <- (!'---@' !'---' Comment / %s / %nl)*
-EmmyComments <- (EmmyComment (%nl EmmyComment)*)
+EmmyComments <- (EmmyComment (%nl EmmyComMulti / %nl EmmyComSingle)*)
-> EmmyComment
-EmmyComment <- EmmySp '---' !'@' %s* {(!%nl .)*}
+EmmyComment <- EmmySp '---' !'@' %s* {(!%nl .)*}
+EmmyComMulti <- EmmySp '---|' {} -> en {(!%nl .)*}
+EmmyComSingle <- EmmySp '---' !'@' %s* {} -> ' ' {(!%nl .)*}
EmmyBody <- 'class' %s+ EmmyClass -> EmmyClass
/ 'type' %s+ EmmyType -> EmmyType
/ 'alias' %s+ EmmyAlias -> EmmyAlias