pub fn pretty(&self, wrapper: &BoogieWrapper, model: &Model, ty: &Type) -> Option<PrettyDoc> {
        if self.extract_list("Error").is_some() {
            // This is an undefined value
            return Some(PrettyDoc::text("<undef>"));
        }
        match ty {
            Type::Primitive(PrimitiveType::U8) => Some(PrettyDoc::text(format!(
                "{}u8",
                self.extract_literal().and_then(|s| s.parse::<u8>().ok())?
            ))),
            Type::Primitive(PrimitiveType::U64) => Some(PrettyDoc::text(
                self.extract_literal()
                    .and_then(|s| s.parse::<u64>().ok())?
                    .to_string(),
            )),
            Type::Primitive(PrimitiveType::U128) => Some(PrettyDoc::text(format!(
                "{}u128",
                self.extract_literal()
                    .and_then(|s| s.parse::<u128>().ok())?
            ))),
            Type::Primitive(PrimitiveType::Num) => Some(PrettyDoc::text(format!(
                "{}num",
                self.extract_literal()
                    .and_then(|s| s.parse::<i128>().ok())?
            ))),
            Type::Primitive(PrimitiveType::Bool) => Some(PrettyDoc::text(
                self.extract_literal()
                    .and_then(|s| s.parse::<bool>().ok())?
                    .to_string(),
            )),
            Type::Primitive(PrimitiveType::Address) => {
                let addr = BigInt::parse_bytes(&self.extract_literal()?.clone().into_bytes(), 10)?;
                Some(PrettyDoc::text(format!("0x{}", &addr.to_str_radix(16))))
            }
            Type::Primitive(PrimitiveType::Signer) => {
                let l = self.extract_list("$signer")?;
                let addr = BigInt::parse_bytes(&l[0].extract_literal()?.clone().into_bytes(), 10)?;
                Some(PrettyDoc::text(format!(
                    "signer{{0x{}}}",
                    &addr.to_str_radix(16)
                )))
            }
            Type::Vector(param) => self.pretty_vector(wrapper, model, param),
            Type::Struct(module_id, struct_id, params) => {
                self.pretty_struct(wrapper, model, *module_id, *struct_id, params)
            }
            Type::Reference(_, bt) => {
                Some(PrettyDoc::text("&").append(self.pretty(wrapper, model, &*bt)?))
            }
            Type::TypeParameter(_) => {
                // The value of a generic cannot be easily displayed because we do not know the
                // actual type unless we parse it out from the model (via the type value parameter)
                // and convert into a Type. However, since the value is parametric and cannot
                // effect the verification outcome, we may not have much need for seeing it.
                Some(PrettyDoc::text("<generic>"))
            }
            _ => None,
        }
    }
/// Pretty prints the given model value which has given type.
Pretty prints the given model value which has given type.
Pretty prints the given model value which has given type .
pub fn pretty(&self, wrapper: &BoogieWrapper, model: &Model, ty: &Type) -> Option<PrettyDoc> {
        if self.extract_list("Error").is_some() {
            // This is an undefined value
            return Some(PrettyDoc::text("<undef>"));
        }
        match ty {
            Type::Primitive(PrimitiveType::U8) => Some(PrettyDoc::text(format!(
                "{}u8",
                self.extract_literal().and_then(|s| s.parse::<u8>().ok())?
            ))),
            Type::Primitive(PrimitiveType::U64) => Some(PrettyDoc::text(
                self.extract_literal()
                    .and_then(|s| s.parse::<u64>().ok())?
                    .to_string(),
            )),
            Type::Primitive(PrimitiveType::U128) => Some(PrettyDoc::text(format!(
                "{}u128",
                self.extract_literal()
                    .and_then(|s| s.parse::<u128>().ok())?
            ))),
            Type::Primitive(PrimitiveType::Num) => Some(PrettyDoc::text(format!(
                "{}num",
                self.extract_literal()
                    .and_then(|s| s.parse::<i128>().ok())?
            ))),
            Type::Primitive(PrimitiveType::Bool) => Some(PrettyDoc::text(
                self.extract_literal()
                    .and_then(|s| s.parse::<bool>().ok())?
                    .to_string(),
            )),
            Type::Primitive(PrimitiveType::Address) => {
                let addr = BigInt::parse_bytes(&self.extract_literal()?.clone().into_bytes(), 10)?;
                Some(PrettyDoc::text(format!("0x{}", &addr.to_str_radix(16))))
            }
            Type::Primitive(PrimitiveType::Signer) => {
                let l = self.extract_list("$signer")?;
                let addr = BigInt::parse_bytes(&l[0].extract_literal()?.clone().into_bytes(), 10)?;
                Some(PrettyDoc::text(format!(
                    "signer{{0x{}}}",
                    &addr.to_str_radix(16)
                )))
            }
            Type::Vector(param) => self.pretty_vector(wrapper, model, param),
            Type::Struct(module_id, struct_id, params) => {
                self.pretty_struct(wrapper, model, *module_id, *struct_id, params)
            }
            Type::Reference(_, bt) => {
                Some(PrettyDoc::text("&").append(self.pretty(wrapper, model, &*bt)?))
            }
            Type::TypeParameter(_) => {
                // The value of a generic cannot be easily displayed because we do not know the
                // actual type unless we parse it out from the model (via the type value parameter)
                // and convert into a Type. However, since the value is parametric and cannot
                // effect the verification outcome, we may not have much need for seeing it.
                Some(PrettyDoc::text("<generic>"))
            }
            _ => None,
        }
    }
pub fn pretty ( & self , wrapper : & BoogieWrapper , model : & Model , ty : & Type ) -> Option < PrettyDoc > { if self . extract_list ( " " ) . is_some ( ) { // This is an undefined value return Some ( PrettyDoc :: text ( " " ) ) ; } match ty { Type :: Primitive ( PrimitiveType :: U8 ) => Some ( PrettyDoc :: text ( format ! ( " " self extract_literal ( ) and_then ( s s parse u8 ( ) ok ( ) ) ) ) ) , Type :: Primitive ( PrimitiveType :: U64 ) => Some ( PrettyDoc :: text ( self . extract_literal ( ) . and_then ( | s | s . parse :: < u64 > ( ) . ok ( ) ) ? . to_string ( ) , ) ) , Type :: Primitive ( PrimitiveType :: U128 ) => Some ( PrettyDoc :: text ( format ! ( " " self extract_literal ( ) and_then ( s s parse u128 ( ) ok ( ) ) ) ) ) , Type :: Primitive ( PrimitiveType :: Num ) => Some ( PrettyDoc :: text ( format ! ( " " self extract_literal ( ) and_then ( s s parse i128 ( ) ok ( ) ) ) ) ) , Type :: Primitive ( PrimitiveType :: Bool ) => Some ( PrettyDoc :: text ( self . extract_literal ( ) . and_then ( | s | s . parse :: < bool > ( ) . ok ( ) ) ? . to_string ( ) , ) ) , Type :: Primitive ( PrimitiveType :: Address ) => { let addr = BigInt :: parse_bytes ( & self . extract_literal ( ) ? . clone ( ) . into_bytes ( ) , 10 ) ? ; Some ( PrettyDoc :: text ( format ! ( " " addr to_str_radix ( 16 ) ) ) ) } Type :: Primitive ( PrimitiveType :: Signer ) => { let l = self . extract_list ( " " ) ? ; let addr = BigInt :: parse_bytes ( & l [ 0 ] . extract_literal ( ) ? . clone ( ) . into_bytes ( ) , 10 ) ? ; Some ( PrettyDoc :: text ( format ! ( " " addr to_str_radix ( 16 ) ) ) ) } Type :: Vector ( param ) => self . pretty_vector ( wrapper , model , param ) , Type :: Struct ( module_id , struct_id , params ) => { self . pretty_struct ( wrapper , model , * module_id , * struct_id , params ) } Type :: Reference ( _ , bt ) => { Some ( PrettyDoc :: text ( " " ) . append ( self . pretty ( wrapper , model , & * bt ) ? ) ) } Type :: TypeParameter ( _ ) => { // The value of a generic cannot be easily displayed because we do not know the // actual type unless we parse it out from the model (via the type value parameter) // and convert into a Type. However, since the value is parametric and cannot // effect the verification outcome, we may not have much need for seeing it. Some ( PrettyDoc :: text ( " " ) ) } _ => None , } }
Pretty prints the given model value which has given type.
Pretty prints the given model value which has given type .
&self
wrapper
&BoogieWrapper
model
&Model
ty
&Type