17 #define CASE(T) case type_t::T: o << #T; break 40 template <
typename ExpSet>
49 template <typename ExpSet> \ 59 out_ << (
rs_.identities().is_distributive()
60 ?
"{\\color{red}{" :
"{\\color{blue}{");
91 add_ = (
rs_.identities().is_distributive() ?
" \\oplus " 94 one_ =
"\\varepsilon";
160 raise(
"expression: invalid format: ",
fmt_);
172 case exp::type_t::Type: \ 173 return precedence_t::Type 196 #define VISIT(Type) \ 197 DEFINE::visit(const Type ## _t& v) \ 230 rs_.labelset()->print(
v.value(),
out_,
237 for (
auto it = begin(
v); it != end(
v); )
245 std::find_if(it, end(
v),
246 [&](
const auto& e) {
return !
rs_.equal(e, i); });
247 const auto count = std::distance(it, next);
257 std::function<void(int)>
print = [
this, &
print](
int n)
283 out_ <<
"\\mathsf{" <<
v.name_get() <<
"}";
285 out_ <<
v.name_get();
291 bool parent_has_precedence =
precedence_(child) <= parent;
294 || (parent_has_precedence
314 template <
typename ExpSet>
315 template <type_t Type>
324 template <
typename ExpSet>
325 template <type_t Type>
331 for (
const auto& i: n)
bool is_braced_(const node_t &v) const
Whether is naturally braced.
const char * lparen_
Left and right parentheses.
bool is_word_(const node_t &v) const
Whether v is an atom whose label is not a letter.
format for_labels() const
A copy of this format, but to print labels.
const char * lgroup_
Left and right boundaries (typically braces for LaTeX).
std::ostream & print(const Aut &aut, std::ostream &out=std::cout, const std::string &fmt="default")
unsigned address(const void *t)
Name pointers, to make them easier to read.
static constexpr const char *const superscripts[]
Exponents in UTF-8.
class format fmt_
Output format.
An inner node with multiple children.
const bool tagged_
Whether to use XML-like tags to highlight the structure.
const char * star_
The expression operators.
void print_child_(const node_t &child, const node_t &parent)
Print a child node, given its parent.
printer(const expressionset_t &rs, std::ostream &out)
A printer.
const expressionset_t & rs_
The expressionset.
const char * zero_
The constants.
const char * lexponent_
Left and right braces for exponents.
const bool parens_
Whether to be overly verbose.
const char * transposition_
precedence_t
The possible node precedence levels, increasing.
const char * meta() const
Characters that need to be escaped.
std::ostream & print_(const node_t &v)
Print v.
An inner node to name the subexpression.
Print as rich UTF-8 text, escaped.
An input/output format for valuesets.
const char * tuple_middle
Tuple tape separator.
const char * ldivide_
Left-quotient.
precedence_t precedence_(const node_t &v) const
The precedence of v (to decide when to print parens).
typename super_t::template unary_t< Type > unary_t
type_t
The possible types of expressions.
const char * compose_
Operator for composition: @.
std::ostream & incendl(std::ostream &o)
Increment the indentation, print an end of line, and set the indentation.
const char * lweight_
External product.
std::ostream & decendl(std::ostream &o)
Decrement the indentation, print an end of line, and set the indentation.
Implementation of nodes of tuple of rational expressions.
typename super_t::template variadic_t< Type > variadic_t
unsigned int exponent_threshold_
Number of consecutive identical letters that we decide to write using exponents.
Print as plain (ASCII) text, escaped.
bool is_letter_(const node_t &v) const
Whether v is an atom whose label is a letter.
An inner node implementing a weight.
const char * langle_
Left and right angle brackets for weights.
const char * tuple_right
Right tuple delimiter.
const char * conjunction_
std::string format(const Value &v, const std::string &format="default")
std::ostream & out_
Output stream.
std::ostream & operator<<(std::ostream &o, type_t t)
Print a expression type.
void print_(std::ostream &o, const T &arg, long)
Serialize arg into o.
Indentation relative functions.
void print_child(const node_t &child, precedence_t parent)
Print a child node, given its parent's precedence.
const char * tuple_left
Left tuple delimiter.
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
typename super_t::node_t node_t
Actual node, without indirection.