roll-parser - v3.4.0
    Preparing search index...

    Variable MAX_PARSE_DEPTHConst

    MAX_PARSE_DEPTH: 128

    Maximum expression nesting depth. Far beyond any human-authored notation — exists so adversarial input like 20,000 nested parens throws a typed ParseError instead of an uncaught RangeError stack overflow (which would also break the isRollParserError contract). Bounding parse depth also bounds AST depth, protecting the recursive AST walkers and evaluator.

    Not configurable — unlike the EvaluationOptions caps, this one always applies, so untrusted notation can never blow the stack.

    import { isRollParserError, MAX_PARSE_DEPTH, parse } from 'roll-parser';

    MAX_PARSE_DEPTH; // 128

    try {
    parse('('.repeat(20_000) + '1d6' + ')'.repeat(20_000));
    } catch (error) {
    isRollParserError(error) && error.code; // 'MAX_DEPTH_EXCEEDED'
    }