27 using word_t = std::vector<letter_t>;
31 static auto res =
symbol{
"string_letters"};
71 res.reserve(l.size() + 1);
72 res.insert(end(res), begin(l), end(l));
73 res.insert(end(res), r);
86 res.reserve(1 + r.size());
87 res.insert(end(res), l);
88 res.insert(end(res), begin(r), end(r));
103 res.reserve(l.size() + r.size());
104 res.insert(end(res), begin(l), end(l));
105 res.insert(end(res), begin(r), end(r));
123 return {begin(w) + 1, begin(w) + (s - 1)};
142 return {w.rbegin(), w.rend()};
154 return l.get().compare(r.get());
197 return w.size() == 1;
228 raise(
sname(),
": get_letter: invalid end-of-file");
242 res = std::string{std::istreambuf_iterator<char>(i), {}};
255 o <<
"`\\mathit{" << l <<
"}\\textrm{'}";
261 if (l.get().size() == 1)
264 o <<
'\'' << l <<
'\'';
285 template <
typename T = letter_t>
292 string_letters::special<string_letters::letter_t>()
300 string_letters::special<string_letters::word_t>()
Print as a parsable type string.
weightset_mixin< detail::r_impl > r
static int compare(const letter_t l, const letter_t r)
Three-way comparison between two letters.
int lexicographical_cmp(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp)
Lexicographical three-way comparison between two ranges.
static int compare(const word_t &l, const word_t &r)
Three-way comparison between two words.
word_t transpose(const word_t &w) const
char get_char(std::istream &i)
Read a single char, with possible -escape support.
static bool equal(const letter_t l, const letter_t r)
Whether l == r.
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
std::ostream & str_escape(std::ostream &os, const std::string &str, const char *special=nullptr)
Output a string, escaping special characters.
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
Represent alphabets whose "letters" are strings.
static T special()
Special character, used to label transitions from pre() and to post().
symbol letter_t
Internalize the letters to save trees.
std::ostream & print(const letter_t l, std::ostream &o, const format &fmt={}) const
static bool is_empty_word(const word_t &w)
Print as rich UTF-8 text, escaped.
An input/output format for valuesets.
Provide a variadic mul on top of a binary mul(), and one().
static bool less(const word_t &l, const word_t &r)
Whether l < r.
letter_t transpose(letter_t l) const
std::vector< letter_t > word_t
word_t delimit(const word_t &w) const
Add the special character first and last.
static bool less(const letter_t l, const letter_t r)
Whether l < r.
word_t mul(const word_t &l, const letter_t r) const
static bool equal(const word_t &l, const word_t &r)
Whether l == r.
word_t undelimit(const word_t &w) const
Remove first and last characters, that must be "special".
Print as plain (ASCII) text, escaped.
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
Print as is. For instance, don't try to escape labels.
word_t mul(const letter_t l, const letter_t r) const
static letter_t special_letter()
The reserved letter used to forge the labels for initial and final transitions.
word_t mul(const word_t &l, const word_t &r) const
Functor to three-way comparison Values of ValueSets.
bool is_letter(const letter_t) const
word_t mul(const letter_t l, const word_t &r) const
static word_t empty_word()
std::ostream & print(const word_t &w, std::ostream &o, const format &fmt={}) const
bool is_letter(const word_t &w) const