8 #include <vcsn/misc/flyweight.hh>
23 = boost::flyweight<std::string, boost::flyweights::no_tracking>;
24 using word_t = std::vector<letter_t>;
28 return "string_letters";
31 virtual std::string
vname(
bool =
true)
const
72 res.reserve(l.size() + 1);
73 res.insert(end(res), begin(l), end(l));
74 res.insert(end(res), r);
87 res.reserve(1 + r.size());
88 res.insert(end(res), l);
89 res.insert(end(res), begin(r), end(r));
104 res.reserve(l.size() + r.size());
105 res.insert(end(res), begin(l), end(l));
106 res.insert(end(res), begin(r), end(r));
124 return {begin(w) + 1, begin(w) + (s - 1)};
143 return {w.rbegin(), w.rend()};
173 return w.size() == 1;
196 throw std::domain_error(
"invalid label: unexpected end-of-file");
197 else if (res ==
'\\')
201 throw std::domain_error(
"invalid label: unexpected end-of-file");
232 const std::string& format =
"text")
const
240 if (format ==
"latex")
243 if (format ==
"latex")
251 const std::string& format =
"text")
const
253 if (format ==
"latex")
257 if (format ==
"latex")
264 template <
typename T = letter_t>
271 string_letters::special<string_letters::letter_t>()
279 string_letters::special<string_letters::word_t>()
std::ostream & print(const letter_t &l, std::ostream &o, const std::string &format="text") const
virtual std::string vname(bool=true) const
static T special()
Special character, used to label transitions from pre() and to post().
const word_t & to_word(const word_t &l) const
boost::flyweight< std::string, boost::flyweights::no_tracking > letter_t
Internalize the letters to save trees.
word_t concat(const letter_t l, const word_t &r) const
std::ostream & print(const word_t &w, std::ostream &o, const std::string &format="text") const
word_t concat(const letter_t l, const letter_t r) const
bool equals(const word_t &w1, const word_t &w2) const
static char get_char(std::istream &i)
FIXME: coding duplication with char.hh. Move to misc?
static letter_t special_letter()
The reserved letter used to forge the labels for initial and final transitions.
bool equals(const letter_t &l1, const letter_t &l2) const
word_t concat(const word_t &l, const letter_t r) const
std::vector< letter_t > word_t
static word_t empty_word()
static letter_t get_letter(std::istream &i)
Read one letter from i.
word_t delimit(const word_t &w) const
Add the special character first and last.
word_t undelimit(const word_t &w) const
Remove first and last characters, that must be "special".
word_t concat(const word_t &l, const word_t &r) const
Provide a variadic mul on top of a binary mul(), and one().
word_t transpose(const word_t &w) const
letter_t transpose(letter_t l) const
bool is_letter(const letter_t &) const
bool is_letter(const word_t &w) const
static letter_t one_letter()
The reserved letter used to forge the "one" label (the unit, the identity).
word_t to_word(const letter_t l) const
static bool is_empty_word(const word_t &w)
variadic_mul_mixin< detail::r_impl > r
static std::string sname()
Represent alphabets whose "letters" are strings.