fn validate_guard(guard: &GuardExpr) -> bool {
    match guard {
        GuardExpr::And(bs) => bs.iter().all(|b| validate_guard(b)),
        GuardExpr::Or(bs) => bs.iter().all(|b| validate_guard(b)),
        GuardExpr::Eq(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Neq(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Gt(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Lt(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Geq(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Leq(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Not(inner) => validate_guard(inner),
        GuardExpr::Atom(Atom::Port(p)) => {
            matches!(p, Port::Comp { .. } | Port::This { .. })
        }
        GuardExpr::Atom(Atom::Num(_)) => true,
    }
}
/// Checks to make sure that there are no holes being
/// used in a guard.
Checks to make sure that there are no holes being
used in a guard.
Checks to make sure that there are no holes being used in a guard .
fn validate_guard(guard: &GuardExpr) -> bool {
    match guard {
        GuardExpr::And(bs) => bs.iter().all(|b| validate_guard(b)),
        GuardExpr::Or(bs) => bs.iter().all(|b| validate_guard(b)),
        GuardExpr::Eq(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Neq(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Gt(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Lt(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Geq(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Leq(left, right) => {
            validate_guard(left) && validate_guard(right)
        }
        GuardExpr::Not(inner) => validate_guard(inner),
        GuardExpr::Atom(Atom::Port(p)) => {
            matches!(p, Port::Comp { .. } | Port::This { .. })
        }
        GuardExpr::Atom(Atom::Num(_)) => true,
    }
}
fn validate_guard ( guard : & GuardExpr ) -> bool { match guard { GuardExpr :: And ( bs ) => bs . iter ( ) . all ( | b | validate_guard ( b ) ) , GuardExpr :: Or ( bs ) => bs . iter ( ) . all ( | b | validate_guard ( b ) ) , GuardExpr :: Eq ( left , right ) => { validate_guard ( left ) && validate_guard ( right ) } GuardExpr :: Neq ( left , right ) => { validate_guard ( left ) && validate_guard ( right ) } GuardExpr :: Gt ( left , right ) => { validate_guard ( left ) && validate_guard ( right ) } GuardExpr :: Lt ( left , right ) => { validate_guard ( left ) && validate_guard ( right ) } GuardExpr :: Geq ( left , right ) => { validate_guard ( left ) && validate_guard ( right ) } GuardExpr :: Leq ( left , right ) => { validate_guard ( left ) && validate_guard ( right ) } GuardExpr :: Not ( inner ) => validate_guard ( inner ) , GuardExpr :: Atom ( Atom :: Port ( p ) ) => { matches ! ( p Port Comp { } Port This { } ) } GuardExpr :: Atom ( Atom :: Num ( _ ) ) => true , } }
Checks to make sure that there are no holes being
used in a guard.
Checks to make sure that there are no holes being used in a guard .
guard
&GuardExpr