summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-07 17:10:37 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-07 17:10:37 +0800
commit56e30b07fffee79e6c0612f0f099eb590c7be558 (patch)
treef636a9d2aa34780eb3967999dce1ad54fcdf386b /script
parenta8c95b64d7e8a8481cbe961b8b872ef0710d618f (diff)
downloadlua-language-server-56e30b07fffee79e6c0612f0f099eb590c7be558.zip
resolve #476 supports multiline comments
Diffstat (limited to 'script')
-rw-r--r--script/parser/ast.lua6
-rw-r--r--script/parser/grammar.lua6
2 files changed, 6 insertions, 6 deletions
diff --git a/script/parser/ast.lua b/script/parser/ast.lua
index 38c4e51b..3ac4d27f 100644
--- a/script/parser/ast.lua
+++ b/script/parser/ast.lua
@@ -277,7 +277,7 @@ local Defs = {
type = 'comment.long',
start = start,
finish = finish - 1,
- text = '',
+ text = str,
}
if not close then
local endSymbol = ']' .. ('='):rep(afterEq-beforeEq) .. ']'
@@ -318,7 +318,7 @@ local Defs = {
}
end
end,
- CLongComment = function (start1, finish1, start2, finish2)
+ CLongComment = function (start1, finish1, str, start2, finish2)
if State.options.nonstandardSymbol and State.options.nonstandardSymbol['/**/'] then
else
PushError {
@@ -344,7 +344,7 @@ local Defs = {
type = 'comment.clong',
start = start1,
finish = finish2 - 1,
- text = '',
+ text = str,
}
end,
CCommentPrefix = function (start, finish, commentFinish)
diff --git a/script/parser/grammar.lua b/script/parser/grammar.lua
index ea9a25e0..01756c2a 100644
--- a/script/parser/grammar.lua
+++ b/script/parser/grammar.lua
@@ -88,13 +88,13 @@ end
grammar 'Comment' [[
Comment <- LongComment
/ '--' ShortComment
-LongComment <- ({} '--[' {} {:eq: '='* :} {} '['
+LongComment <- ({} '--[' {} {:eq: '='* :} {} '[' %nl?
{(!CommentClose .)*}
((CommentClose / %nil) {}))
-> LongComment
/ (
- {} '/*' {}
- (!'*/' .)*
+ {} '/*' {} %nl?
+ {(!'*/' .)*}
{} '*/' {}
)
-> CLongComment