diff options
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | locale/en-us/script.lua | 2 | ||||
-rw-r--r-- | locale/pt-br/script.lua | 2 | ||||
-rw-r--r-- | locale/zh-cn/script.lua | 2 | ||||
-rw-r--r-- | locale/zh-tw/script.lua | 2 | ||||
-rw-r--r-- | script/parser/compile.lua | 13 |
6 files changed, 23 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index 8c563ba8..35b38f02 100644 --- a/changelog.md +++ b/changelog.md @@ -15,6 +15,7 @@ * `FIX` [#1737] * `FIX` [#1751] * `FIX` [#1767] +* `FIX` [#1805] * `FIX` [#1808] * `FIX` [#1811] @@ -23,6 +24,7 @@ [#1737]: https://github.com/sumneko/lua-language-server/issues/1737 [#1751]: https://github.com/sumneko/lua-language-server/issues/1751 [#1767]: https://github.com/sumneko/lua-language-server/issues/1767 +[#1805]: https://github.com/sumneko/lua-language-server/issues/1805 [#1808]: https://github.com/sumneko/lua-language-server/issues/1808 [#1811]: https://github.com/sumneko/lua-language-server/issues/1811 diff --git a/locale/en-us/script.lua b/locale/en-us/script.lua index 4bcff620..9910aa90 100644 --- a/locale/en-us/script.lua +++ b/locale/en-us/script.lua @@ -279,6 +279,8 @@ PARSER_AMBIGUOUS_SYNTAX = -- TODO: need translate! 'In Lua 5.1, the left brackets called by the function must be in the same line as the function.' PARSER_NEED_PAREN = -- TODO: need translate! 'Need to add a pair of parentheses.' +PARSER_NESTING_LONG_MARK = +'Nesting of `[[...]]` is not allowed in Lua 5.1 .' PARSER_LUADOC_MISS_CLASS_NAME = '<class name> expected.' PARSER_LUADOC_MISS_EXTENDS_SYMBOL = diff --git a/locale/pt-br/script.lua b/locale/pt-br/script.lua index 6549de99..a221dffe 100644 --- a/locale/pt-br/script.lua +++ b/locale/pt-br/script.lua @@ -279,6 +279,8 @@ PARSER_AMBIGUOUS_SYNTAX = -- TODO: need translate! 'In Lua 5.1, the left brackets called by the function must be in the same line as the function.' PARSER_NEED_PAREN = -- TODO: need translate! '需要添加一对括号。' +PARSER_NESTING_LONG_MARK = -- TODO: need translate! +'Nesting of `[[...]]` is not allowed in Lua 5.1 .' PARSER_LUADOC_MISS_CLASS_NAME = 'Esperado <class name>.' PARSER_LUADOC_MISS_EXTENDS_SYMBOL = diff --git a/locale/zh-cn/script.lua b/locale/zh-cn/script.lua index 1c5725ab..92019b02 100644 --- a/locale/zh-cn/script.lua +++ b/locale/zh-cn/script.lua @@ -279,6 +279,8 @@ PARSER_AMBIGUOUS_SYNTAX = '在 Lua 5.1 中,函数调用的左括号必须与函数在同一行。' PARSER_NEED_PAREN = '需要添加一对括号。' +PARSER_NESTING_LONG_MARK = +'Lua 5.1 中不允许使用嵌套的 `[[...]]` 。' PARSER_LUADOC_MISS_CLASS_NAME = '缺少类名称。' PARSER_LUADOC_MISS_EXTENDS_SYMBOL = diff --git a/locale/zh-tw/script.lua b/locale/zh-tw/script.lua index b33851b0..13c50a8d 100644 --- a/locale/zh-tw/script.lua +++ b/locale/zh-tw/script.lua @@ -279,6 +279,8 @@ PARSER_AMBIGUOUS_SYNTAX = -- TODO: need translate! '在 Lua 5.1 中,函数调用的左括号必须与函数在同一行。' PARSER_NEED_PAREN = -- TODO: need translate! '需要添加一对括号。' +PARSER_NESTING_LONG_MARK = -- TODO: need translate! +'Nesting of `[[...]]` is not allowed in Lua 5.1 .' PARSER_LUADOC_MISS_CLASS_NAME = '缺少類別名稱。' PARSER_LUADOC_MISS_EXTENDS_SYMBOL = diff --git a/script/parser/compile.lua b/script/parser/compile.lua index 17b9b051..95483cc7 100644 --- a/script/parser/compile.lua +++ b/script/parser/compile.lua @@ -431,6 +431,19 @@ local function resolveLongString(finishMark) : gsub('\r\n?', '\n') stringResult = result end + if finishMark == ']]' and State.version == 'Lua 5.1' then + local nestOffset = sfind(Lua, '[[', start, true) + if nestOffset then + fastForwardToken(nestOffset) + local nestStartPos = getPosition(nestOffset, 'left') + local nestFinishPos = getPosition(nestOffset + 1, 'right') + pushError { + type = 'NESTING_LONG_MARK', + start = nestStartPos, + finish = nestFinishPos, + } + end + end fastForwardToken(finishOffset + #finishMark) if miss then local pos = getPosition(finishOffset - 1, 'right') |