lua-users home
lua-l archive

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


Hi,
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, ", ")
  end
  io.write("{")
end
for i = depth, 1, -1  do
  io.write("}")
end
io.write("}")

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?