X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstrings%2Fregex.h;h=094a295cdb77bc230dd0c79254a4459f1567d945;hp=5b809ab3c363415382a66bbbcf855140a47c5329;hb=f24e7b96e76b63c9b9b8a6bce4c7a9db64276ea8;hpb=00e36d6bf092b98dfa413578d9af58d61cedbc13 diff --git a/source/strings/regex.h b/source/strings/regex.h index 5b809ab..094a295 100644 --- a/source/strings/regex.h +++ b/source/strings/regex.h @@ -1,11 +1,23 @@ #ifndef MSP_STRINGS_REGEX_H_ #define MSP_STRINGS_REGEX_H_ +#include #include #include "regmatch.h" namespace Msp { +class bad_regex: public std::logic_error +{ +public: + bad_regex(const std::string &, const std::string &, const std::string::const_iterator &); + virtual ~bad_regex() throw() { } + +private: + std::string make_where(const std::string &, const std::string::const_iterator &); +}; + + /** This class provides regular expression matching. It supports a subset of POSIX.2 extended regex syntax. Character classes, equivalence classes and @@ -91,7 +103,7 @@ private: struct RunContext { Code::const_iterator citer; - RegMatch::GroupArray groups; + std::vector groups; }; Code code; @@ -108,7 +120,7 @@ private: Code parse_atom(const std::string &, std::string::const_iterator &i, unsigned &); Code parse_brackets(const std::string &, std::string::const_iterator &); - bool parse_repeat(std::string::const_iterator &, Count &, Count &); + bool parse_repeat(const std::string &, std::string::const_iterator &, Count &, Count &); public: /** Matches the regex against a string. Refer to RegMatch documentation for @@ -116,7 +128,7 @@ public: RegMatch match(const std::string &str) const; private: - bool run(const std::string &, const std::string::const_iterator &, RegMatch::GroupArray &) const; + bool run(const std::string &, const std::string::const_iterator &, std::vector &) const; bool group_compare(const RegMatch::Group &, const RegMatch::Group &) const; public: