10 #ifndef CPROVER_JAVA_BYTECODE_EXPR2JAVA_H
11 #define CPROVER_JAVA_BYTECODE_EXPR2JAVA_H
28 const exprt &src,
unsigned &precedence)
override;
35 const exprt &src,
unsigned &precedence)
override;
46 const std::string &declarator)
override;
59 template <
typename float_type>
62 const bool is_float = std::is_same<float_type, float>::value;
63 const std::string class_name = is_float ?
"Float" :
"Double";
65 return class_name +
".NaN";
67 return class_name +
".POSITIVE_INFINITY";
69 return class_name +
".NEGATIVE_INFINITY";
70 const std::string decimal = [&]() -> std::string {
73 std::ostringstream raw_stream;
75 const auto raw_decimal = raw_stream.str();
76 const bool is_scientific = raw_decimal.find(
'e') != std::string::npos;
78 raw_decimal.find(
'.') == std::string::npos &&
81 return raw_decimal +
".0";
85 const bool is_lossless = [&] {
88 return std::stod(decimal) == value;
90 catch(std::out_of_range &)
95 const std::string lossless = [&]() -> std::string {
98 std::ostringstream stream;
99 stream << std::hexfloat << value;
102 const auto literal = is_float ? lossless +
'f' : lossless;
105 return literal +
" /* " + decimal +
" */";
floatbv_typet float_type()
goto_instruction_codet representation of a function call statement.
Data structure for representing an arbitrary statement in a program.
A constant literal expression.
std::string convert_code_java_new(const exprt &src, unsigned precedence)
std::string convert_java_new(const exprt &src)
virtual std::string convert_struct(const exprt &src, unsigned &precedence) override
virtual std::string convert_with_precedence(const exprt &src, unsigned &precedence) override
std::string convert_code_java_delete(const exprt &src, unsigned precedence)
virtual std::string convert_rec(const typet &src, const c_qualifierst &qualifiers, const std::string &declarator) override
std::string convert_code_function_call(const code_function_callt &src, unsigned indent)
const std::size_t char_representation_length
virtual std::string convert_code(const codet &src, unsigned indent) override
std::string convert_java_instanceof(const exprt &src)
virtual std::string convert(const typet &src) override
std::string convert_java_this()
expr2javat(const namespacet &_ns)
virtual std::string convert_constant(const constant_exprt &src, unsigned &precedence) override
Base class for all expressions.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
The type of an expression, extends irept.
std::string type2java(const typet &type, const namespacet &ns)
std::string floating_point_to_java_string(float_type value)
Convert floating point number to a string without printing unnecessary zeros.
std::string expr2java(const exprt &expr, const namespacet &ns)