Skip to main content

MAX_NESTING

Constant MAX_NESTING 

Source
pub const MAX_NESTING: usize = 256;
Expand description

How deeply brackets may nest before the parser gives up.

Recursive descent uses the machine stack for the grammar’s nesting, so a file with a thousand open parentheses is a stack overflow rather than a diagnostic unless something stops it. The number is clang’s -fbracket-depth default, which is the one real code has been measured against, and it is far above anything a human writes and far below anything that costs the stack more than a fraction of a megabyte.