Module evaluator

Module evaluator 

Source
Expand description

Evaluator for Milkdrop expressions.

MilkEvaluator is the entry point. Most callers go through MilkEvaluator::eval (single expression), MilkEvaluator::compile + MilkEvaluator::eval_compiled (precompiled hot path), or MilkEvaluator::eval_equation_list (paren-balance-aware join over a preset’s flat equation list).

The crate’s internals are split across:

  • preprocess — the regex-driven preprocessing pipeline that turns MD2 EEL2 source into something evalexpr will parse.
  • rewriters — AST-style rewriters consumed by preprocess_expression.
  • gmegabufgmegabuf / megabuf write rewrite.
  • joiner — multi-equation join logic and top-level loop/exec/ while interceptors.

Modules§

gmegabuf 🔒
gmegabuf / megabuf write rewrite for the preprocess pipeline.
joiner 🔒
Multi-equation join logic and top-level call interceptors.
preprocess 🔒
Regex-driven preprocessing pipeline.
rewriters 🔒
AST-style rewriters consumed by super::MilkEvaluator::preprocess_expression.

Structs§

EvaluationStats
Aggregate stats returned by MilkEvaluator::eval_equation_list.
MilkEvaluator
Evaluator for Milkdrop expressions.
ShapeInstance
One iteration of a custom-shape (shapecode_N) per-instance loop. MD2 shape per-frame equations can mutate any of these fields and the next instance’s loop body sees the seed values fresh from the preset’s scalar block — instances do NOT carry state across each other (unlike WavePoint). Persistent state across instances lives in q* / t* channels.
WavePoint
One iteration of a custom-wave (or custom-shape) per-point loop. The same struct is used for input (caller seeds the loop variables) and output (evaluator reads x, y, r, g, b, a back from the context after running the equations). sample, value1, value2 are inputs only.

Functions§

contains_top_level_byte 🔒
Generic “byte at depth 0” check.
contains_top_level_comma 🔒
true if s contains a , at paren depth 0.
contains_top_level_comparison 🔒
true if s contains a comparison operator (> < >= <= == !=) at paren depth 0.
is_builtin_ident 🔒
true if name is a registered builtin identifier we should leave alone in the auto-init pass. Centralised so the preprocess and case-normalising helpers stay in sync.
is_ident_byte 🔒
true when b is an ASCII identifier byte ([A-Za-z0-9_]).
is_paren_func_call_open 🔒
true if the ( at byte offset paren_pos opens a function-call arg list (preceded by an identifier or digit, modulo whitespace) rather than a standalone grouping expression.
match_close_paren 🔒
Find the matching ) for the ( at open. Returns the byte offset of the closer or None if unbalanced.
split_top_level_byte 🔒
Generic “split on byte at depth 0”.
split_top_level_commas 🔒
Split inner on each top-level , (commas at paren depth 0). Always returns at least one element (the whole inner if no top-level comma).