mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-22 00:38:11 +08:00
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:
@@ -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| {
|
||||
|
||||
Reference in New Issue
Block a user