Report from: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/8087
This peace of code has wrong comment style for block comment:
print("First")
--[[ Block comment start
print("Second")
--[[ Another block comment ]]
print("Third. If run through an actual program, this will be executed.")
I check this in various online Lua interpreter and all have correct highlighting (see attachments).
Refs:
https://www.lua.org/pil/1.3.html
https://en.wikibooks.org/wiki/Lua_Programming/comment
My bad, heh. I have non-coding stuff that is taking all my free time, so I am quite behind on the curve these days. Here is the explanation for the issue: The incorrect highlighting is due to my attempt at supporting multiple Lua versions. Specifically, nested -[[ ]] long comments. Since that is long ago in the past, I guess nested [[ ]] should be removed. Will users care enough that it should be made an option? Perhaps not.
If I am working on a patch, I'll ping here.
Patch to remove nested comment.
Last edit: Zufu Liu 2020-09-27
Thanks for taking a look. [[ ]] nesting (and folding) for both SCE_LUA_LITERALSTRING and SCE_LUA_COMMENT can be removed or disabled. The syntax was only present in Lua 5.0, I believe. From Lua 5.1 onwards, [==[ ]==] can be used so nesting was more like a failed experiment.
I did not ever recall reading of anyone complaining that their nested [[ ]] failed when folks moved from Lua 5.0 to Lua 5.1, so the probability of anyone still relying on nested [[ ]] today is pretty miniscule.
I think disabling the nesting code is a good idea, and I am totally in support of it.
https://www.lua.org/manual/5.0/manual.html#2.1
5.1 and later
http://www.lua.org/manual/5.1/manual.html#2.1
I also agreed on removing supporting for Lua 5.0 nested brackets.
Patch to remove nested long string and block comment.
I have updated my files to hg HEAD and tested it, works fine, thanks!
OK. It is unlikely this will be committed until after Scintilla 5.0.
Committed fix with
https://github.com/ScintillaOrg/lexilla/commit/39aebbde241c7aa469140efa6202b275243ee397