pub const MAX_DEPTH: u32 = 128;Expand description
The maximum depth of an expression or pattern: deeper, it is refused with an
ErrorKind::TooDeep error.
Reading, printing, compiling and evaluating an expression recurse over its tree, so
the call stack they need grows with its depth: without a bound, a short text nested
deeply enough (((((...)))), 1+1+...+1) would overflow the stack of its thread,
which aborts the whole process. The depth is 1 for a literal, a variable reference,
. and a call without argument; every other expression is one level deeper than its
deepest operand. A chain of left-associative operators nests too (a + b + c is
(a + b) + c, depth 3), and so do the steps of a path (a/b/c is (a/b)/c), the
predicates of a step (each filters what the previous ones kept), the bindings of a
for, some or every (each binds inside the previous one) and the steps of a
pattern; parentheses add no level, but the nesting of parentheses is bounded by the
same maximum. The steps of a path written with // count the
descendant-or-self::node() step // stands for.
128: the official stylesheets nest their expressions 32 deep at most (CEN, Peppol,
Factur-X, XRechnung and the French rules), most often through a chain of or or
and.