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}{");
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 195 #define VISIT(Type) \ 196 DEFINE::visit(const Type ## _t& v) \ 229 rs_.labelset()->print(
v.value(),
out_,
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
258 std::function<void(int)>
print = [
this, &
print](
int n)
284 static bool force = !! getenv(
"VCSN_PARENS");
285 bool parent_has_precedence =
precedence_(child) <= parent;
288 || (parent_has_precedence
308 template <
typename ExpSet>
309 template <type_t Type>
318 template <
typename ExpSet>
319 template <type_t Type>
325 for (
const auto& i: n)
Print as plain (ASCII) text, escaped.
printer(const expressionset_t &rs, std::ostream &out)
A printer.
const char * compose_
Operator for composition: @.
unsigned address(const void *t)
Name pointers, to make them easier to read.
Indentation relative functions.
typename super_t::template variadic_t< Type > variadic_t
Implementation of nodes of tuple of rational expressions.
const char * meta() const
Characters that need to be escaped.
typename super_t::template unary_t< Type > unary_t
const char * conjunction_
static constexpr const char *const superscripts[]
Exponents in UTF-8.
std::ostream & decendl(std::ostream &o)
Decrement the indentation, print an end of line, and set the indentation.
const char * tuple_middle
Tuple tape separator.
const char * tuple_right
Right tuple delimiter.
std::ostream & out_
Output stream.
precedence_t precedence_(const node_t &v) const
The precedence of v (to decide when to print parens).
const char * tuple_left
Left tuple delimiter.
unsigned int exponent_threshold_
precedence_t
The possible node precedence levels, increasing.
typename super_t::node_t node_t
Actual node, without indirection.
const char * lgroup_
Left and right boundaries (typically braces for LaTeX).
const char * langle_
Left and right angle brackets for weights.
const char * transposition_
bool is_braced_(const node_t &v) const
Whether is naturally braced.
Print as rich UTF-8 text, escaped.
std::string format(const Value &v, const std::string &format="default")
bool is_word_(const node_t &v) const
Whether v is an atom whose label is not a letter.
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
const bool debug_
Whether to be overly verbose.
std::ostream & operator<<(std::ostream &o, type_t t)
Print a expression type.
format for_labels() const
A copy of this format, but to print labels.
const char * lexponent_
Left and right braces for exponents.
const char * ldivide_
Left-quotient.
const char * star_
The expression operators.
void print_child_(const node_t &child, const node_t &parent)
Print a child node, given its parent.
void print_(std::ostream &o, const T &arg, long)
Serialize arg into o.
An input/output format for valuesets.
const char * lparen_
Left and right parentheses.
const char * zero_
The constants.
void print_child(const node_t &child, precedence_t parent)
Print a child node, given its parent's precedence.
An inner node with multiple children.
An inner node implementing a weight.
std::ostream & print(const Aut &aut, std::ostream &out=std::cout, const std::string &fmt="default")
const expressionset_t & rs_
The expressionset.
std::ostream & print_(const node_t &v)
Print v.
const char * lweight_
External product.
class format fmt_
Output format.
bool is_letter_(const node_t &v) const
Whether v is an atom whose label is a letter.
type_t
The possible types of expressions.
std::ostream & incendl(std::ostream &o)
Increment the indentation, print an end of line, and set the indentation.