pub const MAX_NTH_OF_DEPTH: usize = 8;Expand description
The maximum An+B of S nesting depth accepted.
XPath 1.0 has no variables, so S must be written out twice: once to
filter the siblings being counted, once to constrain the element being
matched. An of S list nested inside another therefore appears in both
copies, and the output doubles per level — a ~500-byte selector nesting
30 deep asks for tens of gigabytes. The duplication is inherent, so
only a depth limit can bound it. At 8 levels the doubling costs at most
a few hundred times the argument’s own translation, and nothing
hand-written nests of S at all.
This is far below MAX_NESTING_DEPTH, which bounds
recursion rather than output size and so can afford to be generous.