pub fn parse_bounded<R: Send>(
source: &str,
parse: impl FnOnce() -> R + Send,
) -> Option<R>Expand description
Run parse, which parses source with Oxc and walks the result, without
a stack overflow. Returns None when the bracket nesting of source
exceeds MAX_NESTING_DEPTH or the stack it needs exceeds the cap in
stack.rs, so the caller treats the file as a failed parse.
Every parse of user source goes through this function. It sizes the stack
from the source length and the bracket depth, and it moves the work to a
thread with that stack when the current thread has too little left. A
parse of a fragment inside parse runs on the same stack and needs no
second call.