12#ifndef MCRL2_CORE_PRINT_H
13#define MCRL2_CORE_PRINT_H
28const int max_precedence = 10000;
33 return max_precedence;
36template <
typename Derived>
37struct printer:
public core::traverser<Derived>
39 typedef core::traverser<Derived> super;
49 return static_cast<Derived&
>(*this);
57 void print(
const std::string& s)
63 void print_expression(
const T& x,
bool needs_parentheses)
65 if (needs_parentheses)
70 if (needs_parentheses)
76 template <
typename T,
typename U>
77 void print_unary_operand(
const T& x,
const U& operand)
83 void print_unary_left_operation(
const T& x,
const std::string& op)
86 print_unary_operand(x, x.operand());
90 void print_unary_right_operation(
const T& x,
const std::string& op)
92 print_unary_operand(x, x.operand());
97 void print_binary_operation(
const T& x,
const std::string& op)
99 const auto& x1 = x.left();
100 const auto& x2 = x.right();
109 template <
typename Container>
111 const std::string& opener =
"(",
112 const std::string& closer =
")",
113 const std::string& separator =
", ",
114 bool print_empty_container =
false
117 if (container.empty() && !print_empty_container)
121 derived().print(opener);
122 for (
auto i = container.begin(); i != container.end(); ++i)
124 if (i != container.begin())
126 derived().print(separator);
130 derived().print(closer);
133 template <
typename T>
134 void apply(
const std::list<T>& x)
141 template <
typename T>
149 template <
typename T>
150 void apply(
const std::set<T>& x)
157 void apply(
const core::identifier_string& x)
160 if (x == core::identifier_string())
162 derived().print(
"@NoValue");
166 derived().print(std::string(x));
174 derived().print(utilities::to_string(x));
181 derived().print(utilities::to_string(x));
188 derived().print(utilities::to_string(x));
193template <
template <
class>
class Traverser>
194struct apply_printer:
public Traverser<apply_printer<Traverser>>
196 typedef Traverser<apply_printer<Traverser>> super;
202 explicit apply_printer(std::ostream& out)
204 typedef printer<apply_printer<Traverser> > Super;
205 static_cast<Super&
>(*this).m_out = &out;
216 template <
typename T>
219 core::detail::apply_printer<core::detail::printer> printer(out);
226std::string
pp(
const T& x)
228 std::ostringstream out;
An integer term stores a single std::size_t value. It carries no arguments.
add your file description here.
std::string print_list(const Container &v, const std::string &message="", bool print_index=false, bool boundary_spaces=true)
Creates a string representation of a container.
std::string pp(const identifier_string &x)
int precedence(const data_expression &x)
bool is_left_associative(const data_expression &x)
bool is_right_associative(const data_expression &x)
std::string print(const pbespg_solver_type solver_type)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Prints the object x to a stream.
void operator()(const T &x, std::ostream &out)