Expand description
Regex-driven preprocessing pipeline.
MilkEvaluator::preprocess_expression is the entry point: it strips
comments, normalises case, auto-initialises undefined variables, then
chains the rewriter passes in super::rewriters and
super::gmegabuf to massage MD2βs EEL2 dialect into something
evalexpr will accept.
ConstantsΒ§
- MAX_
EXPRESSION_ πLENGTH - Maximum expression length to prevent DoS attacks.
- MAX_
LOOP_ πITER - Clamp on
loop(N, body)iteration count. MD2 presets in the corpus run up to1024 * 1024(gmegabuf full-clear); allow that plus a small safety margin so a single rogue preset canβt lock the frame thread for arbitrarily long.
StaticsΒ§
- ASSIGNMENT_
REGEX π - DOT_
LITERAL_ πREGEX - IF_
REGEX π - PAREN_
INT_ πRHS_ REGEX - UNARY_
PLUS_ πREGEX - VAR_
REGEX π
FunctionsΒ§
- auto_
init_ πvars - Walk every identifier in
exprand auto-init unknown variables to 0. - lowercase_
builtin_ πidents - Lowercase any identifier that matches a registered builtin (Sin β sin, INT β int, Above β above, etc.) while leaving user variables at their original case. MD2 EEL is case-insensitive; evalexpr is not.
- strip_
line_ πcomments - Strip C++-style
// β¦line comments from MD2 expression source.