forked from boostorg/regex
Added BOOST_REGEX_V3 compatibilty workarounds.
[SVN r21288]
This commit is contained in:
@ -449,6 +449,10 @@ unsigned int RegEx::FindFiles(FindFilesCallback cb, const char* files, bool recu
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef BOOST_REGEX_V3
|
||||||
|
#define regex_replace regex_merge
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string RegEx::Merge(const std::string& in, const std::string& fmt,
|
std::string RegEx::Merge(const std::string& in, const std::string& fmt,
|
||||||
bool copy, match_flag_type flags)
|
bool copy, match_flag_type flags)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,9 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char
|
|||||||
if(f & REG_NOCOLLATE)
|
if(f & REG_NOCOLLATE)
|
||||||
{
|
{
|
||||||
flags |= regex::nocollate;
|
flags |= regex::nocollate;
|
||||||
|
#ifndef BOOST_REGEX_V3
|
||||||
flags &= ~regex::collate;
|
flags &= ~regex::collate;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(f & REG_NOSUB)
|
if(f & REG_NOSUB)
|
||||||
|
@ -60,6 +60,7 @@ namespace re_detail{
|
|||||||
//
|
//
|
||||||
BOOST_REGEX_DECL void BOOST_REGEX_CALL verify_options(boost::regex::flag_type /*ef*/, match_flag_type mf)
|
BOOST_REGEX_DECL void BOOST_REGEX_CALL verify_options(boost::regex::flag_type /*ef*/, match_flag_type mf)
|
||||||
{
|
{
|
||||||
|
#ifndef BOOST_REGEX_V3
|
||||||
//
|
//
|
||||||
// can't mix match_extra with POSIX matching rules:
|
// can't mix match_extra with POSIX matching rules:
|
||||||
//
|
//
|
||||||
@ -68,6 +69,7 @@ BOOST_REGEX_DECL void BOOST_REGEX_CALL verify_options(boost::regex::flag_type /*
|
|||||||
std::logic_error msg("Usage Error: Can't mix regular expression captures with POSIX matching rules");
|
std::logic_error msg("Usage Error: Can't mix regular expression captures with POSIX matching rules");
|
||||||
throw_exception(msg);
|
throw_exception(msg);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
|
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||||
|
@ -69,7 +69,9 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha
|
|||||||
if(f & REG_NOCOLLATE)
|
if(f & REG_NOCOLLATE)
|
||||||
{
|
{
|
||||||
flags |= wregex::nocollate;
|
flags |= wregex::nocollate;
|
||||||
|
#ifndef BOOST_REGEX_V3
|
||||||
flags &= ~wregex::collate;
|
flags &= ~wregex::collate;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(f & REG_NOSUB)
|
if(f & REG_NOSUB)
|
||||||
|
@ -29,6 +29,11 @@
|
|||||||
|
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
|
#ifdef BOOST_REGEX_V3
|
||||||
|
#define regex_constants regbase
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// start by defining all our flag types:
|
// start by defining all our flag types:
|
||||||
|
|
||||||
@ -63,9 +68,9 @@ flag_info flag_data[] = {
|
|||||||
{ BOOST_RE_STR("bk_vbar"), 7, regex_constants::bk_vbar, 2 },
|
{ BOOST_RE_STR("bk_vbar"), 7, regex_constants::bk_vbar, 2 },
|
||||||
{ BOOST_RE_STR("use_except"), 10, regex_constants::use_except, 2 },
|
{ BOOST_RE_STR("use_except"), 10, regex_constants::use_except, 2 },
|
||||||
{ BOOST_RE_STR("literal"), 7, regex_constants::literal, 2 },
|
{ BOOST_RE_STR("literal"), 7, regex_constants::literal, 2 },
|
||||||
|
#ifndef BOOST_REGEX_V3
|
||||||
{ BOOST_RE_STR("nosubs"), 6, regex_constants::nosubs, 2 },
|
{ BOOST_RE_STR("nosubs"), 6, regex_constants::nosubs, 2 },
|
||||||
{ BOOST_RE_STR("optimize"), 8, regex_constants::optimize, 2 },
|
{ BOOST_RE_STR("optimize"), 8, regex_constants::optimize, 2 },
|
||||||
#ifndef BOOST_REGEX_V3
|
|
||||||
{ BOOST_RE_STR("perlex"), 6, regex_constants::perlex, 2 },
|
{ BOOST_RE_STR("perlex"), 6, regex_constants::perlex, 2 },
|
||||||
#endif
|
#endif
|
||||||
{ BOOST_RE_STR("normal"), 6, regex_constants::normal, 2 },
|
{ BOOST_RE_STR("normal"), 6, regex_constants::normal, 2 },
|
||||||
@ -87,9 +92,10 @@ flag_info flag_data[] = {
|
|||||||
{ BOOST_RE_STR("match_not_null"), 14, match_not_null, 3 },
|
{ BOOST_RE_STR("match_not_null"), 14, match_not_null, 3 },
|
||||||
{ BOOST_RE_STR("match_continuous"), 16, match_continuous, 3 },
|
{ BOOST_RE_STR("match_continuous"), 16, match_continuous, 3 },
|
||||||
{ BOOST_RE_STR("match_partial"), 13, match_partial, 3 },
|
{ BOOST_RE_STR("match_partial"), 13, match_partial, 3 },
|
||||||
|
#ifndef BOOST_REGEX_V3
|
||||||
{ BOOST_RE_STR("match_nosubs"), 12, match_nosubs, 3 },
|
{ BOOST_RE_STR("match_nosubs"), 12, match_nosubs, 3 },
|
||||||
{ BOOST_RE_STR("match_single_line"), 17, match_single_line, 3 },
|
{ BOOST_RE_STR("match_single_line"), 17, match_single_line, 3 },
|
||||||
|
#endif
|
||||||
{ BOOST_RE_STR("format_all"), 10, format_all, 3 },
|
{ BOOST_RE_STR("format_all"), 10, format_all, 3 },
|
||||||
{ BOOST_RE_STR("format_sed"), 10, format_sed, 3 },
|
{ BOOST_RE_STR("format_sed"), 10, format_sed, 3 },
|
||||||
{ BOOST_RE_STR("format_perl"), 11, format_perl, 3 },
|
{ BOOST_RE_STR("format_perl"), 11, format_perl, 3 },
|
||||||
|
@ -434,12 +434,14 @@ void cpp_tests(const basic_regex<C, T, A>& e, bool recurse = true)
|
|||||||
begin_error();
|
begin_error();
|
||||||
cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const basic_regex&, int)" << endl;
|
cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const basic_regex&, int)" << endl;
|
||||||
}
|
}
|
||||||
|
#ifndef BOOST_REGEX_V3
|
||||||
if(!regex_search(s2, e, static_cast<boost::match_flag_type>(flags[3]))
|
if(!regex_search(s2, e, static_cast<boost::match_flag_type>(flags[3]))
|
||||||
|| !regex_search(s2.begin(), s2.end(), e, static_cast<boost::match_flag_type>(flags[3])))
|
|| !regex_search(s2.begin(), s2.end(), e, static_cast<boost::match_flag_type>(flags[3])))
|
||||||
{
|
{
|
||||||
begin_error();
|
begin_error();
|
||||||
cout << "regex++ API result mismatch in regex_search(const std::string&, const basic_regex&, int)" << endl;
|
cout << "regex++ API result mismatch in regex_search(const std::string&, const basic_regex&, int)" << endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
//
|
//
|
||||||
// partial match should give same result as full match
|
// partial match should give same result as full match
|
||||||
// provided a full match is expected:
|
// provided a full match is expected:
|
||||||
@ -476,11 +478,13 @@ void cpp_tests(const basic_regex<C, T, A>& e, bool recurse = true)
|
|||||||
begin_error();
|
begin_error();
|
||||||
cout << "regex++ API result mismatch in regex_search(const char_t*, match_results&, const basic_regex&, int)" << endl;
|
cout << "regex++ API result mismatch in regex_search(const char_t*, match_results&, const basic_regex&, int)" << endl;
|
||||||
}
|
}
|
||||||
|
#ifndef BOOST_REGEX_V3
|
||||||
if(!regex_search(search_text.c_str(), e, static_cast<boost::match_flag_type>(flags[3])))
|
if(!regex_search(search_text.c_str(), e, static_cast<boost::match_flag_type>(flags[3])))
|
||||||
{
|
{
|
||||||
begin_error();
|
begin_error();
|
||||||
cout << "regex++ API result mismatch in regex_search(const char_t*, const basic_regex&, int)" << endl;
|
cout << "regex++ API result mismatch in regex_search(const char_t*, const basic_regex&, int)" << endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((false == recurse) && (matches[0] == 0) && (matches[1] == static_cast<int>(search_text.size())))
|
if((false == recurse) && (matches[0] == 0) && (matches[1] == static_cast<int>(search_text.size())))
|
||||||
|
Reference in New Issue
Block a user