kommentary icon indicating copy to clipboard operation
kommentary copied to clipboard

Support advanced multiline strings in lua e.g. --[=[ something ]=]

Open Corey-Keller opened this issue 3 years ago • 0 comments

Lua supports semi-arbitrary multiline comment strings in the form of matching numbers of equals signs. Meaning --[==[, --[===[, and --[=[ will only end the comment when it encounters ]==], ]===], and ]=] respectively.

It would be a great idea to match an opening regex like --\[\(=*\)\[ (or --\[(=*)\[ in PCRE style just to make sure it's clear) to the closing ]\1] (using the capture group from the opening regex to guarantee the same number of =)

This may not be as important when creating the comments, but is important to effectively uncomment them.

Corey-Keller avatar Aug 27 '21 22:08 Corey-Keller