Skip to main content

parse_bounded

Function parse_bounded 

Source
pub fn parse_bounded(text: &str) -> Result<Pairs<'_, Rule>, Box<Error<Rule>>>
Expand description

Parse text as a Trilogy file, rejecting input nested deeper than MAX_NESTING_DEPTH with an ordinary parse error rather than recursing on.

pest’s own stack guard turns a parse that would overflow the native stack into “stack limit reached”; that is reported as the same nesting error. The depth check after it is what makes the limit deterministic, since the stack guard depends on the calling thread’s stack size.