1 #ifndef VCSN_CORE_RAT_PRINTER_HH
2 # define VCSN_CORE_RAT_PRINTER_HH
18 template <
typename RatExpSet>
20 :
public RatExpSet::const_visitor
26 using weight_t =
typename context_t::weightset_t::value_t;
27 using super_t =
typename ratexpset_t::const_visitor;
28 using node_t =
typename super_t::node_t;
29 using inner_t =
typename super_t::inner_t;
30 template <type_t Type>
32 template <type_t Type>
34 using leaf_t =
typename super_t::leaf_t;
38 const bool debug = !!getenv(
"VCSN_PARENS"));
55 # define DEFINE(Type) \
56 using Type ## _t = typename super_t::Type ## _t; \
57 virtual void visit(const Type ## _t& v)
79 return atom && !
ctx_.labelset()->is_letter(atom->value());
114 template <rat::exp::type_t Type>
115 void print_(
const unary_t<Type>& n,
const char* op);
118 template <rat::exp::type_t Type>
119 void print_(
const variadic_t<Type>& n,
const char* op);
173 #endif // !VCSN_CORE_RAT_PRINTER_HH
precedence_t
The possible node precedence levels, increasing.
const char * star_
The ratexp operators.
An inner node with multiple children.
const char * ldiv_
Quotient.
bool is_word_(const node_t &v) const
Whether is an atom whose label is not a letter.
typename super_t::inner_t inner_t
std::string format_
Output format.
const char * zero_
The constants.
typename super_t::template unary_t< Type > unary_t
boost::flyweight< std::string, boost::flyweights::no_tracking > symbol
An internalized string.
ATTRIBUTE_PURE bool shows_left_weight_(const node_t &n)
Whether the left weight shows.
typename super_t::atom_t atom_t
typename super_t::template variadic_t< Type > variadic_t
std::ostream & out_
Output stream.
typename context_t::weightset_t::value_t weight_t
void print_(const unary_t< Type > &n, const char *op)
Print a unary node.
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
void format(symbol format)
Set output format.
void print_child_(const node_t &child, const node_t &parent)
Print the given child node, also knowing its parent.
typename super_t::node_t node_t
precedence_t precedence_(const node_t &v) const
The precedence of v (to decide when to print parens).
const char * conjunction_
const char * transposition_
const char * lmul_
External product.
const char * lgroup_
Left and right boundaries (typically braces for LaTeX).
context_t_of< ratexpset_t > context_t
An inner node implementing a weight.
typename super_t::leaf_t leaf_t
const bool debug_
Whether to be overly verbose.
const char * langle_
Left and right angle brackets for weights.
const identities_t identities_
typename ratexpset_t::identities_t identities_t
printer(const ratexpset_t &rs, std::ostream &out, const bool debug=!!getenv("VCSN_PARENS"))
std::ostream & operator()(const node_t &v)
Entry point: print v.
const context_t & ctx_
Context to decode labels and weights.
const char * lparen_
Left and right parentheses.
typename ratexpset_t::const_visitor super_t
std::ostream & operator()(const std::shared_ptr< const node_t > &v)
Entry point: print v.