Skip to content

ValidationConfig

Defined in: packages/engine/src/constants/Configuration.ts:100

Bounds on untrusted input: expression length and nesting depth.

readonly autoBalanceParens: boolean;

Defined in: packages/engine/src/constants/Configuration.ts:116

Auto-balance unmatched parentheses by appending missing closing parens or prepending missing opening parens. When disabled, unbalanced expressions cause parse errors instead of being silently corrected.

Disabled by default for strict parsing. Enable for forgiving user input (e.g., chat-style calculators where users often omit closing parens). Has zero overhead when disabled, the O(n) paren-count scan is skipped.


readonly maxComplexity: number;

Defined in: packages/engine/src/constants/Configuration.ts:104

Maximum expression complexity score (tokens + functionCalls×5 + nestingDepth×10). Protects against deeply nested or combinatorially complex expressions.


readonly maxExpressionLength: number;

Defined in: packages/engine/src/constants/Configuration.ts:102

Maximum expression length in characters. Prevents excessively long strings from entering the pipeline.


readonly maxNestingDepth: number;

Defined in: packages/engine/src/constants/Configuration.ts:106

Maximum parentheses nesting depth. Prevents stack overflow in the recursive-descent parser.