Move the math expression parser from Pest to Chumsky and add more features (#2685)

Rewrite the math-parser library using a chumsky-based lexer and parser, adding functions, comparisons, logic, and conditionals
This commit is contained in:
urisinger
2026-07-27 00:14:39 +03:00
committed by Dennis Kobert
parent c77359bedf
commit b42b00febe
13 changed files with 1415 additions and 534 deletions

View File

@@ -47,10 +47,10 @@ fn math<T: num_traits::float::Float>(
#[default(1.)]
operand_b: T,
) -> T {
let (node, _unit) = match ast::Node::try_parse_from_str(&expression) {
let node = match ast::Node::try_parse_from_str(&expression) {
Ok(expr) => expr,
Err(e) => {
warn!("Invalid expression: `{expression}`\n{e:?}");
warn!("Invalid expression: `{expression}`\n{e}");
return T::from(0.).unwrap();
}
};