18 #define CASE(T) case type_t::T: o << #T; break
39 template <
typename ExpSet>
49 template <typename ExpSet> \
57 static bool print = !! getenv(
"VCSN_PRINT");
61 out_ << (rs_.identities().is_distributive()
62 ?
"{\\color{red}{" :
"{\\color{blue}{");
79 langle_ =
" \\left\\langle ";
80 rangle_ =
" \\right\\rangle ";
87 transposition_ =
"^{T}";
92 sum_ = (rs_.identities().is_distributive() ?
" \\oplus "
95 one_ =
"\\varepsilon";
98 ldiv_ =
" \\backslash ";
99 tuple_left =
" \\left. ";
100 tuple_middle =
" \\middle| ";
101 tuple_right =
" \\right. ";
102 exponent_threshold_= 2;
116 transposition_ =
"{T}";
130 exponent_threshold_= 4;
142 transposition_ =
"ᵗ";
156 exponent_threshold_= 2;
159 raise(
"expression: invalid format: ", fmt_);
171 case exp::type_t::Type: \
172 return precedence_t::Type
193 #define VISIT(Type) \
194 DEFINE::visit(const Type ## _t& v) \
200 rs_.weightset()->print(
v.weight(), out_, fmt_.for_weights());
201 out_ << rangle_ << lmul_;
202 print_child_(*
v.sub(),
v);
207 print_child_(*
v.sub(),
v);
208 out_ << rmul_ << langle_;
209 rs_.weightset()->print(
v.weight(), out_, fmt_.for_weights());
227 rs_.labelset()->print(
v.value(), out_, fmt_.for_labels());
232 for (
auto it = begin(
v); it != end(
v); )
240 std::find_if(it, end(
v),
241 [&](
const auto& e) {
return !rs_.equal(e, i); });
242 auto count = std::distance(it, next);
244 && (!expressionset_t::context_t::is_lal
246 || exponent_threshold_ < count))
254 std::function<void(int)>
print = [
this, &
print](
int n)
265 out_ << lexponent_ << count << rexponent_;
280 static bool force = !! getenv(
"VCSN_PARENS");
281 bool parent_has_precedence = precedence_(child) <= parent;
284 || (parent_has_precedence
286 && ! is_braced_(child)));
301 print_child(child, precedence_(parent));
304 template <
typename ExpSet>
305 template <type_t Type>
311 print_child_(*
v.sub(),
v);
315 template <
typename ExpSet>
316 template <type_t Type>
323 for (
const auto& i: n)
printer(const expressionset_t &rs, std::ostream &out)
A printer.
std::ostream & incendl(std::ostream &o)
Increment the indentation, print an end of line, and set the indentation.
Print as rich UTF-8 text, escaped.
type_t
The possible types of expressions.
std::ostream & decendl(std::ostream &o)
Decrement the indentation, print an end of line, and set the indentation.
automaton infiltration_(const std::vector< automaton > &as, vcsn::detail::index_sequence< I... >)
Variadic bridge helper.
An input/output format for valuesets.
Indentation relative functions.
An inner node with multiple children.
typename super_t::template unary_t< Type > unary_t
constant< type_t::one, Context > one
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
static constexpr const char *const superscripts[]
Exponents in UTF-8.
std::ostream & operator<<(std::ostream &o, type_t t)
Print as plain (ASCII) text, escaped.
typename super_t::template variadic_t< Type > variadic_t
weight_node< type_t::lweight, Context > lweight
constant< type_t::zero, Context > zero
variadic< type_t::prod, Context > prod
std::ostream & print(const Aut &aut, std::ostream &out, const std::string &fmt)
precedence_t
The possible node precedence levels, increasing.
automaton conjunction_(const std::vector< automaton > &as, bool lazy, vcsn::detail::index_sequence< I... >)
Bridge helper.
An inner node implementing a weight.
weight_node< type_t::rweight, Context > rweight
automaton shuffle_(const std::vector< automaton > &as, vcsn::detail::index_sequence< I... >)
Variadic bridge helper.
void print_(const unary_t< Type > &n, const char *op)
Print a unary node.
Implementation of nodes of tuple of rational expressions.
typename super_t::node_t node_t
Actual node, without indirection.
int address(const void *t)
Name pointers, to make them easier to read.