Match Pico-8's nested multiline bracket behavior
dansanderson opened this issue · comments
Lua supports multiline comments that start with --[[
and end with the closest ]]
. Lua does not allow nested pairs of brackets, even if the inner start pair does not look like a multiline comment but instead looks like a multiline string:
--[[
foo [[bar]] baz
]]
is a syntax error in Lua, and in picotool. Pico-8 allows this. Apparently it allows nested pairs: breaking the inner opening brackets in this example result in both (correct) broken syntax coloring and a syntax error when running the cart.
I found a cart (36936) that begins with a large multiline comment documenting how to use an API, and uses multiline string brackets in code samples in this documentation. Pico-8 allows this but this breaks in picotool. I'm tentatively inclined to leave this as is (it's rare), but I'm documenting the issue here in case it becomes a larger problem later.