forked from boostorg/regex
Merge branch 'develop' into modules
Fixed Conflicts: include/boost/regex/v5/basic_regex.hpp include/boost/regex/v5/basic_regex_creator.hpp include/boost/regex/v5/c_regex_traits.hpp include/boost/regex/v5/mem_block_cache.hpp include/boost/regex/v5/regex_format.hpp include/boost/regex/v5/regex_iterator.hpp include/boost/regex/v5/regex_raw_buffer.hpp include/boost/regex/v5/regex_token_iterator.hpp
This commit is contained in:
+26
-18
@@ -1,13 +1,15 @@
|
||||
# copyright John Maddock 2003
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt.
|
||||
|
||||
project
|
||||
: requirements
|
||||
<threading>multi
|
||||
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
|
||||
<toolset>msvc-7.1:<define>TEST_MFC=1
|
||||
: requirements
|
||||
<library>/boost/regex//boost_regex
|
||||
<library>/boost/detail//boost_detail
|
||||
<threading>multi
|
||||
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
|
||||
<toolset>msvc-7.1:<define>TEST_MFC=1
|
||||
<toolset>msvc-7.0:<define>TEST_MFC=1
|
||||
# There are unidentified linker problems on these platforms:
|
||||
<toolset>mipspro-7.4:<link>static
|
||||
@@ -20,6 +22,8 @@ project
|
||||
#<toolset>gcc-mingw:<link>static
|
||||
#<toolset>gcc-cygwin:<link>static
|
||||
<toolset>sun:<link>static
|
||||
<include>../src
|
||||
<include>.
|
||||
;
|
||||
|
||||
#
|
||||
@@ -27,14 +31,14 @@ project
|
||||
#
|
||||
rule regex-test ( name : sources + : requirements * : input-files * )
|
||||
{
|
||||
return [ run $(sources) ../build//boost_regex
|
||||
return [ run $(sources) /boost/regex//boost_regex
|
||||
:
|
||||
: $(input-files)
|
||||
: $(requirements)
|
||||
: $(name) ] ;
|
||||
}
|
||||
|
||||
R_SOURCE =
|
||||
R_SOURCE =
|
||||
basic_tests.cpp
|
||||
main.cpp
|
||||
wmain.cpp
|
||||
@@ -69,7 +73,7 @@ run regress/$(R_SOURCE) ../build//boost_regex ../build//icu_options
|
||||
: regex_regress ;
|
||||
|
||||
run regress/$(R_SOURCE) ../build//boost_regex
|
||||
../../thread/build//boost_thread ../build//icu_options
|
||||
/boost/thread//boost_thread ../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
@@ -77,7 +81,7 @@ run regress/$(R_SOURCE) ../build//boost_regex
|
||||
: regex_regress_threaded ;
|
||||
|
||||
run regress/$(R_SOURCE) ../build//boost_regex
|
||||
../../thread/build//boost_thread ../build//icu_options
|
||||
/boost/thread//boost_thread ../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
@@ -97,15 +101,15 @@ run unicode/unicode_iterator_test.cpp : : : release <define>TEST_UTF16 : unicode
|
||||
run unicode/unicode_casefold_test.cpp ../build//boost_regex ../build//icu_options ;
|
||||
run object_cache/object_cache_test.cpp ;
|
||||
run config_info/regex_config_info.cpp ../build//boost_regex/<link>static : : : <test-info>always_show_run_output ;
|
||||
run config_info/regex_config_info.cpp ../build//boost_regex : : : <test-info>always_show_run_output : regex_dll_config_info ;
|
||||
run config_info/regex_config_info.cpp ../build//boost_regex : : : <test-info>always_show_run_output : regex_dll_config_info ;
|
||||
run collate_info/collate_info.cpp ../build//boost_regex : : : <test-info>always_show_run_output : test_collate_info ;
|
||||
link concepts/concept_check.cpp : <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
|
||||
link concepts/concept_check.cpp /boost/range//boost_range : <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
|
||||
link concepts/concept_check.cpp : <define>BOOST_REGEX_STANDALONE <toolset>gcc:<cxxflags>-Wno-deprecated-copy : standalone_concept_check ;
|
||||
link concepts/icu_concept_check.cpp : <define>BOOST_REGEX_STANDALONE <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
|
||||
link concepts/icu_concept_check.cpp : <toolset>gcc:<cxxflags>-Wno-deprecated-copy : standalone_icu_concept_check ;
|
||||
link concepts/range_concept_check.cpp : <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
|
||||
run concepts/test_bug_11988.cpp ;
|
||||
run captures/captures_test.cpp ../build//icu_options : : : <threading>multi <define>BOOST_REGEX_MATCH_EXTRA=1 <define>BOOST_REGEX_NO_LIB=1 : captures_test ;
|
||||
link concepts/range_concept_check.cpp : <toolset>gcc:<cxxflags>-Wno-deprecated-copy <library>/boost/range//boost_range ;
|
||||
run concepts/test_bug_11988.cpp ;
|
||||
run captures/captures_test.cpp ../build//icu_options /boost/array//boost_array : : : <threading>multi <define>BOOST_REGEX_MATCH_EXTRA=1 <define>BOOST_REGEX_NO_LIB=1 : captures_test ;
|
||||
run regress/$(R_SOURCE) ./noeh_test//boost_regex_noeh ../build//icu_options : : : <define>BOOST_NO_EXCEPTIONS=1 <exception-handling>off <link>static <runtime-link>shared : regex_regress_noeh ;
|
||||
compile test_consolidated.cpp ;
|
||||
|
||||
@@ -113,12 +117,12 @@ build-project ../example ;
|
||||
|
||||
# `quick` target (for CI)
|
||||
run quick.cpp ../build//boost_regex ;
|
||||
compile test_warnings.cpp
|
||||
compile test_warnings.cpp
|
||||
: <toolset>msvc:<warnings>all <toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings>all <toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings>all <toolset>clang:<warnings-as-errors>on ;
|
||||
|
||||
compile test_warnings.cpp
|
||||
compile test_warnings.cpp
|
||||
: <toolset>msvc:<warnings>all <toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings>all <toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings>all <toolset>clang:<warnings-as-errors>on
|
||||
@@ -130,4 +134,8 @@ compile test_windows_defs_2.cpp ;
|
||||
compile test_windows_defs_3.cpp ;
|
||||
compile test_windows_defs_4.cpp ;
|
||||
|
||||
run issue153.cpp : : : <toolset>msvc:<linkflags>-STACK:2097152 ;
|
||||
run issue153.cpp : : : "<toolset>msvc:<linkflags>-STACK:2097152" ;
|
||||
run issue227.cpp ;
|
||||
run issue232.cpp ;
|
||||
run lookbehind_recursion_stress_test.cpp ;
|
||||
|
||||
|
||||
@@ -15,4 +15,4 @@ target_link_libraries(quick Boost::regex Boost::core)
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
||||
@@ -20,4 +20,4 @@ target_link_libraries(quick Boost::regex Boost::core)
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
||||
@@ -19,4 +19,4 @@ target_link_libraries(quick_icu Boost::regex_icu)
|
||||
enable_testing()
|
||||
add_test(quick_icu quick_icu)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@
|
||||
#endif
|
||||
|
||||
#define main OLD_MAIN
|
||||
#include <libs/config/test/config_info.cpp>
|
||||
#include <config_info.cpp>
|
||||
#undef main
|
||||
#ifndef NEW_MAIN
|
||||
# define NEW_MAIN main
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2024
|
||||
* Christian Mazakas
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <string>
|
||||
|
||||
int main() {
|
||||
boost::regex rx("(*ACCEPT)*+\\1((*ACCEPT)*+\\K)");
|
||||
std::string str = "Z";
|
||||
boost::smatch what;
|
||||
boost::regex_search(str, what, rx, boost::match_default | boost::match_partial);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
template<std::size_t N0, std::size_t N = N0 - 1>
|
||||
void tester( char const (&str)[ N0 ] )
|
||||
{
|
||||
std::vector<char> s(N, '\0');
|
||||
std::memcpy(s.data(), str, N);
|
||||
boost::regex rx(s.begin(), s.end());
|
||||
|
||||
std::vector<std::string> wheres;
|
||||
wheres.push_back(std::string(15, 'H'));
|
||||
wheres.push_back("");
|
||||
wheres.push_back(" ");
|
||||
|
||||
// Perl-style matching
|
||||
for (auto const& where : wheres) {
|
||||
boost::match_results<std::string::const_iterator> what;
|
||||
bool match = boost::regex_match(where, what, rx, boost::match_default | boost::match_partial | boost::match_any | boost::match_perl);
|
||||
(void) match;
|
||||
}
|
||||
|
||||
// POSIX-style matching
|
||||
for (auto const& where : wheres) {
|
||||
try {
|
||||
boost::match_results<std::string::const_iterator> what;
|
||||
bool match = boost::regex_match(where, what, rx, boost::match_default | boost::match_partial | boost::match_any | boost::match_posix);
|
||||
(void) match;
|
||||
} catch(...) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// test strings derived from fuzzing
|
||||
// we keep a simple human-readable version
|
||||
char const str1[] = "(Y(*COMMIT)|\\K\\D|.)+";
|
||||
char const str2[] = "(Y(*COMMIT){||\\K\\D|||||||||\\K|||ss|||||.|\232*(?(50)\027\0204657|H)\020}\031\000.* 6.'?-i)+[L??.\000\000\000\004\000\000\000\000?..<[\000\024R]*+";
|
||||
char const str3[] = "(Y(*COMMIT)\xFF\x80|\\L\\K||||||||||.|||||\x84|||||\x00\x00\x10||||||.* .'?-i)[L??...-i)[L??...[\x00\x14R]*+";
|
||||
char const str4[] = "(Y(*COMMIT)\x96||.* .* .\\K|||\x9F||||\x9C|.|||||\x84\x99|||\x01\x00\x00\x00|||'?-i#PL\x00\x01.\x86??OMMIT)?...[\x00\x14R]*+";
|
||||
|
||||
tester(str1);
|
||||
tester(str2);
|
||||
tester(str3);
|
||||
tester(str4);
|
||||
|
||||
// prove that we catch certain impossible scenarios
|
||||
|
||||
{
|
||||
char const* str = "abcd";
|
||||
boost::regex rx(str);
|
||||
boost::match_results<std::string::const_iterator> what;
|
||||
std::string where(15, 'H');
|
||||
BOOST_TEST_THROWS(boost::regex_match(where, rx, boost::match_posix | boost::match_perl), std::logic_error);
|
||||
}
|
||||
|
||||
{
|
||||
char const* str = "ab(*COMMIT)cd";
|
||||
boost::regex rx(str);
|
||||
boost::match_results<std::string::const_iterator> what;
|
||||
std::string where(15, 'H');
|
||||
BOOST_TEST_THROWS(boost::regex_match(where, rx, boost::match_posix), std::logic_error);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2024
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string s("(?<=(");
|
||||
s.append(1000, '|');
|
||||
s += "))";
|
||||
boost::regex rx(s);
|
||||
|
||||
s = "(?<=(a";
|
||||
for (unsigned i = 0; i < 1000; ++i)
|
||||
{
|
||||
s += "|a";
|
||||
}
|
||||
s += "))";
|
||||
boost::regex rx2(s);
|
||||
}
|
||||
@@ -3,12 +3,12 @@
|
||||
* Copyright (c) 2011
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <libs/regex/src/posix_api.cpp>
|
||||
#include <libs/regex/src/wide_posix_api.cpp>
|
||||
#include <posix_api.cpp>
|
||||
#include <wide_posix_api.cpp>
|
||||
|
||||
Reference in New Issue
Block a user