4 #include <initializer_list>
7 #include <boost/optional.hpp>
27 using letters_t = std::set<letter_t, vcsn::less<L, letter_t>>;
58 boost::optional<letter_t> prev;
63 raise(
sname(),
": make: invalid end-of-file");
71 if (prev == boost::none)
76 res.
add_range(prev.get(), L::get_letter(is));
84 if (prev != boost::none)
86 prev = L::get_letter(is);
91 if (prev != boost::none)
123 require(l != this->
template special<letter_t>(),
124 "add_letter: the special letter is reserved: ", l);
131 template <
typename Letter,
typename Enable =
void>
134 template <
typename Letter>
136 decltype((++
std::declval<Letter&>(),
void()))>
144 return add_range_<letter_t>(l1, l2);
147 template <
typename Letter>
151 for (; L::less(l1, l2); ++l1)
156 if (L::equal(l1, l2))
161 template <
typename Letter>
165 raise(
sname(),
": does not support letter ranges");
187 "conv: invalid stream");
189 if (i.good() && i.peek() ==
'\\')
207 && (c = i.peek()) != EOF
215 letter_t l = L::get_letter(i,
true);
220 res = this->mul(res, l);
225 using iterator =
typename letters_t::const_iterator;
259 const char *sep =
"";
263 if (! this->is_letter(l))
265 this->
print(l, o, fmt);
266 if (! this->is_letter(l))
271 o << sep <<
"\\ldots";
279 this->
print(l, o, fmt);
285 raise(
sname(),
": print_set: invalid format: ", fmt);
std::ostream & str_escape(std::ostream &os, const std::string &str)
Output a string, escaping special characters.
typename letters_t::const_iterator const_iterator
std::istringstream is
The input stream: the specification to translate.
typename L::word_t word_t
char eat(std::istream &is, char c)
Check lookahead character and advance.
typename L::letter_t letter_t
auto add_range_(Letter l1, Letter l2) -> enable_if_t< has_range< Letter >
typename std::enable_if< Cond, T >::type enable_if_t
bool open(bool o) const
Whether unknown letters should be added, or rejected.
friend set_alphabet get_union(const set_alphabet &lhs, const set_alphabet &rhs)
Compute the union with another alphabet.
A set of letters of type L.
set_alphabet(const letters_t &l)
auto add_range_(Letter, Letter) -> enable_if_t<!has_range< Letter >
const_iterator begin() const
set_alphabet &bool has(letter_t l) const
Whether l is a letter.
std::ostream & print(const Aut &aut, std::ostream &out, const std::string &format)
static set_alphabet make(std::istream &is)
auto add_range(letter_t l1, letter_t l2) -> set_alphabet &
Add a range of letters, if it is accepted by the labelset.
void require(bool b, Args &&...args)
If b is not verified, raise an error with args as message.
letter_t value_type
The type of our values, when seen as a container.
friend set_alphabet intersection(const set_alphabet &lhs, const set_alphabet &rhs)
Compute the intersection with another alphabet.
set_alphabet & add_letter(letter_t l)
Modify this by adding l, and return *this.
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
const_iterator find(letter_t l) const
const_iterator cend() const
typename letters_t::const_iterator iterator
word_t get_word(std::istream &i) const
Extract and return the next word from i.
set_alphabet(const std::initializer_list< letter_t > &l)
std::ostream & print_set(std::ostream &o, format fmt={}) const
ATTRIBUTE_PURE bool has(const std::deque< T, Allocator > &s, const T &e)
Whether e is member of s.
const_iterator cbegin() const
std::set< letter_t, vcsn::less< L, letter_t >> letters_t
const_iterator end() const
Whether the genset supports the range concept: whether we can use '++' on letters.