15 template <
typename ExpSet>
17 :
public ExpSet::const_visitor
21 using super_t =
typename expressionset_t::const_visitor;
31 using node_t =
typename super_t::node_t;
34 template <type_t Type>
36 template <type_t Type>
38 template <type_t Type>
42 constexpr
static const char*
me() {
return "dot_printer"; }
73 sum_ = (
rs_.identities().is_distributive() ?
" \\oplus "
76 one_ =
"\\varepsilon";
79 ldiv_ =
" \\backslash ";
140 raise(
"expression: invalid format: ",
fmt_);
185 template <
bool = context_t::is_lat,
186 typename Dummy =
void>
194 const auto&
r = std::get<I>(v.sub());
205 template <
size_t... I>
208 using swallow =
int[];
221 print_(v, labelset_t::indices);
226 template <
typename Dummy>
242 template <rat::exp::type_t Type>
243 void print_(
const unary_t<Type>& n,
const char* op)
248 <<
"x" <<
address(*n.sub()) << vcsn::iendl;
253 template <rat::exp::type_t Type>
254 void print_(
const constant_t<Type>& n,
const char* op)
257 <<
" [label=\"" << op <<
"\"]";
261 template <rat::exp::type_t Type>
262 void print_(
const variadic_t<Type>& n,
const char* op)
267 for (
const auto& i: n)
270 for (
const auto& i: n)
282 return out_ <<
"\"]";
290 <<
"x" <<
address(n) <<
" -> {"
303 <<
"x" <<
address(n) <<
" -> {"
327 const bool debug_ = !!getenv(
"VCSN_PARENS");
372 template <
typename ExpSet>
const char * transposition_
weight_t_of< context_t > weight_t
const char * star_
The expression operators.
std::ostream & print(const value_t &v)
Print an expression as a tree.
Provide a variadic mul on top of a binary mul(), and one().
const char * tuple_right
Right tuple delimiter.
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
const char * lmul_
External product.
VCSN_RAT_VISIT(conjunction, v)
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
VCSN_RAT_VISIT(rweight, v)
An inner node implementing a weight.
typename super_t::template constant_t< Type > constant_t
#define BUILTIN_UNREACHABLE()
typename node_t::value_t value_t
A shared_ptr to node_t.
const char * lgroup_
Left and right boundaries (typically braces for LaTeX).
Print as plain (ASCII) text, escaped.
context_t_of< expressionset_t > context_t
const char * tuple_middle
Tuple tape separator.
typename super_t::template unary_t< Type > unary_t
void print_(const constant_t< Type > &n, const char *op)
Print a nullary node.
dot_printer(const expressionset_t &rs, std::ostream &out)
A printer.
typename super_t::node_t node_t
Actual node, without indirection.
std::ostream & operator()(const value_t &v)
Entry point: print v as a complete Dot graph.
typename super_t::tuple_t tuple_t
format for_labels() const
A copy of this format, but to print labels.
typename expressionset_t::identities_t identities_t
void operator()(const tuple_t &v)
Entry point.
void format(format fmt)
Set output format.
void format(format fmt)
Set output format.
void print_(const lweight_t &n)
Print a left-weight.
std::ostream & incendl(std::ostream &o)
Increment the indentation, print an end of line, and set the indentation.
void print_(const tuple_t &v, detail::index_sequence< I... >)
Print all the tapes.
VCSN_RAT_VISIT(shuffle, v)
const char * tuple_left
Left tuple delimiter.
const char * lparen_
Left and right parentheses.
const expressionset_t & rs_
The expressionset.
const char * ldiv_
Quotient.
typename expressionset_t::const_visitor super_t
void print_(const rweight_t &n)
Print a right-weight.
Pretty-printer for rational expressions.
label_t_of< context_t > label_t
void print_(const atom_t &n)
Print a label.
int address(const void *t)
Name pointers, to make them easier to read.
unsigned int exponent_threshold_
dot_printer< ExpSet > make_dot_printer(const ExpSet &rs, std::ostream &out)
Pretty-printer for rational expressions.
std::ostream & decendl(std::ostream &o)
Decrement the indentation, print an end of line, and set the indentation.
const bool debug_
Whether to be overly verbose.
Indentation relative functions.
const char * langle_
Left and right angle brackets for weights.
std::ostream & print_(const node_t &v)
Easy recursion: print an expression.
const char * infiltration_
format for_weights() const
A copy of this format, but to print weights.
labelset_t_of< context_t > labelset_t
VCSN_RAT_VISIT(complement, v)
static constexpr const char * me()
Name of this algorithm, for error messages.
An inner node with multiple children.
VCSN_RAT_VISIT(infiltration, v)
void visit(const tuple_t &v, std::true_type) override
std::ostream & iendl(std::ostream &o)
Print an end of line, then set the indentation.
void print_(const tuple_t &v)
Print one tape.
const char * lexponent_
Left and right braces for exponents.
class format fmt_
Output format.
typename super_t::template variadic_t< Type > variadic_t
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
void print_(const unary_t< Type > &n, const char *op)
Print a unary node.
Print as rich UTF-8 text, escaped.
std::ostream & out_
Output stream.
VCSN_RAT_VISIT(transposition, v)
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
void print_(const variadic_t< Type > &n, const char *op)
Print a variadic node.
const char * zero_
The constants.
VCSN_RAT_VISIT(lweight, v)
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
std::ostream & print_(const weight_t &w)
Print a weight.
An input/output format for valuesets.
void operator()(const tuple_t &)
const char * conjunction_