mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +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:
@@ -52,10 +52,10 @@ fn math<T: num_traits::float::Float>(
|
||||
let (operand_a, attributes) = operand_a.into_parts();
|
||||
let (expression, operand_b) = (expression.element(), *operand_b.element());
|
||||
|
||||
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 Item::from_parts(T::from(0.).unwrap(), attributes);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user