Go to the documentation of this file.
47 {ID_notequal, {
u8"\u2260"}},
48 {ID_and, {
u8"\u2227"}},
49 {ID_or, {
u8"\u2228"}},
50 {ID_xor, {
u8"\u2295"}},
51 {ID_implies, {
u8"\u21d2"}},
52 {ID_le, {
u8"\u2264"}},
53 {ID_ge, {
u8"\u2265"}},
74 (sub_expr.
id() == ID_mult || sub_expr.
id() == ID_div) &&
75 (expr.
id() == ID_plus || expr.
id() == ID_minus))
80 (sub_expr.
id() == ID_equal || sub_expr.
id() == ID_notequal ||
81 sub_expr.
id() == ID_lt || sub_expr.
id() == ID_gt ||
82 sub_expr.
id() == ID_le || sub_expr.
id() == ID_ge) &&
83 (expr.
id() == ID_and || expr.
id() == ID_or))
88 (sub_expr.
id() == ID_plus || sub_expr.
id() == ID_minus ||
89 sub_expr.
id() == ID_mult || sub_expr.
id() == ID_div) &&
90 (expr.
id() == ID_equal || expr.
id() == ID_notequal || expr.
id() == ID_lt ||
91 expr.
id() == ID_gt || expr.
id() == ID_le || expr.
id() == ID_ge))
107 if(src.
id() == ID_equal &&
to_equal_expr(src).op0().type().
id() == ID_bool)
109 operator_str =
u8"\u21d4";
115 operator_str = infix_map_it->second.rep;
118 for(
const auto &op : src.
operands())
123 os <<
' ' << operator_str <<
' ';
150 if(src.
id() == ID_not)
152 else if(src.
id() == ID_unary_minus)
155 return os << src.
pretty();
158 return os <<
'(' <<
format(src.
op()) <<
')';
166 auto type = src.
type().
id();
173 return os <<
"false";
175 return os << src.
pretty();
177 else if(type == ID_unsignedbv || type == ID_signedbv || type == ID_c_bool)
178 return os << *numeric_cast<mp_integer>(src);
179 else if(type == ID_integer)
181 else if(type == ID_string)
183 else if(type == ID_floatbv)
185 else if(type == ID_pointer && src.
is_zero())
188 return os << src.
pretty();
196 if(s.first != ID_type)
197 os <<
' ' << s.first <<
"=\"" << s.second.id() <<
'"';
204 for(
const auto &op : expr.
operands())
225 const auto &
id = expr.
id();
228 id == ID_plus ||
id == ID_mult ||
id == ID_and ||
id == ID_or ||
234 id == ID_lt ||
id == ID_gt ||
id == ID_ge ||
id == ID_le ||
id == ID_div ||
235 id == ID_minus ||
id == ID_implies ||
id == ID_equal ||
id == ID_notequal)
239 else if(
id == ID_not ||
id == ID_unary_minus)
241 else if(
id == ID_constant)
243 else if(
id == ID_typecast)
247 id == ID_byte_extract_little_endian ||
id == ID_byte_extract_big_endian)
250 return os <<
id <<
'(' <<
format(byte_extract_expr.op()) <<
", "
251 <<
format(byte_extract_expr.offset()) <<
", "
252 <<
format(byte_extract_expr.type()) <<
')';
254 else if(
id == ID_byte_update_little_endian ||
id == ID_byte_update_big_endian)
257 return os <<
id <<
'(' <<
format(byte_update_expr.op()) <<
", "
258 <<
format(byte_update_expr.offset()) <<
", "
259 <<
format(byte_update_expr.value()) <<
", "
260 <<
format(byte_update_expr.type()) <<
')';
262 else if(
id == ID_member)
265 else if(
id == ID_symbol)
267 else if(
id == ID_index)
270 return os <<
format(index_expr.array()) <<
'[' <<
format(index_expr.index())
273 else if(
id == ID_type)
275 else if(
id == ID_forall)
279 else if(
id == ID_exists)
283 else if(
id == ID_let)
287 else if(
id == ID_array ||
id == ID_struct)
293 for(
const auto &op : expr.
operands())
308 return os <<
'(' <<
format(if_expr.cond()) <<
" ? "
309 <<
format(if_expr.true_case()) <<
" : "
310 <<
format(if_expr.false_case()) <<
')';
312 else if(
id == ID_code)
314 const auto &code =
to_code(expr);
315 const irep_idt &statement = code.get_statement();
317 if(statement == ID_assign)
320 else if(statement == ID_block)
327 else if(statement == ID_dead)
331 else if(statement == ID_decl)
334 return os <<
"decl " <<
format(declaration_symb.type()) <<
" "
335 <<
format(declaration_symb) <<
";";
337 else if(statement == ID_function_call)
345 func_call.arguments().begin(),
346 func_call.arguments().end(),
348 [](
const exprt &expr) { return format(expr); });
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
A base class for multi-ary expressions Associativity is not specified.
const code_declt & to_code_decl(const codet &code)
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
const byte_extract_exprt & to_byte_extract_expr(const exprt &expr)
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
Base class for all expressions.
Generic base class for unary expressions.
A base class for binary expressions.
bool is_true() const
Return whether the expression is a constant representing true.
bool is_false() const
Return whether the expression is a constant representing false.
const codet & to_code(const exprt &expr)
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
typet & type()
Return the type of the expression.
Expression classes for byte-level operators.
bool has_operands() const
Return true if there is at least one operand.
const std::string & id2string(const irep_idt &d)
named_subt & get_named_sub()
const byte_update_exprt & to_byte_update_expr(const exprt &expr)
Stream & join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter, TransformFunc &&transform_func)
Prints items to an stream, separated by a constant delimiter.
const code_deadt & to_code_dead(const codet &code)
const irep_idt & get_identifier() const
const let_exprt & to_let_expr(const exprt &expr)
Cast an exprt to a let_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const irep_idt & id() const
const code_function_callt & to_code_function_call(const codet &code)
bool is_zero() const
Return whether the expression is a constant representing 0.
Forward depth-first search iterators These iterators' copy operations are expensive,...
const quantifier_exprt & to_quantifier_expr(const exprt &expr)
Cast an exprt to a quantifier_exprt.
const code_assignt & to_code_assign(const codet &code)
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.
const code_blockt & to_code_block(const codet &code)
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
irep_idt get_component_name() const
A constant literal expression.
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
API to expression classes.
const irep_idt & get_value() const
std::string escape(const std::string &s)
Generic escaping of strings; this is not meant to be a particular programming language.
API to expression classes for 'mathematical' expressions.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.