fn cond_parser(path: &Path, options: &[Field<(core::RcExpr, core::RcType)>]) -> RcParseExpr {
    let lower_option = |option: &Field<(core::RcExpr, core::RcType)>| {
        let pred_expr = lower_expr(path, &option.value.0);
        let variant_parser = ParseExpr::Sequence(
            vec![
                Named::new(Ident::from("x"), ty_parser(path, &option.value.1)),
            ],
            Expr::Intro(
                path.clone(),
                option.name.clone(),
                // FIXME: generate fresh name?
                Expr::Var(Var::bound(Name::user("x"), BoundVar::new(Si(0), Bi(0)))).into(),
            ).into(),
        ).into();

        (pred_expr, variant_parser)
    };

    ParseExpr::Cond(options.iter().map(lower_option).collect()).into()
}
/// Create a union parser for the given fields
///
/// # Arguments
///
/// * `path` - path to the parent struct or union
/// * `fields` - the fields to be used in the parser
Create a union parser for the given fields
Create a union parser for the given fields
fn cond_parser(path: &Path, options: &[Field<(core::RcExpr, core::RcType)>]) -> RcParseExpr {
    let lower_option = |option: &Field<(core::RcExpr, core::RcType)>| {
        let pred_expr = lower_expr(path, &option.value.0);
        let variant_parser = ParseExpr::Sequence(
            vec![
                Named::new(Ident::from("x"), ty_parser(path, &option.value.1)),
            ],
            Expr::Intro(
                path.clone(),
                option.name.clone(),
                // FIXME: generate fresh name?
                Expr::Var(Var::bound(Name::user("x"), BoundVar::new(Si(0), Bi(0)))).into(),
            ).into(),
        ).into();
        (pred_expr, variant_parser)
    };
    ParseExpr::Cond(options.iter().map(lower_option).collect()).into()
}
fn cond_parser ( path : & Path , options : & [ Field < ( core :: RcExpr , core :: RcType ) > ] ) -> RcParseExpr { let lower_option = | option : & Field < ( core :: RcExpr , core :: RcType ) > | { let pred_expr = lower_expr ( path , & option . value . 0 ) ; let variant_parser = ParseExpr :: Sequence ( vec ! [ Named new ( Ident from ( " " ) ty_parser ( path option value 1 ) ) ] , Expr :: Intro ( path . clone ( ) , option . name . clone ( ) , // FIXME: generate fresh name? Expr :: Var ( Var :: bound ( Name :: user ( " " ) , BoundVar :: new ( Si ( 0 ) , Bi ( 0 ) ) ) ) . into ( ) , ) . into ( ) , ) . into ( ) ; ( pred_expr , variant_parser ) } ; ParseExpr :: Cond ( options . iter ( ) . map ( lower_option ) . collect ( ) ) . into ( ) }
Create a union parser for the given fields
Create a union parser for the given fields
path
&Path
options
&[Field<(core::RcExpr, core::RcType)>]
path
&Path
options
&[Field<(core::RcExpr, core::RcType)>]