Skip to main content

Module eval

Module eval 

Source
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§

EvalBuilder
A builder bound to a ParsedExpression that defers choosing symbol tables until evaluate is called.
EvalResult
Result of expression evaluation.
ParsedExpression
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).