17 #define CASE(T) case type_t::T: o << #T; break
39 template <
typename ExpSet>
48 template <typename ExpSet> \
55 static bool print = !! getenv(
"VCSN_PRINT");
59 out_ << (rs_.identities().is_distributive()
60 ?
"{\\color{red}{" :
"{\\color{blue}{");
77 langle_ =
" \\left\\langle ";
78 rangle_ =
" \\right\\rangle ";
86 transposition_ =
"^{T}";
91 add_ = (rs_.identities().is_distributive() ?
" \\oplus "
94 one_ =
"\\varepsilon";
97 ldivide_ =
" \\backslash ";
98 tuple_left =
" \\left. ";
99 tuple_middle =
" \\middle| ";
100 tuple_right =
" \\right. ";
101 exponent_threshold_= 2;
116 transposition_ =
"{T}";
130 exponent_threshold_= 4;
143 transposition_ =
"ᵗ";
157 exponent_threshold_= 2;
160 raise(
"expression: invalid format: ", fmt_);
172 case exp::type_t::Type: \
173 return precedence_t::Type
195 #define VISIT(Type) \
196 DEFINE::visit(const Type ## _t& v) \
203 out_ << rangle_ << lweight_;
204 print_child_(*
v.sub(),
v);
209 print_child_(*
v.sub(),
v);
210 out_ << rweight_ << langle_;
229 rs_.labelset()->print(
v.value(), out_,
230 fmt_.for_labels().meta(
"!&%|@',[-]<> (){}\n*+:.?"));
236 for (
auto it = begin(
v); it != end(
v); )
244 std::find_if(it, end(
v),
245 [&](
const auto& e) {
return !rs_.equal(e, i); });
246 auto count = std::distance(it, next);
248 && (!expressionset_t::context_t::is_lal
250 || exponent_threshold_ < count))
258 std::function<void(int)>
print = [
this, &
print](
int n)
269 out_ << lexponent_ << count << rexponent_;
284 static bool force = !! getenv(
"VCSN_PARENS");
285 bool parent_has_precedence = precedence_(child) <= parent;
288 || (parent_has_precedence
290 && ! is_braced_(child)));
305 print_child(child, precedence_(parent));
308 template <
typename ExpSet>
309 template <type_t Type>
314 print_child_(*
v.sub(),
v);
318 template <
typename ExpSet>
319 template <type_t Type>
325 for (
const auto& i: n)
type_t
The possible types of expressions.
std::ostream & operator<<(std::ostream &o, type_t t)
Print a expression type.
std::ostream & incendl(std::ostream &o)
Increment the indentation, print an end of line, and set the indentation.
unsigned address(const void *t)
Name pointers, to make them easier to read.
std::ostream & decendl(std::ostream &o)
Decrement the indentation, print an end of line, and set the indentation.
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
An inner node implementing a weight.
typename super_t::template unary_t< Type > unary_t
constant< type_t::one, Context > one
weight_node< type_t::rweight, Context > rweight
precedence_t
The possible node precedence levels, increasing.
std::ostream & print(const Aut &aut, std::ostream &out=std::cout, const std::string &fmt="default")
printer(const expressionset_t &rs, std::ostream &out)
A printer.
variadic< type_t::mul, Context > mul
automaton conjunction_(const std::vector< automaton > &as, bool lazy, vcsn::detail::index_sequence< I... >)
Bridge helper.
automaton shuffle_(const std::vector< automaton > &as, vcsn::detail::index_sequence< I... >)
Variadic bridge helper.
An input/output format for valuesets.
std::ostream & print_(const node_t &v)
Print v.
Indentation relative functions.
constant< type_t::zero, Context > zero
automaton infiltrate_(const std::vector< automaton > &as, vcsn::detail::index_sequence< I... >)
Variadic bridge helper.
Print as rich UTF-8 text, escaped.
Implementation of nodes of tuple of rational expressions.
weight_node< type_t::lweight, Context > lweight
An inner node with multiple children.
static constexpr const char *const superscripts[]
Exponents in UTF-8.
Print as plain (ASCII) text, escaped.
typename super_t::node_t node_t
Actual node, without indirection.
typename super_t::template variadic_t< Type > variadic_t
void print_(std::ostream &o, const T &arg, long)
Serialize arg into o.