mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-16 23:42:27 +00:00
From the second review round (FredApps): - Strings joined with `&` are printed as one flat chain, which nests one level per string. A balanced tree of 4,096 empty strings fits in 16,383 token bytes and is 13 levels deep, but as a chain it was 4,096 levels, and printing and dropping it recurse: on a 256 KiB stack it overflowed. The chain is now made only up to MAX_DEPTH strings, the bound push keeps on the decoded tree (Excel's 8,192 characters hold at most about 33 full-length constants, so Python code split into constants is unaffected). A longer one prints as its tokens nest, with the parentheses that needs. GridCraft's tree walks a left-deep chain in a loop; the printer copied from craft-xls recurses, which is how the port lost the bound. - The first cell of a shared or array formula whose BrtShrFmla/BrtArrFmla never comes (another cell or the next row follows) loses its cell metadata too, as a formula kept as its value does. The new unit test overflowed its stack without this commit; the extended metadata test fails without it. The Excel-saved workbook still reads with all 33 formulas as in its .xlsx.