24 using word_t = std::vector<letter_t>;
28 static auto res =
symbol{
"string_letters"};
68 res.reserve(l.size() + 1);
69 res.insert(end(res), begin(l), end(l));
70 res.insert(end(res), r);
83 res.reserve(1 + r.size());
84 res.insert(end(res), l);
85 res.insert(end(res), begin(r), end(r));
100 res.reserve(l.size() + r.size());
101 res.insert(end(res), begin(l), end(l));
102 res.insert(end(res), begin(r), end(r));
120 return {begin(w) + 1, begin(w) + (s - 1)};
139 return {w.rbegin(), w.rend()};
181 return w.size() == 1;
213 raise(
sname(),
": get_letter: invalid end-of-file");
227 res = std::string{std::istreambuf_iterator<char>(i), {}};
240 o <<
"`\\mathit{" << l <<
"}\\textrm{'}";
246 if (l.get().size() == 1)
249 o <<
'\'' << l <<
'\'';
270 template <
typename T = letter_t>
277 string_letters::special<string_letters::letter_t>()
285 string_letters::special<string_letters::word_t>()
bool is_letter(const word_t &w) const
letter_t transpose(letter_t l) const
Represent alphabets whose "letters" are strings.
static letter_t special_letter()
The reserved letter used to forge the labels for initial and final transitions.
Print as rich UTF-8 text, escaped.
char get_char(std::istream &i)
Read a single char, with possible -escape support.
static word_t empty_word()
static letter_t one_letter()
The reserved letter used to forge the "one" label (the unit, the identity).
std::ostream & str_escape(std::ostream &os, const std::string &str, const char *special=nullptr)
Output a string, escaping special characters.
Print as is. For instance, don't try to escape labels.
word_t transpose(const word_t &w) const
weightset_mixin< detail::r_impl > r
An input/output format for valuesets.
Provide a variadic mul on top of a binary mul(), and one().
std::ostream & print(const word_t &w, std::ostream &o, const format &fmt={}) const
static bool is_empty_word(const word_t &w)
symbol letter_t
Internalize the letters to save trees.
const word_t & to_word(const word_t &l) const
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
Print as plain (ASCII) text, escaped.
static bool less(const word_t &l, const word_t &r)
Whether l < r.
std::vector< letter_t > word_t
word_t delimit(const word_t &w) const
Add the special character first and last.
static bool equal(const word_t &l, const word_t &r)
Whether l == r.
static T special()
Special character, used to label transitions from pre() and to post().
word_t mul(const word_t &l, const letter_t r) const
Print as a parsable type string.
static bool less(const letter_t l, const letter_t r)
Whether l < r.
word_t mul(const letter_t l, const letter_t r) const
std::ostream & print(const letter_t l, std::ostream &o, const format &fmt={}) const
word_t mul(const word_t &l, const word_t &r) const
word_t undelimit(const word_t &w) const
Remove first and last characters, that must be "special".
word_t mul(const letter_t l, const word_t &r) const
static letter_t get_letter(std::istream &i, bool quoted=true)
Read one letter from i.
bool is_letter(const letter_t) const
word_t to_word(const letter_t l) const
static bool equal(const letter_t l, const letter_t r)
Whether l == r.