diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-01-16 18:58:33 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-01-16 18:58:33 +0800 |
commit | 7f3ed1f3b74c0b651ce2aae6a8a345c069db5d06 (patch) | |
tree | 2e073b747d99b2c94b83d16cb7dec5a0b1359c74 /script/parser | |
parent | be4dcc0fb3ad331a882f57f20e90bbca30770323 (diff) | |
download | lua-language-server-7f3ed1f3b74c0b651ce2aae6a8a345c069db5d06.zip |
Nesting of `[[...]]` is not allowed in Lua 5.1 .
fix #1805
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/compile.lua | 13 |
1 files changed, 13 insertions, 0 deletions
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') |