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-26 14:14:39 -07:00
committed by GitHub
parent b2e5b6645c
commit 0952933ede
13 changed files with 1415 additions and 534 deletions
+5 -2
View File
@@ -9,7 +9,7 @@ macro_rules! generate_benchmarks {
$(
c.bench_function(concat!("parse ", $input), |b| {
b.iter(|| {
let _ = black_box(ast::Node::try_parse_from_str($input)).unwrap();
let _ = black_box(ast::Node::try_parse_from_str($input));
});
});
)*
@@ -17,7 +17,10 @@ macro_rules! generate_benchmarks {
fn evaluation_bench(c: &mut Criterion) {
$(
let expr = ast::Node::try_parse_from_str($input).unwrap().0;
let expr = match ast::Node::try_parse_from_str($input) {
Ok(expr) => expr,
Err(err) => panic!("failed to parse `{}`: {err}", $input),
};
let context = EvalContext::default();
c.bench_function(concat!("eval ", $input), |b| {