fn parse_comparison_val(pair: Pair<Rule>) -> Expr {
    let primary = |pair| parse_comparison_val(pair);

    let infix = |lhs: Expr, op: Pair<Rule>, rhs: Expr| {
        Expr::new(ExprVal::Math(MathExpr {
            lhs: Box::new(lhs),
            operator: match op.as_rule() {
                Rule::op_plus => MathOperator::Add,
                Rule::op_minus => MathOperator::Sub,
                Rule::op_times => MathOperator::Mul,
                Rule::op_slash => MathOperator::Div,
                Rule::op_modulo => MathOperator::Modulo,
                _ => unreachable!(),
            },
            rhs: Box::new(rhs),
        }))
    };

    match pair.as_rule() {
        Rule::basic_expr_filter => parse_basic_expr_with_filters(pair),
        Rule::comparison_val => MATH_CLIMBER.climb(pair.into_inner(), primary, infix),
        _ => unreachable!("Got {:?} in parse_comparison_val", pair.as_rule()),
    }
}
/// A basic expression with optional filters
A basic expression with optional filters
A basic expression with optional filters
fn parse_comparison_val(pair: Pair<Rule>) -> Expr {
    let primary = |pair| parse_comparison_val(pair);
    let infix = |lhs: Expr, op: Pair<Rule>, rhs: Expr| {
        Expr::new(ExprVal::Math(MathExpr {
            lhs: Box::new(lhs),
            operator: match op.as_rule() {
                Rule::op_plus => MathOperator::Add,
                Rule::op_minus => MathOperator::Sub,
                Rule::op_times => MathOperator::Mul,
                Rule::op_slash => MathOperator::Div,
                Rule::op_modulo => MathOperator::Modulo,
                _ => unreachable!(),
            },
            rhs: Box::new(rhs),
        }))
    };
    match pair.as_rule() {
        Rule::basic_expr_filter => parse_basic_expr_with_filters(pair),
        Rule::comparison_val => MATH_CLIMBER.climb(pair.into_inner(), primary, infix),
        _ => unreachable!("Got {:?} in parse_comparison_val", pair.as_rule()),
    }
}
fn parse_comparison_val ( pair : Pair < Rule > ) -> Expr { let primary = | pair | parse_comparison_val ( pair ) ; let infix = | lhs : Expr , op : Pair < Rule > , rhs : Expr | { Expr :: new ( ExprVal :: Math ( MathExpr { lhs : Box :: new ( lhs ) , operator : match op . as_rule ( ) { Rule :: op_plus => MathOperator :: Add , Rule :: op_minus => MathOperator :: Sub , Rule :: op_times => MathOperator :: Mul , Rule :: op_slash => MathOperator :: Div , Rule :: op_modulo => MathOperator :: Modulo , _ => unreachable ! ( ) , } , rhs : Box :: new ( rhs ) , } ) ) } ; match pair . as_rule ( ) { Rule :: basic_expr_filter => parse_basic_expr_with_filters ( pair ) , Rule :: comparison_val => MATH_CLIMBER . climb ( pair . into_inner ( ) , primary , infix ) , _ => unreachable ! ( " " pair as_rule ( ) ) , } }
A basic expression with optional filters
A basic expression with optional filters
pair
Pair<Rule>
pair
Pair<Rule>