fn ty_parser(path: &Path, ty: &core::RcType) -> RcParseExpr {
    match *ty.inner {
        core::Type::Var(_, ref var) => ParseExpr::Var(var.clone()).into(),
        core::Type::Const(ty_const) => ParseExpr::Const(ty_const).into(),
        core::Type::Lam(_, _, _) => unimplemented!("Abs: {:?}", ty),
        core::Type::App(_, ref ty, _) => ty_parser(path, ty),

        core::Type::Array(_, ref elem_ty, ref size_expr) => {
            let elem_path = path.append_child("Elem");
            let elem_parser = ty_parser(&elem_path, elem_ty);
            let size_expr = lower_expr(path, size_expr);

            ParseExpr::Repeat(elem_parser, RepeatBound::Exact(size_expr)).into()
        }
        core::Type::Cond(_, ref options) => cond_parser(path, options),
        core::Type::Struct(_, ref fields) => struct_parser(path, fields),
        core::Type::Assert(_, ref ty, ref pred_expr) => {
            let ty_parser = ty_parser(path, ty);
            let pred_expr = lower_expr(path, pred_expr);

            ParseExpr::Assert(ty_parser, pred_expr).into()
        }
        core::Type::Interp(_, ref ty, ref conv_expr, _) => {
            let fn_expr = lower_expr(path, conv_expr);
            let parser_expr = ty_parser(path, ty);

            ParseExpr::Apply(fn_expr, parser_expr).into()
        }

        _ => unimplemented!(),
    }
}
/// Create a parser for the given type
///
/// # Arguments
///
/// * `path` - path to the parent struct or union
/// * `ty` - the binary type to use as a basis for the parser
Create a parser for the given type
Create a parser for the given type
fn ty_parser(path: &Path, ty: &core::RcType) -> RcParseExpr {
    match *ty.inner {
        core::Type::Var(_, ref var) => ParseExpr::Var(var.clone()).into(),
        core::Type::Const(ty_const) => ParseExpr::Const(ty_const).into(),
        core::Type::Lam(_, _, _) => unimplemented!("Abs: {:?}", ty),
        core::Type::App(_, ref ty, _) => ty_parser(path, ty),
        core::Type::Array(_, ref elem_ty, ref size_expr) => {
            let elem_path = path.append_child("Elem");
            let elem_parser = ty_parser(&elem_path, elem_ty);
            let size_expr = lower_expr(path, size_expr);
            ParseExpr::Repeat(elem_parser, RepeatBound::Exact(size_expr)).into()
        }
        core::Type::Cond(_, ref options) => cond_parser(path, options),
        core::Type::Struct(_, ref fields) => struct_parser(path, fields),
        core::Type::Assert(_, ref ty, ref pred_expr) => {
            let ty_parser = ty_parser(path, ty);
            let pred_expr = lower_expr(path, pred_expr);
            ParseExpr::Assert(ty_parser, pred_expr).into()
        }
        core::Type::Interp(_, ref ty, ref conv_expr, _) => {
            let fn_expr = lower_expr(path, conv_expr);
            let parser_expr = ty_parser(path, ty);
            ParseExpr::Apply(fn_expr, parser_expr).into()
        }
        _ => unimplemented!(),
    }
}
fn ty_parser ( path : & Path , ty : & core :: RcType ) -> RcParseExpr { match * ty . inner { core :: Type :: Var ( _ , ref var ) => ParseExpr :: Var ( var . clone ( ) ) . into ( ) , core :: Type :: Const ( ty_const ) => ParseExpr :: Const ( ty_const ) . into ( ) , core :: Type :: Lam ( _ , _ , _ ) => unimplemented ! ( " " ty ) , core :: Type :: App ( _ , ref ty , _ ) => ty_parser ( path , ty ) , core :: Type :: Array ( _ , ref elem_ty , ref size_expr ) => { let elem_path = path . append_child ( " " ) ; let elem_parser = ty_parser ( & elem_path , elem_ty ) ; let size_expr = lower_expr ( path , size_expr ) ; ParseExpr :: Repeat ( elem_parser , RepeatBound :: Exact ( size_expr ) ) . into ( ) } core :: Type :: Cond ( _ , ref options ) => cond_parser ( path , options ) , core :: Type :: Struct ( _ , ref fields ) => struct_parser ( path , fields ) , core :: Type :: Assert ( _ , ref ty , ref pred_expr ) => { let ty_parser = ty_parser ( path , ty ) ; let pred_expr = lower_expr ( path , pred_expr ) ; ParseExpr :: Assert ( ty_parser , pred_expr ) . into ( ) } core :: Type :: Interp ( _ , ref ty , ref conv_expr , _ ) => { let fn_expr = lower_expr ( path , conv_expr ) ; let parser_expr = ty_parser ( path , ty ) ; ParseExpr :: Apply ( fn_expr , parser_expr ) . into ( ) } _ => unimplemented ! ( ) , } }
Create a parser for the given type
Create a parser for the given type
path
&Path
ty
&core::RcType
path
&Path
ty
&core::RcType