1 #ifndef WIBBLE_REGEXP_H
2 #define WIBBLE_REGEXP_H
25 #include <sys/types.h>
47 virtual const char*
type()
const throw () {
return "Regexp"; }
66 Regexp(
const std::string& expr,
int match_count = 0,
int flags = 0) throw (wibble::exception::
Regexp);
69 bool match(const std::
string& str,
int flags = 0) throw (wibble::exception::Regexp);
75 std::
string operator[](
int idx) throw (wibble::exception::OutOfRange);
77 size_t matchStart(
int idx) throw (wibble::exception::OutOfRange);
78 size_t matchEnd(
int idx) throw (wibble::exception::OutOfRange);
79 size_t matchLength(
int idx) throw (wibble::exception::OutOfRange);
85 ERegexp(
const std::string& expr,
int match_count = 0,
int flags = 0) throw (wibble::exception::Regexp)
86 : Regexp(expr, match_count, flags | REG_EXTENDED) {}
91 const std::string& str;
113 return tok.str.substr(beg,
end-beg);
117 return beg == ti.beg &&
end == ti.end;
121 return beg != ti.beg ||
end != ti.end;
125 Tokenizer(
const std::string& str,
const std::string&
re,
int flags)
126 : str(str), re(re, 1, flags) {}
183 return cur == ti.cur && next == ti.next;
187 return cur != ti.cur || next != ti.next;
195 : re(re, 1, flags) {}