lua-users home
lua-l archive

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

It is because you allocating by 49 elements each time.

There is optimizations in that cause problem

It won't flush until LFIELDS_PER_FLUSH (defined as 50 )

So 5 levels by 50 registers gives 250 registers So 6th level will for sure exceed amount of free registers

You discover aт antique bug.

On 06.10.2023 14:29, Andrey Dobrovolsky wrote:
The nesting depth of the table to be parsed successfully depends on how the nested levels are filled. Here is the code to produce the worst case for the parser:

local depth = 5
local list_size= 49
io.write("return { ")
for i = 1, depth do
  for j = 1, list_size do
    io.write(i, ", ")
for i = depth, 1, -1  do

For depth = 5 the output is valid code, while for the depth = 6 parser fails. If You will play with list_size values You may obtain much deeper nested tables to be parsed successfully. But the guaranteed depth to be parsed is 5. My patch increases it up to 29.

Родион Горковенко wrote:
> Perhaps, provide a small straightforward example please?