4 #include <initializer_list> 7 #include <boost/container/flat_set.hpp> 8 #include <boost/optional.hpp> 9 #include <boost/version.hpp> 22 template <
typename Key,
typename Compare,
typename Allocator>
25 has(
const boost::container::flat_set<Key, Compare, Allocator>& s,
28 return s.find(e) != s.end();
41 = boost::container::flat_set<letter_t, vcsn::less<L, letter_t>>;
72 boost::optional<letter_t> prev;
77 raise(
sname(),
": make: invalid end-of-file");
100 prev = L::get_letter(is);
117 #if 105700 <= BOOST_VERSION 142 ": add_letter: the special letter is reserved: ",
150 template <
typename Letter,
typename Enable =
void>
153 template <
typename Letter>
155 decltype((++
std::declval<Letter&>(),
void()))>
163 return add_range_<letter_t>(l1, l2);
166 template <
typename Letter>
170 for (; L::less(l1, l2); ++l1)
175 if (L::equal(l1, l2))
180 template <
typename Letter>
182 -> std::enable_if_t<!has_range<Letter>{},
set_alphabet&>
184 raise(*
this,
": does not support letter ranges");
205 require(!i.bad(), *
this,
": conv: invalid stream");
207 if (i.good() && i.peek() ==
'\\')
229 && (c = i.peek()) != EOF
237 letter_t l = L::get_letter(i,
true);
241 res = this->mul(res, l);
246 using iterator =
typename letters_t::const_iterator;
294 const char *sep =
"";
298 if (! this->is_letter(l))
300 this->
print(l, o, fmt);
301 if (! this->is_letter(l))
306 o << sep <<
"\\ldots";
Print as plain (ASCII) text, escaped.
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.
typename letters_t::const_iterator iterator
void swap(config::config_value &first, config::config_value &second)
boost::container::flat_set< letter_t, vcsn::less< L, letter_t > > letters_t
friend set_alphabet set_intersection(const set_alphabet &lhs, const set_alphabet &rhs)
Compute the intersection with another alphabet.
static set_alphabet make(std::istream &is)
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
set_alphabet &bool has(letter_t l) const
Whether l is a letter.
set_alphabet(std::initializer_list< letter_t > l)
typename letters_t::const_iterator const_iterator
size_t size() const
Number of letters.
Print as rich UTF-8 text, escaped.
const_iterator cend() const
set_alphabet & add_letter(letter_t l)
Modify this by adding l, and return *this.
typename L::letter_t letter_t
std::ostream & str_escape(std::ostream &os, const std::string &str, const char *special=nullptr)
Output a string, escaping special characters.
auto add_range_(Letter, Letter) -> std::enable_if_t<!has_range< Letter >
An input/output format for valuesets.
const_iterator end() const
Print as is. For instance, don't try to escape labels.
bool open(bool o) const
Whether unknown letters should be added, or rejected.
Whether the genset supports the range concept: whether we can use '++' on letters.
set_alphabet(const letters_t &l)
std::ostream & print(const Aut &aut, std::ostream &out=std::cout, const std::string &fmt="default")
typename L::word_t word_t
auto add_range_(Letter l1, Letter l2) -> std::enable_if_t< has_range< Letter >
auto add_range(letter_t l1, letter_t l2) -> set_alphabet &
Add a range of letters, if it is accepted by the labelset.
char eat(std::istream &is, char c)
Check lookahead character and advance.
std::ostream & print_set(std::ostream &o, format fmt={}) const
#define VCSN_REQUIRE(Cond,...)
A macro similar to require.
word_t get_word(std::istream &i) const
Extract and return the next word from i.
void require(Bool b, Args &&... args)
If b is not verified, raise an error with args as message.
const_iterator begin() const
letter_t value_type
The type of our values, when seen as a container.
const_iterator cbegin() const
bool empty() const
Whether this alphabet has no letters.
const_iterator find(letter_t l) const
friend set_alphabet set_union(const set_alphabet &lhs, const set_alphabet &rhs)
Compute the union with another alphabet.
A set of letters of type L.