4 #include <initializer_list> 7 #include <boost/container/flat_set.hpp> 8 #include <boost/optional.hpp> 9 #include <boost/range/iterator_range_core.hpp> 10 #include <boost/version.hpp> 23 template <
typename Key,
typename Compare,
typename Allocator>
26 has(
const boost::container::flat_set<Key, Compare, Allocator>& s,
29 return s.find(e) != s.end();
42 = boost::container::flat_set<letter_t, vcsn::less<L, letter_t>>;
73 boost::optional<letter_t> prev;
78 raise(
sname(),
": make: invalid end-of-file");
101 prev = L::get_letter(is);
121 #if 105700 <= BOOST_VERSION 148 ": add_letter: the special letter is reserved: ",
156 template <
typename Letter,
typename Enable =
void>
159 template <
typename Letter>
161 decltype((++
std::declval<Letter&>(),
void()))>
169 return add_range_<letter_t>(l1, l2);
172 template <
typename Letter>
176 for (; L::less(l1, l2); ++l1)
181 if (L::equal(l1, l2))
186 template <
typename Letter>
188 -> std::enable_if_t<!has_range<Letter>{},
set_alphabet&>
190 raise(*
this,
": does not support letter ranges");
211 require(!i.bad(), *
this,
": conv: invalid stream");
213 if (i.good() && i.peek() ==
'\\')
235 && (c = i.peek()) != EOF
243 letter_t l = L::get_letter(i,
true);
247 res = this->mul(res, l);
252 using iterator =
typename letters_t::const_iterator;
284 return boost::make_iterator_range(
cbegin(),
cend());
312 const char *sep =
"";
316 if (! this->is_letter(l))
318 this->
print(l, o, fmt);
319 if (! this->is_letter(l))
324 o << sep <<
"\\ldots";
Print as a parsable type string.
ATTRIBUTE_PURE bool has(const boost::container::flat_set< Key, Compare, Allocator > &s, const Key &e)
Whether e is member of s.
std::ostream & print(const Aut &aut, std::ostream &out=std::cout, const std::string &fmt="default")
const_iterator cbegin() const
auto add_range_(Letter, Letter) -> std::enable_if_t<!has_range< Letter >
set_alphabet & add_letter(letter_t l)
Modify this by adding l, and return *this.
Whether the genset supports the range concept: whether we can use '++' on letters.
char eat(std::istream &is, char c)
Check lookahead character and advance.
auto add_range_(Letter l1, Letter l2) -> std::enable_if_t< has_range< Letter >
boost::container::flat_set< letter_t, vcsn::less< L, letter_t > > letters_t
auto generators() const
All the generators.
auto add_range(letter_t l1, letter_t l2) -> set_alphabet &
Add a range of letters, if it is accepted by the labelset.
typename L::word_t word_t
const_iterator find(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.
const_iterator cend() const
Print as rich UTF-8 text, escaped.
An input/output format for valuesets.
A set of letters of type L.
std::ostream & print_set(std::ostream &o, format fmt={}) const
const_iterator begin() const
set_alphabet &bool has(letter_t l) const
Whether l is a letter.
friend set_alphabet set_intersection(const set_alphabet &lhs, const set_alphabet &rhs)
Compute the intersection with another alphabet.
size_t size() const
Number of letters.
Print as plain (ASCII) text, escaped.
set_alphabet(std::initializer_list< letter_t > l)
word_t get_word(std::istream &i) const
Extract and return the next word from i.
void swap(config::value &first, config::value &second)
typename letters_t::const_iterator const_iterator
typename letters_t::const_iterator iterator
Print as is. For instance, don't try to escape labels.
static set_alphabet make(std::istream &is)
auto pregenerators() const
All the "pregenerators", including the empty word.
typename L::letter_t letter_t
void require(Bool b, Args &&... args)
If b is not verified, raise an error with args as message.
friend set_alphabet set_union(const set_alphabet &lhs, const set_alphabet &rhs)
Compute the union with another alphabet.
bool empty() const
Whether this alphabet has no letters.
#define VCSN_REQUIRE(Cond,...)
A macro similar to require.
set_alphabet(const letters_t &l)
letter_t value_type
The type of our values, when seen as a container.
const_iterator end() const
bool open(bool o) const
Whether unknown letters should be added, or rejected.