lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 12/14/18 7:32 PM, Roberto Ierusalimschy wrote:
>> Finding longest "=" sequence is arguably simplest and not optimal. I prefer
>> finding shortest long closing quote: min(N): ("]" "=" ^ N "]") not in string.
>> This algorithm have no worst cases.
>> Sample implementation at
> It doesn't seem to work for "]]a]=". (Result is "[=[]]a]=]=]"...)
> -- Roberto

Thank you for pointing at this case!

I fixed algorithm by concatenating "]" to source string before determining
variable number of "=" required.

So now "]]a]=" transformed to "]]a]=]" and ("[==[", "]==]") are used as proper

Sadly, link now points to current version. Link to original (bugged) version is

-- Martin