diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-04 16:43:52 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-04 16:43:52 +0800 |
commit | 304006115543ff5fe5a6d4e777e20013b0e20c91 (patch) | |
tree | 1bca805746fffa4b3e119d8bfc78f5bf5f213b74 /script/parser/ast.lua | |
parent | fcf7e914ad6d43ee6953e68c8ab791da4e3f6302 (diff) | |
download | lua-language-server-304006115543ff5fe5a6d4e777e20013b0e20c91.zip |
new folding
Diffstat (limited to 'script/parser/ast.lua')
-rw-r--r-- | script/parser/ast.lua | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/script/parser/ast.lua b/script/parser/ast.lua index 68fd59d7..8ddf0ff4 100644 --- a/script/parser/ast.lua +++ b/script/parser/ast.lua @@ -266,28 +266,35 @@ local Defs = { end, ShortComment = function (start, text, finish) PushComment { + type = 'comment.short', start = start, finish = finish - 1, text = text, } end, - LongComment = function (beforeEq, afterEq, str, missPos) - if missPos then + LongComment = function (start, beforeEq, afterEq, str, close, finish) + PushComment { + type = 'comment.long', + start = start, + finish = finish - 1, + text = '', + } + if not close then local endSymbol = ']' .. ('='):rep(afterEq-beforeEq) .. ']' local s, _, w = str:find('(%][%=]*%])[%c%s]*$') if s then PushError { type = 'ERR_LCOMMENT_END', - start = missPos - #str + s - 1, - finish = missPos - #str + s + #w - 2, + start = finish - #str + s - 1, + finish = finish - #str + s + #w - 2, info = { symbol = endSymbol, }, fix = { title = 'FIX_LCOMMENT_END', { - start = missPos - #str + s - 1, - finish = missPos - #str + s + #w - 2, + start = finish - #str + s - 1, + finish = finish - #str + s + #w - 2, text = endSymbol, } }, @@ -295,16 +302,16 @@ local Defs = { end PushError { type = 'MISS_SYMBOL', - start = missPos, - finish = missPos, + start = finish, + finish = finish, info = { symbol = endSymbol, }, fix = { title = 'ADD_LCOMMENT_END', { - start = missPos, - finish = missPos, + start = finish, + finish = finish, text = endSymbol, } }, @@ -334,9 +341,9 @@ local Defs = { } end PushComment { + type = 'comment.clong', start = start1, finish = finish2 - 1, - semantic = true, text = '', } end, @@ -358,9 +365,9 @@ local Defs = { } end PushComment { + type = 'comment.cshort', start = start, finish = commentFinish - 1, - semantic = true, text = '', } end, |