![]()  | 
  
    Vcsn
    2.2a
    
   Be Rational 
   | 
 
Pretty-printer for rational expressions. More...
#include <fwd.hh>
Classes | |
| struct | visit_tuple | 
| struct | visit_tuple< false, Dummy > | 
Public Types | |
| using | expressionset_t = ExpSet | 
| using | super_t = typename expressionset_t::const_visitor | 
| using | self_t = printer | 
| using | context_t = context_t_of< expressionset_t > | 
| using | identities_t = typename expressionset_t::identities_t | 
| using | labelset_t = labelset_t_of< context_t > | 
| using | label_t = label_t_of< context_t > | 
| using | weight_t = weight_t_of< context_t > | 
| using | node_t = typename super_t::node_t | 
| Actual node, without indirection.  More... | |
| using | value_t = typename node_t::value_t | 
| A shared_ptr to node_t.  More... | |
| using | inner_t = typename super_t::inner_t | 
| template<type_t Type> | |
| using | unary_t = typename super_t::template unary_t< Type > | 
| template<type_t Type> | |
| using | variadic_t = typename super_t::template variadic_t< Type > | 
| using | leaf_t = typename super_t::leaf_t | 
Public Member Functions | |
| printer (const expressionset_t &rs, std::ostream &out) | |
| A printer.  More... | |
| void | format (format fmt) | 
| Set output format.  More... | |
| std::ostream & | operator() (const value_t &v) | 
| Entry point: print v.  More... | |
| void | print_child (const node_t &child, precedence_t parent) | 
| Print a child node, given its parent's precedence.  More... | |
| template<type_t Type> | |
| auto | print_ (const unary_t< Type > &v, const char *op) -> void | 
| template<type_t Type> | |
| auto | print_ (const variadic_t< Type > &n, const char *op) -> void | 
Static Public Member Functions | |
| static constexpr const char * | me () | 
| Name of this algorithm, for error messages.  More... | |
Private Types | |
| using | tuple_t = typename super_t::tuple_t | 
Private Member Functions | |
| std::ostream & | print_ (const node_t &v) | 
| Print v.  More... | |
| void | print_ (const weight_t &w) | 
| Print a weight.  More... | |
| VCSN_RAT_VISIT (atom, v) | |
| VCSN_RAT_VISIT (complement, v) | |
| VCSN_RAT_VISIT (conjunction, v) | |
| VCSN_RAT_VISIT (infiltration, v) | |
| VCSN_RAT_VISIT (ldiv, v) | |
| VCSN_RAT_VISIT (lweight, v) | |
| VCSN_RAT_VISIT (one, v) | |
| VCSN_RAT_VISIT (prod, v) | |
| VCSN_RAT_VISIT (rweight, v) | |
| VCSN_RAT_VISIT (shuffle, v) | |
| VCSN_RAT_VISIT (star, v) | |
| VCSN_RAT_VISIT (sum, v) | |
| VCSN_RAT_VISIT (transposition, v) | |
| VCSN_RAT_VISIT (zero, v) | |
| void | visit (const tuple_t &v, std::true_type) override | 
| bool | is_letter_ (const node_t &v) const | 
| Whether v is an atom whose label is a letter.  More... | |
| bool | is_word_ (const node_t &v) const | 
| Whether v is an atom whose label is not a letter.  More... | |
| bool | is_braced_ (const node_t &v) const | 
| Whether is naturally braced.  More... | |
| precedence_t | precedence_ (const node_t &v) const | 
| The precedence of v (to decide when to print parens).  More... | |
| void | print_child_ (const node_t &child, const node_t &parent) | 
| Print a child node, given its parent.  More... | |
| template<rat::exp::type_t Type> | |
| void | print_ (const unary_t< Type > &n, const char *op) | 
| Print a unary node.  More... | |
| template<rat::exp::type_t Type> | |
| void | print_ (const variadic_t< Type > &n, const char *op) | 
| Print an n-ary node.  More... | |
| ATTRIBUTE_PURE bool | shows_left_weight_ (const node_t &n) | 
| Whether the left weight shows.  More... | |
| template<typename Iterator > | |
| auto | letter_range (Iterator i, Iterator end) const -> boost::iterator_range< Iterator > | 
| Return the longest range of expressions that are letters, in strictly increasing order.  More... | |
| template<typename LS = labelset_t> | |
| auto | print_sum_ (const sum_t &v) -> std::enable_if_t< detail::has_generators_mem_fn< LS > | 
| Print a sum, when the labelset has a genset() function.  More... | |
| for (auto i=std::begin(v), end=std::end(v);i!=end;) | |
| template<typename LS = labelset_t> | |
| auto | print_sum_ (const sum_t &v) -> std::enable_if_t<!detail::has_generators_mem_fn< LS > | 
| Print a sum, when the labelset does not have a genset() function.  More... | |
Private Attributes | |
| void | |
| std::ostream & | out_ | 
| Output stream.  More... | |
| class format | fmt_ | 
| Output format.  More... | |
| const expressionset_t & | rs_ | 
| The expressionset.  More... | |
| const bool | debug_ = !!getenv("VCSN_PARENS") | 
| Whether to be overly verbose.  More... | |
| const char * | lgroup_ = nullptr | 
| Left and right boundaries (typically braces for LaTeX).  More... | |
| const char * | rgroup_ = nullptr | 
| const char * | langle_ = nullptr | 
| Left and right angle brackets for weights.  More... | |
| const char * | rangle_ = nullptr | 
| const char * | lparen_ = nullptr | 
| Left and right parentheses.  More... | |
| const char * | rparen_ = nullptr | 
| const char * | lexponent_ = nullptr | 
| Left and right braces for exponents.  More... | |
| const char * | rexponent_ = nullptr | 
| const char * | lmul_ = nullptr | 
| External product.  More... | |
| const char * | rmul_ = nullptr | 
| const char * | ldiv_ = nullptr | 
| Quotient.  More... | |
| const char * | star_ = nullptr | 
| The expression operators.  More... | |
| const char * | complement_ = nullptr | 
| const char * | transposition_ = nullptr | 
| const char * | conjunction_ = nullptr | 
| const char * | infiltration_ = nullptr | 
| const char * | shuffle_ = nullptr | 
| const char * | product_ = nullptr | 
| const char * | sum_ = nullptr | 
| const char * | tuple_left = nullptr | 
| Left tuple delimiter.  More... | |
| const char * | tuple_middle = nullptr | 
| Tuple tape separator.  More... | |
| const char * | tuple_right = nullptr | 
| Right tuple delimiter.  More... | |
| const char * | zero_ = nullptr | 
| The constants.  More... | |
| const char * | one_ = nullptr | 
| unsigned int | exponent_threshold_ = 0 | 
Pretty-printer for rational expressions.
| using vcsn::rat::printer< ExpSet >::context_t = context_t_of<expressionset_t> | 
Definition at line 72 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::expressionset_t = ExpSet | 
Definition at line 68 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::identities_t = typename expressionset_t::identities_t | 
Definition at line 73 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::inner_t = typename super_t::inner_t | 
Definition at line 82 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::label_t = label_t_of<context_t> | 
Definition at line 75 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::labelset_t = labelset_t_of<context_t> | 
Definition at line 74 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::leaf_t = typename super_t::leaf_t | 
Definition at line 87 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::node_t = typename super_t::node_t | 
Actual node, without indirection.
Definition at line 79 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::self_t = printer | 
Definition at line 70 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::super_t = typename expressionset_t::const_visitor | 
Definition at line 69 of file printer.hh.
      
  | 
  private | 
Definition at line 135 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::unary_t = typename super_t::template unary_t<Type> | 
Definition at line 84 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::value_t = typename node_t::value_t | 
A shared_ptr to node_t.
Definition at line 81 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::variadic_t = typename super_t::template variadic_t<Type> | 
Definition at line 86 of file printer.hh.
| using vcsn::rat::printer< ExpSet >::weight_t = weight_t_of<context_t> | 
Definition at line 76 of file printer.hh.
| vcsn::rat::printer< ExpSet >::printer | ( | const expressionset_t & | rs, | 
| std::ostream & | out | ||
| ) | 
A printer.
Definition at line 39 of file printer.hxx.
      
  | 
  inlineprivate | 
Definition at line 286 of file printer.hh.
References vcsn::rat::printer< ExpSet >::fmt_, vcsn::rat::printer< ExpSet >::letter_range(), vcsn::rat::printer< ExpSet >::out_, vcsn::rat::printer< ExpSet >::print_child_(), vcsn::detail::print_label_class(), vcsn::rat::printer< ExpSet >::rs_, vcsn::rat::printer< ExpSet >::sum_, and vcsn::detail::v.
| auto vcsn::rat::printer< ExpSet >::format | ( | format | fmt | ) | 
Set output format.
Definition at line 68 of file printer.hxx.
References vcsn::dyn::detail::conjunction_(), vcsn::dyn::detail::infiltration_(), vcsn::format::latex, vcsn::dyn::detail::shuffle_(), vcsn::format::text, and vcsn::format::utf8.
Referenced by vcsn::rat::dot_printer< ExpSet >::visit_tuple< bool, Dummy >::print_().
      
  | 
  inlineprivate | 
Whether is naturally braced.
This is the case of sums of letters printed as range: we want to print [a-z]*, not ([a-z])*. 
Definition at line 227 of file printer.hh.
References vcsn::rat::printer< ExpSet >::letter_range().
      
  | 
  inlineprivate | 
Whether v is an atom whose label is a letter.
Used to know if we can print a sum of expressions as a letter range.
Definition at line 195 of file printer.hh.
References vcsn::rat::printer< ExpSet >::rs_, vcsn::detail::v, and vcsn::rat::atom< Context >::value().
Referenced by vcsn::rat::printer< ExpSet >::letter_range().
      
  | 
  inlineprivate | 
Whether v is an atom whose label is not a letter.
Used to decide when to issues parens via precedence ("letter" and "word" have different precedence). Actually, this routine checks whether this node is a self-delimited atom. Letters are of course self-delimited, so we don't add parens to "a" in "a*". Tuples printed as labels are not, so we need to add parens to "a|x" in "(a|x)*".
Note that 1-tape tuple are self-delimited (well, if what they contain is self-delimited). But then visually there is no difference between a lal and a lat<lal>. I think there should be one, so let's keep it this way. Likewise for 0-tape tuples.
Definition at line 215 of file printer.hh.
References vcsn::rat::printer< ExpSet >::rs_, vcsn::detail::v, and vcsn::rat::atom< Context >::value().
      
  | 
  inlineprivate | 
Return the longest range of expressions that are letters, in strictly increasing order.
Definition at line 263 of file printer.hh.
References vcsn::detail::initial_sorted_range(), vcsn::rat::printer< ExpSet >::is_letter_(), and vcsn::rat::printer< ExpSet >::rs_.
Referenced by vcsn::rat::printer< ExpSet >::for(), and vcsn::rat::printer< ExpSet >::is_braced_().
      
  | 
  inlinestatic | 
Name of this algorithm, for error messages.
Definition at line 90 of file printer.hh.
      
  | 
  inline | 
Entry point: print v.
Definition at line 100 of file printer.hh.
References vcsn::rat::printer< ExpSet >::print_().
      
  | 
  private | 
The precedence of v (to decide when to print parens).
Definition at line 159 of file printer.hxx.
References CASE, vcsn::detail::v, and vcsn::rat::word.
      
  | 
  private | 
Print v.
Definition at line 51 of file printer.hxx.
References vcsn::address(), vcsn::decendl(), vcsn::incendl(), vcsn::format::latex, vcsn::print(), and vcsn::detail::v.
Referenced by vcsn::rat::printer< ExpSet >::operator()(), and vcsn::rat::printer< ExpSet >::VCSN_RAT_VISIT().
      
  | 
  inlineprivate | 
Print a weight.
Definition at line 115 of file printer.hh.
References vcsn::rat::printer< ExpSet >::fmt_, vcsn::format::for_weights(), vcsn::rat::printer< ExpSet >::out_, and vcsn::rat::printer< ExpSet >::rs_.
      
  | 
  private | 
Print a unary node.
      
  | 
  private | 
Print an n-ary node.
| auto vcsn::rat::printer< ExpSet >::print_ | ( | const unary_t< Type > & | v, | 
| const char * | op | ||
| ) | -> void | 
Definition at line 304 of file printer.hxx.
References vcsn::detail::v.
| auto vcsn::rat::printer< ExpSet >::print_ | ( | const variadic_t< Type > & | n, | 
| const char * | op | ||
| ) | -> void | 
Definition at line 314 of file printer.hxx.
| auto vcsn::rat::printer< ExpSet >::print_child | ( | const node_t & | child, | 
| precedence_t | parent | ||
| ) | 
Print a child node, given its parent's precedence.
Public function, to support tuples.
Definition at line 274 of file printer.hxx.
References vcsn::detail::print_(), and vcsn::rat::unary.
      
  | 
  private | 
Print a child node, given its parent.
Definition at line 295 of file printer.hxx.
Referenced by vcsn::rat::printer< ExpSet >::for().
      
  | 
  inlineprivate | 
Print a sum, when the labelset has a genset() function.
Definition at line 281 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::VCSN_RAT_VISIT().
      
  | 
  inlineprivate | 
Print a sum, when the labelset does not have a genset() function.
Definition at line 317 of file printer.hh.
      
  | 
  inlineprivate | 
Whether the left weight shows.
Definition at line 255 of file printer.hh.
References vcsn::rat::lweight.
      
  | 
  private | 
      
  | 
  inlineprivate | 
Definition at line 121 of file printer.hh.
References vcsn::rat::printer< ExpSet >::complement_, vcsn::rat::printer< ExpSet >::print_(), and vcsn::detail::v.
      
  | 
  inlineprivate | 
Definition at line 122 of file printer.hh.
References vcsn::rat::printer< ExpSet >::conjunction_, vcsn::rat::printer< ExpSet >::print_(), and vcsn::detail::v.
      
  | 
  inlineprivate | 
Definition at line 123 of file printer.hh.
References vcsn::rat::printer< ExpSet >::infiltration_, vcsn::rat::printer< ExpSet >::print_(), and vcsn::detail::v.
      
  | 
  inlineprivate | 
Definition at line 124 of file printer.hh.
References vcsn::rat::printer< ExpSet >::ldiv_, vcsn::rat::printer< ExpSet >::print_(), and vcsn::detail::v.
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  inlineprivate | 
Definition at line 129 of file printer.hh.
References vcsn::rat::printer< ExpSet >::print_(), vcsn::rat::printer< ExpSet >::shuffle_, and vcsn::detail::v.
      
  | 
  inlineprivate | 
Definition at line 130 of file printer.hh.
References vcsn::rat::printer< ExpSet >::print_(), vcsn::rat::printer< ExpSet >::star_, and vcsn::detail::v.
      
  | 
  inlineprivate | 
Definition at line 131 of file printer.hh.
References vcsn::rat::printer< ExpSet >::print_sum_(), and vcsn::detail::v.
      
  | 
  inlineprivate | 
Definition at line 132 of file printer.hh.
References vcsn::rat::printer< ExpSet >::print_(), vcsn::rat::printer< ExpSet >::transposition_, and vcsn::detail::v.
      
  | 
  private | 
      
  | 
  inlineoverrideprivate | 
Definition at line 185 of file printer.hh.
References vcsn::detail::v.
      
  | 
  private | 
Definition at line 354 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::VCSN_RAT_VISIT().
      
  | 
  private | 
Definition at line 356 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::VCSN_RAT_VISIT().
      
  | 
  private | 
Whether to be overly verbose.
Definition at line 330 of file printer.hh.
      
  | 
  private | 
Definition at line 372 of file printer.hh.
      
  | 
  private | 
Output format.
Definition at line 326 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::for(), vcsn::rat::printer< ExpSet >::print_(), and vcsn::rat::printer< ExpSet >::visit_tuple< bool, Dummy >::print_().
      
  | 
  private | 
Definition at line 357 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::VCSN_RAT_VISIT().
      
  | 
  private | 
Left and right angle brackets for weights.
Definition at line 339 of file printer.hh.
      
  | 
  private | 
Quotient.
Definition at line 351 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::VCSN_RAT_VISIT().
      
  | 
  private | 
Left and right braces for exponents.
Definition at line 345 of file printer.hh.
      
  | 
  private | 
Left and right boundaries (typically braces for LaTeX).
Used to group operand of unary operators, e.g. "a" -> "a", "a*" -> "{a}^{*}" and "a**" -> "{{a}^{*}}^{*}".
Definition at line 336 of file printer.hh.
      
  | 
  private | 
External product.
Definition at line 348 of file printer.hh.
      
  | 
  private | 
Left and right parentheses.
Definition at line 342 of file printer.hh.
      
  | 
  private | 
Definition at line 371 of file printer.hh.
      
  | 
  private | 
Output stream.
Definition at line 324 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::for(), vcsn::rat::printer< ExpSet >::visit_tuple< bool, Dummy >::operator()(), vcsn::rat::printer< ExpSet >::print_(), and vcsn::rat::printer< ExpSet >::visit_tuple< bool, Dummy >::print_().
      
  | 
  private | 
Definition at line 359 of file printer.hh.
      
  | 
  private | 
Definition at line 340 of file printer.hh.
      
  | 
  private | 
Definition at line 346 of file printer.hh.
      
  | 
  private | 
Definition at line 337 of file printer.hh.
      
  | 
  private | 
Definition at line 349 of file printer.hh.
      
  | 
  private | 
Definition at line 343 of file printer.hh.
      
  | 
  private | 
The expressionset.
Definition at line 328 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::for(), vcsn::rat::printer< ExpSet >::is_letter_(), vcsn::rat::printer< ExpSet >::is_word_(), vcsn::rat::printer< ExpSet >::letter_range(), vcsn::rat::printer< ExpSet >::print_(), and vcsn::rat::printer< ExpSet >::visit_tuple< bool, Dummy >::print_().
      
  | 
  private | 
Definition at line 358 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::VCSN_RAT_VISIT().
      
  | 
  private | 
The expression operators.
Definition at line 353 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::VCSN_RAT_VISIT().
      
  | 
  private | 
Definition at line 360 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::for().
      
  | 
  private | 
Definition at line 355 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::VCSN_RAT_VISIT().
      
  | 
  private | 
Left tuple delimiter.
Definition at line 363 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::visit_tuple< bool, Dummy >::operator()().
      
  | 
  private | 
Tuple tape separator.
Definition at line 365 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::visit_tuple< bool, Dummy >::print_().
      
  | 
  private | 
Right tuple delimiter.
Definition at line 367 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::visit_tuple< bool, Dummy >::operator()().
      
  | 
  private | 
Definition at line 283 of file printer.hh.
Referenced by vcsn::rat::printer< ExpSet >::visit_tuple< bool, Dummy >::print_().
      
  | 
  private | 
The constants.
Definition at line 370 of file printer.hh.