25 using word_t = std::vector<letter_t>;
29 static auto res =
symbol{
"string_letters"};
69 res.reserve(l.size() + 1);
70 res.insert(end(res), begin(l), end(l));
71 res.insert(end(res), r);
84 res.reserve(1 + r.size());
85 res.insert(end(res), l);
86 res.insert(end(res), begin(r), end(r));
101 res.reserve(l.size() + r.size());
102 res.insert(end(res), begin(l), end(l));
103 res.insert(end(res), begin(r), end(r));
121 return {begin(w) + 1, begin(w) + (s - 1)};
140 return {w.rbegin(), w.rend()};
182 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>()
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
std::ostream & print(const letter_t l, std::ostream &o, const format &fmt={}) const
std::ostream & str_escape(std::ostream &os, const std::string &str, const char *special=nullptr)
Output a string, escaping special characters.
static letter_t get_letter(std::istream &i, bool quoted=true)
Read one letter from i.
word_t to_word(const letter_t l) const
static bool equal(const letter_t l, const letter_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
word_t delimit(const word_t &w) const
Add the special character first and last.
Print as a parsable type string.
char get_char(std::istream &i)
Read a single char, with possible -escape support.
symbol letter_t
Internalize the letters to save trees.
bool is_letter(const word_t &w) const
static bool equal(const word_t &l, const word_t &r)
Whether l == r.
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".
std::vector< letter_t > word_t
letter_t transpose(letter_t l) const
bool is_letter(const letter_t) const
An input/output format for valuesets.
static letter_t special_letter()
The reserved letter used to forge the labels for initial and final transitions.
static bool less(const letter_t l, const letter_t r)
Whether l < r.
word_t transpose(const word_t &w) const
Print as is. For instance, don't try to escape labels.
Represent alphabets whose "letters" are strings.
Print as rich UTF-8 text, escaped.
word_t mul(const letter_t l, const word_t &r) const
word_t mul(const letter_t l, const letter_t r) const
static bool less(const word_t &l, const word_t &r)
Whether l < r.
Provide a variadic mul on top of a binary mul(), and one().
Print as plain (ASCII) text, escaped.
static word_t empty_word()
static letter_t one_letter()
The reserved letter used to forge the "one" label (the unit, the identity).
const word_t & to_word(const word_t &l) const
static bool is_empty_word(const word_t &w)
weightset_mixin< detail::r_impl > r
std::ostream & print(const word_t &w, std::ostream &o, const format &fmt={}) const