Expand description
Expression parsing and evaluation.
Uses ruff_python_parser to parse Python expression syntax into an AST,
then evaluates with a custom bounded evaluator. This mirrors the Python
implementation which uses ast.parse() + a custom Evaluator class.
Structs§
- Eval
Builder - A builder bound to a
ParsedExpressionthat defers choosing symbol tables untilevaluateis called. - Eval
Result - Result of expression evaluation.
- Parsed
Expression - A parsed expression ready for evaluation.
Constants§
- DEFAULT_
MEMORY_ LIMIT - Default memory limit: 100 million bytes.
- DEFAULT_
OPERATION_ LIMIT - Default operation limit: 10 million.
- MAX_
EXPRESSION_ DEPTH - Maximum permitted AST nesting depth.
- MAX_
PARSE_ INPUT_ LEN - Maximum permitted source length (in bytes) for a single
ParsedExpression. An absolute cap independent of any AST-shape analysis: the parser’s recursive descent can recurse at most once per input byte, so bounding input length bounds worst-case stack use. Set to a value that leaves generous headroom in a debug-profile build on the parser worker thread (32 MB stack).