1 #ifndef VCSN_LABELSET_GENSET_LABELSET_HH
2 # define VCSN_LABELSET_GENSET_LABELSET_HH
7 # include <boost/optional.hpp>
18 template <
typename GenSet>
25 using word_t =
typename genset_t::word_t;
46 std::string
vname(
bool full =
true)
const
48 return this->
genset().vname(full);
64 boost::optional<letter_t> previous;
65 std::set<letter_t> res;
66 while (i.peek() != EOF && i.peek() !=
']')
70 require(previous != boost::none,
71 "bracket cannot begin with '-'");
80 letter_t l2 = genset_t::get_letter(i);
83 for (
auto i = this->
genset().
find(previous.get());
91 previous = boost::none;
96 letter_t l = genset_t::get_letter(i);
108 # define DEFINE(Name, Attribute) \
109 template <typename... Args> \
112 Name(Args&&... args) const \
113 -> decltype(this->genset().Name(std::forward<Args>(args)...)) \
115 return this->genset().Name(std::forward<Args>(args)...); \
137 #endif // !VCSN_LABELSET_GENSET_LABELSET_HH
ATTRIBUTE_PURE auto transpose(Args &&...args) const -> decltype(this->genset().transpose(std::forward< Args >(args)...))
std::shared_ptr< const genset_t > genset_ptr
auto end(Args &&...args) const -> decltype(this->genset().end(std::forward< Args >(args)...))
auto undelimit(Args &&...args) const -> decltype(this->genset().undelimit(std::forward< Args >(args)...))
auto delimit(Args &&...args) const -> decltype(this->genset().delimit(std::forward< Args >(args)...))
auto begin(Args &&...args) const -> decltype(this->genset().begin(std::forward< Args >(args)...))
auto get_word(Args &&...args) const -> decltype(this->genset().get_word(std::forward< Args >(args)...))
std::set< letter_t > letters_t
typename genset_t::word_t word_t
std::ostream & str_escape(std::ostream &os, const std::string &str)
Output a string, escaping special characters.
This class has no modeling purpose, it only serves to factor code common to letterset, nullableset and wordset.
std::string vname(bool full=true) const
ATTRIBUTE_PURE auto is_letter(Args &&...args) const -> decltype(this->genset().is_letter(std::forward< Args >(args)...))
static std::string sname()
std::set< letter_t > convs_(std::istream &i) const
Read a range of letters.
ATTRIBUTE_PURE auto equals(Args &&...args) const -> decltype(this->genset().equals(std::forward< Args >(args)...))
ATTRIBUTE_PURE auto has(Args &&...args) const -> decltype(this->genset().has(std::forward< Args >(args)...))
char eat(std::istream &is, char c)
Check lookahead character and advance.
genset_labelset(const genset_ptr &gs)
genset_labelset(const genset_t &gs={})
typename genset_t::letter_t letter_t
#define DEFINE(Name, Attribute)
Use the implementation from genset.
const genset_t & genset() const
void require(bool b, Args &&...args)
If b is not verified, raise an error with args as message.
ATTRIBUTE_PURE auto find(const std::vector< T, Alloc > &s, const T &e) -> typename std::vector< T, Alloc >::const_iterator
Convenience wrapper around std::find.