summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/regex
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/regex')
-rw-r--r--src/boost/libs/regex/README.md36
-rw-r--r--src/boost/libs/regex/build/Jamfile.v2158
-rw-r--r--src/boost/libs/regex/build/has_icu_test.cpp52
-rw-r--r--src/boost/libs/regex/example/Jamfile.v281
-rw-r--r--src/boost/libs/regex/example/grep/grep.cpp217
-rw-r--r--src/boost/libs/regex/example/snippets/captures_example.cpp68
-rw-r--r--src/boost/libs/regex/example/snippets/credit_card_example.cpp67
-rw-r--r--src/boost/libs/regex/example/snippets/icu_example.cpp188
-rw-r--r--src/boost/libs/regex/example/snippets/mfc_example.cpp162
-rw-r--r--src/boost/libs/regex/example/snippets/partial_regex_grep.cpp109
-rw-r--r--src/boost/libs/regex/example/snippets/partial_regex_iterate.cpp118
-rw-r--r--src/boost/libs/regex/example/snippets/partial_regex_match.cpp69
-rw-r--r--src/boost/libs/regex/example/snippets/regex_grep_example_1.cpp131
-rw-r--r--src/boost/libs/regex/example/snippets/regex_grep_example_2.cpp123
-rw-r--r--src/boost/libs/regex/example/snippets/regex_grep_example_3.cpp153
-rw-r--r--src/boost/libs/regex/example/snippets/regex_grep_example_4.cpp155
-rw-r--r--src/boost/libs/regex/example/snippets/regex_iterator_example.cpp114
-rw-r--r--src/boost/libs/regex/example/snippets/regex_match_example.cpp105
-rw-r--r--src/boost/libs/regex/example/snippets/regex_merge_example.cpp137
-rw-r--r--src/boost/libs/regex/example/snippets/regex_replace_example.cpp138
-rw-r--r--src/boost/libs/regex/example/snippets/regex_search_example.cpp129
-rw-r--r--src/boost/libs/regex/example/snippets/regex_split_example_1.cpp76
-rw-r--r--src/boost/libs/regex/example/snippets/regex_split_example_2.cpp86
-rw-r--r--src/boost/libs/regex/example/snippets/regex_token_iterator_eg_1.cpp72
-rw-r--r--src/boost/libs/regex/example/snippets/regex_token_iterator_eg_2.cpp89
-rw-r--r--src/boost/libs/regex/example/timer/bc55.mak51
-rw-r--r--src/boost/libs/regex/example/timer/bcb4.mak51
-rw-r--r--src/boost/libs/regex/example/timer/bcb5.mak51
-rw-r--r--src/boost/libs/regex/example/timer/gcc.mak38
-rw-r--r--src/boost/libs/regex/example/timer/input_script.txt14
-rw-r--r--src/boost/libs/regex/example/timer/regex_timer.cpp382
-rw-r--r--src/boost/libs/regex/example/timer/vc6-stlport.mak39
-rw-r--r--src/boost/libs/regex/example/timer/vc6.mak39
-rw-r--r--src/boost/libs/regex/index.html15
-rw-r--r--src/boost/libs/regex/meta/libraries.json17
-rw-r--r--src/boost/libs/regex/performance/Jamfile.v270
-rw-r--r--src/boost/libs/regex/performance/boost.cpp62
-rw-r--r--src/boost/libs/regex/performance/config/pcre.cpp17
-rw-r--r--src/boost/libs/regex/performance/config/posix.cpp15
-rw-r--r--src/boost/libs/regex/performance/config/re2.cpp12
-rw-r--r--src/boost/libs/regex/performance/pcre.cpp95
-rw-r--r--src/boost/libs/regex/performance/performance.cpp259
-rw-r--r--src/boost/libs/regex/performance/performance.hpp30
-rw-r--r--src/boost/libs/regex/performance/posix.cpp97
-rw-r--r--src/boost/libs/regex/performance/re2.cpp71
-rw-r--r--src/boost/libs/regex/performance/std.cpp73
-rw-r--r--src/boost/libs/regex/performance/table_helper.cpp420
-rw-r--r--src/boost/libs/regex/performance/third_party/readme.txt3
-rw-r--r--src/boost/libs/regex/performance/xpressive.cpp74
-rw-r--r--src/boost/libs/regex/readme.txt21
-rw-r--r--src/boost/libs/regex/src/c_regex_traits.cpp206
-rw-r--r--src/boost/libs/regex/src/cpp_regex_traits.cpp117
-rw-r--r--src/boost/libs/regex/src/cregex.cpp660
-rw-r--r--src/boost/libs/regex/src/fileiter.cpp928
-rw-r--r--src/boost/libs/regex/src/icu.cpp511
-rw-r--r--src/boost/libs/regex/src/instances.cpp32
-rw-r--r--src/boost/libs/regex/src/internals.hpp35
-rw-r--r--src/boost/libs/regex/src/posix_api.cpp295
-rw-r--r--src/boost/libs/regex/src/regex.cpp231
-rw-r--r--src/boost/libs/regex/src/regex_debug.cpp59
-rw-r--r--src/boost/libs/regex/src/regex_raw_buffer.cpp72
-rw-r--r--src/boost/libs/regex/src/regex_traits_defaults.cpp692
-rw-r--r--src/boost/libs/regex/src/static_mutex.cpp185
-rw-r--r--src/boost/libs/regex/src/usinstances.cpp81
-rw-r--r--src/boost/libs/regex/src/w32_regex_traits.cpp654
-rw-r--r--src/boost/libs/regex/src/wc_regex_traits.cpp314
-rw-r--r--src/boost/libs/regex/src/wide_posix_api.cpp312
-rw-r--r--src/boost/libs/regex/src/winstances.cpp35
-rw-r--r--src/boost/libs/regex/test/Jamfile.v2203
-rw-r--r--src/boost/libs/regex/test/c_compiler_checks/posix_api_check.c64
-rw-r--r--src/boost/libs/regex/test/c_compiler_checks/posix_api_check.cpp65
-rw-r--r--src/boost/libs/regex/test/c_compiler_checks/wide_posix_api_check.c89
-rw-r--r--src/boost/libs/regex/test/c_compiler_checks/wide_posix_api_check.cpp102
-rw-r--r--src/boost/libs/regex/test/captures/Jamfile.v238
-rw-r--r--src/boost/libs/regex/test/captures/captures_test.cpp177
-rw-r--r--src/boost/libs/regex/test/collate_info/collate_info.cpp255
-rw-r--r--src/boost/libs/regex/test/concepts/concept_check.cpp105
-rw-r--r--src/boost/libs/regex/test/concepts/icu_concept_check.cpp249
-rw-r--r--src/boost/libs/regex/test/concepts/range_concept_check.cpp41
-rw-r--r--src/boost/libs/regex/test/concepts/test_bug_11988.cpp115
-rw-r--r--src/boost/libs/regex/test/config_info/regex_config_info.cpp73
-rw-r--r--src/boost/libs/regex/test/de_fuzz/Jamfile.v237
-rw-r--r--src/boost/libs/regex/test/de_fuzz/dictionary.txt195
-rw-r--r--src/boost/libs/regex/test/de_fuzz/narrow.cpp20
-rw-r--r--src/boost/libs/regex/test/de_fuzz/wide.cpp21
-rw-r--r--src/boost/libs/regex/test/named_subexpressions/named_subexpressions_test.cpp112
-rw-r--r--src/boost/libs/regex/test/noeh_test/Jamfile.v250
-rw-r--r--src/boost/libs/regex/test/object_cache/object_cache_test.cpp77
-rw-r--r--src/boost/libs/regex/test/pathology/bad_expression_test.cpp60
-rw-r--r--src/boost/libs/regex/test/pathology/recursion_test.cpp65
-rw-r--r--src/boost/libs/regex/test/profile/Makefile16
-rw-r--r--src/boost/libs/regex/test/quick.cpp55
-rw-r--r--src/boost/libs/regex/test/regress/basic_tests.cpp212
-rw-r--r--src/boost/libs/regex/test/regress/bcb6.mak215
-rw-r--r--src/boost/libs/regex/test/regress/gcc.mak74
-rw-r--r--src/boost/libs/regex/test/regress/info.hpp268
-rw-r--r--src/boost/libs/regex/test/regress/main.cpp239
-rw-r--r--src/boost/libs/regex/test/regress/sunpro.mak145
-rw-r--r--src/boost/libs/regex/test/regress/test.hpp293
-rw-r--r--src/boost/libs/regex/test/regress/test_alt.cpp55
-rw-r--r--src/boost/libs/regex/test/regress/test_anchors.cpp67
-rw-r--r--src/boost/libs/regex/test/regress/test_asserts.cpp72
-rw-r--r--src/boost/libs/regex/test/regress/test_backrefs.cpp107
-rw-r--r--src/boost/libs/regex/test/regress/test_deprecated.cpp386
-rw-r--r--src/boost/libs/regex/test/regress/test_deprecated.hpp35
-rw-r--r--src/boost/libs/regex/test/regress/test_emacs.cpp166
-rw-r--r--src/boost/libs/regex/test/regress/test_escapes.cpp216
-rw-r--r--src/boost/libs/regex/test/regress/test_grep.cpp67
-rw-r--r--src/boost/libs/regex/test/regress/test_icu.cpp703
-rw-r--r--src/boost/libs/regex/test/regress/test_icu.hpp33
-rw-r--r--src/boost/libs/regex/test/regress/test_locale.cpp220
-rw-r--r--src/boost/libs/regex/test/regress/test_locale.hpp90
-rw-r--r--src/boost/libs/regex/test/regress/test_mfc.cpp551
-rw-r--r--src/boost/libs/regex/test/regress/test_mfc.hpp36
-rw-r--r--src/boost/libs/regex/test/regress/test_non_greedy_repeats.cpp45
-rw-r--r--src/boost/libs/regex/test/regress/test_not_regex.hpp127
-rw-r--r--src/boost/libs/regex/test/regress/test_operators.cpp178
-rw-r--r--src/boost/libs/regex/test/regress/test_overloads.cpp56
-rw-r--r--src/boost/libs/regex/test/regress/test_partial_match.hpp389
-rw-r--r--src/boost/libs/regex/test/regress/test_perl_ex.cpp1019
-rw-r--r--src/boost/libs/regex/test/regress/test_regex_replace.hpp80
-rw-r--r--src/boost/libs/regex/test/regress/test_regex_search.hpp554
-rw-r--r--src/boost/libs/regex/test/regress/test_replace.cpp198
-rw-r--r--src/boost/libs/regex/test/regress/test_sets.cpp406
-rw-r--r--src/boost/libs/regex/test/regress/test_simple_repeats.cpp500
-rw-r--r--src/boost/libs/regex/test/regress/test_tricky_cases.cpp450
-rw-r--r--src/boost/libs/regex/test/regress/test_unicode.cpp170
-rw-r--r--src/boost/libs/regex/test/regress/vc6-stlport.mak77
-rw-r--r--src/boost/libs/regex/test/regress/vc6.mak68
-rw-r--r--src/boost/libs/regex/test/regress/vc7.mak68
-rw-r--r--src/boost/libs/regex/test/regress/vc71.mak68
-rw-r--r--src/boost/libs/regex/test/regress/vc8.mak68
-rw-r--r--src/boost/libs/regex/test/static_mutex/static_mutex_test.cpp207
-rw-r--r--src/boost/libs/regex/test/test_consolidated.cpp29
-rw-r--r--src/boost/libs/regex/test/test_macros.hpp227
-rw-r--r--src/boost/libs/regex/test/test_warnings.cpp29
-rw-r--r--src/boost/libs/regex/test/unicode/unicode_iterator_test.cpp322
-rw-r--r--src/boost/libs/regex/tools/generate/tables.cpp217
138 files changed, 22354 insertions, 0 deletions
diff --git a/src/boost/libs/regex/README.md b/src/boost/libs/regex/README.md
new file mode 100644
index 000000000..2c03881d1
--- /dev/null
+++ b/src/boost/libs/regex/README.md
@@ -0,0 +1,36 @@
+Boost Regex Library
+============================
+
+The Boost Regex library provides regular expression support for C++, this library is the ancestor to std::regex and still goes beyond
+and offers some advantages to, the standard version.
+
+The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/regex/index.html).
+
+## Support, bugs and feature requests ##
+
+Bugs and feature requests can be reported through the [Gitub issue tracker](https://github.com/boostorg/regex/issues)
+(see [open issues](https://github.com/boostorg/regex/issues) and
+[closed issues](https://github.com/boostorg/regex/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed)).
+
+You can submit your changes through a [pull request](https://github.com/boostorg/regex/pulls).
+
+There is no mailing-list specific to Boost Regex, although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users) using the tag [regex].
+
+
+## Development ##
+
+Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)):
+
+ git clone https://github.com/boostorg/boost
+ cd boost
+ git submodule update --init
+
+The Boost Regex Library is located in `libs/regex/`.
+
+### Running tests ###
+First, make sure you are in `libs/regex/test`.
+You can either run all the tests listed in `Jamfile.v2` or run a single test:
+
+ ../../../b2 <- run all tests
+ ../../../b2 regex_regress <- single test
+
diff --git a/src/boost/libs/regex/build/Jamfile.v2 b/src/boost/libs/regex/build/Jamfile.v2
new file mode 100644
index 000000000..f54157283
--- /dev/null
+++ b/src/boost/libs/regex/build/Jamfile.v2
@@ -0,0 +1,158 @@
+# copyright John Maddock 2003
+# 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.
+
+import modules ;
+import testing ;
+import errors ;
+
+project : requirements
+ # default to all warnings on:
+ <warnings>all
+ ;
+
+local disable-icu = [ MATCH (--disable-icu) : [ modules.peek : ARGV ] ] ;
+
+rule path_options ( properties * )
+{
+ local result ;
+ if <address-model>64 in $(properties) && <toolset>msvc in $(properties)
+ {
+ result = <search>$(ICU_PATH)/bin64 <search>$(ICU_PATH)/lib64 ;
+ }
+ else
+ {
+ result = <search>$(ICU_PATH)/bin <search>$(ICU_PATH)/lib ;
+ }
+ return $(result) ;
+}
+
+#
+# ICU configuration:
+#
+if ! $(disable-icu)
+{
+ if [ modules.peek : ICU_LINK ]
+ {
+ errors.user-error : "The ICU_LINK option is no longer supported by the Boost.Regex build - please refer to the documentation for equivalent options" ;
+ }
+
+ if [ modules.peek : ICU_PATH ]
+ {
+ ICU_PATH = [ modules.peek : ICU_PATH ] ;
+ }
+ if [ modules.peek : ICU_ICUUC_NAME ]
+ {
+ ICU_ICUUC_NAME = [ modules.peek : ICU_ICUUC_NAME ] ;
+ }
+ if [ modules.peek : ICU_ICUDT_NAME ]
+ {
+ ICU_ICUDT_NAME = [ modules.peek : ICU_ICUDT_NAME ] ;
+ }
+ if [ modules.peek : ICU_ICUIN_NAME ]
+ {
+ ICU_ICUIN_NAME = [ modules.peek : ICU_ICUIN_NAME ] ;
+ }
+
+ if $(ICU_ICUUC_NAME)
+ {
+ lib icuuc : : <name>$(ICU_ICUUC_NAME) ;
+ }
+ else
+ {
+ lib icuuc : : <runtime-link>shared <conditional>@path_options ;
+ lib icuuc : : <toolset>msvc <variant>debug <name>icuucd <runtime-link>shared <conditional>@path_options ;
+ lib icuuc : : <toolset>intel <target-os>windows <variant>debug <name>icuucd <runtime-link>shared <conditional>@path_options ;
+ lib icuuc : : <name>sicuuc <runtime-link>static <conditional>@path_options ;
+ lib icuuc : : <toolset>msvc <variant>debug <name>sicuucd <runtime-link>static <conditional>@path_options ;
+ lib icuuc : : <toolset>intel <target-os>windows <variant>debug <name>sicuucd <runtime-link>static <conditional>@path_options ;
+ lib icuuc : : <name>this_is_an_invalid_library_name ;
+ }
+ if $(ICU_ICUDT_NAME)
+ {
+ lib icudt : : <name>$(ICU_ICUDT_NAME) ;
+ }
+ else
+ {
+ lib icudt : : <name>icudata <runtime-link>shared <conditional>@path_options ;
+ lib icudt : : <name>icudt <toolset>msvc <runtime-link>shared <conditional>@path_options ;
+ lib icudt : : <name>icudt <toolset>intel <target-os>windows <runtime-link>shared <conditional>@path_options ;
+ lib icudt : : <name>sicudata <runtime-link>static <conditional>@path_options ;
+ lib icudt : : <name>sicudt <toolset>msvc <runtime-link>static <conditional>@path_options ;
+ lib icudt : : <name>sicudt <toolset>intel <target-os>windows <runtime-link>static <conditional>@path_options ;
+ lib icudt : : <name>this_is_an_invalid_library_name ;
+ }
+ if $(ICU_ICUIN_NAME)
+ {
+ lib icuin : : <name>$(ICU_ICUIN_NAME) ;
+ }
+ else
+ {
+ lib icuin : : <name>icui18n <runtime-link>shared <conditional>@path_options ;
+ lib icuin : : <toolset>msvc <variant>debug <name>icuind <runtime-link>shared <conditional>@path_options ;
+ lib icuin : : <toolset>msvc <name>icuin <runtime-link>shared <conditional>@path_options ;
+ lib icuin : : <toolset>intel <target-os>windows <variant>debug <name>icuind <runtime-link>shared <conditional>@path_options ;
+ lib icuin : : <toolset>intel <target-os>windows <name>icuin <runtime-link>shared <conditional>@path_options ;
+ lib icuin : : <name>sicui18n <runtime-link>static <conditional>@path_options ;
+ lib icuin : : <toolset>msvc <variant>debug <name>sicuind <runtime-link>static <conditional>@path_options ;
+ lib icuin : : <toolset>msvc <name>sicuin <runtime-link>static <conditional>@path_options ;
+ lib icuin : : <toolset>intel <target-os>windows <variant>debug <name>sicuind <runtime-link>static <conditional>@path_options ;
+ lib icuin : : <toolset>intel <target-os>windows <name>sicuin <runtime-link>static <conditional>@path_options ;
+ lib icuin : : <name>this_is_an_invalid_library_name ;
+ }
+
+ ICU_OPTS =
+ <include>$(ICU_PATH)/include
+ <runtime-link>shared:<library>icuuc/<link>shared
+ <runtime-link>shared:<library>icudt/<link>shared
+ <runtime-link>shared:<library>icuin/<link>shared
+ <runtime-link>static:<library>icuuc
+ <runtime-link>static:<library>icudt
+ <runtime-link>static:<library>icuin
+ <define>BOOST_HAS_ICU=1
+ <runtime-link>static:<define>U_STATIC_IMPLEMENTATION=1
+ ;
+
+}
+
+unit-test has_icu : has_icu_test.cpp : $(ICU_OPTS) ;
+explicit has_icu ;
+
+alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ;
+
+SOURCES =
+ c_regex_traits.cpp
+ cpp_regex_traits.cpp
+ cregex.cpp
+ fileiter.cpp
+ icu.cpp
+ instances.cpp
+ posix_api.cpp
+ regex.cpp
+ regex_debug.cpp
+ regex_raw_buffer.cpp
+ regex_traits_defaults.cpp
+ static_mutex.cpp
+ w32_regex_traits.cpp
+ wc_regex_traits.cpp
+ wide_posix_api.cpp
+ winstances.cpp
+ usinstances.cpp ;
+
+
+lib boost_regex : ../src/$(SOURCES) icu_options
+ :
+ <link>shared:<define>BOOST_REGEX_DYN_LINK=1
+ <toolset>gcc-cygwin:<link>static
+ ;
+
+boost-install boost_regex ;
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/build/has_icu_test.cpp b/src/boost/libs/regex/build/has_icu_test.cpp
new file mode 100644
index 000000000..31c964e71
--- /dev/null
+++ b/src/boost/libs/regex/build/has_icu_test.cpp
@@ -0,0 +1,52 @@
+/*
+ *
+ * Copyright (c) 2010
+ * 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 <unicode/uversion.h>
+#include <unicode/utypes.h>
+#include <unicode/uchar.h>
+#include <unicode/coll.h>
+#include <boost/scoped_ptr.hpp>
+#include <iostream>
+#include <iomanip>
+
+#if defined(_MSC_VER) && !defined(_DLL)
+//#error "Mixing ICU with a static runtime doesn't work"
+#endif
+
+void print_error(UErrorCode err, const char* func)
+{
+ std::cerr << "Error from function " << func << " with error: " << ::u_errorName(err) << std::endl;
+}
+
+int main()
+{
+ // To detect possible binary mismatches between the installed ICU build, and whatever
+ // C++ std lib's we're using, we need to:
+ // * Make sure we call ICU C++ API's
+ // * Make sure we call std lib C++ API's as well (cout).
+ // * Be sure this program is run, not just built.
+ UErrorCode err = U_ZERO_ERROR;
+ UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, "GREEK SMALL LETTER ALPHA", &err);
+ std::cout << (int)c << std::endl;
+ if(err > 0)
+ {
+ print_error(err, "u_charFromName");
+ return err;
+ }
+ U_NAMESPACE_QUALIFIER Locale l;
+ boost::scoped_ptr<U_NAMESPACE_QUALIFIER Collator> p_col(U_NAMESPACE_QUALIFIER Collator::createInstance(l, err));
+ if(err > 0)
+ {
+ print_error(err, "Collator::createInstance");
+ return err;
+ }
+ return err > 0 ? err : 0;
+}
diff --git a/src/boost/libs/regex/example/Jamfile.v2 b/src/boost/libs/regex/example/Jamfile.v2
new file mode 100644
index 000000000..dd958c7da
--- /dev/null
+++ b/src/boost/libs/regex/example/Jamfile.v2
@@ -0,0 +1,81 @@
+# copyright John Maddock 2003
+# 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
+ # There are unidentified linker problems on these platforms:
+ <toolset>mipspro-7.4:<link>static
+ <toolset>sun-5.9:<link>static
+ <toolset>msvc:<warnings>all
+ <toolset>gcc:<warnings>all
+ <toolset>gcc:<cxxflags>-Wextra
+ <define>U_USING_ICU_NAMESPACE=0
+ #<toolset>gcc-mw:<link>static
+ #<toolset>gcc-mingw:<link>static
+ <toolset>gcc-cygwin:<link>static
+ ;
+
+rule regex-test-run ( sources + : input * : name * )
+{
+ return [
+ run
+ # sources
+ $(sources)
+ # dependencies
+ ../build//boost_regex
+ : # additional args
+ $(input)
+ : # test-files
+ : # requirements
+ <toolset>msvc-7.1:<define>TEST_MFC=1 <toolset>msvc-7.0:<define>TEST_MFC=1
+ : # test name
+ $(name)
+ ] ;
+}
+
+test-suite regex-examples :
+
+[ regex-test-run timer/regex_timer.cpp : $(BOOST_ROOT)/libs/regex/example/timer/input_script.txt ]
+[ regex-test-run grep/grep.cpp ../../program_options/build//boost_program_options/<link>static : -n -b $(BOOST_ROOT)/boost/regex.hpp $(BOOST_ROOT)/boost/type_traits.hpp : test_grep ]
+[ regex-test-run snippets/credit_card_example.cpp ]
+[ regex-test-run snippets/mfc_example.cpp ]
+[ regex-test-run snippets/icu_example.cpp ]
+[ regex-test-run snippets/partial_regex_grep.cpp : $(BOOST_ROOT)/libs/regex/index.htm ]
+[ regex-test-run snippets/partial_regex_iterate.cpp : $(BOOST_ROOT)/libs/regex/index.htm ]
+[ regex-test-run snippets/partial_regex_match.cpp : 1234-5678-8765-4 ]
+[ regex-test-run snippets/regex_grep_example_1.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
+[ regex-test-run snippets/regex_grep_example_2.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
+[ regex-test-run snippets/regex_grep_example_3.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
+[ regex-test-run snippets/regex_grep_example_4.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
+[ regex-test-run snippets/regex_match_example.cpp : -auto ]
+[ regex-test-run snippets/regex_merge_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
+[ regex-test-run snippets/regex_replace_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
+[ regex-test-run snippets/regex_search_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
+[ regex-test-run snippets/regex_split_example_1.cpp : -auto ]
+[ regex-test-run snippets/regex_split_example_2.cpp : $(BOOST_ROOT)/libs/regex/doc/html/index.html ]
+[ regex-test-run snippets/regex_token_iterator_eg_1.cpp : -auto ]
+[ regex-test-run snippets/regex_token_iterator_eg_2.cpp : $(BOOST_ROOT)/libs/regex/doc/html/index.html ]
+[ regex-test-run snippets/regex_iterator_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
+[ run snippets/captures_example.cpp
+ ../test/captures//boost_regex_extra
+ : : : <threading>multi <define>BOOST_REGEX_MATCH_EXTRA=1 ]
+
+;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/grep/grep.cpp b/src/boost/libs/regex/example/grep/grep.cpp
new file mode 100644
index 000000000..5c212ea68
--- /dev/null
+++ b/src/boost/libs/regex/example/grep/grep.cpp
@@ -0,0 +1,217 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4512 4244)
+#endif
+
+#include <boost/program_options.hpp>
+
+namespace po = boost::program_options;
+
+int after_context;
+int before_context;
+bool print_byte_offset;
+bool count_only;
+std::string pattern;
+bool print_non_matching_files;
+bool files_only;
+bool print_line_numbers;
+
+boost::regex_constants::syntax_option_type flags = boost::regex_constants::basic;
+boost::regex re;
+boost::smatch what;
+std::string current_file;
+int file_count;
+
+void process_stream(std::istream& is)
+{
+ std::string line;
+ int match_found = 0;
+ int linenum = 1;
+ while(std::getline(is, line))
+ {
+ bool result = boost::regex_search(line, what, re);
+ if(result)
+ {
+ if(print_non_matching_files)
+ return;
+ if(files_only)
+ {
+ std::cout << current_file << std::endl;
+ return;
+ }
+ if(!match_found && !count_only && (file_count > 1))
+ {
+ std::cout << current_file << ":\n";
+ }
+ ++match_found;
+ if(!count_only)
+ {
+ if(print_line_numbers)
+ {
+ std::cout << linenum << ":";
+ }
+ if(print_byte_offset)
+ {
+ std::cout << what.position() << ":";
+ }
+ std::cout << what[0] << std::endl;
+ }
+ }
+ ++linenum;
+ }
+ if(count_only && match_found)
+ {
+ std::cout << match_found << " matches found in file " << current_file << std::endl;
+ }
+ else if(print_non_matching_files && !match_found)
+ {
+ std::cout << current_file << std::endl;
+ }
+}
+
+void process_file(const std::string& name)
+{
+ current_file = name;
+ std::ifstream is(name.c_str());
+ if(is.bad())
+ {
+ std::cerr << "Unable to open file " << name << std::endl;
+ }
+ process_stream(is);
+}
+
+int main(int argc, char * argv[])
+{
+ try{
+ po::options_description opts("Options");
+ opts.add_options()
+ ("help,h", "produce help message")
+ //("after-context,A", po::value<int>(&after_context)->default_value(0), "Print arg lines of trailing context after matching lines. Places a line containing -- between contiguous groups of matches.")
+ //("before-context,B", po::value<int>(&before_context)->default_value(0), "Print arg lines of leading context before matching lines. Places a line containing -- between contiguous groups of matches.")
+ //("context,C", po::value<int>(), "Print arg lines of output context. Places a line containing -- between contiguous groups of matches.")
+ ("byte-offset,b", "Print the byte offset within the input file before each line of output.")
+ ("count,c", "Suppress normal output; instead print a count of matching lines for each input file. With the -v, --invert-match option (see below), count non-matching lines.")
+ ("extended-regexp,E", "Interpret PATTERN as an POSIX-extended regular expression.")
+ ("perl-regexp,P", "Interpret PATTERN as a Perl regular expression.")
+ //("regexp,e", po::value<std::string>(&pattern), "Use PATTERN as the pattern; useful to protect patterns beginning with -.")
+ ("basic-regexp,G", "Interpret arg as a POSIX-basic regular expression (see below). This is the default.")
+ ("ignore-case,i", "Ignore case distinctions in both the PATTERN and the input files.")
+ ("files-without-match,L", "Suppress normal output; instead print the name of each input file from which no output would normally have been printed. The scanning will stop on the first match.")
+ ("files-with-matches,l", "Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match.")
+ ("line-number,n", "Prefix each line of output with the line number within its input file.")
+ ;
+ // Hidden options, will be allowed both on command line and
+ // in config file, but will not be shown to the user.
+ po::options_description hidden("Hidden options");
+ hidden.add_options()
+ ("input-file", po::value< std::vector<std::string> >(), "input file")
+ ("input-pattern", po::value< std::string >(), "input file")
+ ;
+
+ po::options_description cmdline_options;
+ cmdline_options.add(opts).add(hidden);
+
+ po::positional_options_description p;
+ p.add("input-pattern", 1);
+ p.add("input-file", -1);
+
+ po::variables_map vm;
+ po::store(po::command_line_parser(argc, argv).options(cmdline_options)/*.options(hidden)*/.positional(p).run(), vm);
+ po::notify(vm);
+
+ if (vm.count("help"))
+ {
+ std::cout << opts << "\n";
+ return 0;
+ }
+ if (vm.count("context"))
+ {
+ after_context = vm["context"].as< int >();
+ before_context = after_context;
+ }
+ if(vm.count("extended-regexp"))
+ {
+ flags = boost::regex_constants::extended;
+ }
+ if(vm.count("basic-regexp"))
+ {
+ flags = boost::regex_constants::basic;
+ }
+ if(vm.count("perl-regexp"))
+ {
+ flags = boost::regex_constants::perl;
+ }
+ if(vm.count("ignore-case"))
+ {
+ flags |= boost::regex_constants::icase;
+ }
+ if(vm.count("byte-offset"))
+ {
+ print_byte_offset = true;
+ }
+ if(vm.count("count"))
+ {
+ count_only = true;
+ }
+ if(vm.count("files-without-match"))
+ {
+ print_non_matching_files = true;
+ }
+ if(vm.count("files-with-matches"))
+ {
+ files_only = true;
+ }
+ if(vm.count("line-number"))
+ {
+ print_line_numbers = true;
+ }
+ if(vm.count("input-pattern"))
+ {
+ pattern = vm["input-pattern"].as< std::string >();
+ re.assign(pattern, flags);
+ }
+ else
+ {
+ std::cerr << "No pattern specified" << std::endl;
+ return 1;
+ }
+ if (vm.count("input-file"))
+ {
+ const std::vector<std::string>& files = vm["input-file"].as< std::vector<std::string> >();
+ file_count = files.size();
+ for(std::vector<std::string>::const_iterator i = files.begin(); i != files.end(); ++i)
+ {
+ process_file(*i);
+ }
+ }
+ else
+ {
+ // no input files, scan stdin instead:
+ process_stream(std::cin);
+ }
+
+ }
+ catch(const std::exception& e)
+ {
+ std::cerr << e.what() << std::endl;
+ }
+
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/example/snippets/captures_example.cpp b/src/boost/libs/regex/example/snippets/captures_example.cpp
new file mode 100644
index 000000000..d1ff1e9f8
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/captures_example.cpp
@@ -0,0 +1,68 @@
+/*
+ *
+ * Copyright (c) 2003-2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE captures_example.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Demonstrate the behaviour of captures.
+ */
+
+#include <boost/regex.hpp>
+#include <iostream>
+
+
+void print_captures(const std::string& regx, const std::string& text)
+{
+ boost::regex e(regx);
+ boost::smatch what;
+ std::cout << "Expression: \"" << regx << "\"\n";
+ std::cout << "Text: \"" << text << "\"\n";
+ if(boost::regex_match(text, what, e, boost::match_extra))
+ {
+ unsigned i, j;
+ std::cout << "** Match found **\n Sub-Expressions:\n";
+ for(i = 0; i < what.size(); ++i)
+ std::cout << " $" << i << " = \"" << what[i] << "\"\n";
+ std::cout << " Captures:\n";
+ for(i = 0; i < what.size(); ++i)
+ {
+ std::cout << " $" << i << " = {";
+ for(j = 0; j < what.captures(i).size(); ++j)
+ {
+ if(j)
+ std::cout << ", ";
+ else
+ std::cout << " ";
+ std::cout << "\"" << what.captures(i)[j] << "\"";
+ }
+ std::cout << " }\n";
+ }
+ }
+ else
+ {
+ std::cout << "** No Match found **\n";
+ }
+}
+
+int main(int , char* [])
+{
+ print_captures("(([[:lower:]]+)|([[:upper:]]+))+", "aBBcccDDDDDeeeeeeee");
+ print_captures("a(b+|((c)*))+d", "abd");
+ print_captures("(.*)bar|(.*)bah", "abcbar");
+ print_captures("(.*)bar|(.*)bah", "abcbah");
+ print_captures("^(?:(\\w+)|(?>\\W+))*$", "now is the time for all good men to come to the aid of the party");
+ print_captures("^(?>(\\w+)\\W*)*$", "now is the time for all good men to come to the aid of the party");
+ print_captures("^(\\w+)\\W+(?>(\\w+)\\W+)*(\\w+)$", "now is the time for all good men to come to the aid of the party");
+ print_captures("^(\\w+)\\W+(?>(\\w+)\\W+(?:(\\w+)\\W+){0,2})*(\\w+)$", "now is the time for all good men to come to the aid of the party");
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/example/snippets/credit_card_example.cpp b/src/boost/libs/regex/example/snippets/credit_card_example.cpp
new file mode 100644
index 000000000..1620d8cca
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/credit_card_example.cpp
@@ -0,0 +1,67 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE credit_card_example.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Credit card number formatting code.
+ */
+
+#include <boost/regex.hpp>
+#include <string>
+
+bool validate_card_format(const std::string& s)
+{
+ static const boost::regex e("(\\d{4}[- ]){3}\\d{4}");
+ return boost::regex_match(s, e);
+}
+
+const boost::regex e("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z");
+const std::string machine_format("\\1\\2\\3\\4");
+const std::string human_format("\\1-\\2-\\3-\\4");
+
+std::string machine_readable_card_number(const std::string& s)
+{
+ return boost::regex_replace(s, e, machine_format, boost::match_default | boost::format_sed);
+}
+
+std::string human_readable_card_number(const std::string& s)
+{
+ return boost::regex_replace(s, e, human_format, boost::match_default | boost::format_sed);
+}
+
+#include <iostream>
+using namespace std;
+
+int main()
+{
+ string s[4] = { "0000111122223333", "0000 1111 2222 3333",
+ "0000-1111-2222-3333", "000-1111-2222-3333", };
+ int i;
+ for(i = 0; i < 4; ++i)
+ {
+ cout << "validate_card_format(\"" << s[i] << "\") returned " << validate_card_format(s[i]) << endl;
+ }
+ for(i = 0; i < 4; ++i)
+ {
+ cout << "machine_readable_card_number(\"" << s[i] << "\") returned " << machine_readable_card_number(s[i]) << endl;
+ }
+ for(i = 0; i < 4; ++i)
+ {
+ cout << "human_readable_card_number(\"" << s[i] << "\") returned " << human_readable_card_number(s[i]) << endl;
+ }
+ return 0;
+}
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/icu_example.cpp b/src/boost/libs/regex/example/snippets/icu_example.cpp
new file mode 100644
index 000000000..6d1fc3bec
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/icu_example.cpp
@@ -0,0 +1,188 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE mfc_example.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: examples of using Boost.Regex with MFC and ATL string types.
+ */
+
+#include <boost/regex/config.hpp>
+
+#ifdef BOOST_HAS_ICU
+
+#include <boost/regex/icu.hpp>
+#include <iostream>
+#include <assert.h>
+
+//
+// Find out if *password* meets our password requirements,
+// as defined by the regular expression *requirements*.
+//
+bool is_valid_password(const U_NAMESPACE_QUALIFIER UnicodeString& password, const U_NAMESPACE_QUALIFIER UnicodeString& requirements)
+{
+ return boost::u32regex_match(password, boost::make_u32regex(requirements));
+}
+
+//
+// Extract filename part of a path from a UTF-8 encoded std::string and return the result
+// as another std::string:
+//
+std::string get_filename(const std::string& path)
+{
+ boost::u32regex r = boost::make_u32regex("(?:\\A|.*\\\\)([^\\\\]+)");
+ boost::smatch what;
+ if(boost::u32regex_match(path, what, r))
+ {
+ // extract $1 as a std::string:
+ return what.str(1);
+ }
+ else
+ {
+ throw std::runtime_error("Invalid pathname");
+ }
+}
+
+U_NAMESPACE_QUALIFIER UnicodeString extract_greek(const U_NAMESPACE_QUALIFIER UnicodeString& text)
+{
+ // searches through some UTF-16 encoded text for a block encoded in Greek,
+ // this expression is imperfect, but the best we can do for now - searching
+ // for specific scripts is actually pretty hard to do right.
+ boost::u32regex r = boost::make_u32regex(L"[\\x{370}-\\x{3FF}](?:[^[:L*:]]|[\\x{370}-\\x{3FF}])*");
+ boost::u16match what;
+ if(boost::u32regex_search(text, what, r))
+ {
+ // extract $0 as a UnicodeString:
+ return U_NAMESPACE_QUALIFIER UnicodeString(what[0].first, what.length(0));
+ }
+ else
+ {
+ throw std::runtime_error("No Greek found!");
+ }
+}
+
+void enumerate_currencies(const std::string& text)
+{
+ // enumerate and print all the currency symbols, along
+ // with any associated numeric values:
+ const char* re =
+ "([[:Sc:]][[:Cf:][:Cc:][:Z*:]]*)?"
+ "([[:Nd:]]+(?:[[:Po:]][[:Nd:]]+)?)?"
+ "(?(1)"
+ "|(?(2)"
+ "[[:Cf:][:Cc:][:Z*:]]*"
+ ")"
+ "[[:Sc:]]"
+ ")";
+ boost::u32regex r = boost::make_u32regex(re);
+ boost::u32regex_iterator<std::string::const_iterator> i(boost::make_u32regex_iterator(text, r)), j;
+ while(i != j)
+ {
+ std::cout << (*i)[0] << std::endl;
+ ++i;
+ }
+}
+
+void enumerate_currencies2(const std::string& text)
+{
+ // enumerate and print all the currency symbols, along
+ // with any associated numeric values:
+ const char* re =
+ "([[:Sc:]][[:Cf:][:Cc:][:Z*:]]*)?"
+ "([[:Nd:]]+(?:[[:Po:]][[:Nd:]]+)?)?"
+ "(?(1)"
+ "|(?(2)"
+ "[[:Cf:][:Cc:][:Z*:]]*"
+ ")"
+ "[[:Sc:]]"
+ ")";
+ boost::u32regex r = boost::make_u32regex(re);
+ boost::u32regex_token_iterator<std::string::const_iterator>
+ i(boost::make_u32regex_token_iterator(text, r, 1)), j;
+ while(i != j)
+ {
+ std::cout << *i << std::endl;
+ ++i;
+ }
+}
+
+
+//
+// Take a credit card number as a string of digits,
+// and reformat it as a human readable string with "-"
+// separating each group of four digit;,
+// note that we're mixing a UTF-32 regex, with a UTF-16
+// string and a UTF-8 format specifier, and it still all
+// just works:
+//
+const boost::u32regex e = boost::make_u32regex("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z");
+const char* human_format = "$1-$2-$3-$4";
+
+U_NAMESPACE_QUALIFIER UnicodeString human_readable_card_number(const U_NAMESPACE_QUALIFIER UnicodeString& s)
+{
+ return boost::u32regex_replace(s, e, human_format);
+}
+
+
+int main()
+{
+ // password checks using u32regex_match:
+ U_NAMESPACE_QUALIFIER UnicodeString pwd = "abcDEF---";
+ U_NAMESPACE_QUALIFIER UnicodeString pwd_check = "(?=.*[[:lower:]])(?=.*[[:upper:]])(?=.*[[:punct:]]).{6,}";
+ bool b = is_valid_password(pwd, pwd_check);
+ assert(b);
+ pwd = "abcD-";
+ b = is_valid_password(pwd, pwd_check);
+ assert(!b);
+ // filename extraction with u32regex_match:
+ std::string file = "abc.hpp";
+ file = get_filename(file);
+ assert(file == "abc.hpp");
+ file = "c:\\a\\b\\c\\d.h";
+ file = get_filename(file);
+ assert(file == "d.h");
+
+ // Greek text extraction with u32regex_search:
+ const UChar t[] = {
+ 'S', 'o', 'm', 'e', ' ', 'w', 'h', 'e', 'r', 'e', ' ', 'i', 'n', 0x0391, 0x039D, 0x0395, 0x0398, 0x0391, 0
+ };
+ const UChar g[] = {
+ 0x0391, 0x039D, 0x0395, 0x0398, 0x0391, 0
+ };
+ U_NAMESPACE_QUALIFIER UnicodeString text = t;
+ U_NAMESPACE_QUALIFIER UnicodeString greek = extract_greek(text);
+ assert(greek == g);
+
+ // extract currency symbols with associated value, use iterator interface:
+ std::string text2 = " $100.23 or \xC2\xA3""198.12 "; // \xC2\xA3 is the pound sign encoded in UTF-8
+ enumerate_currencies(text2);
+ enumerate_currencies2(text2);
+
+ U_NAMESPACE_QUALIFIER UnicodeString credit_card_number = "1234567887654321";
+ credit_card_number = human_readable_card_number(credit_card_number);
+ assert(credit_card_number == "1234-5678-8765-4321");
+ return 0;
+}
+
+#else
+
+#include <iostream>
+
+int main()
+{
+ std::cout << "<NOTE>ICU support not enabled, feature unavailable</NOTE>";
+ return 0;
+}
+
+
+#endif
+
diff --git a/src/boost/libs/regex/example/snippets/mfc_example.cpp b/src/boost/libs/regex/example/snippets/mfc_example.cpp
new file mode 100644
index 000000000..4b3ae62ba
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/mfc_example.cpp
@@ -0,0 +1,162 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE mfc_example.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: examples of using Boost.Regex with MFC and ATL string types.
+ */
+
+#ifdef TEST_MFC
+
+#include <boost/regex/mfc.hpp>
+#include <cstringt.h>
+#include <atlstr.h>
+#include <assert.h>
+#include <tchar.h>
+#include <iostream>
+
+#ifdef _UNICODE
+#define cout wcout
+#endif
+
+//
+// Find out if *password* meets our password requirements,
+// as defined by the regular expression *requirements*.
+//
+bool is_valid_password(const CString& password, const CString& requirements)
+{
+ return boost::regex_match(password, boost::make_regex(requirements));
+}
+
+//
+// Extract filename part of a path from a CString and return the result
+// as another CString:
+//
+CString get_filename(const CString& path)
+{
+ boost::tregex r(__T("(?:\\A|.*\\\\)([^\\\\]+)"));
+ boost::tmatch what;
+ if(boost::regex_match(path, what, r))
+ {
+ // extract $1 as a CString:
+ return CString(what[1].first, what.length(1));
+ }
+ else
+ {
+ throw std::runtime_error("Invalid pathname");
+ }
+}
+
+CString extract_postcode(const CString& address)
+{
+ // searches throw address for a UK postcode and returns the result,
+ // the expression used is by Phil A. on www.regxlib.com:
+ boost::tregex r(__T("^(([A-Z]{1,2}[0-9]{1,2})|([A-Z]{1,2}[0-9][A-Z]))\\s?([0-9][A-Z]{2})$"));
+ boost::tmatch what;
+ if(boost::regex_search(address, what, r))
+ {
+ // extract $0 as a CString:
+ return CString(what[0].first, what.length());
+ }
+ else
+ {
+ throw std::runtime_error("No postcode found");
+ }
+}
+
+void enumerate_links(const CString& html)
+{
+ // enumerate and print all the <a> links in some HTML text,
+ // the expression used is by Andew Lee on www.regxlib.com:
+ boost::tregex r(__T("href=[\"\']((http:\\/\\/|\\.\\/|\\/)?\\w+(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?)[\"\']"));
+ boost::tregex_iterator i(boost::make_regex_iterator(html, r)), j;
+ while(i != j)
+ {
+ std::cout << (*i)[1] << std::endl;
+ ++i;
+ }
+}
+
+void enumerate_links2(const CString& html)
+{
+ // enumerate and print all the <a> links in some HTML text,
+ // the expression used is by Andew Lee on www.regxlib.com:
+ boost::tregex r(__T("href=[\"\']((http:\\/\\/|\\.\\/|\\/)?\\w+(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?)[\"\']"));
+ boost::tregex_token_iterator i(boost::make_regex_token_iterator(html, r, 1)), j;
+ while(i != j)
+ {
+ std::cout << *i << std::endl;
+ ++i;
+ }
+}
+
+//
+// Take a credit card number as a string of digits,
+// and reformat it as a human readable string with "-"
+// separating each group of four digits:
+//
+const boost::tregex e(__T("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z"));
+const CString human_format = __T("$1-$2-$3-$4");
+
+CString human_readable_card_number(const CString& s)
+{
+ return boost::regex_replace(s, e, human_format);
+}
+
+
+int main()
+{
+ // password checks using regex_match:
+ CString pwd = "abcDEF---";
+ CString pwd_check = "(?=.*[[:lower:]])(?=.*[[:upper:]])(?=.*[[:punct:]]).{6,}";
+ bool b = is_valid_password(pwd, pwd_check);
+ assert(b);
+ pwd = "abcD-";
+ b = is_valid_password(pwd, pwd_check);
+ assert(!b);
+
+ // filename extraction with regex_match:
+ CString file = "abc.hpp";
+ file = get_filename(file);
+ assert(file == "abc.hpp");
+ file = "c:\\a\\b\\c\\d.h";
+ file = get_filename(file);
+ assert(file == "d.h");
+
+ // postcode extraction with regex_search:
+ CString address = "Joe Bloke, 001 Somestreet, Somewhere,\nPL2 8AB";
+ CString postcode = extract_postcode(address);
+ assert(postcode = "PL2 8NV");
+
+ // html link extraction with regex_iterator:
+ CString text = "<dt><a href=\"syntax_perl.html\">Perl Regular Expressions</a></dt><dt><a href=\"syntax_extended.html\">POSIX-Extended Regular Expressions</a></dt><dt><a href=\"syntax_basic.html\">POSIX-Basic Regular Expressions</a></dt>";
+ enumerate_links(text);
+ enumerate_links2(text);
+
+ CString credit_card_number = "1234567887654321";
+ credit_card_number = human_readable_card_number(credit_card_number);
+ assert(credit_card_number == "1234-5678-8765-4321");
+ return 0;
+}
+
+#else
+
+#include <iostream>
+
+int main()
+{
+ std::cout << "<NOTE>MFC support not enabled, feature unavailable</NOTE>";
+ return 0;
+}
+
+#endif
diff --git a/src/boost/libs/regex/example/snippets/partial_regex_grep.cpp b/src/boost/libs/regex/example/snippets/partial_regex_grep.cpp
new file mode 100644
index 000000000..9934ebc58
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/partial_regex_grep.cpp
@@ -0,0 +1,109 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE partial_regex_grep.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Search example using partial matches.
+ */
+
+#include <boost/regex.hpp>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <cstring>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{ using ::memmove; }
+#endif
+
+// match some kind of html tag:
+boost::regex e("<[^>]*>");
+// count how many:
+unsigned int tags = 0;
+// saved position of partial match:
+const char* next_pos = 0;
+
+bool grep_callback(const boost::match_results<const char*>& m)
+{
+ if(m[0].matched == false)
+ {
+ // save position and return:
+ next_pos = m[0].first;
+ }
+ else
+ ++tags;
+ return true;
+}
+
+void search(std::istream& is)
+{
+ char buf[4096];
+ next_pos = buf + sizeof(buf);
+ bool have_more = true;
+ while(have_more)
+ {
+ // how much do we copy forward from last try:
+ std::ptrdiff_t leftover = (buf + sizeof(buf)) - next_pos;
+ // and how much is left to fill:
+ std::ptrdiff_t size = next_pos - buf;
+ // copy forward whatever we have left:
+ std::memmove(buf, next_pos, leftover);
+ // fill the rest from the stream:
+ is.read(buf + leftover, size);
+ std::streamsize read = is.gcount();
+ // check to see if we've run out of text:
+ have_more = read == size;
+ // reset next_pos:
+ next_pos = buf + sizeof(buf);
+ // and then grep:
+ boost::regex_grep<bool(*)(const boost::cmatch&), const char*>(grep_callback,
+ static_cast<const char*>(buf),
+ static_cast<const char*>(buf + read + leftover),
+ e,
+ boost::match_default | boost::match_partial);
+ }
+}
+
+int main(int argc, char* argv[])
+{
+ if(argc > 1)
+ {
+ for(int i = 1; i < argc; ++i)
+ {
+ std::ifstream fs(argv[i]);
+ if(fs.bad()) continue;
+ search(fs);
+ fs.close();
+ }
+ }
+ else
+ {
+ std::string one("<META NAME=\"keywords\" CONTENT=\"regex++, regular expressions, regular expression library, C++\">");
+ std::string what;
+ while(what.size() < 10000)
+ {
+ what.append(one);
+ what.append(13, ' ');
+ }
+ std::stringstream ss;
+ ss.str(what);
+ search(ss);
+ }
+ std::cout << "total tag count was " << tags << std::endl;
+ return 0;
+}
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/partial_regex_iterate.cpp b/src/boost/libs/regex/example/snippets/partial_regex_iterate.cpp
new file mode 100644
index 000000000..62f67dd21
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/partial_regex_iterate.cpp
@@ -0,0 +1,118 @@
+/*
+ *
+ * Copyright (c) 1998-2007
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE partial_regex_iterate.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Search example using partial matches.
+ */
+
+#include <boost/regex.hpp>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <cstring>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{ using ::memmove; }
+#endif
+
+// match some kind of html tag:
+boost::regex e("<[^>]*>");
+// count how many:
+unsigned int tags = 0;
+
+void search(std::istream& is)
+{
+ // buffer we'll be searching in:
+ char buf[4096];
+ // saved position of end of partial match:
+ const char* next_pos = buf + sizeof(buf);
+ // flag to indicate whether there is more input to come:
+ bool have_more = true;
+
+ while(have_more)
+ {
+ // how much do we copy forward from last try:
+ std::ptrdiff_t leftover = (buf + sizeof(buf)) - next_pos;
+ // and how much is left to fill:
+ std::ptrdiff_t size = next_pos - buf;
+ // copy forward whatever we have left:
+ std::memmove(buf, next_pos, leftover);
+ // fill the rest from the stream:
+ is.read(buf + leftover, size);
+ std::streamsize read = is.gcount();
+ // check to see if we've run out of text:
+ have_more = read == size;
+ // reset next_pos:
+ next_pos = buf + sizeof(buf);
+ // and then iterate:
+ boost::cregex_iterator a(
+ buf,
+ buf + read + leftover,
+ e,
+ boost::match_default | boost::match_partial);
+ boost::cregex_iterator b;
+
+ while(a != b)
+ {
+ if((*a)[0].matched == false)
+ {
+ // Partial match, save position and break:
+ next_pos = (*a)[0].first;
+ break;
+ }
+ else
+ {
+ // full match:
+ ++tags;
+ }
+
+ // move to next match:
+ ++a;
+ }
+ }
+}
+
+int main(int argc, char* argv[])
+{
+ if(argc > 1)
+ {
+ for(int i = 1; i < argc; ++i)
+ {
+ std::ifstream fs(argv[i]);
+ if(fs.bad()) continue;
+ search(fs);
+ fs.close();
+ }
+ }
+ else
+ {
+ std::string one("<META NAME=\"keywords\" CONTENT=\"regex++, regular expressions, regular expression library, C++\">");
+ std::string what;
+ while(what.size() < 10000)
+ {
+ what.append(one);
+ what.append(13, ' ');
+ }
+ std::stringstream ss;
+ ss.str(what);
+ search(ss);
+ }
+ std::cout << "total tag count was " << tags << std::endl;
+ return 0;
+}
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/partial_regex_match.cpp b/src/boost/libs/regex/example/snippets/partial_regex_match.cpp
new file mode 100644
index 000000000..096072bf9
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/partial_regex_match.cpp
@@ -0,0 +1,69 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE partial_regex_match.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_match example using partial matches.
+ */
+
+#include <boost/regex.hpp>
+#include <string>
+#include <iostream>
+
+boost::regex e("(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})");
+
+bool is_possible_card_number(const std::string& input)
+{
+ //
+ // return false for partial match, true for full match, or throw for
+ // impossible match based on what we have so far...
+ boost::match_results<std::string::const_iterator> what;
+ if(0 == boost::regex_match(input, what, e, boost::match_default | boost::match_partial))
+ {
+ // the input so far could not possibly be valid so reject it:
+ throw std::runtime_error("Invalid data entered - this could not possibly be a valid card number");
+ }
+ // OK so far so good, but have we finished?
+ if(what[0].matched)
+ {
+ // excellent, we have a result:
+ return true;
+ }
+ // what we have so far is only a partial match...
+ return false;
+}
+
+int main(int argc, char* argv[])
+{
+ try{
+ std::string input;
+ if(argc > 1)
+ input = argv[1];
+ else
+ std::cin >> input;
+ if(is_possible_card_number(input))
+ {
+ std::cout << "Matched OK..." << std::endl;
+ }
+ else
+ std::cout << "Got a partial match..." << std::endl;
+ }
+ catch(const std::exception& e)
+ {
+ std::cout << e.what() << std::endl;
+ }
+ return 0;
+}
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_grep_example_1.cpp b/src/boost/libs/regex/example/snippets/regex_grep_example_1.cpp
new file mode 100644
index 000000000..2878f5783
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_grep_example_1.cpp
@@ -0,0 +1,131 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_grep_example_1.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_grep example 1: searches a cpp file for class definitions.
+ */
+
+#include <boost/regex.hpp>
+#include <string>
+#include <map>
+
+// purpose:
+// takes the contents of a file in the form of a string
+// and searches for all the C++ class definitions, storing
+// their locations in a map of strings/int's
+
+typedef std::map<std::string, std::string::difference_type, std::less<std::string> > map_type;
+
+const char* re =
+ // possibly leading whitespace:
+ "^[[:space:]]*"
+ // possible template declaration:
+ "(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
+ // class or struct:
+ "(class|struct)[[:space:]]*"
+ // leading declspec macros etc:
+ "("
+ "\\<\\w+\\>"
+ "("
+ "[[:blank:]]*\\([^)]*\\)"
+ ")?"
+ "[[:space:]]*"
+ ")*"
+ // the class name
+ "(\\<\\w*\\>)[[:space:]]*"
+ // template specialisation parameters
+ "(<[^;:{]+>)?[[:space:]]*"
+ // terminate in { or :
+ "(\\{|:[^;\\{()]*\\{)";
+
+boost::regex expression(re);
+
+class IndexClassesPred
+{
+ map_type& m;
+ std::string::const_iterator base;
+public:
+ IndexClassesPred(map_type& a, std::string::const_iterator b) : m(a), base(b) {}
+ bool operator()(const boost::match_results<std::string::const_iterator>& what)
+ {
+ // what[0] contains the whole string
+ // what[5] contains the class name.
+ // what[6] contains the template specialisation if any.
+ // add class name and position to map:
+ m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
+ what[5].first - base;
+ return true;
+ }
+private:
+ IndexClassesPred& operator=(const IndexClassesPred&);
+};
+
+void IndexClasses(map_type& m, const std::string& file)
+{
+ std::string::const_iterator start, end;
+ start = file.begin();
+ end = file.end();
+ boost::regex_grep(IndexClassesPred(m, start), start, end, expression);
+}
+
+
+#include <fstream>
+#include <iostream>
+
+using namespace std;
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
+ char c;
+ while(is.get(c))
+ {
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, const char** argv)
+{
+ std::string text;
+ for(int i = 1; i < argc; ++i)
+ {
+ cout << "Processing file " << argv[i] << endl;
+ map_type m;
+ std::ifstream fs(argv[i]);
+ load_file(text, fs);
+ fs.close();
+ IndexClasses(m, text);
+ cout << m.size() << " matches found" << endl;
+ map_type::iterator c, d;
+ c = m.begin();
+ d = m.end();
+ while(c != d)
+ {
+ cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
+ ++c;
+ }
+ }
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_grep_example_2.cpp b/src/boost/libs/regex/example/snippets/regex_grep_example_2.cpp
new file mode 100644
index 000000000..b5222c2dd
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_grep_example_2.cpp
@@ -0,0 +1,123 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_grep_example_2.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_grep example 2: searches a cpp file for class definitions,
+ * using a global callback function.
+ */
+
+#include <boost/regex.hpp>
+#include <string>
+#include <map>
+#include <boost/regex.hpp>
+
+// purpose:
+// takes the contents of a file in the form of a string
+// and searches for all the C++ class definitions, storing
+// their locations in a map of strings/int's
+
+typedef std::map<std::string, std::string::difference_type, std::less<std::string> > map_type;
+
+const char* re =
+ // possibly leading whitespace:
+ "^[[:space:]]*"
+ // possible template declaration:
+ "(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
+ // class or struct:
+ "(class|struct)[[:space:]]*"
+ // leading declspec macros etc:
+ "("
+ "\\<\\w+\\>"
+ "("
+ "[[:blank:]]*\\([^)]*\\)"
+ ")?"
+ "[[:space:]]*"
+ ")*"
+ // the class name
+ "(\\<\\w*\\>)[[:space:]]*"
+ // template specialisation parameters
+ "(<[^;:{]+>)?[[:space:]]*"
+ // terminate in { or :
+ "(\\{|:[^;\\{()]*\\{)";
+
+
+boost::regex expression(re);
+map_type class_index;
+std::string::const_iterator base;
+
+bool grep_callback(const boost::match_results<std::string::const_iterator>& what)
+{
+ // what[0] contains the whole string
+ // what[5] contains the class name.
+ // what[6] contains the template specialisation if any.
+ // add class name and position to map:
+ class_index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
+ what[5].first - base;
+ return true;
+}
+
+void IndexClasses(const std::string& file)
+{
+ std::string::const_iterator start, end;
+ start = file.begin();
+ end = file.end();
+ base = start;
+ boost::regex_grep(grep_callback, start, end, expression);
+}
+
+#include <fstream>
+#include <iostream>
+
+using namespace std;
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
+ char c;
+ while(is.get(c))
+ {
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, const char** argv)
+{
+ std::string text;
+ for(int i = 1; i < argc; ++i)
+ {
+ cout << "Processing file " << argv[i] << endl;
+ std::ifstream fs(argv[i]);
+ load_file(text, fs);
+ fs.close();
+ IndexClasses(text);
+ cout << class_index.size() << " matches found" << endl;
+ map_type::iterator c, d;
+ c = class_index.begin();
+ d = class_index.end();
+ while(c != d)
+ {
+ cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
+ ++c;
+ }
+ class_index.erase(class_index.begin(), class_index.end());
+ }
+ return 0;
+}
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_grep_example_3.cpp b/src/boost/libs/regex/example/snippets/regex_grep_example_3.cpp
new file mode 100644
index 000000000..9097dfda6
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_grep_example_3.cpp
@@ -0,0 +1,153 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_grep_example_3.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_grep example 3: searches a cpp file for class definitions,
+ * using a bound member function callback.
+ */
+
+#include <boost/regex.hpp>
+#include <string>
+#include <map>
+#include <functional>
+#include <boost/detail/workaround.hpp>
+
+// purpose:
+// takes the contents of a file in the form of a string
+// and searches for all the C++ class definitions, storing
+// their locations in a map of strings/int's
+
+typedef std::map<std::string, std::string::difference_type, std::less<std::string> > map_type;
+
+const char* re =
+ // possibly leading whitespace:
+ "^[[:space:]]*"
+ // possible template declaration:
+ "(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
+ // class or struct:
+ "(class|struct)[[:space:]]*"
+ // leading declspec macros etc:
+ "("
+ "\\<\\w+\\>"
+ "("
+ "[[:blank:]]*\\([^)]*\\)"
+ ")?"
+ "[[:space:]]*"
+ ")*"
+ // the class name
+ "(\\<\\w*\\>)[[:space:]]*"
+ // template specialisation parameters
+ "(<[^;:{]+>)?[[:space:]]*"
+ // terminate in { or :
+ "(\\{|:[^;\\{()]*\\{)";
+
+
+class class_index
+{
+ boost::regex expression;
+ map_type index;
+ std::string::const_iterator base;
+
+ bool grep_callback(boost::match_results<std::string::const_iterator> what);
+public:
+ map_type& get_map() { return index; }
+ void IndexClasses(const std::string& file);
+ class_index()
+ : expression(re) {}
+};
+
+bool class_index::grep_callback(boost::match_results<std::string::const_iterator> what)
+{
+ // what[0] contains the whole string
+ // what[5] contains the class name.
+ // what[6] contains the template specialisation if any.
+ // add class name and position to map:
+ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
+ what[5].first - base;
+ return true;
+}
+
+void class_index::IndexClasses(const std::string& file)
+{
+ std::string::const_iterator start, end;
+ start = file.begin();
+ end = file.end();
+ base = start;
+#if BOOST_WORKAROUND(_MSC_VER, < 1300) && !defined(_STLP_VERSION)
+ boost::regex_grep(std::bind1st(std::mem_fun1(&class_index::grep_callback), this),
+ start,
+ end,
+ expression);
+#elif defined(BOOST_NO_CXX98_BINDERS)
+ boost::regex_grep(std::bind(&class_index::grep_callback, this, std::placeholders::_1),
+ start,
+ end,
+ expression);
+#else
+ boost::regex_grep(std::bind1st(std::mem_fun(&class_index::grep_callback), this),
+ start,
+ end,
+ expression);
+#endif
+}
+
+
+#include <fstream>
+#include <iostream>
+
+using namespace std;
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
+ char c;
+ while(is.get(c))
+ {
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, const char** argv)
+{
+ std::string text;
+ for(int i = 1; i < argc; ++i)
+ {
+ cout << "Processing file " << argv[i] << endl;
+ std::ifstream fs(argv[i]);
+ load_file(text, fs);
+ fs.close();
+ class_index idx;
+ idx.IndexClasses(text);
+ cout << idx.get_map().size() << " matches found" << endl;
+ map_type::iterator c, d;
+ c = idx.get_map().begin();
+ d = idx.get_map().end();
+ while(c != d)
+ {
+ cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
+ ++c;
+ }
+ }
+ return 0;
+}
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_grep_example_4.cpp b/src/boost/libs/regex/example/snippets/regex_grep_example_4.cpp
new file mode 100644
index 000000000..533d896ee
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_grep_example_4.cpp
@@ -0,0 +1,155 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_grep_example_4.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_grep example 4: searches a cpp file for class definitions,
+ * using a C++ Builder closure as a callback.
+ */
+
+#ifdef __BORLANDC__
+
+#include <boost/regex.hpp>
+#include <string>
+#include <map>
+#include <functional>
+
+// purpose:
+// takes the contents of a file in the form of a string
+// and searches for all the C++ class definitions, storing
+// their locations in a map of strings/int's
+
+typedef std::map<std::string, int, std::less<std::string> > map_type;
+
+const char* re =
+ // possibly leading whitespace:
+ "^[[:space:]]*"
+ // possible template declaration:
+ "(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
+ // class or struct:
+ "(class|struct)[[:space:]]*"
+ // leading declspec macros etc:
+ "("
+ "\\<\\w+\\>"
+ "("
+ "[[:blank:]]*\\([^)]*\\)"
+ ")?"
+ "[[:space:]]*"
+ ")*"
+ // the class name
+ "(\\<\\w*\\>)[[:space:]]*"
+ // template specialisation parameters
+ "(<[^;:{]+>)?[[:space:]]*"
+ // terminate in { or :
+ "(\\{|:[^;\\{()]*\\{)";
+
+
+class class_index
+{
+ boost::regex expression;
+ map_type index;
+ std::string::const_iterator base;
+ typedef boost::match_results<std::string::const_iterator> arg_type;
+
+ bool grep_callback(const boost::match_results<std::string::const_iterator>& what);
+public:
+ map_type& get_map() { return index; }
+ typedef bool (__closure* grep_callback_type)(const arg_type&);
+ void IndexClasses(const std::string& file);
+ class_index()
+ : index(),
+ expression(re)
+ {}
+};
+
+bool class_index::grep_callback(const boost::match_results<std::string::const_iterator>& what)
+{
+ // what[0] contains the whole string
+ // what[5] contains the class name.
+ // what[6] contains the template specialisation if any.
+ // add class name and position to map:
+ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
+ what[5].first - base;
+ return true;
+}
+
+void class_index::IndexClasses(const std::string& file)
+{
+ std::string::const_iterator start, end;
+ start = file.begin();
+ end = file.end();
+ base = start;
+ class_index::grep_callback_type cl = &(this->grep_callback);
+ boost::regex_grep(cl,
+ start,
+ end,
+ expression);
+}
+
+
+#include <fstream>
+#include <iostream>
+
+using namespace std;
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ s.reserve(is.rdbuf()->in_avail());
+ char c;
+ while(is.get(c))
+ {
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, const char** argv)
+{
+ std::string text;
+ for(int i = 1; i < argc; ++i)
+ {
+ cout << "Processing file " << argv[i] << endl;
+ std::ifstream fs(argv[i]);
+ load_file(text, fs);
+ fs.close();
+ class_index i;
+ i.IndexClasses(text);
+ cout << i.get_map().size() << " matches found" << endl;
+ map_type::iterator c, d;
+ c = i.get_map().begin();
+ d = i.get_map().end();
+ while(c != d)
+ {
+ cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
+ ++c;
+ }
+ }
+ return 0;
+}
+
+#else // __BORLANDC__
+
+int main()
+{
+ return 0;
+}
+
+
+#endif
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_iterator_example.cpp b/src/boost/libs/regex/example/snippets/regex_iterator_example.cpp
new file mode 100644
index 000000000..101052f1a
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_iterator_example.cpp
@@ -0,0 +1,114 @@
+/*
+ *
+ * Copyright (c) 2003
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_iterator_example_2.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_iterator example 2: searches a cpp file for class definitions,
+ * using global data.
+ */
+
+#include <boost/regex.hpp>
+#include <string>
+#include <map>
+#include <fstream>
+#include <iostream>
+
+using namespace std;
+
+// purpose:
+// takes the contents of a file in the form of a string
+// and searches for all the C++ class definitions, storing
+// their locations in a map of strings/int's
+
+typedef std::map<std::string, std::string::difference_type, std::less<std::string> > map_type;
+
+const char* re =
+ // possibly leading whitespace:
+ "^[[:space:]]*"
+ // possible template declaration:
+ "(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
+ // class or struct:
+ "(class|struct)[[:space:]]*"
+ // leading declspec macros etc:
+ "("
+ "\\<\\w+\\>"
+ "("
+ "[[:blank:]]*\\([^)]*\\)"
+ ")?"
+ "[[:space:]]*"
+ ")*"
+ // the class name
+ "(\\<\\w*\\>)[[:space:]]*"
+ // template specialisation parameters
+ "(<[^;:{]+>)?[[:space:]]*"
+ // terminate in { or :
+ "(\\{|:[^;\\{()]*\\{)";
+
+
+boost::regex expression(re);
+map_type class_index;
+
+bool regex_callback(const boost::match_results<std::string::const_iterator>& what)
+{
+ // what[0] contains the whole string
+ // what[5] contains the class name.
+ // what[6] contains the template specialisation if any.
+ // add class name and position to map:
+ class_index[what[5].str() + what[6].str()] = what.position(5);
+ return true;
+}
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
+ char c;
+ while(is.get(c))
+ {
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, const char** argv)
+{
+ std::string text;
+ for(int i = 1; i < argc; ++i)
+ {
+ cout << "Processing file " << argv[i] << endl;
+ std::ifstream fs(argv[i]);
+ load_file(text, fs);
+ fs.close();
+ // construct our iterators:
+ boost::sregex_iterator m1(text.begin(), text.end(), expression);
+ boost::sregex_iterator m2;
+ std::for_each(m1, m2, &regex_callback);
+ // copy results:
+ cout << class_index.size() << " matches found" << endl;
+ map_type::iterator c, d;
+ c = class_index.begin();
+ d = class_index.end();
+ while(c != d)
+ {
+ cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
+ ++c;
+ }
+ class_index.erase(class_index.begin(), class_index.end());
+ }
+ return 0;
+}
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_match_example.cpp b/src/boost/libs/regex/example/snippets/regex_match_example.cpp
new file mode 100644
index 000000000..dd10de4d6
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_match_example.cpp
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_match_example.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: ftp based regex_match example.
+ */
+
+#include <boost/regex.hpp>
+#include <cstdlib>
+#include <stdlib.h>
+#include <string>
+#include <iostream>
+
+using namespace std;
+using namespace boost;
+
+regex expression("^([0-9]+)(\\-| |$)(.*)$");
+
+// process_ftp:
+// on success returns the ftp response code, and fills
+// msg with the ftp response message.
+int process_ftp(const char* response, std::string* msg)
+{
+ cmatch what;
+ if(regex_match(response, what, expression))
+ {
+ // what[0] contains the whole string
+ // what[1] contains the response code
+ // what[2] contains the separator character
+ // what[3] contains the text message.
+ if(msg)
+ msg->assign(what[3].first, what[3].second);
+ return ::atoi(what[1].first);
+ }
+ // failure did not match
+ if(msg)
+ msg->erase();
+ return -1;
+}
+
+#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550))
+//
+// problem with std::getline under MSVC6sp3
+istream& getline(istream& is, std::string& s)
+{
+ s.erase();
+ char c = static_cast<char>(is.get());
+ while(c != '\n')
+ {
+ s.append(1, c);
+ c = static_cast<char>(is.get());
+ }
+ return is;
+}
+#endif
+
+int main(int argc, const char*[])
+{
+ std::string in, out;
+ do
+ {
+ if(argc == 1)
+ {
+ cout << "enter test string" << endl;
+ getline(cin, in);
+ if(in == "quit")
+ break;
+ }
+ else
+ in = "100 this is an ftp message text";
+ int result;
+ result = process_ftp(in.c_str(), &out);
+ if(result != -1)
+ {
+ cout << "Match found:" << endl;
+ cout << "Response code: " << result << endl;
+ cout << "Message text: " << out << endl;
+ }
+ else
+ {
+ cout << "Match not found" << endl;
+ }
+ cout << endl;
+ } while(argc == 1);
+ return 0;
+}
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_merge_example.cpp b/src/boost/libs/regex/example/snippets/regex_merge_example.cpp
new file mode 100644
index 000000000..cb8b493ca
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_merge_example.cpp
@@ -0,0 +1,137 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_merge_example.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_merge example:
+ * converts a C++ file to syntax highlighted HTML.
+ */
+
+#include <boost/regex.hpp>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <iterator>
+#include <fstream>
+#include <iostream>
+
+// purpose:
+// takes the contents of a file and transform to
+// syntax highlighted code in html format
+
+boost::regex e1, e2;
+extern const char* expression_text;
+extern const char* format_string;
+extern const char* pre_expression;
+extern const char* pre_format;
+extern const char* header_text;
+extern const char* footer_text;
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
+ char c;
+ while(is.get(c))
+ {
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, const char** argv)
+{
+ try{
+ e1.assign(expression_text);
+ e2.assign(pre_expression);
+ for(int i = 1; i < argc; ++i)
+ {
+ std::cout << "Processing file " << argv[i] << std::endl;
+ std::ifstream fs(argv[i]);
+ std::string in;
+ load_file(in, fs);
+ fs.close();
+ std::string out_name = std::string(argv[i]) + std::string(".htm");
+ std::ofstream os(out_name.c_str());
+ os << header_text;
+ // strip '<' and '>' first by outputting to a
+ // temporary string stream
+ std::ostringstream t(std::ios::out | std::ios::binary);
+ std::ostream_iterator<char> oi(t);
+ boost::regex_merge(oi, in.begin(), in.end(), e2, pre_format, boost::match_default | boost::format_all);
+ // then output to final output stream
+ // adding syntax highlighting:
+ std::string s(t.str());
+ std::ostream_iterator<char> out(os);
+ boost::regex_merge(out, s.begin(), s.end(), e1, format_string, boost::match_default | boost::format_all);
+ os << footer_text;
+ os.close();
+ }
+ }
+ catch(...)
+ { return -1; }
+ return 0;
+}
+
+const char* pre_expression = "(<)|(>)|\\r";
+const char* pre_format = "(?1&lt;)(?2&gt;)";
+
+
+const char* expression_text = // preprocessor directives: index 1
+ "(^[[:blank:]]*#(?:[^\\\\\\n]|\\\\[^\\n[:punct:][:word:]]*[\\n[:punct:][:word:]])*)|"
+ // comment: index 2
+ "(//[^\\n]*|/\\*.*?\\*/)|"
+ // literals: index 3
+ "\\<([+-]?(?:(?:0x[[:xdigit:]]+)|(?:(?:[[:digit:]]*\\.)?[[:digit:]]+(?:[eE][+-]?[[:digit:]]+)?))u?(?:(?:int(?:8|16|32|64))|L)?)\\>|"
+ // string literals: index 4
+ "('(?:[^\\\\']|\\\\.)*'|\"(?:[^\\\\\"]|\\\\.)*\")|"
+ // keywords: index 5
+ "\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import"
+ "|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall"
+ "|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool"
+ "|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete"
+ "|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto"
+ "|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected"
+ "|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast"
+ "|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned"
+ "|using|virtual|void|volatile|wchar_t|while)\\>"
+ ;
+
+const char* format_string = "(?1<font color=\"#008040\">$&</font>)"
+ "(?2<I><font color=\"#000080\">$&</font></I>)"
+ "(?3<font color=\"#0000A0\">$&</font>)"
+ "(?4<font color=\"#0000FF\">$&</font>)"
+ "(?5<B>$&</B>)";
+
+const char* header_text = "<HTML>\n<HEAD>\n"
+ "<TITLE>Auto-generated html formated source</TITLE>\n"
+ "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1252\">\n"
+ "</HEAD>\n"
+ "<BODY LINK=\"#0000ff\" VLINK=\"#800080\" BGCOLOR=\"#ffffff\">\n"
+ "<P> </P>\n<PRE>";
+
+const char* footer_text = "</PRE>\n</BODY>\n\n";
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_replace_example.cpp b/src/boost/libs/regex/example/snippets/regex_replace_example.cpp
new file mode 100644
index 000000000..19331ab86
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_replace_example.cpp
@@ -0,0 +1,138 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_replace_example.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_replace example:
+ * converts a C++ file to syntax highlighted HTML.
+ */
+
+#include <boost/regex.hpp>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <iterator>
+#include <fstream>
+#include <iostream>
+
+// purpose:
+// takes the contents of a file and transform to
+// syntax highlighted code in html format
+
+boost::regex e1, e2;
+extern const char* expression_text;
+extern const char* format_string;
+extern const char* pre_expression;
+extern const char* pre_format;
+extern const char* header_text;
+extern const char* footer_text;
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
+ char c;
+ while(is.get(c))
+ {
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, const char** argv)
+{
+ try{
+ e1.assign(expression_text);
+ e2.assign(pre_expression);
+ for(int i = 1; i < argc; ++i)
+ {
+ std::cout << "Processing file " << argv[i] << std::endl;
+ std::ifstream fs(argv[i]);
+ std::string in;
+ load_file(in, fs);
+ fs.close();
+ std::string out_name = std::string(argv[i]) + std::string(".htm");
+ std::ofstream os(out_name.c_str());
+ os << header_text;
+ // strip '<' and '>' first by outputting to a
+ // temporary string stream
+ std::ostringstream t(std::ios::out | std::ios::binary);
+ std::ostream_iterator<char> oi(t);
+ boost::regex_replace(oi, in.begin(), in.end(), e2, pre_format, boost::match_default | boost::format_all);
+ // then output to final output stream
+ // adding syntax highlighting:
+ std::string s(t.str());
+ std::ostream_iterator<char> out(os);
+ boost::regex_replace(out, s.begin(), s.end(), e1, format_string, boost::match_default | boost::format_all);
+ os << footer_text;
+ os.close();
+ }
+ }
+ catch(...)
+ { return -1; }
+ return 0;
+}
+
+const char* pre_expression = "(<)|(>)|(&)|\\r";
+const char* pre_format = "(?1&lt;)(?2&gt;)(?3&amp;)";
+
+
+const char* expression_text = // preprocessor directives: index 1
+ "(^[[:blank:]]*#(?:[^\\\\\\n]|\\\\[^\\n[:punct:][:word:]]*[\\n[:punct:][:word:]])*)|"
+ // comment: index 2
+ "(//[^\\n]*|/\\*.*?\\*/)|"
+ // literals: index 3
+ "\\<([+-]?(?:(?:0x[[:xdigit:]]+)|(?:(?:[[:digit:]]*\\.)?[[:digit:]]+(?:[eE][+-]?[[:digit:]]+)?))u?(?:(?:int(?:8|16|32|64))|L)?)\\>|"
+ // string literals: index 4
+ "('(?:[^\\\\']|\\\\.)*'|\"(?:[^\\\\\"]|\\\\.)*\")|"
+ // keywords: index 5
+ "\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import"
+ "|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall"
+ "|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool"
+ "|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete"
+ "|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto"
+ "|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected"
+ "|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast"
+ "|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned"
+ "|using|virtual|void|volatile|wchar_t|while)\\>"
+ ;
+
+const char* format_string = "(?1<font color=\"#008040\">$&</font>)"
+ "(?2<I><font color=\"#000080\">$&</font></I>)"
+ "(?3<font color=\"#0000A0\">$&</font>)"
+ "(?4<font color=\"#0000FF\">$&</font>)"
+ "(?5<B>$&</B>)";
+
+const char* header_text = "<HTML>\n<HEAD>\n"
+ "<TITLE>Auto-generated html formated source</TITLE>\n"
+ "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1252\">\n"
+ "</HEAD>\n"
+ "<BODY LINK=\"#0000ff\" VLINK=\"#800080\" BGCOLOR=\"#ffffff\">\n"
+ "<P> </P>\n<PRE>";
+
+const char* footer_text = "</PRE>\n</BODY>\n\n";
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_search_example.cpp b/src/boost/libs/regex/example/snippets/regex_search_example.cpp
new file mode 100644
index 000000000..ee9cd90fe
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_search_example.cpp
@@ -0,0 +1,129 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_search_example.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_search example: searches a cpp file for class definitions.
+ */
+
+#include <boost/regex.hpp>
+#include <string>
+#include <map>
+
+// purpose:
+// takes the contents of a file in the form of a string
+// and searches for all the C++ class definitions, storing
+// their locations in a map of strings/int's
+
+typedef std::map<std::string, std::string::difference_type, std::less<std::string> > map_type;
+
+const char* re =
+ // possibly leading whitespace:
+ "^[[:space:]]*"
+ // possible template declaration:
+ "(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
+ // class or struct:
+ "(class|struct)[[:space:]]*"
+ // leading declspec macros etc:
+ "("
+ "\\<\\w+\\>"
+ "("
+ "[[:blank:]]*\\([^)]*\\)"
+ ")?"
+ "[[:space:]]*"
+ ")*"
+ // the class name
+ "(\\<\\w*\\>)[[:space:]]*"
+ // template specialisation parameters
+ "(<[^;:{]+>)?[[:space:]]*"
+ // terminate in { or :
+ "(\\{|:[^;\\{()]*\\{)";
+
+
+boost::regex expression(re);
+
+void IndexClasses(map_type& m, const std::string& file)
+{
+ std::string::const_iterator start, end;
+ start = file.begin();
+ end = file.end();
+ boost::match_results<std::string::const_iterator> what;
+ boost::match_flag_type flags = boost::match_default;
+ while(boost::regex_search(start, end, what, expression, flags))
+ {
+ // what[0] contains the whole string
+ // what[5] contains the class name.
+ // what[6] contains the template specialisation if any.
+ // add class name and position to map:
+ m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
+ what[5].first - file.begin();
+ // update search position:
+ start = what[0].second;
+ // update flags:
+ flags |= boost::match_prev_avail;
+ flags |= boost::match_not_bob;
+ }
+}
+
+
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
+ char c;
+ while(is.get(c))
+ {
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, const char** argv)
+{
+ std::string text;
+ for(int i = 1; i < argc; ++i)
+ {
+ cout << "Processing file " << argv[i] << endl;
+ map_type m;
+ std::ifstream fs(argv[i]);
+ load_file(text, fs);
+ fs.close();
+ IndexClasses(m, text);
+ cout << m.size() << " matches found" << endl;
+ map_type::iterator c, d;
+ c = m.begin();
+ d = m.end();
+ while(c != d)
+ {
+ cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
+ ++c;
+ }
+ }
+ return 0;
+}
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_split_example_1.cpp b/src/boost/libs/regex/example/snippets/regex_split_example_1.cpp
new file mode 100644
index 000000000..df2ef96bb
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_split_example_1.cpp
@@ -0,0 +1,76 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_split_example_1.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_split example: split a string into tokens.
+ */
+
+
+#include <boost/regex.hpp>
+#include <list>
+
+
+unsigned tokenise(std::list<std::string>& l, std::string& s)
+{
+ return boost::regex_split(std::back_inserter(l), s);
+}
+
+#include <iostream>
+using namespace std;
+
+
+#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550))
+//
+// problem with std::getline under MSVC6sp3
+istream& getline(istream& is, std::string& s)
+{
+ s.erase();
+ char c = static_cast<char>(is.get());
+ while(c != '\n')
+ {
+ s.append(1, c);
+ c = static_cast<char>(is.get());
+ }
+ return is;
+}
+#endif
+
+
+int main(int argc, const char*[])
+{
+ string s;
+ list<string> l;
+ do{
+ if(argc == 1)
+ {
+ cout << "Enter text to split (or \"quit\" to exit): ";
+ getline(cin, s);
+ if(s == "quit") break;
+ }
+ else
+ s = "This is a string of tokens";
+ unsigned result = tokenise(l, s);
+ cout << result << " tokens found" << endl;
+ cout << "The remaining text is: \"" << s << "\"" << endl;
+ while(l.size())
+ {
+ s = *(l.begin());
+ l.pop_front();
+ cout << s << endl;
+ }
+ }while(argc == 1);
+ return 0;
+}
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_split_example_2.cpp b/src/boost/libs/regex/example/snippets/regex_split_example_2.cpp
new file mode 100644
index 000000000..ad7350229
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_split_example_2.cpp
@@ -0,0 +1,86 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_split_example_2.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_split example: spit out linked URL's.
+ */
+
+
+#include <boost/regex.hpp>
+#include <list>
+#include <fstream>
+#include <iostream>
+#include <iterator>
+
+boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"",
+ boost::regex::normal | boost::regbase::icase);
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ //
+ // attempt to grow string buffer to match file size,
+ // this doesn't always work...
+ s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
+ char c;
+ while(is.get(c))
+ {
+ // use logarithmic growth stategy, in case
+ // in_avail (above) returned zero:
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, char** argv)
+{
+ std::string s;
+ std::list<std::string> l;
+ int i;
+ for(i = 1; i < argc; ++i)
+ {
+ std::cout << "Findings URL's in " << argv[i] << ":" << std::endl;
+ s.erase();
+ std::ifstream is(argv[i]);
+ load_file(s, is);
+ is.close();
+ boost::regex_split(std::back_inserter(l), s, e);
+ while(l.size())
+ {
+ s = *(l.begin());
+ l.pop_front();
+ std::cout << s << std::endl;
+ }
+ }
+ //
+ // alternative method:
+ // split one match at a time and output direct to
+ // cout via ostream_iterator<std::string>....
+ //
+ for(i = 1; i < argc; ++i)
+ {
+ std::cout << "Findings URL's in " << argv[i] << ":" << std::endl;
+ s.erase();
+ std::ifstream is(argv[i]);
+ load_file(s, is);
+ is.close();
+ while(boost::regex_split(std::ostream_iterator<std::string>(std::cout), s, e, boost::match_default, 1)) std::cout << std::endl;
+ }
+
+ return 0;
+}
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_token_iterator_eg_1.cpp b/src/boost/libs/regex/example/snippets/regex_token_iterator_eg_1.cpp
new file mode 100644
index 000000000..f1ecb44de
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_token_iterator_eg_1.cpp
@@ -0,0 +1,72 @@
+/*
+ *
+ * Copyright (c) 12003
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_token_iterator_example_1.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_token_iterator example: split a string into tokens.
+ */
+
+
+#include <boost/regex.hpp>
+
+#include <iostream>
+using namespace std;
+
+
+#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550))
+//
+// problem with std::getline under MSVC6sp3
+istream& getline(istream& is, std::string& s)
+{
+ s.erase();
+ char c = static_cast<char>(is.get());
+ while(c != '\n')
+ {
+ s.append(1, c);
+ c = static_cast<char>(is.get());
+ }
+ return is;
+}
+#endif
+
+
+int main(int argc, const char*[])
+{
+ string s;
+ do{
+ if(argc == 1)
+ {
+ cout << "Enter text to split (or \"quit\" to exit): ";
+ getline(cin, s);
+ if(s == "quit") break;
+ }
+ else
+ s = "This is a string of tokens";
+
+ boost::regex re("\\s+");
+ boost::sregex_token_iterator i(s.begin(), s.end(), re, -1);
+ boost::sregex_token_iterator j;
+
+ unsigned count = 0;
+ while(i != j)
+ {
+ cout << *i++ << endl;
+ count++;
+ }
+ cout << "There were " << count << " tokens found." << endl;
+
+ }while(argc == 1);
+ return 0;
+}
+
+
diff --git a/src/boost/libs/regex/example/snippets/regex_token_iterator_eg_2.cpp b/src/boost/libs/regex/example/snippets/regex_token_iterator_eg_2.cpp
new file mode 100644
index 000000000..3458ce4d3
--- /dev/null
+++ b/src/boost/libs/regex/example/snippets/regex_token_iterator_eg_2.cpp
@@ -0,0 +1,89 @@
+/*
+ *
+ * Copyright (c) 2003
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_token_iterator_example_2.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: regex_token_iterator example: spit out linked URL's.
+ */
+
+
+#include <boost/regex.hpp>
+#include <fstream>
+#include <iostream>
+#include <iterator>
+
+boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"",
+ boost::regex::normal | boost::regbase::icase);
+
+void load_file(std::string& s, std::istream& is)
+{
+ s.erase();
+ if(is.bad()) return;
+ //
+ // attempt to grow string buffer to match file size,
+ // this doesn't always work...
+ s.reserve(static_cast<std::string::size_type>(is.rdbuf()->in_avail()));
+ char c;
+ while(is.get(c))
+ {
+ // use logarithmic growth stategy, in case
+ // in_avail (above) returned zero:
+ if(s.capacity() == s.size())
+ s.reserve(s.capacity() * 3);
+ s.append(1, c);
+ }
+}
+
+int main(int argc, char** argv)
+{
+ std::string s;
+ int i;
+ for(i = 1; i < argc; ++i)
+ {
+ std::cout << "Findings URL's in " << argv[i] << ":" << std::endl;
+ s.erase();
+ std::ifstream is(argv[i]);
+ load_file(s, is);
+ is.close();
+ boost::sregex_token_iterator i(s.begin(), s.end(), e, 1);
+ boost::sregex_token_iterator j;
+ while(i != j)
+ {
+ std::cout << *i++ << std::endl;
+ }
+ }
+ //
+ // alternative method:
+ // test the array-literal constructor, and split out the whole
+ // match as well as $1....
+ //
+ for(i = 1; i < argc; ++i)
+ {
+ std::cout << "Findings URL's in " << argv[i] << ":" << std::endl;
+ s.erase();
+ std::ifstream is(argv[i]);
+ load_file(s, is);
+ is.close();
+ const int subs[] = {1, 0,};
+ boost::sregex_token_iterator i(s.begin(), s.end(), e, subs);
+ boost::sregex_token_iterator j;
+ while(i != j)
+ {
+ std::cout << *i++ << std::endl;
+ }
+ }
+
+ return 0;
+}
+
+
diff --git a/src/boost/libs/regex/example/timer/bc55.mak b/src/boost/libs/regex/example/timer/bc55.mak
new file mode 100644
index 000000000..44795fc6c
--- /dev/null
+++ b/src/boost/libs/regex/example/timer/bc55.mak
@@ -0,0 +1,51 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for timer.exe
+#
+# Borland C++ tools
+#
+# BCROOT defines the root directory of your bc builder install
+#
+
+!ifndef BCROOT
+BCROOT=$(MAKEDIR)\..
+!endif
+
+BCC32 = $(BCROOT)\bin\Bcc32.exe
+
+IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
+COMPOPTS= -O2 -tWC -tWM- -Vx -Ve -D_NO_VCL; -I../../../../; -L..\..\build\bcb5
+
+
+timer.exe : regex_timer.cpp
+ $(BCC32) @&&|
+ $(COMPOPTS) -e$@ regex_timer.cpp
+|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/timer/bcb4.mak b/src/boost/libs/regex/example/timer/bcb4.mak
new file mode 100644
index 000000000..372b647d4
--- /dev/null
+++ b/src/boost/libs/regex/example/timer/bcb4.mak
@@ -0,0 +1,51 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for timer.exe
+#
+# Borland C++ tools
+#
+# BCROOT defines the root directory of your bc builder install
+#
+
+!ifndef BCROOT
+BCROOT=$(MAKEDIR)\..
+!endif
+
+BCC32 = $(BCROOT)\bin\Bcc32.exe
+
+IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
+COMPOPTS= -O2 -tWC -tWM- -Vx -Ve -D_NO_VCL; -I../../../../; -L..\..\build\bcb4
+
+
+timer.exe : regex_timer.cpp
+ $(BCC32) @&&|
+ $(COMPOPTS) -e$@ regex_timer.cpp
+|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/timer/bcb5.mak b/src/boost/libs/regex/example/timer/bcb5.mak
new file mode 100644
index 000000000..44795fc6c
--- /dev/null
+++ b/src/boost/libs/regex/example/timer/bcb5.mak
@@ -0,0 +1,51 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for timer.exe
+#
+# Borland C++ tools
+#
+# BCROOT defines the root directory of your bc builder install
+#
+
+!ifndef BCROOT
+BCROOT=$(MAKEDIR)\..
+!endif
+
+BCC32 = $(BCROOT)\bin\Bcc32.exe
+
+IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
+COMPOPTS= -O2 -tWC -tWM- -Vx -Ve -D_NO_VCL; -I../../../../; -L..\..\build\bcb5
+
+
+timer.exe : regex_timer.cpp
+ $(BCC32) @&&|
+ $(COMPOPTS) -e$@ regex_timer.cpp
+|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/timer/gcc.mak b/src/boost/libs/regex/example/timer/gcc.mak
new file mode 100644
index 000000000..2faf64189
--- /dev/null
+++ b/src/boost/libs/regex/example/timer/gcc.mak
@@ -0,0 +1,38 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for timer.exe
+#
+# GNU compiler GCC
+#
+CXX= $(INCLUDES) -I../../../../ -I./ $(CXXFLAGS)
+
+timer : regex_timer.cpp
+ g++ $(CXX) -O2 -o timer regex_timer.cpp -L../../build/gcc $(LDFLAGS) -lboost_regex $(LIBS)
+
+debug : regex_timer.cpp timer.cpp
+ g++ $(CXX) -g -o timer regex_timer.cpp -L../../build/gcc $(LDFLAGS) -lboost_regex_debug $(LIBS)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/timer/input_script.txt b/src/boost/libs/regex/example/timer/input_script.txt
new file mode 100644
index 000000000..4a9e3e2df
--- /dev/null
+++ b/src/boost/libs/regex/example/timer/input_script.txt
@@ -0,0 +1,14 @@
+abc
+aaaaaaaaaaabcccccccc
+quit
+^([0-9]+)(\-| |$)(.*)$
+100- this is a line of ftp response which contains a message string
+quit
+quit
+
+# Copyright 2007 John Maddock.
+# 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).
+
+
diff --git a/src/boost/libs/regex/example/timer/regex_timer.cpp b/src/boost/libs/regex/example/timer/regex_timer.cpp
new file mode 100644
index 000000000..48f41a9b1
--- /dev/null
+++ b/src/boost/libs/regex/example/timer/regex_timer.cpp
@@ -0,0 +1,382 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+#ifdef _MSC_VER
+#pragma warning(disable: 4996 4127)
+#endif
+
+#include <boost/config.hpp>
+#include <boost/regex.hpp>
+#include <boost/cregex.hpp>
+#include <boost/timer.hpp>
+#include <boost/smart_ptr.hpp>
+
+#include <string>
+#include <algorithm>
+#include <deque>
+#include <iterator>
+
+#ifdef BOOST_RE_OLD_IOSTREAM
+#include <iostream.h>
+#include <fstream.h>
+#else
+#include <iostream>
+#include <fstream>
+using std::cout;
+using std::cin;
+using std::cerr;
+using std::istream;
+using std::ostream;
+using std::endl;
+using std::ifstream;
+using std::streambuf;
+using std::getline;
+#endif
+
+#if defined(_WIN32) && defined(BOOST_REGEX_USE_WIN32_LOCALE)
+#include <windows.h>
+#endif
+
+#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || defined(__sgi)
+// maybe no Koenig lookup, use using declaration instead:
+using namespace boost;
+#endif
+
+#ifndef BOOST_NO_WREGEX
+ostream& operator << (ostream& os, const std::wstring& s)
+{
+ std::wstring::const_iterator i, j;
+ i = s.begin();
+ j = s.end();
+ while(i != j)
+ {
+ os.put(static_cast<char>(*i));
+ ++i;
+ }
+ return os;
+}
+#endif
+
+template <class S>
+class string_out_iterator
+{
+public:
+ typedef std::output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+private:
+ S* out;
+public:
+ string_out_iterator(S& s) : out(&s) {}
+ string_out_iterator& operator++() { return *this; }
+ string_out_iterator& operator++(int) { return *this; }
+ string_out_iterator& operator*() { return *this; }
+ string_out_iterator& operator=(typename S::value_type v)
+ {
+ out->append(1, v);
+ return *this;
+ }
+};
+
+namespace boost{
+#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550)) || defined(__SGI_STL_PORT)
+//
+// problem with std::getline under MSVC6sp3
+// and C++ Builder 5.5, is this really that hard?
+istream& getline(istream& is, std::string& s)
+{
+ s.erase();
+ char c = static_cast<char>(is.get());
+ while(c != '\n')
+ {
+ BOOST_ASSERT(is.good());
+ s.append(1, c);
+ c = static_cast<char>(is.get());
+ }
+ return is;
+}
+#else
+istream& getline(istream& is, std::string& s)
+{
+ std::getline(is, s);
+ if(s.size() && (s[s.size() -1] == '\r'))
+ s.erase(s.size() - 1);
+ return is;
+}
+#endif
+}
+
+
+int main(int argc, char**argv)
+{
+ ifstream ifs;
+ std::istream* p_in = &std::cin;
+ if(argc == 2)
+ {
+ ifs.open(argv[1]);
+ ifs.peek();
+ if(!ifs.good())
+ {
+ cout << "Bad filename: " << argv[1] << endl;
+ return -1;
+ }
+ p_in = &ifs;
+ }
+
+ boost::regex ex;
+ boost::match_results<std::string::const_iterator> sm;
+#ifndef BOOST_NO_WREGEX
+ std::wstring ws1, ws2;
+ boost::wregex wex;
+ boost::match_results<std::wstring::const_iterator> wsm;
+#endif
+ boost::match_results<std::deque<char>::iterator> dm;
+ std::string s1, s2, ts;
+ std::deque<char> ds;
+ boost::regex_tA r;
+ boost::scoped_array<boost::regmatch_t> matches;
+ std::size_t nsubs;
+ boost::timer t;
+ double tim;
+ int result = 0;
+ unsigned iters = 100;
+ double wait_time = (std::min)(t.elapsed_min() * 1000, 0.5);
+
+ while(true)
+ {
+ cout << "Enter expression (or \"quit\" to exit): ";
+ boost::getline(*p_in, s1);
+ if(argc == 2)
+ cout << endl << s1 << endl;
+ if(s1 == "quit")
+ break;
+#ifndef BOOST_NO_WREGEX
+ ws1.erase();
+ std::copy(s1.begin(), s1.end(), string_out_iterator<std::wstring>(ws1));
+#endif
+ try{
+ ex.assign(s1);
+#ifndef BOOST_NO_WREGEX
+ wex.assign(ws1);
+#endif
+ }
+ catch(std::exception& e)
+ {
+ cout << "Error in expression: \"" << e.what() << "\"" << endl;
+ continue;
+ }
+ int code = regcompA(&r, s1.c_str(), boost::REG_PERL);
+ if(code != 0)
+ {
+ char buf[256];
+ regerrorA(code, &r, buf, 256);
+ cout << "regcompA error: \"" << buf << "\"" << endl;
+ continue;
+ }
+ nsubs = r.re_nsub + 1;
+ matches.reset(new boost::regmatch_t[nsubs]);
+
+ while(true)
+ {
+ cout << "Enter string to search (or \"quit\" to exit): ";
+ boost::getline(*p_in, s2);
+ if(argc == 2)
+ cout << endl << s2 << endl;
+ if(s2 == "quit")
+ break;
+
+#ifndef BOOST_NO_WREGEX
+ ws2.erase();
+ std::copy(s2.begin(), s2.end(), string_out_iterator<std::wstring>(ws2));
+#endif
+ ds.erase(ds.begin(), ds.end());
+ std::copy(s2.begin(), s2.end(), std::back_inserter(ds));
+
+ unsigned i;
+ iters = 10;
+ tim = 1.1;
+
+#if defined(_WIN32) && defined(BOOST_REGEX_USE_WIN32_LOCALE)
+ MSG msg;
+ PeekMessage(&msg, 0, 0, 0, 0);
+ Sleep(0);
+#endif
+
+ // cache load:
+ regex_search(s2, sm, ex);
+
+ // measure time interval for basic_regex<char>
+ do{
+ iters *= static_cast<unsigned>((tim > 0.001) ? (1.1/tim) : 100);
+ t.restart();
+ for(i =0; i < iters; ++i)
+ {
+ result = regex_search(s2, sm, ex);
+ }
+ tim = t.elapsed();
+ }while(tim < wait_time);
+
+ cout << "regex time: " << (tim * 1000000 / iters) << "us" << endl;
+ if(result)
+ {
+ for(i = 0; i < sm.size(); ++i)
+ {
+ ts = sm[i];
+ cout << "\tmatch " << i << ": \"";
+ cout << ts;
+ cout << "\" (matched=" << sm[i].matched << ")" << endl;
+ }
+ cout << "\tmatch $`: \"";
+ cout << std::string(sm[-1]);
+ cout << "\" (matched=" << sm[-1].matched << ")" << endl;
+ cout << "\tmatch $': \"";
+ cout << std::string(sm[-2]);
+ cout << "\" (matched=" << sm[-2].matched << ")" << endl << endl;
+ }
+
+#ifndef BOOST_NO_WREGEX
+ // measure time interval for boost::wregex
+ iters = 10;
+ tim = 1.1;
+ // cache load:
+ regex_search(ws2, wsm, wex);
+ do{
+ iters *= static_cast<unsigned>((tim > 0.001) ? (1.1/tim) : 100);
+ t.restart();
+ for(i = 0; i < iters; ++i)
+ {
+ result = regex_search(ws2, wsm, wex);
+ }
+ tim = t.elapsed();
+ }while(tim < wait_time);
+ cout << "wregex time: " << (tim * 1000000 / iters) << "us" << endl;
+ if(result)
+ {
+ std::wstring tw;
+ for(i = 0; i < wsm.size(); ++i)
+ {
+ tw.erase();
+ std::copy(wsm[i].first, wsm[i].second, string_out_iterator<std::wstring>(tw));
+ cout << "\tmatch " << i << ": \"" << tw;
+ cout << "\" (matched=" << sm[i].matched << ")" << endl;
+ }
+ cout << "\tmatch $`: \"";
+ tw.erase();
+ std::copy(wsm[-1].first, wsm[-1].second, string_out_iterator<std::wstring>(tw));
+ cout << tw;
+ cout << "\" (matched=" << sm[-1].matched << ")" << endl;
+ cout << "\tmatch $': \"";
+ tw.erase();
+ std::copy(wsm[-2].first, wsm[-2].second, string_out_iterator<std::wstring>(tw));
+ cout << tw;
+ cout << "\" (matched=" << sm[-2].matched << ")" << endl << endl;
+ }
+#endif
+
+ // measure time interval for basic_regex<char> using a deque
+ iters = 10;
+ tim = 1.1;
+ // cache load:
+ regex_search(ds.begin(), ds.end(), dm, ex);
+ do{
+ iters *= static_cast<unsigned>((tim > 0.001) ? (1.1/tim) : 100);
+ t.restart();
+ for(i = 0; i < iters; ++i)
+ {
+ result = regex_search(ds.begin(), ds.end(), dm, ex);
+ }
+ tim = t.elapsed();
+ }while(tim < wait_time);
+ cout << "regex time (search over std::deque<char>): " << (tim * 1000000 / iters) << "us" << endl;
+
+ if(result)
+ {
+ for(i = 0; i < dm.size(); ++i)
+ {
+ ts.erase();
+ std::copy(dm[i].first, dm[i].second, string_out_iterator<std::string>(ts));
+ cout << "\tmatch " << i << ": \"" << ts;
+ cout << "\" (matched=" << sm[i].matched << ")" << endl;
+ }
+ cout << "\tmatch $`: \"";
+ ts.erase();
+ std::copy(dm[-1].first, dm[-1].second, string_out_iterator<std::string>(ts));
+ cout << ts;
+ cout << "\" (matched=" << sm[-1].matched << ")" << endl;
+ cout << "\tmatch $': \"";
+ ts.erase();
+ std::copy(dm[-2].first, dm[-2].second, string_out_iterator<std::string>(ts));
+ cout << ts;
+ cout << "\" (matched=" << sm[-2].matched << ")" << endl << endl;
+ }
+
+ // measure time interval for POSIX matcher:
+ iters = 10;
+ tim = 1.1;
+ // cache load:
+ regexecA(&r, s2.c_str(), nsubs, matches.get(), 0);
+ do{
+ iters *= static_cast<unsigned>((tim > 0.001) ? (1.1/tim) : 100);
+ t.restart();
+ for(i = 0; i < iters; ++i)
+ {
+ result = regexecA(&r, s2.c_str(), nsubs, matches.get(), 0);
+ }
+ tim = t.elapsed();
+ }while(tim < wait_time);
+ cout << "POSIX regexecA time: " << (tim * 1000000 / iters) << "us" << endl;
+
+ if(result == 0)
+ {
+ for(i = 0; i < nsubs; ++i)
+ {
+ if(matches[i].rm_so >= 0)
+ {
+ ts.assign(s2.begin() + matches[i].rm_so, s2.begin() + matches[i].rm_eo);
+ cout << "\tmatch " << i << ": \"" << ts << "\" (matched=" << (matches[i].rm_so != -1) << ")"<< endl;
+ }
+ else
+ cout << "\tmatch " << i << ": \"\" (matched=" << (matches[i].rm_so != -1) << ")" << endl; // no match
+ }
+ cout << "\tmatch $`: \"";
+ ts.erase();
+ ts.assign(s2.begin(), s2.begin() + matches[0].rm_so);
+ cout << ts;
+ cout << "\" (matched=" << (matches[0].rm_so != 0) << ")" << endl;
+ cout << "\tmatch $': \"";
+ ts.erase();
+ ts.assign(s2.begin() + matches[0].rm_eo, s2.end());
+ cout << ts;
+ cout << "\" (matched=" << (matches[0].rm_eo != (int)s2.size()) << ")" << endl << endl;
+ }
+ }
+ regfreeA(&r);
+ }
+
+ return 0;
+}
+
+#if defined(_WIN32) && defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(UNDER_CE)
+#pragma comment(lib, "user32.lib")
+#endif
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/timer/vc6-stlport.mak b/src/boost/libs/regex/example/timer/vc6-stlport.mak
new file mode 100644
index 000000000..1b5f686dd
--- /dev/null
+++ b/src/boost/libs/regex/example/timer/vc6-stlport.mak
@@ -0,0 +1,39 @@
+# copyright John Maddock 2003
+# 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.
+#
+# very basic VC6 makefile for timer
+#
+CXX=cl
+CXXFLAGS=/Oityb1 /GF /Gy -MT -GX -DSTRICT -I../../../../ -I./
+LIBS=/link /LIBPATH:..\..\build\vc6-stlport kernel32.lib user32.lib
+EXE=.exe
+OBJ=.obj
+
+LIBDEP= ../../../../boost/regex/detail/regex_options.hpp ../../../../boost/regex/detail/regex_config.hpp
+
+regex_timer$(EXE) : regex_timer$(OBJ)
+ $(CXX) -o timer$(EXE) regex_timer$(OBJ) $(LIBS)
+
+regex_timer$(OBJ) : regex_timer.cpp $(LIBDEP)
+ $(CXX) -c $(CXXFLAGS) regex_timer.cpp
+
+timer$(OBJ) : ../../../timer/timer.cpp $(LIBDEP)
+ $(CXX) -c $(CXXFLAGS) ../../../timer/timer.cpp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/example/timer/vc6.mak b/src/boost/libs/regex/example/timer/vc6.mak
new file mode 100644
index 000000000..c611195fa
--- /dev/null
+++ b/src/boost/libs/regex/example/timer/vc6.mak
@@ -0,0 +1,39 @@
+# copyright John Maddock 2003
+# 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.
+#
+# very basic VC6 makefile for timer
+#
+CXX=cl
+CXXFLAGS=/Oityb1 /GF /Gy -GX -DSTRICT -I../../../../ -I./
+LIBS=/link /LIBPATH:..\..\build\vc6
+EXE=.exe
+OBJ=.obj
+
+LIBDEP= ../../../../boost/regex/detail/regex_options.hpp ../../../../boost/regex/detail/regex_config.hpp
+
+regex_timer$(EXE) : regex_timer$(OBJ)
+ $(CXX) -o timer$(EXE) regex_timer$(OBJ) $(LIBS)
+
+regex_timer$(OBJ) : regex_timer.cpp $(LIBDEP)
+ $(CXX) -c $(CXXFLAGS) regex_timer.cpp
+
+timer$(OBJ) : ../../../timer/timer.cpp $(LIBDEP)
+ $(CXX) -c $(CXXFLAGS) ../../../timer/timer.cpp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/index.html b/src/boost/libs/regex/index.html
new file mode 100644
index 000000000..df7430bd0
--- /dev/null
+++ b/src/boost/libs/regex/index.html
@@ -0,0 +1,15 @@
+<html>
+ <head>
+ <meta http-equiv="refresh" content="0; URL=doc/html/index.html">
+ </head>
+ <body>
+ <P>
+ Automatic redirection failed, please go to <a href="doc/html/index.html">doc/html/index.html</a>.
+ </P>
+ <P>Copyright&nbsp;John Maddock 2001</P>
+ <P>Distributed under the Boost Software License, Version 1.0. (See accompanying file <A href="../../LICENSE_1_0.txt">
+ LICENSE_1_0.txt</A> or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</A>).</P>
+ </body>
+</html>
+
+
diff --git a/src/boost/libs/regex/meta/libraries.json b/src/boost/libs/regex/meta/libraries.json
new file mode 100644
index 000000000..a2aadf92d
--- /dev/null
+++ b/src/boost/libs/regex/meta/libraries.json
@@ -0,0 +1,17 @@
+{
+ "key": "regex",
+ "name": "Regex",
+ "authors": [
+ "John Maddock"
+ ],
+ "description": "Regular expression library.",
+ "std": [
+ "tr1"
+ ],
+ "category": [
+ "String"
+ ],
+ "maintainers": [
+ "John Maddock <john -at- johnmaddock.co.uk>"
+ ]
+}
diff --git a/src/boost/libs/regex/performance/Jamfile.v2 b/src/boost/libs/regex/performance/Jamfile.v2
new file mode 100644
index 000000000..63dfee348
--- /dev/null
+++ b/src/boost/libs/regex/performance/Jamfile.v2
@@ -0,0 +1,70 @@
+# Copyright Daryle Walker, Hubert Holin, John Maddock 2006 - 2007
+# copyright Paul A. Bristow 2006 - 2010
+# 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.
+# \math_toolkit\libs\math\test\jamfile.v2
+# Runs all math toolkit tests, functions & distributions,
+# and build math examples.
+
+# bring in the rules for testing
+import testing ;
+import modules ;
+import path ;
+import pch ;
+using quickbook ;
+using auto-index ;
+
+path-constant images_location : html ;
+path-constant here : . ;
+
+lib pcre2-8 ;
+lib re2 ;
+
+exe has_pcre2 : config/pcre.cpp pcre2-8 : <include>third_party <dll-path>third_party <library-path>third_party release ;
+explicit has_pcre2 ;
+exe has_posix : config/posix.cpp : release ;
+explicit has_posix ;
+exe has_re2 : config/re2.cpp : release <source>re2 <include>third_party <dll-path>third_party <library-path>third_party ;
+explicit has_re2 ;
+
+run [ glob *.cpp ] /boost/regex//boost_regex /boost/system /boost/chrono /boost/filesystem
+ : : :
+ release
+ [ check-target-builds has_pcre2 : <define>TEST_PCRE2 <source>pcre2-8 ]
+ [ check-target-builds has_posix : <define>TEST_POSIX ]
+ [ check-target-builds has_re2 : <define>TEST_RE2 <source>re2 <include>third_party <dll-path>third_party <library-path>third_party ]
+ <include>third_party
+ <dll-path>third_party
+ <library-path>third_party
+ : performance ;
+
+
+xml report : doc/report.qbk : <dependency>performance ;
+boostbook standalone
+ :
+ report
+ :
+ # Path for links to Boost:
+ <xsl:param>boost.root=../../../..
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+ <xsl:param>html.stylesheet=../../../../doc/src/boostbook.css
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=0
+ # Don't put the first section on the same page as the TOC:
+ <xsl:param>chunk.first.sections=0
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=2
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=4
+ # How far down we go with TOC's
+ <xsl:param>generate.section.toc.level=10
+ ;
+
diff --git a/src/boost/libs/regex/performance/boost.cpp b/src/boost/libs/regex/performance/boost.cpp
new file mode 100644
index 000000000..dfff9ecac
--- /dev/null
+++ b/src/boost/libs/regex/performance/boost.cpp
@@ -0,0 +1,62 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#include "performance.hpp"
+#include <boost/regex.hpp>
+#include <boost/version.hpp>
+#include <boost/lexical_cast.hpp>
+
+struct boost_regex : public abstract_regex
+{
+private:
+ boost::regex e;
+ boost::cmatch what;
+public:
+ virtual bool set_expression(const char* pe, bool isperl)
+ {
+ e.assign(pe, isperl ? boost::regex::perl : boost::regex::extended);
+ return e.status() == 0;
+ }
+ virtual bool match_test(const char* text);
+ virtual unsigned find_all(const char* text);
+ virtual std::string name();
+
+ struct initializer
+ {
+ initializer()
+ {
+ boost_regex::register_instance(boost::shared_ptr<abstract_regex>(new boost_regex));
+ }
+ void do_nothing()const {}
+ };
+ static const initializer init;
+};
+
+const boost_regex::initializer boost_regex::init;
+
+
+bool boost_regex::match_test(const char * text)
+{
+ return regex_match(text, what, e);
+}
+
+unsigned boost_regex::find_all(const char * text)
+{
+ boost::regex_iterator<const char*> i(text, text + std::strlen(text), e), j;
+ unsigned count = 0;
+ while(i != j)
+ {
+ ++i;
+ ++count;
+ }
+ return count;
+}
+
+std::string boost_regex::name()
+{
+ init.do_nothing();
+ return boost_name();
+}
diff --git a/src/boost/libs/regex/performance/config/pcre.cpp b/src/boost/libs/regex/performance/config/pcre.cpp
new file mode 100644
index 000000000..36e19ea9b
--- /dev/null
+++ b/src/boost/libs/regex/performance/config/pcre.cpp
@@ -0,0 +1,17 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#define PCRE2_STATIC
+#define PCRE2_CODE_UNIT_WIDTH 8
+
+#include <pcre2.h>
+
+int main()
+{
+ pcre2_match_data* pdata = pcre2_match_data_create(30, NULL);
+ pcre2_match_data_free(pdata);
+ return 0;
+}
diff --git a/src/boost/libs/regex/performance/config/posix.cpp b/src/boost/libs/regex/performance/config/posix.cpp
new file mode 100644
index 000000000..26ac6d625
--- /dev/null
+++ b/src/boost/libs/regex/performance/config/posix.cpp
@@ -0,0 +1,15 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#include <regex.h>
+
+int main()
+{
+ regex_t pe;
+ int r = regcomp(&pe, "foo", REG_EXTENDED);
+ regfree(&pe);
+ return r;
+}
diff --git a/src/boost/libs/regex/performance/config/re2.cpp b/src/boost/libs/regex/performance/config/re2.cpp
new file mode 100644
index 000000000..98b109169
--- /dev/null
+++ b/src/boost/libs/regex/performance/config/re2.cpp
@@ -0,0 +1,12 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#include <re2.h>
+
+int main()
+{
+ return re2::RE2::FullMatch("a", "a") ? 0 : 1;
+}
diff --git a/src/boost/libs/regex/performance/pcre.cpp b/src/boost/libs/regex/performance/pcre.cpp
new file mode 100644
index 000000000..878a5cad9
--- /dev/null
+++ b/src/boost/libs/regex/performance/pcre.cpp
@@ -0,0 +1,95 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#ifdef TEST_PCRE2
+
+#define PCRE2_STATIC
+#define PCRE2_CODE_UNIT_WIDTH 8
+
+#include "performance.hpp"
+#include <pcre2.h>
+#include <boost/version.hpp>
+#include <boost/lexical_cast.hpp>
+
+struct pcre_regex : public abstract_regex
+{
+private:
+ pcre2_code* pe;
+ pcre2_match_data* pdata;
+public:
+ pcre_regex()
+ : pe(0)
+ {
+ pdata = pcre2_match_data_create(30, NULL);
+ }
+ ~pcre_regex()
+ {
+ if(pe)
+ pcre2_code_free(pe);
+ pcre2_match_data_free(pdata);
+ }
+ virtual bool set_expression(const char* pat, bool isperl)
+ {
+ if(!isperl)
+ return false;
+ if(pe)
+ pcre2_code_free(pe);
+ int errorcode = 0;
+ PCRE2_SIZE erroroffset;
+ pe = pcre2_compile((PCRE2_SPTR)pat, std::strlen(pat), PCRE2_MULTILINE, &errorcode, &erroroffset, NULL);
+ return pe ? true : false;
+ }
+ virtual bool match_test(const char* text);
+ virtual unsigned find_all(const char* text);
+ virtual std::string name();
+
+ struct initializer
+ {
+ initializer()
+ {
+ pcre_regex::register_instance(boost::shared_ptr<abstract_regex>(new pcre_regex));
+ }
+ void do_nothing()const {}
+ };
+ static const initializer init;
+};
+
+const pcre_regex::initializer pcre_regex::init;
+
+
+bool pcre_regex::match_test(const char * text)
+{
+ int r = pcre2_match(pe, (PCRE2_SPTR)text, std::strlen(text), 0, PCRE2_ANCHORED, pdata, NULL);
+ return r >= 0;
+}
+
+unsigned pcre_regex::find_all(const char * text)
+{
+ unsigned count = 0;
+ int flags = 0;
+ const char* end = text + std::strlen(text);
+ while(pcre2_match(pe, (PCRE2_SPTR)text, end - text, 0, flags, pdata, NULL) >= 0)
+ {
+ ++count;
+ PCRE2_SIZE* v = pcre2_get_ovector_pointer(pdata);
+ text += v[1];
+ if(v[0] == v[1])
+ ++text;
+ if(*text)
+ {
+ flags = *(text - 1) == '\n' ? 0 : PCRE2_NOTBOL;
+ }
+ }
+ return count;
+}
+
+std::string pcre_regex::name()
+{
+ init.do_nothing();
+ return std::string("PCRE-") + boost::lexical_cast<std::string>(PCRE2_MAJOR) + "." + boost::lexical_cast<std::string>(PCRE2_MINOR);
+}
+
+#endif
diff --git a/src/boost/libs/regex/performance/performance.cpp b/src/boost/libs/regex/performance/performance.cpp
new file mode 100644
index 000000000..798aa3309
--- /dev/null
+++ b/src/boost/libs/regex/performance/performance.cpp
@@ -0,0 +1,259 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#include "performance.hpp"
+#include <list>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <boost/chrono.hpp>
+#include <boost/detail/lightweight_main.hpp>
+#include <boost/regex.hpp>
+#include <boost/filesystem.hpp>
+
+void load_file(std::string& text, const char* file)
+{
+ std::deque<char> temp_copy;
+ std::ifstream is(file);
+ if(!is.good())
+ {
+ std::string msg("Unable to open file: \"");
+ msg.append(file);
+ msg.append("\"");
+ throw std::runtime_error(msg);
+ }
+ is.seekg(0, std::ios_base::end);
+ std::istream::pos_type pos = is.tellg();
+ is.seekg(0, std::ios_base::beg);
+ text.erase();
+ text.reserve(pos);
+ std::istreambuf_iterator<char> it(is);
+ std::copy(it, std::istreambuf_iterator<char>(), std::back_inserter(text));
+}
+
+
+typedef std::list<boost::shared_ptr<abstract_regex> > list_type;
+
+list_type& engines()
+{
+ static list_type l;
+ return l;
+}
+
+void abstract_regex::register_instance(boost::shared_ptr<abstract_regex> item)
+{
+ engines().push_back(item);
+}
+
+template <class Clock>
+struct stopwatch
+{
+ typedef typename Clock::duration duration;
+ stopwatch()
+ {
+ m_start = Clock::now();
+ }
+ duration elapsed()
+ {
+ return Clock::now() - m_start;
+ }
+ void reset()
+ {
+ m_start = Clock::now();
+ }
+
+private:
+ typename Clock::time_point m_start;
+};
+
+unsigned sum = 0;
+unsigned last_value_returned = 0;
+
+template <class Func>
+double exec_timed_test(Func f)
+{
+ double t = 0;
+ unsigned repeats = 1;
+ do {
+ stopwatch<boost::chrono::high_resolution_clock> w;
+
+ for(unsigned count = 0; count < repeats; ++count)
+ {
+ last_value_returned = f();
+ sum += last_value_returned;
+ }
+
+ t = boost::chrono::duration_cast<boost::chrono::duration<double>>(w.elapsed()).count();
+ if(t < 0.5)
+ repeats *= 2;
+ } while(t < 0.5);
+ return t / repeats;
+}
+
+
+std::string format_expression_as_quickbook(std::string s)
+{
+ static const boost::regex e("[`/_*=$^@#&%\\\\]");
+ static const boost::regex open_b("\\[");
+ static const boost::regex close_b("\\]");
+ s = regex_replace(s, e, "\\\\$0");
+ s = regex_replace(s, open_b, "\\\\u005B");
+ s = regex_replace(s, close_b, "\\\\u005D");
+ if(s.size() > 200)
+ {
+ s.erase(200);
+ s += " ...";
+ }
+ return "[^" + s + "]";
+}
+
+void test_match(const char* expression, const char* text, bool isperl = false)
+{
+ std::string table = "Testing simple " + (isperl ? std::string("Perl") : std::string("leftmost-longest")) + " matches (platform = " + platform_name() + ", compiler = " + compiler_name() + ")";
+ std::string row = format_expression_as_quickbook(expression);
+ row += "[br]";
+ row += format_expression_as_quickbook(text);
+ for(list_type::const_iterator i = engines().begin(); i != engines().end(); ++i)
+ {
+ std::string heading = (*i)->name();
+ if((*i)->set_expression(expression, isperl))
+ {
+ double time = exec_timed_test([&]() { return (*i)->match_test(text) ? 1 : 0; });
+ report_execution_time(time, table, row, heading);
+ }
+ }
+}
+
+void test_search(const char* expression, const char* text, bool isperl = false, const char* filename = 0)
+{
+ std::string table = "Testing " + (isperl ? std::string("Perl") : std::string("leftmost-longest")) + " searches (platform = " + platform_name() + ", compiler = " + compiler_name() + ")";
+ std::string row = format_expression_as_quickbook(expression);
+ row += "[br]";
+ if(filename)
+ {
+ row += "In file: ";
+ row += filename;
+ }
+ else
+ {
+ row += format_expression_as_quickbook(text);
+ }
+ for(list_type::const_iterator i = engines().begin(); i != engines().end(); ++i)
+ {
+ std::string heading = (*i)->name();
+ if((*i)->set_expression(expression, isperl))
+ {
+ double time = exec_timed_test([&]() { return (*i)->find_all(text); });
+ report_execution_time(time, table, row, heading);
+ std::cout << "Search with library: " << heading << " found " << last_value_returned << " occurances.\n";
+ }
+ }
+}
+
+int cpp_main(int argc, char* argv[])
+{
+ boost::filesystem::path here(__FILE__);
+ here = here.parent_path().parent_path().parent_path().parent_path();
+
+ boost::filesystem::path cpp_file = here / "boost";
+ cpp_file /= "crc.hpp";
+
+ // start with a simple test, this is basically a measure of the minimal overhead
+ // involved in calling a regex matcher:
+ test_match("abc", "abc");
+ // these are from the regex docs:
+ test_match("^([0-9]+)(\\-| |$)(.*)$", "100- this is a line of ftp response which contains a message string");
+ test_match("([[:digit:]]{4}[- ]){3}[[:digit:]]{3,4}", "1234-5678-1234-456");
+ // these are from http://www.regxlib.com/
+ test_match("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", "john@johnmaddock.co.uk");
+ test_match("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", "foo12@foo.edu");
+ test_match("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", "bob.smith@foo.tv");
+ test_match("^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$", "EH10 2QQ");
+ test_match("^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$", "G1 1AA");
+ test_match("^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$", "SW1 1ZZ");
+ test_match("^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$", "4/1/2001");
+ test_match("^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$", "12/12/2001");
+ test_match("^[-+]?[[:digit:]]*\\.?[[:digit:]]*$", "123");
+ test_match("^[-+]?[[:digit:]]*\\.?[[:digit:]]*$", "+3.14159");
+ test_match("^[-+]?[[:digit:]]*\\.?[[:digit:]]*$", "-3.14159");
+
+ // start with a simple test, this is basically a measure of the minimal overhead
+ // involved in calling a regex matcher:
+ test_match("abc", "abc", true);
+ // these are from the regex docs:
+ test_match("^([0-9]+)(\\-| |$)(.*)$", "100- this is a line of ftp response which contains a message string", true);
+ test_match("([[:digit:]]{4}[- ]){3}[[:digit:]]{3,4}", "1234-5678-1234-456", true);
+ // these are from http://www.regxlib.com/
+ test_match("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", "john@johnmaddock.co.uk", true);
+ test_match("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", "foo12@foo.edu", true);
+ test_match("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", "bob.smith@foo.tv", true);
+ test_match("^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$", "EH10 2QQ", true);
+ test_match("^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$", "G1 1AA", true);
+ test_match("^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$", "SW1 1ZZ", true);
+ test_match("^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$", "4/1/2001", true);
+ test_match("^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$", "12/12/2001", true);
+ test_match("^[-+]?[[:digit:]]*\\.?[[:digit:]]*$", "123", true);
+ test_match("^[-+]?[[:digit:]]*\\.?[[:digit:]]*$", "+3.14159", true);
+ test_match("^[-+]?[[:digit:]]*\\.?[[:digit:]]*$", "-3.14159", true);
+
+ std::string file_contents;
+
+ const char* highlight_expression = // preprocessor directives: index 1
+ "(^[ \\t]*#(?:(?>[^\\\\\\n]+)|\\\\(?>\\s*\\n|.))*)|";
+ // comment: index 2
+ "(//[^\\n]*|/\\*.*?\\*/)|"
+ // literals: index 3
+ "\\<([+-]?(?:(?:0x[[:xdigit:]]+)|(?:(?:[[:digit:]]*\\.)?[[:digit:]]+(?:[eE][+-]?[[:digit:]]+)?))u?(?:(?:int(?:8|16|32|64))|L)?)\\>|"
+ // string literals: index 4
+ "('(?:[^\\\\']|\\\\.)*'|\"(?:[^\\\\\"]|\\\\.)*\")|"
+ // keywords: index 5
+ "\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import"
+ "|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall"
+ "|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool"
+ "|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete"
+ "|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto"
+ "|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected"
+ "|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast"
+ "|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned"
+ "|using|virtual|void|volatile|wchar_t|while)\\>"
+ ;
+ const char* class_expression = "(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
+ "(class|struct)[[:space:]]*(\\w+([ \t]*\\([^)]*\\))?"
+ "[[:space:]]*)*(\\w*)[[:space:]]*(<[^;:{]+>[[:space:]]*)?"
+ "(\\{|:[^;\\{()]*\\{)";
+ const char* call_expression = "\\w+\\s*(\\([^()]++(?:(?1)[^()]++)*+[^)]*\\))";
+
+ const char* include_expression = "^[ \t]*#[ \t]*include[ \t]+(\"[^\"]+\"|<[^>]+>)";
+ const char* boost_include_expression = "^[ \t]*#[ \t]*include[ \t]+(\"boost/[^\"]+\"|<boost/[^>]+>)";
+ const char* brace_expression = "\\{[^{}]++((?0)[^{}]++)*+[^}]*+\\}";
+ const char* function_with_body_expression = "(\\w+)\\s*(\\([^()]++(?:(?2)[^()]++)*+[^)]*\\))\\s*(\\{[^{}]++((?3)[^{}]++)*+[^}]*+\\})";
+
+
+ load_file(file_contents, "../../../libs/libraries.htm");
+ test_search("Beman|John|Dave", file_contents.c_str(), false, "../../../libs/libraries.htm");
+ test_search("Beman|John|Dave", file_contents.c_str(), true, "../../../libs/libraries.htm");
+ test_search("(?i)<p>.*?</p>", file_contents.c_str(), true, "../../../libs/libraries.htm");
+ test_search("<a[^>]+href=(\"[^\"]*\"|[^[:space:]]+)[^>]*>", file_contents.c_str(), false, "../../../libs/libraries.htm");
+ test_search("(?i)<a[^>]+href=(\"[^\"]*\"|[^[:space:]]+)[^>]*>", file_contents.c_str(), true, "../../../libs/libraries.htm");
+ test_search("(?i)<h[12345678][^>]*>.*?</h[12345678]>", file_contents.c_str(), true, "../../../libs/libraries.htm");
+ test_search("<img[^>]+src=(\"[^\"]*\"|[^[:space:]]+)[^>]*>", file_contents.c_str(), false, "../../../libs/libraries.htm");
+ test_search("(?i)<img[^>]+src=(\"[^\"]*\"|[^[:space:]]+)[^>]*>", file_contents.c_str(), true, "../../../libs/libraries.htm");
+ test_search("(?i)<font[^>]+face=(\"[^\"]*\"|[^[:space:]]+)[^>]*>.*?</font>", file_contents.c_str(), true, "../../../libs/libraries.htm");
+
+
+ load_file(file_contents, "../../../boost/multiprecision/number.hpp");
+
+ test_search(function_with_body_expression, file_contents.c_str(), true, "boost/multiprecision/number.hpp");
+ test_search(brace_expression, file_contents.c_str(), true, "boost/multiprecision/number.hpp");
+ test_search(call_expression, file_contents.c_str(), true, "boost/multiprecision/number.hpp");
+ test_search(highlight_expression, file_contents.c_str(), true, "boost/multiprecision/number.hpp");
+ test_search(class_expression, file_contents.c_str(), true, "boost/multiprecision/number.hpp");
+ test_search(include_expression, file_contents.c_str(), true, "boost/multiprecision/number.hpp");
+ test_search(boost_include_expression, file_contents.c_str(), true, "boost/multiprecision/number.hpp");
+
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/performance/performance.hpp b/src/boost/libs/regex/performance/performance.hpp
new file mode 100644
index 000000000..627065a68
--- /dev/null
+++ b/src/boost/libs/regex/performance/performance.hpp
@@ -0,0 +1,30 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#ifndef BOOST_REGEX_PERFRMANCE_HPP
+#define BOOST_REGEX_PERFRMANCE_HPP
+
+#include <string>
+#include <boost/shared_ptr.hpp>
+
+struct abstract_regex
+{
+ virtual bool set_expression(const char*, bool isperl) = 0;
+ virtual bool match_test(const char* text) = 0;
+ virtual unsigned find_all(const char* text) = 0;
+ virtual std::string name() = 0;
+ static void register_instance(boost::shared_ptr<abstract_regex> item);
+};
+
+void report_execution_time(double t, std::string table, std::string row, std::string heading);
+std::string boost_name();
+std::string compiler_name();
+std::string platform_name();
+
+
+#endif
+
+
diff --git a/src/boost/libs/regex/performance/posix.cpp b/src/boost/libs/regex/performance/posix.cpp
new file mode 100644
index 000000000..37f2a8d6e
--- /dev/null
+++ b/src/boost/libs/regex/performance/posix.cpp
@@ -0,0 +1,97 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#ifdef TEST_POSIX
+
+#include "performance.hpp"
+#include <boost/lexical_cast.hpp>
+
+#include <regex.h>
+
+struct posix_regex : public abstract_regex
+{
+private:
+ regex_t pe, pe2;
+ bool init;
+public:
+ posix_regex() : init(false) {}
+ ~posix_regex()
+ {
+ if(init)
+ {
+ regfree(&pe);
+ regfree(&pe2);
+ }
+ }
+ virtual bool set_expression(const char* pat, bool isperl)
+ {
+ if(isperl)
+ return false;
+ if(init)
+ {
+ regfree(&pe);
+ regfree(&pe2);
+ }
+ else
+ init = true;
+ int r = regcomp(&pe, pat, REG_EXTENDED);
+ std::string s(pat);
+ if(s.size() && (s[0] != '^'))
+ s.insert(0, 1, '^');
+ if(s.size() && (*s.rbegin() != '$'))
+ s.append("$");
+ r |= regcomp(&pe2, s.c_str(), REG_EXTENDED);
+ return r ? false : true;
+ }
+ virtual bool match_test(const char* text);
+ virtual unsigned find_all(const char* text);
+ virtual std::string name();
+
+ struct initializer
+ {
+ initializer()
+ {
+ posix_regex::register_instance(boost::shared_ptr<abstract_regex>(new posix_regex));
+ }
+ void do_nothing()const {}
+ };
+ static const initializer init2;
+};
+
+const posix_regex::initializer posix_regex::init2;
+
+
+bool posix_regex::match_test(const char * text)
+{
+ regmatch_t m[30];
+ int r = regexec(&pe2, text, 30, m, 0);
+ return r == 0;
+}
+
+unsigned posix_regex::find_all(const char * text)
+{
+ unsigned count = 0;
+ regmatch_t m[30];
+ int flags = 0;
+ while(regexec(&pe, text, 30, m, flags) == 0)
+ {
+ ++count;
+ text += m[0].rm_eo;
+ if(m[0].rm_eo - m[0].rm_so)
+ flags = *(text - 1) == '\n' ? 0 : REG_NOTBOL;
+ else
+ flags = 0;
+ }
+ return 0;
+}
+
+std::string posix_regex::name()
+{
+ init2.do_nothing();
+ return "POSIX";
+}
+
+#endif
diff --git a/src/boost/libs/regex/performance/re2.cpp b/src/boost/libs/regex/performance/re2.cpp
new file mode 100644
index 000000000..2ddf1aaf3
--- /dev/null
+++ b/src/boost/libs/regex/performance/re2.cpp
@@ -0,0 +1,71 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#ifdef TEST_RE2
+
+#include "performance.hpp"
+#include <boost/scoped_ptr.hpp>
+#include <re2.h>
+
+using namespace re2;
+
+struct re2_regex : public abstract_regex
+{
+private:
+ boost::scoped_ptr<RE2> pat;
+public:
+ re2_regex() {}
+ ~re2_regex(){}
+ virtual bool set_expression(const char* pp, bool isperl)
+ {
+ if(!isperl)
+ return false;
+ std::string s("(?m)");
+ s += pp;
+ pat.reset(new RE2(s));
+ return pat->ok();
+ }
+ virtual bool match_test(const char* text);
+ virtual unsigned find_all(const char* text);
+ virtual std::string name();
+
+ struct initializer
+ {
+ initializer()
+ {
+ re2_regex::register_instance(boost::shared_ptr<abstract_regex>(new re2_regex));
+ }
+ void do_nothing()const {}
+ };
+ static const initializer init;
+};
+
+const re2_regex::initializer re2_regex::init;
+
+
+bool re2_regex::match_test(const char * text)
+{
+ return RE2::FullMatch(text, *pat);
+}
+
+unsigned re2_regex::find_all(const char * text)
+{
+ unsigned count = 0;
+ StringPiece input(text);
+ while(RE2::FindAndConsume(&input, *pat))
+ {
+ ++count;
+ }
+ return count;
+}
+
+std::string re2_regex::name()
+{
+ init.do_nothing();
+ return "RE2";
+}
+
+#endif
diff --git a/src/boost/libs/regex/performance/std.cpp b/src/boost/libs/regex/performance/std.cpp
new file mode 100644
index 000000000..9294acefb
--- /dev/null
+++ b/src/boost/libs/regex/performance/std.cpp
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#include <boost/config.hpp>
+
+#ifndef BOOST_NO_CXX11_HDR_REGEX
+
+#include "performance.hpp"
+#include <regex>
+
+struct std_regex : public abstract_regex
+{
+private:
+ std::regex e;
+ std::cmatch what;
+public:
+ virtual bool set_expression(const char* pe, bool isperl)
+ {
+ try
+ {
+ e.assign(pe, isperl ? std::regex::ECMAScript : std::regex::extended);
+ }
+ catch(const std::exception&)
+ {
+ return false;
+ }
+ return true;
+ }
+ virtual bool match_test(const char* text);
+ virtual unsigned find_all(const char* text);
+ virtual std::string name();
+
+ struct initializer
+ {
+ initializer()
+ {
+ std_regex::register_instance(boost::shared_ptr<abstract_regex>(new std_regex));
+ }
+ void do_nothing()const {}
+ };
+ static const initializer init;
+};
+
+const std_regex::initializer std_regex::init;
+
+
+bool std_regex::match_test(const char * text)
+{
+ return regex_match(text, what, e);
+}
+
+unsigned std_regex::find_all(const char * text)
+{
+ std::regex_iterator<const char*> i(text, text + std::strlen(text), e), j;
+ unsigned count = 0;
+ while(i != j)
+ {
+ ++i;
+ ++count;
+ }
+ return count;
+}
+
+std::string std_regex::name()
+{
+ init.do_nothing();
+ return "std::regex";
+}
+
+#endif
diff --git a/src/boost/libs/regex/performance/table_helper.cpp b/src/boost/libs/regex/performance/table_helper.cpp
new file mode 100644
index 000000000..2ff40f1f0
--- /dev/null
+++ b/src/boost/libs/regex/performance/table_helper.cpp
@@ -0,0 +1,420 @@
+// Copyright John Maddock 2015.
+// 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)
+
+#ifdef _MSC_VER
+# pragma warning (disable : 4224)
+#endif
+
+#include <boost/regex.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+#include <boost/container_hash/hash.hpp>
+#include <vector>
+#include <set>
+#include <iostream>
+#include <sstream>
+#include <iomanip>
+
+std::vector<std::vector<double> > data;
+
+inline std::string sanitize_string(const std::string& s)
+{
+ static const boost::regex e("[^a-zA-Z0-9]+");
+ std::string result = boost::regex_replace(s, e, "_");
+ while(result[0] == '_')
+ result.erase(0);
+ return result;
+}
+
+inline std::string sanitize_short_string(const std::string& s)
+{
+ unsigned id = boost::hash<std::string>()(s);
+ return sanitize_string("id" + boost::lexical_cast<std::string>(id));
+}
+
+std::string format_precision(double val, int digits)
+{
+ std::stringstream ss;
+ ss << std::setprecision(digits);
+ ss << std::fixed;
+ ss << val;
+ return ss.str();
+}
+
+static std::string content;
+boost::filesystem::path path_to_content;
+
+struct content_loader
+{
+ content_loader()
+ {
+ boost::filesystem::path p(__FILE__);
+ p = p.parent_path();
+ p /= "doc";
+ p /= "performance_tables.qbk";
+ path_to_content = p;
+ if(boost::filesystem::exists(p))
+ {
+ boost::filesystem::ifstream is(p);
+ if(is.good())
+ {
+ do
+ {
+ char c = static_cast<char>(is.get());
+ if(c != EOF)
+ content.append(1, c);
+ } while(is.good());
+ }
+ }
+ }
+ ~content_loader()
+ {
+ boost::filesystem::ofstream os(path_to_content);
+ os << content;
+ }
+ void instantiate()const
+ {
+ }
+};
+
+static const content_loader loader;
+
+void load_table(std::vector<std::vector<std::string> >& table, std::string::const_iterator begin, std::string::const_iterator end)
+{
+ static const boost::regex item_e(
+ "\\["
+ "([^\\[\\]]*(?0)?)*"
+ "\\]"
+ );
+
+ boost::regex_token_iterator<std::string::const_iterator> i(begin, end, item_e), j;
+
+ while(i != j)
+ {
+ // Add a row:
+ table.push_back(std::vector<std::string>());
+ boost::regex_token_iterator<std::string::const_iterator> k(i->first + 1, i->second - 1, item_e);
+ while(k != j)
+ {
+ // Add a cell:
+ table.back().push_back(std::string(k->first + 1, k->second - 1));
+ ++k;
+ }
+ ++i;
+ }
+}
+
+std::string save_table(std::vector<std::vector<std::string> >& table)
+{
+ std::string result;
+
+ for(std::vector<std::vector<std::string> >::const_iterator i = table.begin(), j = table.end(); i != j; ++i)
+ {
+ result += "[";
+ for(std::vector<std::string>::const_iterator k = i->begin(), l = i->end(); k != l; ++k)
+ {
+ result += "[";
+ result += *k;
+ result += "]";
+ }
+ result += "]\n";
+ }
+ return result;
+}
+
+void add_to_all_sections(const std::string& id, std::string list_name = "performance_all_sections")
+{
+ std::string::size_type pos = content.find("[template " + list_name + "[]"), end_pos;
+ if(pos == std::string::npos)
+ {
+ //
+ // Just append to the end:
+ //
+ content.append("\n[template ").append(list_name).append("[]\n[").append(id).append("]\n]\n");
+ }
+ else
+ {
+ //
+ // Read in the all list of sections, add our new one (in alphabetical order),
+ // and then rewrite the whole thing:
+ //
+ static const boost::regex item_e(
+ "\\["
+ "((?=[^\\]])[^\\[\\]]*+(?0)?+)*+"
+ "\\]|\\]"
+ );
+ boost::regex_token_iterator<std::string::const_iterator> i(content.begin() + pos + 12 + list_name.size(), content.end(), item_e), j;
+ std::set<std::string> sections;
+ while(i != j)
+ {
+ if(i->length() == 1)
+ {
+ end_pos = i->first - content.begin();
+ break;
+ }
+ sections.insert(std::string(i->first + 1, i->second - 1));
+ ++i;
+ }
+ sections.insert(id);
+ std::string new_list = "\n";
+ for(std::set<std::string>::const_iterator sec = sections.begin(); sec != sections.end(); ++sec)
+ {
+ new_list += "[" + *sec + "]\n";
+ }
+ content.replace(pos + 12 + list_name.size(), end_pos - pos - 12 - list_name.size(), new_list);
+ }
+}
+
+std::string get_colour(boost::uintmax_t val, boost::uintmax_t best)
+{
+ if(val <= best * 1.2)
+ return "green";
+ if(val > best * 4)
+ return "red";
+ return "blue";
+}
+
+boost::intmax_t get_value_from_cell(const std::string& cell)
+{
+ static const boost::regex time_e("(\\d+)ns");
+ boost::smatch what;
+ if(regex_search(cell, what, time_e))
+ {
+ return boost::lexical_cast<boost::uintmax_t>(what.str(1));
+ }
+ return -1;
+}
+
+void add_cell(boost::intmax_t val, const std::string& table_name, const std::string& row_name, const std::string& column_heading)
+{
+ //
+ // Load the table, add our data, and re-write:
+ //
+ std::string table_id = "table_" + sanitize_string(table_name);
+ boost::regex table_e("\\[table:" + table_id
+ + "\\s(?:[^\\[]|\\\\.)++"
+ "((\\["
+ "((?:[^\\[\\]]|\\\\.)*+(?2)?+)*+"
+ "\\]\\s*+)*+\\s*+)"
+ "\\]"
+ );
+
+ boost::smatch table_location;
+ if(regex_search(content, table_location, table_e))
+ {
+ std::vector<std::vector<std::string> > table_data;
+ load_table(table_data, table_location[1].first, table_location[1].second);
+ //
+ // Figure out which column we're on:
+ //
+ unsigned column_id = 1001u;
+ for(unsigned i = 0; i < table_data[0].size(); ++i)
+ {
+ if(table_data[0][i] == column_heading)
+ {
+ column_id = i;
+ break;
+ }
+ }
+ if(column_id > 1000)
+ {
+ //
+ // Need a new column, must be adding a new compiler to the table!
+ //
+ table_data[0].push_back(column_heading);
+ for(unsigned i = 1; i < table_data.size(); ++i)
+ table_data[i].push_back(std::string());
+ column_id = table_data[0].size() - 1;
+ }
+ //
+ // Figure out the row:
+ //
+ unsigned row_id = 1001;
+ for(unsigned i = 1; i < table_data.size(); ++i)
+ {
+ if(table_data[i][0] == row_name)
+ {
+ row_id = i;
+ break;
+ }
+ }
+ if(row_id > 1000)
+ {
+ //
+ // Need a new row, add it now:
+ //
+ table_data.push_back(std::vector<std::string>());
+ table_data.back().push_back(row_name);
+ for(unsigned i = 1; i < table_data[0].size(); ++i)
+ table_data.back().push_back(std::string());
+ row_id = table_data.size() - 1;
+ }
+ //
+ // Find the best result in this row:
+ //
+ boost::uintmax_t best = (std::numeric_limits<boost::uintmax_t>::max)();
+ std::vector<boost::intmax_t> values;
+ for(unsigned i = 1; i < table_data[row_id].size(); ++i)
+ {
+ if(i == column_id)
+ {
+ if(val < best)
+ best = val;
+ values.push_back(val);
+ }
+ else
+ {
+ std::cout << "Existing cell value was " << table_data[row_id][i] << std::endl;
+ boost::uintmax_t cell_val = get_value_from_cell(table_data[row_id][i]);
+ std::cout << "Extracted value: " << cell_val << std::endl;
+ if(cell_val < best)
+ best = cell_val;
+ values.push_back(cell_val);
+ }
+ }
+ //
+ // Update the row:
+ //
+ for(unsigned i = 1; i < table_data[row_id].size(); ++i)
+ {
+ std::string& s = table_data[row_id][i];
+ s = "[role ";
+ if(values[i - 1] < 0)
+ {
+ s += "grey -]";
+ }
+ else
+ {
+ s += get_colour(values[i - 1], best);
+ s += " ";
+ s += format_precision(static_cast<double>(values[i - 1]) / best, 2);
+ s += "[br](";
+ s += boost::lexical_cast<std::string>(values[i - 1]) + "ns)]";
+ }
+ }
+ //
+ // Convert back to a string and insert into content:
+ std::sort(table_data.begin() + 1, table_data.end(), [](std::vector<std::string> const& a, std::vector<std::string> const& b) { return a[0] < b[0]; } );
+ std::string c = save_table(table_data);
+ content.replace(table_location.position(1), table_location.length(1), c);
+ }
+ else
+ {
+ //
+ // Create a new table and try again:
+ //
+ std::string new_table = "\n[template " + table_id;
+ new_table += "[]\n[table:" + table_id;
+ new_table += " ";
+ new_table += table_name;
+ new_table += "\n[[Expression[br]Text][";
+ new_table += column_heading;
+ new_table += "]]\n";
+ new_table += "[[";
+ new_table += row_name;
+ new_table += "][[role blue 1.00[br](";
+ new_table += boost::lexical_cast<std::string>(val);
+ new_table += "ns)]]]\n]\n]\n";
+
+ std::string::size_type pos = content.find("[/tables:]");
+ if(pos != std::string::npos)
+ content.insert(pos + 10, new_table);
+ else
+ content += "\n\n[/tables:]\n" + new_table;
+ //
+ // Add a section for this table as well:
+ //
+ std::string section_id = "section_" + sanitize_short_string(table_name);
+ if(content.find(section_id + "[]") == std::string::npos)
+ {
+ std::string new_section = "\n[template " + section_id + "[]\n[section:" + section_id + " " + table_name + "]\n[" + table_id + "]\n[endsect]\n]\n";
+ pos = content.find("[/sections:]");
+ if(pos != std::string::npos)
+ content.insert(pos + 12, new_section);
+ else
+ content += "\n\n[/sections:]\n" + new_section;
+ add_to_all_sections(section_id);
+ }
+ //
+ // Add to list of all tables (not in sections):
+ //
+ add_to_all_sections(table_id, "performance_all_tables");
+ }
+}
+
+void report_execution_time(double t, std::string table, std::string row, std::string heading)
+{
+ try {
+ add_cell(static_cast<boost::uintmax_t>(t / 1e-9), table, row, heading);
+ }
+ catch(const std::exception& e)
+ {
+ std::cout << "Error in adding cell: " << e.what() << std::endl;
+ throw;
+ }
+}
+
+std::string boost_name()
+{
+ return "boost " + boost::lexical_cast<std::string>(BOOST_VERSION / 100000) + "." + boost::lexical_cast<std::string>((BOOST_VERSION / 100) % 1000);
+}
+
+std::string compiler_name()
+{
+#ifdef COMPILER_NAME
+ return COMPILER_NAME;
+#else
+ return BOOST_COMPILER;
+#endif
+}
+
+std::string platform_name()
+{
+#ifdef _WIN32
+ return "Windows x64";
+#else
+ return BOOST_PLATFORM;
+#endif
+}
+
+
+std::string get_compiler_options_name()
+{
+#if defined(BOOST_MSVC) || defined(__ICL)
+ std::string result;
+#ifdef BOOST_MSVC
+ result = "cl ";
+#else
+ result = "icl ";
+#endif
+#ifdef _M_AMD64
+#ifdef __AVX__
+ result += "/arch:AVX /Ox";
+#else
+ result += "/Ox";
+#endif
+ result += " (x64 build)";
+#else
+#ifdef _DEBUG
+ result += "/Od";
+#elif defined(__AVX2__)
+ result += "/arch:AVX2 /Ox";
+#elif defined(__AVX__)
+ result += "/arch:AVX /Ox";
+#elif _M_IX86_FP == 2
+ result += "/arch:sse2 /Ox";
+#else
+ result += "/arch:ia32 /Ox";
+#endif
+ result += " (x86 build)";
+#endif
+ std::cout << "Compiler options are found as: " << result << std::endl;
+ return result;
+#else
+ return "Unknown";
+#endif
+}
+
diff --git a/src/boost/libs/regex/performance/third_party/readme.txt b/src/boost/libs/regex/performance/third_party/readme.txt
new file mode 100644
index 000000000..8e95e9179
--- /dev/null
+++ b/src/boost/libs/regex/performance/third_party/readme.txt
@@ -0,0 +1,3 @@
+Place third party headers and libraries in this directory to have them built as part of the performance test application.
+
+Or install in your compiler's search paths if you prefer. \ No newline at end of file
diff --git a/src/boost/libs/regex/performance/xpressive.cpp b/src/boost/libs/regex/performance/xpressive.cpp
new file mode 100644
index 000000000..22b57cfcd
--- /dev/null
+++ b/src/boost/libs/regex/performance/xpressive.cpp
@@ -0,0 +1,74 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2015 John Maddock. 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_
+//
+
+#include <boost/config.hpp>
+
+#include "performance.hpp"
+#include <boost/xpressive/xpressive.hpp>
+
+using namespace boost::xpressive;
+
+struct xpressive_regex : public abstract_regex
+{
+private:
+ cregex e;
+ cmatch what;
+public:
+ virtual bool set_expression(const char* pe, bool isperl)
+ {
+ if(!isperl)
+ return false;
+ try
+ {
+ e = cregex::compile(pe, regex_constants::ECMAScript);
+ }
+ catch(const std::exception&)
+ {
+ return false;
+ }
+ return true;
+ }
+ virtual bool match_test(const char* text);
+ virtual unsigned find_all(const char* text);
+ virtual std::string name();
+
+ struct initializer
+ {
+ initializer()
+ {
+ xpressive_regex::register_instance(boost::shared_ptr<abstract_regex>(new xpressive_regex));
+ }
+ void do_nothing()const {}
+ };
+ static const initializer init;
+};
+
+const xpressive_regex::initializer xpressive_regex::init;
+
+
+bool xpressive_regex::match_test(const char * text)
+{
+ return regex_match(text, what, e);
+}
+
+unsigned xpressive_regex::find_all(const char * text)
+{
+ cregex_token_iterator i(text, text + std::strlen(text), e), j;
+ unsigned count = 0;
+ while(i != j)
+ {
+ ++i;
+ ++count;
+ }
+ return count;
+}
+
+std::string xpressive_regex::name()
+{
+ init.do_nothing();
+ return "boost::xpressive::cregex";
+}
+
diff --git a/src/boost/libs/regex/readme.txt b/src/boost/libs/regex/readme.txt
new file mode 100644
index 000000000..f028bd33d
--- /dev/null
+++ b/src/boost/libs/regex/readme.txt
@@ -0,0 +1,21 @@
+Copyright (c) 1998-2003
+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)
+
+************************************************************************
+
+Full instructions for use of this library can be accessed from
+libs/regex/docs/index.html
+
+Installation instructions and library overview is are in
+libs/regex/docs/introduction.html
+
+This library is part of boost (see www.boost.org), the latest version
+of the library is available from the boost web site, or development
+snapshots from the boost cvs repository at
+http://sourceforge.net/project/?group_id=7586
+
+
diff --git a/src/boost/libs/regex/src/c_regex_traits.cpp b/src/boost/libs/regex/src/c_regex_traits.cpp
new file mode 100644
index 000000000..a0b52ee4e
--- /dev/null
+++ b/src/boost/libs/regex/src/c_regex_traits.cpp
@@ -0,0 +1,206 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: c_regex_traits.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Implements out of line c_regex_traits<char> members
+ */
+
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+#include "internals.hpp"
+
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+
+#include <boost/regex/v4/c_regex_traits.hpp>
+#include <boost/regex/v4/primary_transform.hpp>
+#include <boost/regex/v4/regex_traits_defaults.hpp>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::strxfrm; using ::isspace;
+ using ::ispunct; using ::isalpha;
+ using ::isalnum; using ::iscntrl;
+ using ::isprint; using ::isupper;
+ using ::islower; using ::isdigit;
+ using ::isxdigit; using ::strtol;
+}
+#endif
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost{
+
+c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transform(const char* p1, const char* p2)
+{
+ std::string result(10, ' ');
+ std::size_t s = result.size();
+ std::size_t r;
+ std::string src(p1, p2);
+ while(s < (r = std::strxfrm(&*result.begin(), src.c_str(), s)))
+ {
+#if defined(_CPPLIB_VER)
+ //
+ // A bug in VC11 and 12 causes the program to hang if we pass a null-string
+ // to std::strxfrm, but only for certain locales :-(
+ // Probably effects Intel and Clang or any compiler using the VC std library (Dinkumware).
+ //
+ if(r == INT_MAX)
+ {
+ result.erase();
+ result.insert(result.begin(), static_cast<char>(0));
+ return result;
+ }
+#endif
+ result.append(r - s + 3, ' ');
+ s = result.size();
+ }
+ result.erase(r);
+ return result;
+}
+
+c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transform_primary(const char* p1, const char* p2)
+{
+ static char s_delim;
+ static const int s_collate_type = ::boost::BOOST_REGEX_DETAIL_NS::find_sort_syntax(static_cast<c_regex_traits<char>*>(0), &s_delim);
+ std::string result;
+ //
+ // What we do here depends upon the format of the sort key returned by
+ // sort key returned by this->transform:
+ //
+ switch(s_collate_type)
+ {
+ case ::boost::BOOST_REGEX_DETAIL_NS::sort_C:
+ case ::boost::BOOST_REGEX_DETAIL_NS::sort_unknown:
+ // the best we can do is translate to lower case, then get a regular sort key:
+ {
+ result.assign(p1, p2);
+ for(std::string::size_type i = 0; i < result.size(); ++i)
+ result[i] = static_cast<char>((std::tolower)(static_cast<unsigned char>(result[i])));
+ result = transform(&*result.begin(), &*result.begin() + result.size());
+ break;
+ }
+ case ::boost::BOOST_REGEX_DETAIL_NS::sort_fixed:
+ {
+ // get a regular sort key, and then truncate it:
+ result = transform(p1, p2);
+ result.erase(s_delim);
+ break;
+ }
+ case ::boost::BOOST_REGEX_DETAIL_NS::sort_delim:
+ // get a regular sort key, and then truncate everything after the delim:
+ result = transform(p1, p2);
+ if(result.size() && (result[0] == s_delim))
+ break;
+ std::size_t i;
+ for(i = 0; i < result.size(); ++i)
+ {
+ if(result[i] == s_delim)
+ break;
+ }
+ result.erase(i);
+ break;
+ }
+ if(result.empty())
+ result = std::string(1, char(0));
+ return result;
+}
+
+c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_classname(const char* p1, const char* p2)
+{
+ static const char_class_type masks[] =
+ {
+ 0,
+ char_class_alnum,
+ char_class_alpha,
+ char_class_blank,
+ char_class_cntrl,
+ char_class_digit,
+ char_class_digit,
+ char_class_graph,
+ char_class_horizontal,
+ char_class_lower,
+ char_class_lower,
+ char_class_print,
+ char_class_punct,
+ char_class_space,
+ char_class_space,
+ char_class_upper,
+ char_class_unicode,
+ char_class_upper,
+ char_class_vertical,
+ char_class_alnum | char_class_word,
+ char_class_alnum | char_class_word,
+ char_class_xdigit,
+ };
+
+ int idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(p1, p2);
+ if(idx < 0)
+ {
+ std::string s(p1, p2);
+ for(std::string::size_type i = 0; i < s.size(); ++i)
+ s[i] = static_cast<char>((std::tolower)(static_cast<unsigned char>(s[i])));
+ idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
+ }
+ BOOST_ASSERT(std::size_t(idx+1) < sizeof(masks) / sizeof(masks[0]));
+ return masks[idx+1];
+}
+
+bool BOOST_REGEX_CALL c_regex_traits<char>::isctype(char c, char_class_type mask)
+{
+ return
+ ((mask & char_class_space) && (std::isspace)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_print) && (std::isprint)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_cntrl) && (std::iscntrl)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_upper) && (std::isupper)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_lower) && (std::islower)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_alpha) && (std::isalpha)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_digit) && (std::isdigit)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_punct) && (std::ispunct)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_xdigit) && (std::isxdigit)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_blank) && (std::isspace)(static_cast<unsigned char>(c)) && !::boost::BOOST_REGEX_DETAIL_NS::is_separator(c))
+ || ((mask & char_class_word) && (c == '_'))
+ || ((mask & char_class_vertical) && (::boost::BOOST_REGEX_DETAIL_NS::is_separator(c) || (c == '\v')))
+ || ((mask & char_class_horizontal) && (std::isspace)(static_cast<unsigned char>(c)) && !::boost::BOOST_REGEX_DETAIL_NS::is_separator(c) && (c != '\v'));
+}
+
+c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_collatename(const char* p1, const char* p2)
+{
+ std::string s(p1, p2);
+ s = ::boost::BOOST_REGEX_DETAIL_NS::lookup_default_collate_name(s);
+ if(s.empty() && (p2-p1 == 1))
+ s.append(1, *p1);
+ return s;
+}
+
+int BOOST_REGEX_CALL c_regex_traits<char>::value(char c, int radix)
+{
+ char b[2] = { c, '\0', };
+ char* ep;
+ int result = std::strtol(b, &ep, radix);
+ if(ep == b)
+ return -1;
+ return result;
+}
+
+}
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif
diff --git a/src/boost/libs/regex/src/cpp_regex_traits.cpp b/src/boost/libs/regex/src/cpp_regex_traits.cpp
new file mode 100644
index 000000000..05bbc50d7
--- /dev/null
+++ b/src/boost/libs/regex/src/cpp_regex_traits.cpp
@@ -0,0 +1,117 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE cpp_regex_traits.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Implements cpp_regex_traits<char> (and associated helper classes).
+ */
+
+#define BOOST_REGEX_SOURCE
+#include <boost/config.hpp>
+#ifndef BOOST_NO_STD_LOCALE
+#include <boost/regex/regex_traits.hpp>
+#include <boost/regex/pattern_except.hpp>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::memset;
+}
+#endif
+
+namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
+
+void cpp_regex_traits_char_layer<char>::init()
+{
+ // we need to start by initialising our syntax map so we know which
+ // character is used for which purpose:
+ std::memset(m_char_map, 0, sizeof(m_char_map));
+#ifndef BOOST_NO_STD_MESSAGES
+#ifndef __IBMCPP__
+ std::messages<char>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
+#else
+ std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
+#endif
+ std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
+ if(cat_name.size() && (m_pmessages != 0))
+ {
+ cat = this->m_pmessages->open(
+ cat_name,
+ this->m_locale);
+ if((int)cat < 0)
+ {
+ std::string m("Unable to open message catalog: ");
+ std::runtime_error err(m + cat_name);
+ boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err);
+ }
+ }
+ //
+ // if we have a valid catalog then load our messages:
+ //
+ if((int)cat >= 0)
+ {
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
+ {
+ string_type mss = this->m_pmessages->get(cat, 0, i, get_default_syntax(i));
+ for(string_type::size_type j = 0; j < mss.size(); ++j)
+ {
+ m_char_map[static_cast<unsigned char>(mss[j])] = i;
+ }
+ }
+ this->m_pmessages->close(cat);
+#ifndef BOOST_NO_EXCEPTIONS
+ }
+ catch(...)
+ {
+ this->m_pmessages->close(cat);
+ throw;
+ }
+#endif
+ }
+ else
+ {
+#endif
+ for(regex_constants::syntax_type j = 1; j < regex_constants::syntax_max; ++j)
+ {
+ const char* ptr = get_default_syntax(j);
+ while(ptr && *ptr)
+ {
+ m_char_map[static_cast<unsigned char>(*ptr)] = j;
+ ++ptr;
+ }
+ }
+#ifndef BOOST_NO_STD_MESSAGES
+ }
+#endif
+ //
+ // finish off by calculating our escape types:
+ //
+ unsigned char i = 'A';
+ do
+ {
+ if(m_char_map[i] == 0)
+ {
+ if(this->m_pctype->is(std::ctype_base::lower, i))
+ m_char_map[i] = regex_constants::escape_type_class;
+ else if(this->m_pctype->is(std::ctype_base::upper, i))
+ m_char_map[i] = regex_constants::escape_type_not_class;
+ }
+ }while(0xFF != i++);
+}
+
+} // BOOST_REGEX_DETAIL_NS
+} // boost
+#endif
+
diff --git a/src/boost/libs/regex/src/cregex.cpp b/src/boost/libs/regex/src/cregex.cpp
new file mode 100644
index 000000000..a1ae3b087
--- /dev/null
+++ b/src/boost/libs/regex/src/cregex.cpp
@@ -0,0 +1,660 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: cregex.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Implements high level class boost::RexEx
+ */
+
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/regex.hpp>
+#include <boost/cregex.hpp>
+#if !defined(BOOST_NO_STD_STRING)
+#include <map>
+#include <list>
+#include <boost/regex/v4/fileiter.hpp>
+typedef boost::match_flag_type match_flag_type;
+#include <cstdio>
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4309)
+#endif
+#ifdef BOOST_INTEL
+#pragma warning(disable:981 383)
+#endif
+
+namespace boost{
+
+#ifdef __BORLANDC__
+#if __BORLANDC__ < 0x530
+//
+// we need to instantiate the vector classes we use
+// since declaring a reference to type doesn't seem to
+// do the job...
+std::vector<std::size_t> inst1;
+std::vector<std::string> inst2;
+#endif
+#endif
+
+namespace{
+
+template <class iterator>
+std::string to_string(iterator i, iterator j)
+{
+ std::string s;
+ while(i != j)
+ {
+ s.append(1, *i);
+ ++i;
+ }
+ return s;
+}
+
+inline std::string to_string(const char* i, const char* j)
+{
+ return std::string(i, j);
+}
+
+}
+namespace BOOST_REGEX_DETAIL_NS{
+
+class RegExData
+{
+public:
+ enum type
+ {
+ type_pc,
+ type_pf,
+ type_copy
+ };
+ regex e;
+ cmatch m;
+#ifndef BOOST_REGEX_NO_FILEITER
+ match_results<mapfile::iterator> fm;
+#endif
+ type t;
+ const char* pbase;
+#ifndef BOOST_REGEX_NO_FILEITER
+ mapfile::iterator fbase;
+#endif
+ std::map<int, std::string, std::less<int> > strings;
+ std::map<int, std::ptrdiff_t, std::less<int> > positions;
+ void update();
+ void clean();
+ RegExData() : e(), m(),
+#ifndef BOOST_REGEX_NO_FILEITER
+ fm(),
+#endif
+ t(type_copy), pbase(0),
+#ifndef BOOST_REGEX_NO_FILEITER
+ fbase(),
+#endif
+ strings(), positions() {}
+};
+
+void RegExData::update()
+{
+ strings.erase(strings.begin(), strings.end());
+ positions.erase(positions.begin(), positions.end());
+ if(t == type_pc)
+ {
+ for(unsigned int i = 0; i < m.size(); ++i)
+ {
+ if(m[i].matched) strings[i] = std::string(m[i].first, m[i].second);
+ positions[i] = m[i].matched ? m[i].first - pbase : -1;
+ }
+ }
+#ifndef BOOST_REGEX_NO_FILEITER
+ else
+ {
+ for(unsigned int i = 0; i < fm.size(); ++i)
+ {
+ if(fm[i].matched) strings[i] = to_string(fm[i].first, fm[i].second);
+ positions[i] = fm[i].matched ? fm[i].first - fbase : -1;
+ }
+ }
+#endif
+ t = type_copy;
+}
+
+void RegExData::clean()
+{
+#ifndef BOOST_REGEX_NO_FILEITER
+ fbase = mapfile::iterator();
+ fm = match_results<mapfile::iterator>();
+#endif
+}
+
+} // namespace
+
+RegEx::RegEx()
+{
+ pdata = new BOOST_REGEX_DETAIL_NS::RegExData();
+}
+
+RegEx::RegEx(const RegEx& o)
+{
+ pdata = new BOOST_REGEX_DETAIL_NS::RegExData(*(o.pdata));
+}
+
+RegEx::~RegEx()
+{
+ delete pdata;
+}
+
+RegEx::RegEx(const char* c, bool icase)
+{
+ pdata = new BOOST_REGEX_DETAIL_NS::RegExData();
+ SetExpression(c, icase);
+}
+
+RegEx::RegEx(const std::string& s, bool icase)
+{
+ pdata = new BOOST_REGEX_DETAIL_NS::RegExData();
+ SetExpression(s.c_str(), icase);
+}
+
+RegEx& RegEx::operator=(const RegEx& o)
+{
+ *pdata = *(o.pdata);
+ return *this;
+}
+
+RegEx& RegEx::operator=(const char* p)
+{
+ SetExpression(p, false);
+ return *this;
+}
+
+unsigned int RegEx::SetExpression(const char* p, bool icase)
+{
+ boost::uint_fast32_t f = icase ? regex::normal | regex::icase : regex::normal;
+ return pdata->e.set_expression(p, f);
+}
+
+unsigned int RegEx::error_code()const
+{
+ return pdata->e.error_code();
+}
+
+
+std::string RegEx::Expression()const
+{
+ return pdata->e.expression();
+}
+
+//
+// now matching operators:
+//
+bool RegEx::Match(const char* p, match_flag_type flags)
+{
+ pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
+ pdata->pbase = p;
+ const char* end = p;
+ while(*end)++end;
+
+ if(regex_match(p, end, pdata->m, pdata->e, flags))
+ {
+ pdata->update();
+ return true;
+ }
+ return false;
+}
+
+bool RegEx::Search(const char* p, match_flag_type flags)
+{
+ pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
+ pdata->pbase = p;
+ const char* end = p;
+ while(*end)++end;
+
+ if(regex_search(p, end, pdata->m, pdata->e, flags))
+ {
+ pdata->update();
+ return true;
+ }
+ return false;
+}
+namespace BOOST_REGEX_DETAIL_NS{
+struct pred1
+{
+ GrepCallback cb;
+ RegEx* pe;
+ pred1(GrepCallback c, RegEx* i) : cb(c), pe(i) {}
+ bool operator()(const cmatch& m)
+ {
+ pe->pdata->m = m;
+ return cb(*pe);
+ }
+};
+}
+unsigned int RegEx::Grep(GrepCallback cb, const char* p, match_flag_type flags)
+{
+ pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
+ pdata->pbase = p;
+ const char* end = p;
+ while(*end)++end;
+
+ unsigned int result = regex_grep(BOOST_REGEX_DETAIL_NS::pred1(cb, this), p, end, pdata->e, flags);
+ if(result)
+ pdata->update();
+ return result;
+}
+namespace BOOST_REGEX_DETAIL_NS{
+struct pred2
+{
+ std::vector<std::string>& v;
+ RegEx* pe;
+ pred2(std::vector<std::string>& o, RegEx* e) : v(o), pe(e) {}
+ bool operator()(const cmatch& m)
+ {
+ pe->pdata->m = m;
+ v.push_back(std::string(m[0].first, m[0].second));
+ return true;
+ }
+private:
+ pred2& operator=(const pred2&);
+};
+}
+
+unsigned int RegEx::Grep(std::vector<std::string>& v, const char* p, match_flag_type flags)
+{
+ pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
+ pdata->pbase = p;
+ const char* end = p;
+ while(*end)++end;
+
+ unsigned int result = regex_grep(BOOST_REGEX_DETAIL_NS::pred2(v, this), p, end, pdata->e, flags);
+ if(result)
+ pdata->update();
+ return result;
+}
+namespace BOOST_REGEX_DETAIL_NS{
+struct pred3
+{
+ std::vector<std::size_t>& v;
+ const char* base;
+ RegEx* pe;
+ pred3(std::vector<std::size_t>& o, const char* pb, RegEx* p) : v(o), base(pb), pe(p) {}
+ bool operator()(const cmatch& m)
+ {
+ pe->pdata->m = m;
+ v.push_back(static_cast<std::size_t>(m[0].first - base));
+ return true;
+ }
+private:
+ pred3& operator=(const pred3&);
+};
+}
+unsigned int RegEx::Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags)
+{
+ pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
+ pdata->pbase = p;
+ const char* end = p;
+ while(*end)++end;
+
+ unsigned int result = regex_grep(BOOST_REGEX_DETAIL_NS::pred3(v, p, this), p, end, pdata->e, flags);
+ if(result)
+ pdata->update();
+ return result;
+}
+#ifndef BOOST_REGEX_NO_FILEITER
+namespace BOOST_REGEX_DETAIL_NS{
+struct pred4
+{
+ GrepFileCallback cb;
+ RegEx* pe;
+ const char* file;
+ bool ok;
+ pred4(GrepFileCallback c, RegEx* i, const char* f) : cb(c), pe(i), file(f), ok(true) {}
+ bool operator()(const match_results<mapfile::iterator>& m)
+ {
+ pe->pdata->t = RegExData::type_pf;
+ pe->pdata->fm = m;
+ pe->pdata->update();
+ ok = cb(file, *pe);
+ return ok;
+ }
+};
+}
+namespace{
+void BuildFileList(std::list<std::string>* pl, const char* files, bool recurse)
+{
+ file_iterator start(files);
+ file_iterator end;
+ if(recurse)
+ {
+ // go through sub directories:
+ char buf[MAX_PATH];
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(buf, MAX_PATH, start.root()));
+ if(*buf == 0)
+ {
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(buf, MAX_PATH, "."));
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, "*"));
+ }
+ else
+ {
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, "*"));
+ }
+ directory_iterator dstart(buf);
+ directory_iterator dend;
+
+ // now get the file mask bit of "files":
+ const char* ptr = files;
+ while(*ptr) ++ptr;
+ while((ptr != files) && (*ptr != *directory_iterator::separator()) && (*ptr != '/'))--ptr;
+ if(ptr != files) ++ptr;
+
+ while(dstart != dend)
+ {
+ // Verify that sprintf will not overflow:
+ if(std::strlen(dstart.path()) + std::strlen(directory_iterator::separator()) + std::strlen(ptr) >= MAX_PATH)
+ {
+ // Oops overflow, skip this item:
+ ++dstart;
+ continue;
+ }
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
+ int r = (::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
+#else
+ int r = (std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
+#endif
+ if(r < 0)
+ {
+ // sprintf failed, skip this item:
+ ++dstart;
+ continue;
+ }
+ BuildFileList(pl, buf, recurse);
+ ++dstart;
+ }
+ }
+ while(start != end)
+ {
+ pl->push_back(*start);
+ ++start;
+ }
+}
+}
+
+unsigned int RegEx::GrepFiles(GrepFileCallback cb, const char* files, bool recurse, match_flag_type flags)
+{
+ unsigned int result = 0;
+ std::list<std::string> file_list;
+ BuildFileList(&file_list, files, recurse);
+ std::list<std::string>::iterator start, end;
+ start = file_list.begin();
+ end = file_list.end();
+
+ while(start != end)
+ {
+ mapfile map((*start).c_str());
+ pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pf;
+ pdata->fbase = map.begin();
+ BOOST_REGEX_DETAIL_NS::pred4 pred(cb, this, (*start).c_str());
+ int r = regex_grep(pred, map.begin(), map.end(), pdata->e, flags);
+ result += r;
+ ++start;
+ pdata->clean();
+ if(pred.ok == false)
+ return result;
+ }
+
+ return result;
+}
+
+
+unsigned int RegEx::FindFiles(FindFilesCallback cb, const char* files, bool recurse, match_flag_type flags)
+{
+ unsigned int result = 0;
+ std::list<std::string> file_list;
+ BuildFileList(&file_list, files, recurse);
+ std::list<std::string>::iterator start, end;
+ start = file_list.begin();
+ end = file_list.end();
+
+ while(start != end)
+ {
+ mapfile map((*start).c_str());
+ pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pf;
+ pdata->fbase = map.begin();
+
+ if(regex_search(map.begin(), map.end(), pdata->fm, pdata->e, flags))
+ {
+ ++result;
+ if(false == cb((*start).c_str()))
+ return result;
+ }
+ //pdata->update();
+ ++start;
+ //pdata->clean();
+ }
+
+ return result;
+}
+#endif
+
+#ifdef BOOST_REGEX_V3
+#define regex_replace regex_merge
+#endif
+
+std::string RegEx::Merge(const std::string& in, const std::string& fmt,
+ bool copy, match_flag_type flags)
+{
+ std::string result;
+ BOOST_REGEX_DETAIL_NS::string_out_iterator<std::string> i(result);
+ if(!copy) flags |= format_no_copy;
+ regex_replace(i, in.begin(), in.end(), pdata->e, fmt.c_str(), flags);
+ return result;
+}
+
+std::string RegEx::Merge(const char* in, const char* fmt,
+ bool copy, match_flag_type flags)
+{
+ std::string result;
+ if(!copy) flags |= format_no_copy;
+ BOOST_REGEX_DETAIL_NS::string_out_iterator<std::string> i(result);
+ regex_replace(i, in, in + std::strlen(in), pdata->e, fmt, flags);
+ return result;
+}
+
+std::size_t RegEx::Split(std::vector<std::string>& v,
+ std::string& s,
+ match_flag_type flags,
+ unsigned max_count)
+{
+ return regex_split(std::back_inserter(v), s, pdata->e, flags, max_count);
+}
+
+
+
+//
+// now operators for returning what matched in more detail:
+//
+std::size_t RegEx::Position(int i)const
+{
+ switch(pdata->t)
+ {
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
+ return pdata->m[i].matched ? pdata->m[i].first - pdata->pbase : RegEx::npos;
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
+#ifndef BOOST_REGEX_NO_FILEITER
+ return pdata->fm[i].matched ? pdata->fm[i].first - pdata->fbase : RegEx::npos;
+#endif
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
+ {
+ std::map<int, std::ptrdiff_t, std::less<int> >::iterator pos = pdata->positions.find(i);
+ if(pos == pdata->positions.end())
+ return RegEx::npos;
+ return (*pos).second;
+ }
+ }
+ return RegEx::npos;
+}
+
+std::size_t RegEx::Marks()const
+{
+ return pdata->e.mark_count();
+}
+
+
+std::size_t RegEx::Length(int i)const
+{
+ switch(pdata->t)
+ {
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
+ return pdata->m[i].matched ? pdata->m[i].second - pdata->m[i].first : RegEx::npos;
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
+#ifndef BOOST_REGEX_NO_FILEITER
+ return pdata->fm[i].matched ? pdata->fm[i].second - pdata->fm[i].first : RegEx::npos;
+#endif
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
+ {
+ std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
+ if(pos == pdata->strings.end())
+ return RegEx::npos;
+ return (*pos).second.size();
+ }
+ }
+ return RegEx::npos;
+}
+
+bool RegEx::Matched(int i)const
+{
+ switch(pdata->t)
+ {
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
+ return pdata->m[i].matched;
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
+#ifndef BOOST_REGEX_NO_FILEITER
+ return pdata->fm[i].matched;
+#endif
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
+ {
+ std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
+ if(pos == pdata->strings.end())
+ return false;
+ return true;
+ }
+ }
+ return false;
+}
+
+
+std::string RegEx::What(int i)const
+{
+ std::string result;
+ switch(pdata->t)
+ {
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
+ if(pdata->m[i].matched)
+ result.assign(pdata->m[i].first, pdata->m[i].second);
+ break;
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
+ if(pdata->m[i].matched)
+ result.assign(to_string(pdata->m[i].first, pdata->m[i].second));
+ break;
+ case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
+ {
+ std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
+ if(pos != pdata->strings.end())
+ result = (*pos).second;
+ break;
+ }
+ }
+ return result;
+}
+
+const std::size_t RegEx::npos = ~static_cast<std::size_t>(0);
+
+} // namespace boost
+
+#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) && (__BORLANDC__ <= 0x551) && !defined(_RWSTD_COMPILE_INSTANTIATE)
+//
+// this is an ugly hack to work around an ugly problem:
+// by default this file will produce unresolved externals during
+// linking unless _RWSTD_COMPILE_INSTANTIATE is defined (Borland bug).
+// However if _RWSTD_COMPILE_INSTANTIATE is defined then we get separate
+// copies of basic_string's static data in the RTL and this DLL, this messes
+// with basic_string's memory management and results in run-time crashes,
+// Oh sweet joy of Catch 22....
+//
+namespace std{
+template<> template<>
+basic_string<char>& BOOST_REGEX_DECL
+basic_string<char>::replace<const char*>(char* f1, char* f2, const char* i1, const char* i2)
+{
+ unsigned insert_pos = f1 - begin();
+ unsigned remove_len = f2 - f1;
+ unsigned insert_len = i2 - i1;
+ unsigned org_size = size();
+ if(insert_len > remove_len)
+ {
+ append(insert_len-remove_len, ' ');
+ std::copy_backward(begin() + insert_pos + remove_len, begin() + org_size, end());
+ std::copy(i1, i2, begin() + insert_pos);
+ }
+ else
+ {
+ std::copy(begin() + insert_pos + remove_len, begin() + org_size, begin() + insert_pos + insert_len);
+ std::copy(i1, i2, begin() + insert_pos);
+ erase(size() + insert_len - remove_len);
+ }
+ return *this;
+}
+template<> template<>
+basic_string<wchar_t>& BOOST_REGEX_DECL
+basic_string<wchar_t>::replace<const wchar_t*>(wchar_t* f1, wchar_t* f2, const wchar_t* i1, const wchar_t* i2)
+{
+ unsigned insert_pos = f1 - begin();
+ unsigned remove_len = f2 - f1;
+ unsigned insert_len = i2 - i1;
+ unsigned org_size = size();
+ if(insert_len > remove_len)
+ {
+ append(insert_len-remove_len, ' ');
+ std::copy_backward(begin() + insert_pos + remove_len, begin() + org_size, end());
+ std::copy(i1, i2, begin() + insert_pos);
+ }
+ else
+ {
+ std::copy(begin() + insert_pos + remove_len, begin() + org_size, begin() + insert_pos + insert_len);
+ std::copy(i1, i2, begin() + insert_pos);
+ erase(size() + insert_len - remove_len);
+ }
+ return *this;
+}
+} // namespace std
+#endif
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/src/fileiter.cpp b/src/boost/libs/regex/src/fileiter.cpp
new file mode 100644
index 000000000..c80459b86
--- /dev/null
+++ b/src/boost/libs/regex/src/fileiter.cpp
@@ -0,0 +1,928 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: fileiter.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Implements file io primitives + directory searching for class boost::RegEx.
+ */
+
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/config.hpp>
+#include <climits>
+#include <stdexcept>
+#include <string>
+#include <boost/throw_exception.hpp>
+#include <boost/regex/v4/fileiter.hpp>
+#include <boost/regex/v4/regex_workaround.hpp>
+#include <boost/regex/pattern_except.hpp>
+
+#include <cstdio>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::sprintf;
+ using ::fseek;
+ using ::fread;
+ using ::ftell;
+ using ::fopen;
+ using ::fclose;
+ using ::FILE;
+ using ::strcpy;
+ using ::strcpy;
+ using ::strcat;
+ using ::strcmp;
+ using ::strlen;
+}
+#endif
+
+
+#ifndef BOOST_REGEX_NO_FILEITER
+
+#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+#include <sys/cygwin.h>
+#endif
+
+#ifdef BOOST_MSVC
+# pragma warning(disable: 4800)
+#endif
+
+namespace boost{
+ namespace BOOST_REGEX_DETAIL_NS{
+// start with the operating system specific stuff:
+
+#if (defined(__BORLANDC__) || defined(BOOST_REGEX_FI_WIN32_DIR) || defined(BOOST_MSVC)) && !defined(BOOST_RE_NO_WIN32)
+
+// platform is DOS or Windows
+// directories are separated with '\\'
+// and names are insensitive of case
+
+BOOST_REGEX_DECL const char* _fi_sep = "\\";
+const char* _fi_sep_alt = "/";
+#define BOOST_REGEX_FI_TRANSLATE(c) std::tolower(c)
+
+#else
+
+// platform is not DOS or Windows
+// directories are separated with '/'
+// and names are sensitive of case
+
+BOOST_REGEX_DECL const char* _fi_sep = "/";
+const char* _fi_sep_alt = _fi_sep;
+#define BOOST_REGEX_FI_TRANSLATE(c) c
+
+#endif
+
+#ifdef BOOST_REGEX_FI_WIN32_MAP
+
+void mapfile::open(const char* file)
+{
+#if defined(BOOST_NO_ANSI_APIS)
+ int filename_size = strlen(file);
+ LPWSTR wide_file = (LPWSTR)_alloca( (filename_size + 1) * sizeof(WCHAR) );
+ if(::MultiByteToWideChar(CP_ACP, 0, file, filename_size, wide_file, filename_size + 1) == 0)
+ hfile = INVALID_HANDLE_VALUE;
+ else
+ hfile = CreateFileW(wide_file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+#elif defined(__CYGWIN__)||defined(__CYGWIN32__)
+ char win32file[ MAX_PATH ];
+ cygwin_conv_to_win32_path( file, win32file );
+ hfile = CreateFileA(win32file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+#else
+ hfile = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+#endif
+ if(hfile != INVALID_HANDLE_VALUE)
+ {
+ hmap = CreateFileMapping(hfile, 0, PAGE_READONLY, 0, 0, 0);
+ if((hmap == INVALID_HANDLE_VALUE) || (hmap == NULL))
+ {
+ CloseHandle(hfile);
+ hmap = 0;
+ hfile = 0;
+ std::runtime_error err("Unable to create file mapping.");
+ boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err);
+ }
+ _first = static_cast<const char*>(MapViewOfFile(hmap, FILE_MAP_READ, 0, 0, 0));
+ if(_first == 0)
+ {
+ CloseHandle(hmap);
+ CloseHandle(hfile);
+ hmap = 0;
+ hfile = 0;
+ std::runtime_error err("Unable to create file mapping.");
+ }
+ _last = _first + GetFileSize(hfile, 0);
+ }
+ else
+ {
+ hfile = 0;
+#ifndef BOOST_NO_EXCEPTIONS
+ throw std::runtime_error("Unable to open file.");
+#else
+ BOOST_REGEX_NOEH_ASSERT(hfile != INVALID_HANDLE_VALUE);
+#endif
+ }
+}
+
+void mapfile::close()
+{
+ if(hfile != INVALID_HANDLE_VALUE)
+ {
+ UnmapViewOfFile((void*)_first);
+ CloseHandle(hmap);
+ CloseHandle(hfile);
+ hmap = hfile = 0;
+ _first = _last = 0;
+ }
+}
+
+#elif !defined(BOOST_RE_NO_STL)
+
+mapfile_iterator& mapfile_iterator::operator = (const mapfile_iterator& i)
+{
+ if(file && node)
+ file->unlock(node);
+ file = i.file;
+ node = i.node;
+ offset = i.offset;
+ if(file)
+ file->lock(node);
+ return *this;
+}
+
+mapfile_iterator& mapfile_iterator::operator++ ()
+{
+ if((++offset == mapfile::buf_size) && file)
+ {
+ ++node;
+ offset = 0;
+ file->lock(node);
+ file->unlock(node-1);
+ }
+ return *this;
+}
+
+mapfile_iterator mapfile_iterator::operator++ (int)
+{
+ mapfile_iterator temp(*this);
+ if((++offset == mapfile::buf_size) && file)
+ {
+ ++node;
+ offset = 0;
+ file->lock(node);
+ file->unlock(node-1);
+ }
+ return temp;
+}
+
+mapfile_iterator& mapfile_iterator::operator-- ()
+{
+ if((offset == 0) && file)
+ {
+ --node;
+ offset = mapfile::buf_size - 1;
+ file->lock(node);
+ file->unlock(node + 1);
+ }
+ else
+ --offset;
+ return *this;
+}
+
+mapfile_iterator mapfile_iterator::operator-- (int)
+{
+ mapfile_iterator temp(*this);
+ if((offset == 0) && file)
+ {
+ --node;
+ offset = mapfile::buf_size - 1;
+ file->lock(node);
+ file->unlock(node + 1);
+ }
+ else
+ --offset;
+ return temp;
+}
+
+mapfile_iterator operator + (const mapfile_iterator& i, long off)
+{
+ mapfile_iterator temp(i);
+ temp += off;
+ return temp;
+}
+
+mapfile_iterator operator - (const mapfile_iterator& i, long off)
+{
+ mapfile_iterator temp(i);
+ temp -= off;
+ return temp;
+}
+
+mapfile::iterator mapfile::begin()const
+{
+ return mapfile_iterator(this, 0);
+}
+
+mapfile::iterator mapfile::end()const
+{
+ return mapfile_iterator(this, _size);
+}
+
+void mapfile::lock(pointer* node)const
+{
+ BOOST_ASSERT(node >= _first);
+ BOOST_ASSERT(node <= _last);
+ if(node < _last)
+ {
+ if(*node == 0)
+ {
+ if(condemed.empty())
+ {
+ *node = new char[sizeof(int) + buf_size];
+ *(reinterpret_cast<int*>(*node)) = 1;
+ }
+ else
+ {
+ pointer* p = condemed.front();
+ condemed.pop_front();
+ *node = *p;
+ *p = 0;
+ *(reinterpret_cast<int*>(*node)) = 1;
+ }
+
+ std::size_t read_size = 0;
+ int read_pos = std::fseek(hfile, (node - _first) * buf_size, SEEK_SET);
+
+ if(0 == read_pos && node == _last - 1)
+ read_size = std::fread(*node + sizeof(int), _size % buf_size, 1, hfile);
+ else
+ read_size = std::fread(*node + sizeof(int), buf_size, 1, hfile);
+ if((read_size == 0) || (std::ferror(hfile)))
+ {
+#ifndef BOOST_NO_EXCEPTIONS
+ unlock(node);
+ throw std::runtime_error("Unable to read file.");
+#else
+ BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0));
+#endif
+ }
+ }
+ else
+ {
+ if(*reinterpret_cast<int*>(*node) == 0)
+ {
+ *reinterpret_cast<int*>(*node) = 1;
+ condemed.remove(node);
+ }
+ else
+ ++(*reinterpret_cast<int*>(*node));
+ }
+ }
+}
+
+void mapfile::unlock(pointer* node)const
+{
+ BOOST_ASSERT(node >= _first);
+ BOOST_ASSERT(node <= _last);
+ if(node < _last)
+ {
+ if(--(*reinterpret_cast<int*>(*node)) == 0)
+ {
+ condemed.push_back(node);
+ }
+ }
+}
+
+long int get_file_length(std::FILE* hfile)
+{
+ long int result;
+ std::fseek(hfile, 0, SEEK_END);
+ result = std::ftell(hfile);
+ std::fseek(hfile, 0, SEEK_SET);
+ return result;
+}
+
+
+void mapfile::open(const char* file)
+{
+ hfile = std::fopen(file, "rb");
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ if(hfile != 0)
+ {
+ _size = get_file_length(hfile);
+ long cnodes = (_size + buf_size - 1) / buf_size;
+
+ // check that number of nodes is not too high:
+ if(cnodes > (long)((INT_MAX) / sizeof(pointer*)))
+ {
+ std::fclose(hfile);
+ hfile = 0;
+ _size = 0;
+ return;
+ }
+
+ _first = new pointer[(int)cnodes];
+ _last = _first + cnodes;
+ std::memset(_first, 0, cnodes*sizeof(pointer));
+ }
+ else
+ {
+ std::runtime_error err("Unable to open file.");
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ }catch(...)
+ { close(); throw; }
+#endif
+}
+
+void mapfile::close()
+{
+ if(hfile != 0)
+ {
+ pointer* p = _first;
+ while(p != _last)
+ {
+ if(*p)
+ delete[] *p;
+ ++p;
+ }
+ delete[] _first;
+ _size = 0;
+ _first = _last = 0;
+ std::fclose(hfile);
+ hfile = 0;
+ condemed.erase(condemed.begin(), condemed.end());
+ }
+}
+
+
+#endif
+
+inline _fi_find_handle find_first_file(const char* wild, _fi_find_data& data)
+{
+#ifdef BOOST_NO_ANSI_APIS
+ std::size_t wild_size = std::strlen(wild);
+ LPWSTR wide_wild = (LPWSTR)_alloca( (wild_size + 1) * sizeof(WCHAR) );
+ if (::MultiByteToWideChar(CP_ACP, 0, wild, wild_size, wide_wild, wild_size + 1) == 0)
+ return _fi_invalid_handle;
+
+ return FindFirstFileW(wide_wild, &data);
+#else
+ return FindFirstFileA(wild, &data);
+#endif
+}
+
+inline bool find_next_file(_fi_find_handle hf, _fi_find_data& data)
+{
+#ifdef BOOST_NO_ANSI_APIS
+ return FindNextFileW(hf, &data);
+#else
+ return FindNextFileA(hf, &data);
+#endif
+}
+
+inline void copy_find_file_result_with_overflow_check(const _fi_find_data& data, char* path, size_t max_size)
+{
+#ifdef BOOST_NO_ANSI_APIS
+ if (::WideCharToMultiByte(CP_ACP, 0, data.cFileName, -1, path, max_size, NULL, NULL) == 0)
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(1);
+#else
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(path, max_size, data.cFileName));
+#endif
+}
+
+inline bool is_not_current_or_parent_path_string(const _fi_find_data& data)
+{
+#ifdef BOOST_NO_ANSI_APIS
+ return (std::wcscmp(data.cFileName, L".") && std::wcscmp(data.cFileName, L".."));
+#else
+ return (std::strcmp(data.cFileName, ".") && std::strcmp(data.cFileName, ".."));
+#endif
+}
+
+
+file_iterator::file_iterator()
+{
+ _root = _path = 0;
+ ref = 0;
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ _root = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_root)
+ _path = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_path)
+ ptr = _path;
+ *_path = 0;
+ *_root = 0;
+ ref = new file_iterator_ref();
+ BOOST_REGEX_NOEH_ASSERT(ref)
+ ref->hf = _fi_invalid_handle;
+ ref->count = 1;
+#ifndef BOOST_NO_EXCEPTIONS
+ }
+ catch(...)
+ {
+ delete[] _root;
+ delete[] _path;
+ delete ref;
+ throw;
+ }
+#endif
+}
+
+file_iterator::file_iterator(const char* wild)
+{
+ _root = _path = 0;
+ ref = 0;
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ _root = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_root)
+ _path = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_path)
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_root, MAX_PATH, wild));
+ ptr = _root;
+ while(*ptr)++ptr;
+ while((ptr > _root) && (*ptr != *_fi_sep) && (*ptr != *_fi_sep_alt))--ptr;
+ if((ptr == _root) && ( (*ptr== *_fi_sep) || (*ptr==*_fi_sep_alt) ) )
+ {
+ _root[1]='\0';
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, _root));
+ }
+ else
+ {
+ *ptr = 0;
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, _root));
+ if(*_path == 0)
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, "."));
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(_path, MAX_PATH, _fi_sep));
+ }
+ ptr = _path + std::strlen(_path);
+
+ ref = new file_iterator_ref();
+ BOOST_REGEX_NOEH_ASSERT(ref)
+ ref->hf = find_first_file(wild, ref->_data);
+ ref->count = 1;
+
+ if(ref->hf == _fi_invalid_handle)
+ {
+ *_path = 0;
+ ptr = _path;
+ }
+ else
+ {
+ copy_find_file_result_with_overflow_check(ref->_data, ptr, (MAX_PATH - (ptr - _path)));
+ if(ref->_data.dwFileAttributes & _fi_dir)
+ next();
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ }
+ catch(...)
+ {
+ delete[] _root;
+ delete[] _path;
+ delete ref;
+ throw;
+ }
+#endif
+}
+
+file_iterator::file_iterator(const file_iterator& other)
+{
+ _root = _path = 0;
+ ref = 0;
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ _root = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_root)
+ _path = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_path)
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_root, MAX_PATH, other._root));
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, other._path));
+ ptr = _path + (other.ptr - other._path);
+ ref = other.ref;
+#ifndef BOOST_NO_EXCEPTIONS
+ }
+ catch(...)
+ {
+ delete[] _root;
+ delete[] _path;
+ throw;
+ }
+#endif
+ ++(ref->count);
+}
+
+file_iterator& file_iterator::operator=(const file_iterator& other)
+{
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_root, MAX_PATH, other._root));
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, other._path));
+ ptr = _path + (other.ptr - other._path);
+ if(--(ref->count) == 0)
+ {
+ if(ref->hf != _fi_invalid_handle)
+ FindClose(ref->hf);
+ delete ref;
+ }
+ ref = other.ref;
+ ++(ref->count);
+ return *this;
+}
+
+
+file_iterator::~file_iterator()
+{
+ delete[] _root;
+ delete[] _path;
+ if(--(ref->count) == 0)
+ {
+ if(ref->hf != _fi_invalid_handle)
+ FindClose(ref->hf);
+ delete ref;
+ }
+}
+
+file_iterator file_iterator::operator++(int)
+{
+ file_iterator temp(*this);
+ next();
+ return temp;
+}
+
+
+void file_iterator::next()
+{
+ if(ref->hf != _fi_invalid_handle)
+ {
+ bool cont = true;
+ while(cont)
+ {
+ cont = find_next_file(ref->hf, ref->_data);
+ if(cont && ((ref->_data.dwFileAttributes & _fi_dir) == 0))
+ break;
+ }
+ if(!cont)
+ {
+ // end of sequence
+ FindClose(ref->hf);
+ ref->hf = _fi_invalid_handle;
+ *_path = 0;
+ ptr = _path;
+ }
+ else
+ copy_find_file_result_with_overflow_check(ref->_data, ptr, MAX_PATH - (ptr - _path));
+ }
+}
+
+
+
+directory_iterator::directory_iterator()
+{
+ _root = _path = 0;
+ ref = 0;
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ _root = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_root)
+ _path = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_path)
+ ptr = _path;
+ *_path = 0;
+ *_root = 0;
+ ref = new file_iterator_ref();
+ BOOST_REGEX_NOEH_ASSERT(ref)
+ ref->hf = _fi_invalid_handle;
+ ref->count = 1;
+#ifndef BOOST_NO_EXCEPTIONS
+ }
+ catch(...)
+ {
+ delete[] _root;
+ delete[] _path;
+ delete ref;
+ throw;
+ }
+#endif
+}
+
+directory_iterator::directory_iterator(const char* wild)
+{
+ _root = _path = 0;
+ ref = 0;
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ _root = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_root)
+ _path = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_path)
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_root, MAX_PATH, wild));
+ ptr = _root;
+ while(*ptr)++ptr;
+ while((ptr > _root) && (*ptr != *_fi_sep) && (*ptr != *_fi_sep_alt))--ptr;
+
+ if((ptr == _root) && ( (*ptr== *_fi_sep) || (*ptr==*_fi_sep_alt) ) )
+ {
+ _root[1]='\0';
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, _root));
+ }
+ else
+ {
+ *ptr = 0;
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, _root));
+ if(*_path == 0)
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, "."));
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(_path, MAX_PATH, _fi_sep));
+ }
+ ptr = _path + std::strlen(_path);
+
+ ref = new file_iterator_ref();
+ BOOST_REGEX_NOEH_ASSERT(ref)
+ ref->count = 1;
+ ref->hf = find_first_file(wild, ref->_data);
+ if(ref->hf == _fi_invalid_handle)
+ {
+ *_path = 0;
+ ptr = _path;
+ }
+ else
+ {
+ copy_find_file_result_with_overflow_check(ref->_data, ptr, MAX_PATH - (ptr - _path));
+ if(((ref->_data.dwFileAttributes & _fi_dir) == 0) || (std::strcmp(ptr, ".") == 0) || (std::strcmp(ptr, "..") == 0))
+ next();
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ }
+ catch(...)
+ {
+ delete[] _root;
+ delete[] _path;
+ delete ref;
+ throw;
+ }
+#endif
+}
+
+directory_iterator::~directory_iterator()
+{
+ delete[] _root;
+ delete[] _path;
+ if(--(ref->count) == 0)
+ {
+ if(ref->hf != _fi_invalid_handle)
+ FindClose(ref->hf);
+ delete ref;
+ }
+}
+
+directory_iterator::directory_iterator(const directory_iterator& other)
+{
+ _root = _path = 0;
+ ref = 0;
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ _root = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_root)
+ _path = new char[MAX_PATH];
+ BOOST_REGEX_NOEH_ASSERT(_path)
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_root, MAX_PATH, other._root));
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, other._path));
+ ptr = _path + (other.ptr - other._path);
+ ref = other.ref;
+#ifndef BOOST_NO_EXCEPTIONS
+ }
+ catch(...)
+ {
+ delete[] _root;
+ delete[] _path;
+ throw;
+ }
+#endif
+ ++(ref->count);
+}
+
+directory_iterator& directory_iterator::operator=(const directory_iterator& other)
+{
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_root, MAX_PATH, other._root));
+ BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(_path, MAX_PATH, other._path));
+ ptr = _path + (other.ptr - other._path);
+ if(--(ref->count) == 0)
+ {
+ if(ref->hf != _fi_invalid_handle)
+ FindClose(ref->hf);
+ delete ref;
+ }
+ ref = other.ref;
+ ++(ref->count);
+ return *this;
+}
+
+directory_iterator directory_iterator::operator++(int)
+{
+ directory_iterator temp(*this);
+ next();
+ return temp;
+}
+
+void directory_iterator::next()
+{
+ if(ref->hf != _fi_invalid_handle)
+ {
+ bool cont = true;
+ while(cont)
+ {
+ cont = find_next_file(ref->hf, ref->_data);
+ if(cont && (ref->_data.dwFileAttributes & _fi_dir))
+ {
+ if(is_not_current_or_parent_path_string(ref->_data))
+ break;
+ }
+ }
+ if(!cont)
+ {
+ // end of sequence
+ FindClose(ref->hf);
+ ref->hf = _fi_invalid_handle;
+ *_path = 0;
+ ptr = _path;
+ }
+ else
+ copy_find_file_result_with_overflow_check(ref->_data, ptr, MAX_PATH - (ptr - _path));
+ }
+}
+
+
+#ifdef BOOST_REGEX_FI_POSIX_DIR
+
+struct _fi_priv_data
+{
+ char root[MAX_PATH];
+ char* mask;
+ DIR* d;
+ _fi_priv_data(const char* p);
+};
+
+_fi_priv_data::_fi_priv_data(const char* p)
+{
+ std::strcpy(root, p);
+ mask = root;
+ while(*mask) ++mask;
+ while((mask > root) && (*mask != *_fi_sep) && (*mask != *_fi_sep_alt)) --mask;
+ if(mask == root && ((*mask== *_fi_sep) || (*mask == *_fi_sep_alt)) )
+ {
+ root[1] = '\0';
+ std::strcpy(root+2, p+1);
+ mask = root+2;
+ }
+ else if(mask == root)
+ {
+ root[0] = '.';
+ root[1] = '\0';
+ std::strcpy(root+2, p);
+ mask = root+2;
+ }
+ else
+ {
+ *mask = 0;
+ ++mask;
+ }
+}
+
+bool iswild(const char* mask, const char* name)
+{
+ while(*mask && *name)
+ {
+ switch(*mask)
+ {
+ case '?':
+ ++name;
+ ++mask;
+ continue;
+ case '*':
+ ++mask;
+ if(*mask == 0)
+ return true;
+ while(*name)
+ {
+ if(iswild(mask, name))
+ return true;
+ ++name;
+ }
+ return false;
+ case '.':
+ if(0 == *name)
+ {
+ ++mask;
+ continue;
+ }
+ // fall through
+ default:
+ if(BOOST_REGEX_FI_TRANSLATE(*mask) != BOOST_REGEX_FI_TRANSLATE(*name))
+ return false;
+ ++mask;
+ ++name;
+ continue;
+ }
+ }
+ if(*mask != *name)
+ return false;
+ return true;
+}
+
+unsigned _fi_attributes(const char* root, const char* name)
+{
+ char buf[MAX_PATH];
+ // verify that we can not overflow:
+ if(std::strlen(root) + std::strlen(_fi_sep) + std::strlen(name) >= MAX_PATH)
+ return 0;
+ int r;
+ if( ( (root[0] == *_fi_sep) || (root[0] == *_fi_sep_alt) ) && (root[1] == '\0') )
+ r = (std::sprintf)(buf, "%s%s", root, name);
+ else
+ r = (std::sprintf)(buf, "%s%s%s", root, _fi_sep, name);
+ if(r < 0)
+ return 0; // sprintf failed
+ DIR* d = opendir(buf);
+ if(d)
+ {
+ closedir(d);
+ return _fi_dir;
+ }
+ return 0;
+}
+
+_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData)
+{
+ _fi_find_handle dat = new _fi_priv_data(lpFileName);
+
+ DIR* h = opendir(dat->root);
+ dat->d = h;
+ if(h != 0)
+ {
+ if(_fi_FindNextFile(dat, lpFindFileData))
+ return dat;
+ closedir(h);
+ }
+ delete dat;
+ return 0;
+}
+
+bool _fi_FindNextFile(_fi_find_handle dat, _fi_find_data* lpFindFileData)
+{
+ dirent* d;
+ do
+ {
+ d = readdir(dat->d);
+ } while(d && !iswild(dat->mask, d->d_name));
+
+ if(d)
+ {
+ std::strcpy(lpFindFileData->cFileName, d->d_name);
+ lpFindFileData->dwFileAttributes = _fi_attributes(dat->root, d->d_name);
+ return true;
+ }
+ return false;
+}
+
+bool _fi_FindClose(_fi_find_handle dat)
+{
+ closedir(dat->d);
+ delete dat;
+ return true;
+}
+
+#endif
+
+} // namespace BOOST_REGEX_DETAIL_NS
+} // namspace boost
+
+#endif // BOOST_REGEX_NO_FILEITER
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/src/icu.cpp b/src/boost/libs/regex/src/icu.cpp
new file mode 100644
index 000000000..5f249e2d8
--- /dev/null
+++ b/src/boost/libs/regex/src/icu.cpp
@@ -0,0 +1,511 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE icu.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Unicode regular expressions on top of the ICU Library.
+ */
+#define BOOST_REGEX_SOURCE
+
+#include <boost/regex/config.hpp>
+#ifdef BOOST_HAS_ICU
+#define BOOST_REGEX_ICU_INSTANTIATE
+#include <boost/regex/icu.hpp>
+
+#ifdef BOOST_INTEL
+#pragma warning(disable:981 2259 383)
+#endif
+
+namespace boost{
+
+namespace BOOST_REGEX_DETAIL_NS{
+
+icu_regex_traits_implementation::string_type icu_regex_traits_implementation::do_transform(const char_type* p1, const char_type* p2, const U_NAMESPACE_QUALIFIER Collator* pcoll) const
+{
+ // TODO make thread safe!!!! :
+ typedef u32_to_u16_iterator<const char_type*, ::UChar> itt;
+ itt i(p1), j(p2);
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ std::vector< ::UChar> t(i, j);
+#else
+ std::vector< ::UChar> t;
+ while(i != j)
+ t.push_back(*i++);
+#endif
+ ::uint8_t result[100];
+ ::int32_t len;
+ if(t.size())
+ len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), result, sizeof(result));
+ else
+ len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast< ::int32_t>(0), result, sizeof(result));
+ if(std::size_t(len) > sizeof(result))
+ {
+ scoped_array< ::uint8_t> presult(new ::uint8_t[len+1]);
+ if(t.size())
+ len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), presult.get(), len+1);
+ else
+ len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast< ::int32_t>(0), presult.get(), len+1);
+ if((0 == presult[len-1]) && (len > 1))
+ --len;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ return string_type(presult.get(), presult.get()+len);
+#else
+ string_type sresult;
+ ::uint8_t const* ia = presult.get();
+ ::uint8_t const* ib = presult.get()+len;
+ while(ia != ib)
+ sresult.push_back(*ia++);
+ return sresult;
+#endif
+ }
+ if((0 == result[len-1]) && (len > 1))
+ --len;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ return string_type(result, result+len);
+#else
+ string_type sresult;
+ ::uint8_t const* ia = result;
+ ::uint8_t const* ib = result+len;
+ while(ia != ib)
+ sresult.push_back(*ia++);
+ return sresult;
+#endif
+}
+
+}
+
+icu_regex_traits::size_type icu_regex_traits::length(const char_type* p)
+{
+ size_type result = 0;
+ while(*p)
+ {
+ ++p;
+ ++result;
+ }
+ return result;
+}
+
+//
+// define our bitmasks:
+//
+const icu_regex_traits::char_class_type icu_regex_traits::mask_blank = icu_regex_traits::char_class_type(1) << offset_blank;
+const icu_regex_traits::char_class_type icu_regex_traits::mask_space = icu_regex_traits::char_class_type(1) << offset_space;
+const icu_regex_traits::char_class_type icu_regex_traits::mask_xdigit = icu_regex_traits::char_class_type(1) << offset_xdigit;
+const icu_regex_traits::char_class_type icu_regex_traits::mask_underscore = icu_regex_traits::char_class_type(1) << offset_underscore;
+const icu_regex_traits::char_class_type icu_regex_traits::mask_unicode = icu_regex_traits::char_class_type(1) << offset_unicode;
+const icu_regex_traits::char_class_type icu_regex_traits::mask_any = icu_regex_traits::char_class_type(1) << offset_any;
+const icu_regex_traits::char_class_type icu_regex_traits::mask_ascii = icu_regex_traits::char_class_type(1) << offset_ascii;
+const icu_regex_traits::char_class_type icu_regex_traits::mask_horizontal = icu_regex_traits::char_class_type(1) << offset_horizontal;
+const icu_regex_traits::char_class_type icu_regex_traits::mask_vertical = icu_regex_traits::char_class_type(1) << offset_vertical;
+
+icu_regex_traits::char_class_type icu_regex_traits::lookup_icu_mask(const ::UChar32* p1, const ::UChar32* p2)
+{
+ static const ::UChar32 prop_name_table[] = {
+ /* any */ 'a', 'n', 'y',
+ /* ascii */ 'a', 's', 'c', 'i', 'i',
+ /* assigned */ 'a', 's', 's', 'i', 'g', 'n', 'e', 'd',
+ /* c* */ 'c', '*',
+ /* cc */ 'c', 'c',
+ /* cf */ 'c', 'f',
+ /* closepunctuation */ 'c', 'l', 'o', 's', 'e', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n',
+ /* cn */ 'c', 'n',
+ /* co */ 'c', 'o',
+ /* connectorpunctuation */ 'c', 'o', 'n', 'n', 'e', 'c', 't', 'o', 'r', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n',
+ /* control */ 'c', 'o', 'n', 't', 'r', 'o', 'l',
+ /* cs */ 'c', 's',
+ /* currencysymbol */ 'c', 'u', 'r', 'r', 'e', 'n', 'c', 'y', 's', 'y', 'm', 'b', 'o', 'l',
+ /* dashpunctuation */ 'd', 'a', 's', 'h', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n',
+ /* decimaldigitnumber */ 'd', 'e', 'c', 'i', 'm', 'a', 'l', 'd', 'i', 'g', 'i', 't', 'n', 'u', 'm', 'b', 'e', 'r',
+ /* enclosingmark */ 'e', 'n', 'c', 'l', 'o', 's', 'i', 'n', 'g', 'm', 'a', 'r', 'k',
+ /* finalpunctuation */ 'f', 'i', 'n', 'a', 'l', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n',
+ /* format */ 'f', 'o', 'r', 'm', 'a', 't',
+ /* initialpunctuation */ 'i', 'n', 'i', 't', 'i', 'a', 'l', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n',
+ /* l* */ 'l', '*',
+ /* letter */ 'l', 'e', 't', 't', 'e', 'r',
+ /* letternumber */ 'l', 'e', 't', 't', 'e', 'r', 'n', 'u', 'm', 'b', 'e', 'r',
+ /* lineseparator */ 'l', 'i', 'n', 'e', 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r',
+ /* ll */ 'l', 'l',
+ /* lm */ 'l', 'm',
+ /* lo */ 'l', 'o',
+ /* lowercaseletter */ 'l', 'o', 'w', 'e', 'r', 'c', 'a', 's', 'e', 'l', 'e', 't', 't', 'e', 'r',
+ /* lt */ 'l', 't',
+ /* lu */ 'l', 'u',
+ /* m* */ 'm', '*',
+ /* mark */ 'm', 'a', 'r', 'k',
+ /* mathsymbol */ 'm', 'a', 't', 'h', 's', 'y', 'm', 'b', 'o', 'l',
+ /* mc */ 'm', 'c',
+ /* me */ 'm', 'e',
+ /* mn */ 'm', 'n',
+ /* modifierletter */ 'm', 'o', 'd', 'i', 'f', 'i', 'e', 'r', 'l', 'e', 't', 't', 'e', 'r',
+ /* modifiersymbol */ 'm', 'o', 'd', 'i', 'f', 'i', 'e', 'r', 's', 'y', 'm', 'b', 'o', 'l',
+ /* n* */ 'n', '*',
+ /* nd */ 'n', 'd',
+ /* nl */ 'n', 'l',
+ /* no */ 'n', 'o',
+ /* nonspacingmark */ 'n', 'o', 'n', 's', 'p', 'a', 'c', 'i', 'n', 'g', 'm', 'a', 'r', 'k',
+ /* notassigned */ 'n', 'o', 't', 'a', 's', 's', 'i', 'g', 'n', 'e', 'd',
+ /* number */ 'n', 'u', 'm', 'b', 'e', 'r',
+ /* openpunctuation */ 'o', 'p', 'e', 'n', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n',
+ /* other */ 'o', 't', 'h', 'e', 'r',
+ /* otherletter */ 'o', 't', 'h', 'e', 'r', 'l', 'e', 't', 't', 'e', 'r',
+ /* othernumber */ 'o', 't', 'h', 'e', 'r', 'n', 'u', 'm', 'b', 'e', 'r',
+ /* otherpunctuation */ 'o', 't', 'h', 'e', 'r', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n',
+ /* othersymbol */ 'o', 't', 'h', 'e', 'r', 's', 'y', 'm', 'b', 'o', 'l',
+ /* p* */ 'p', '*',
+ /* paragraphseparator */ 'p', 'a', 'r', 'a', 'g', 'r', 'a', 'p', 'h', 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r',
+ /* pc */ 'p', 'c',
+ /* pd */ 'p', 'd',
+ /* pe */ 'p', 'e',
+ /* pf */ 'p', 'f',
+ /* pi */ 'p', 'i',
+ /* po */ 'p', 'o',
+ /* privateuse */ 'p', 'r', 'i', 'v', 'a', 't', 'e', 'u', 's', 'e',
+ /* ps */ 'p', 's',
+ /* punctuation */ 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n',
+ /* s* */ 's', '*',
+ /* sc */ 's', 'c',
+ /* separator */ 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r',
+ /* sk */ 's', 'k',
+ /* sm */ 's', 'm',
+ /* so */ 's', 'o',
+ /* spaceseparator */ 's', 'p', 'a', 'c', 'e', 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r',
+ /* spacingcombiningmark */ 's', 'p', 'a', 'c', 'i', 'n', 'g', 'c', 'o', 'm', 'b', 'i', 'n', 'i', 'n', 'g', 'm', 'a', 'r', 'k',
+ /* surrogate */ 's', 'u', 'r', 'r', 'o', 'g', 'a', 't', 'e',
+ /* symbol */ 's', 'y', 'm', 'b', 'o', 'l',
+ /* titlecase */ 't', 'i', 't', 'l', 'e', 'c', 'a', 's', 'e',
+ /* titlecaseletter */ 't', 'i', 't', 'l', 'e', 'c', 'a', 's', 'e', 'l', 'e', 't', 't', 'e', 'r',
+ /* uppercaseletter */ 'u', 'p', 'p', 'e', 'r', 'c', 'a', 's', 'e', 'l', 'e', 't', 't', 'e', 'r',
+ /* z* */ 'z', '*',
+ /* zl */ 'z', 'l',
+ /* zp */ 'z', 'p',
+ /* zs */ 'z', 's',
+ };
+
+ static const BOOST_REGEX_DETAIL_NS::character_pointer_range< ::UChar32> range_data[] = {
+ { prop_name_table+0, prop_name_table+3, }, // any
+ { prop_name_table+3, prop_name_table+8, }, // ascii
+ { prop_name_table+8, prop_name_table+16, }, // assigned
+ { prop_name_table+16, prop_name_table+18, }, // c*
+ { prop_name_table+18, prop_name_table+20, }, // cc
+ { prop_name_table+20, prop_name_table+22, }, // cf
+ { prop_name_table+22, prop_name_table+38, }, // closepunctuation
+ { prop_name_table+38, prop_name_table+40, }, // cn
+ { prop_name_table+40, prop_name_table+42, }, // co
+ { prop_name_table+42, prop_name_table+62, }, // connectorpunctuation
+ { prop_name_table+62, prop_name_table+69, }, // control
+ { prop_name_table+69, prop_name_table+71, }, // cs
+ { prop_name_table+71, prop_name_table+85, }, // currencysymbol
+ { prop_name_table+85, prop_name_table+100, }, // dashpunctuation
+ { prop_name_table+100, prop_name_table+118, }, // decimaldigitnumber
+ { prop_name_table+118, prop_name_table+131, }, // enclosingmark
+ { prop_name_table+131, prop_name_table+147, }, // finalpunctuation
+ { prop_name_table+147, prop_name_table+153, }, // format
+ { prop_name_table+153, prop_name_table+171, }, // initialpunctuation
+ { prop_name_table+171, prop_name_table+173, }, // l*
+ { prop_name_table+173, prop_name_table+179, }, // letter
+ { prop_name_table+179, prop_name_table+191, }, // letternumber
+ { prop_name_table+191, prop_name_table+204, }, // lineseparator
+ { prop_name_table+204, prop_name_table+206, }, // ll
+ { prop_name_table+206, prop_name_table+208, }, // lm
+ { prop_name_table+208, prop_name_table+210, }, // lo
+ { prop_name_table+210, prop_name_table+225, }, // lowercaseletter
+ { prop_name_table+225, prop_name_table+227, }, // lt
+ { prop_name_table+227, prop_name_table+229, }, // lu
+ { prop_name_table+229, prop_name_table+231, }, // m*
+ { prop_name_table+231, prop_name_table+235, }, // mark
+ { prop_name_table+235, prop_name_table+245, }, // mathsymbol
+ { prop_name_table+245, prop_name_table+247, }, // mc
+ { prop_name_table+247, prop_name_table+249, }, // me
+ { prop_name_table+249, prop_name_table+251, }, // mn
+ { prop_name_table+251, prop_name_table+265, }, // modifierletter
+ { prop_name_table+265, prop_name_table+279, }, // modifiersymbol
+ { prop_name_table+279, prop_name_table+281, }, // n*
+ { prop_name_table+281, prop_name_table+283, }, // nd
+ { prop_name_table+283, prop_name_table+285, }, // nl
+ { prop_name_table+285, prop_name_table+287, }, // no
+ { prop_name_table+287, prop_name_table+301, }, // nonspacingmark
+ { prop_name_table+301, prop_name_table+312, }, // notassigned
+ { prop_name_table+312, prop_name_table+318, }, // number
+ { prop_name_table+318, prop_name_table+333, }, // openpunctuation
+ { prop_name_table+333, prop_name_table+338, }, // other
+ { prop_name_table+338, prop_name_table+349, }, // otherletter
+ { prop_name_table+349, prop_name_table+360, }, // othernumber
+ { prop_name_table+360, prop_name_table+376, }, // otherpunctuation
+ { prop_name_table+376, prop_name_table+387, }, // othersymbol
+ { prop_name_table+387, prop_name_table+389, }, // p*
+ { prop_name_table+389, prop_name_table+407, }, // paragraphseparator
+ { prop_name_table+407, prop_name_table+409, }, // pc
+ { prop_name_table+409, prop_name_table+411, }, // pd
+ { prop_name_table+411, prop_name_table+413, }, // pe
+ { prop_name_table+413, prop_name_table+415, }, // pf
+ { prop_name_table+415, prop_name_table+417, }, // pi
+ { prop_name_table+417, prop_name_table+419, }, // po
+ { prop_name_table+419, prop_name_table+429, }, // privateuse
+ { prop_name_table+429, prop_name_table+431, }, // ps
+ { prop_name_table+431, prop_name_table+442, }, // punctuation
+ { prop_name_table+442, prop_name_table+444, }, // s*
+ { prop_name_table+444, prop_name_table+446, }, // sc
+ { prop_name_table+446, prop_name_table+455, }, // separator
+ { prop_name_table+455, prop_name_table+457, }, // sk
+ { prop_name_table+457, prop_name_table+459, }, // sm
+ { prop_name_table+459, prop_name_table+461, }, // so
+ { prop_name_table+461, prop_name_table+475, }, // spaceseparator
+ { prop_name_table+475, prop_name_table+495, }, // spacingcombiningmark
+ { prop_name_table+495, prop_name_table+504, }, // surrogate
+ { prop_name_table+504, prop_name_table+510, }, // symbol
+ { prop_name_table+510, prop_name_table+519, }, // titlecase
+ { prop_name_table+519, prop_name_table+534, }, // titlecaseletter
+ { prop_name_table+534, prop_name_table+549, }, // uppercaseletter
+ { prop_name_table+549, prop_name_table+551, }, // z*
+ { prop_name_table+551, prop_name_table+553, }, // zl
+ { prop_name_table+553, prop_name_table+555, }, // zp
+ { prop_name_table+555, prop_name_table+557, }, // zs
+ };
+
+ static const icu_regex_traits::char_class_type icu_class_map[] = {
+ icu_regex_traits::mask_any, // any
+ icu_regex_traits::mask_ascii, // ascii
+ (0x3FFFFFFFu) & ~(U_GC_CN_MASK), // assigned
+ U_GC_C_MASK, // c*
+ U_GC_CC_MASK, // cc
+ U_GC_CF_MASK, // cf
+ U_GC_PE_MASK, // closepunctuation
+ U_GC_CN_MASK, // cn
+ U_GC_CO_MASK, // co
+ U_GC_PC_MASK, // connectorpunctuation
+ U_GC_CC_MASK, // control
+ U_GC_CS_MASK, // cs
+ U_GC_SC_MASK, // currencysymbol
+ U_GC_PD_MASK, // dashpunctuation
+ U_GC_ND_MASK, // decimaldigitnumber
+ U_GC_ME_MASK, // enclosingmark
+ U_GC_PF_MASK, // finalpunctuation
+ U_GC_CF_MASK, // format
+ U_GC_PI_MASK, // initialpunctuation
+ U_GC_L_MASK, // l*
+ U_GC_L_MASK, // letter
+ U_GC_NL_MASK, // letternumber
+ U_GC_ZL_MASK, // lineseparator
+ U_GC_LL_MASK, // ll
+ U_GC_LM_MASK, // lm
+ U_GC_LO_MASK, // lo
+ U_GC_LL_MASK, // lowercaseletter
+ U_GC_LT_MASK, // lt
+ U_GC_LU_MASK, // lu
+ U_GC_M_MASK, // m*
+ U_GC_M_MASK, // mark
+ U_GC_SM_MASK, // mathsymbol
+ U_GC_MC_MASK, // mc
+ U_GC_ME_MASK, // me
+ U_GC_MN_MASK, // mn
+ U_GC_LM_MASK, // modifierletter
+ U_GC_SK_MASK, // modifiersymbol
+ U_GC_N_MASK, // n*
+ U_GC_ND_MASK, // nd
+ U_GC_NL_MASK, // nl
+ U_GC_NO_MASK, // no
+ U_GC_MN_MASK, // nonspacingmark
+ U_GC_CN_MASK, // notassigned
+ U_GC_N_MASK, // number
+ U_GC_PS_MASK, // openpunctuation
+ U_GC_C_MASK, // other
+ U_GC_LO_MASK, // otherletter
+ U_GC_NO_MASK, // othernumber
+ U_GC_PO_MASK, // otherpunctuation
+ U_GC_SO_MASK, // othersymbol
+ U_GC_P_MASK, // p*
+ U_GC_ZP_MASK, // paragraphseparator
+ U_GC_PC_MASK, // pc
+ U_GC_PD_MASK, // pd
+ U_GC_PE_MASK, // pe
+ U_GC_PF_MASK, // pf
+ U_GC_PI_MASK, // pi
+ U_GC_PO_MASK, // po
+ U_GC_CO_MASK, // privateuse
+ U_GC_PS_MASK, // ps
+ U_GC_P_MASK, // punctuation
+ U_GC_S_MASK, // s*
+ U_GC_SC_MASK, // sc
+ U_GC_Z_MASK, // separator
+ U_GC_SK_MASK, // sk
+ U_GC_SM_MASK, // sm
+ U_GC_SO_MASK, // so
+ U_GC_ZS_MASK, // spaceseparator
+ U_GC_MC_MASK, // spacingcombiningmark
+ U_GC_CS_MASK, // surrogate
+ U_GC_S_MASK, // symbol
+ U_GC_LT_MASK, // titlecase
+ U_GC_LT_MASK, // titlecaseletter
+ U_GC_LU_MASK, // uppercaseletter
+ U_GC_Z_MASK, // z*
+ U_GC_ZL_MASK, // zl
+ U_GC_ZP_MASK, // zp
+ U_GC_ZS_MASK, // zs
+ };
+
+
+ static const BOOST_REGEX_DETAIL_NS::character_pointer_range< ::UChar32>* ranges_begin = range_data;
+ static const BOOST_REGEX_DETAIL_NS::character_pointer_range< ::UChar32>* ranges_end = range_data + (sizeof(range_data)/sizeof(range_data[0]));
+
+ BOOST_REGEX_DETAIL_NS::character_pointer_range< ::UChar32> t = { p1, p2, };
+ const BOOST_REGEX_DETAIL_NS::character_pointer_range< ::UChar32>* p = std::lower_bound(ranges_begin, ranges_end, t);
+ if((p != ranges_end) && (t == *p))
+ return icu_class_map[p - ranges_begin];
+ return 0;
+}
+
+icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_type* p1, const char_type* p2) const
+{
+ static const char_class_type masks[] =
+ {
+ 0,
+ U_GC_L_MASK | U_GC_ND_MASK,
+ U_GC_L_MASK,
+ mask_blank,
+ U_GC_CC_MASK | U_GC_CF_MASK | U_GC_ZL_MASK | U_GC_ZP_MASK,
+ U_GC_ND_MASK,
+ U_GC_ND_MASK,
+ (0x3FFFFFFFu) & ~(U_GC_CC_MASK | U_GC_CF_MASK | U_GC_CS_MASK | U_GC_CN_MASK | U_GC_Z_MASK),
+ mask_horizontal,
+ U_GC_LL_MASK,
+ U_GC_LL_MASK,
+ ~(U_GC_C_MASK),
+ U_GC_P_MASK,
+ char_class_type(U_GC_Z_MASK) | mask_space,
+ char_class_type(U_GC_Z_MASK) | mask_space,
+ U_GC_LU_MASK,
+ mask_unicode,
+ U_GC_LU_MASK,
+ mask_vertical,
+ char_class_type(U_GC_L_MASK | U_GC_ND_MASK | U_GC_MN_MASK) | mask_underscore,
+ char_class_type(U_GC_L_MASK | U_GC_ND_MASK | U_GC_MN_MASK) | mask_underscore,
+ char_class_type(U_GC_ND_MASK) | mask_xdigit,
+ };
+
+ int idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(p1, p2);
+ if(idx >= 0)
+ return masks[idx+1];
+ char_class_type result = lookup_icu_mask(p1, p2);
+ if(result != 0)
+ return result;
+
+ if(idx < 0)
+ {
+ string_type s(p1, p2);
+ string_type::size_type i = 0;
+ while(i < s.size())
+ {
+ s[i] = static_cast<char>((::u_tolower)(s[i]));
+ if(::u_isspace(s[i]) || (s[i] == '-') || (s[i] == '_'))
+ s.erase(s.begin()+i, s.begin()+i+1);
+ else
+ {
+ s[i] = static_cast<char>((::u_tolower)(s[i]));
+ ++i;
+ }
+ }
+ if(s.size())
+ idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
+ if(idx >= 0)
+ return masks[idx+1];
+ if(s.size())
+ result = lookup_icu_mask(&*s.begin(), &*s.begin() + s.size());
+ if(result != 0)
+ return result;
+ }
+ BOOST_ASSERT(std::size_t(idx+1) < sizeof(masks) / sizeof(masks[0]));
+ return masks[idx+1];
+}
+
+icu_regex_traits::string_type icu_regex_traits::lookup_collatename(const char_type* p1, const char_type* p2) const
+{
+ string_type result;
+#ifdef BOOST_NO_CXX98_BINDERS
+ if(std::find_if(p1, p2, std::bind(std::greater< ::UChar32>(), std::placeholders::_1, 0x7f)) == p2)
+#else
+ if(std::find_if(p1, p2, std::bind2nd(std::greater< ::UChar32>(), 0x7f)) == p2)
+#endif
+ {
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ std::string s(p1, p2);
+#else
+ std::string s;
+ const char_type* p3 = p1;
+ while(p3 != p2)
+ s.append(1, *p3++);
+#endif
+ // Try Unicode name:
+ UErrorCode err = U_ZERO_ERROR;
+ UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, s.c_str(), &err);
+ if(U_SUCCESS(err))
+ {
+ result.push_back(c);
+ return result;
+ }
+ // Try Unicode-extended name:
+ err = U_ZERO_ERROR;
+ c = ::u_charFromName(U_EXTENDED_CHAR_NAME, s.c_str(), &err);
+ if(U_SUCCESS(err))
+ {
+ result.push_back(c);
+ return result;
+ }
+ // try POSIX name:
+ s = ::boost::BOOST_REGEX_DETAIL_NS::lookup_default_collate_name(s);
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ result.assign(s.begin(), s.end());
+#else
+ result.clear();
+ std::string::const_iterator si, sj;
+ si = s.begin();
+ sj = s.end();
+ while(si != sj)
+ result.push_back(*si++);
+#endif
+ }
+ if(result.empty() && (p2-p1 == 1))
+ result.push_back(*p1);
+ return result;
+}
+
+bool icu_regex_traits::isctype(char_type c, char_class_type f) const
+{
+ // check for standard catagories first:
+ char_class_type m = char_class_type(static_cast<char_class_type>(1) << u_charType(c));
+ if((m & f) != 0)
+ return true;
+ // now check for special cases:
+ if(((f & mask_blank) != 0) && u_isblank(c))
+ return true;
+ if(((f & mask_space) != 0) && u_isspace(c))
+ return true;
+ if(((f & mask_xdigit) != 0) && (u_digit(c, 16) >= 0))
+ return true;
+ if(((f & mask_unicode) != 0) && (c >= 0x100))
+ return true;
+ if(((f & mask_underscore) != 0) && (c == '_'))
+ return true;
+ if(((f & mask_any) != 0) && (c <= 0x10FFFF))
+ return true;
+ if(((f & mask_ascii) != 0) && (c <= 0x7F))
+ return true;
+ if(((f & mask_vertical) != 0) && (::boost::BOOST_REGEX_DETAIL_NS::is_separator(c) || (c == static_cast<char_type>('\v')) || (m == U_GC_ZL_MASK) || (m == U_GC_ZP_MASK)))
+ return true;
+ if(((f & mask_horizontal) != 0) && !::boost::BOOST_REGEX_DETAIL_NS::is_separator(c) && u_isspace(c) && (c != static_cast<char_type>('\v')))
+ return true;
+ return false;
+}
+
+}
+
+#endif // BOOST_HAS_ICU
diff --git a/src/boost/libs/regex/src/instances.cpp b/src/boost/libs/regex/src/instances.cpp
new file mode 100644
index 000000000..69d72ad6e
--- /dev/null
+++ b/src/boost/libs/regex/src/instances.cpp
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: instances.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: regex narrow character template instances.
+ */
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/regex/config.hpp>
+
+#if !defined(BOOST_REGEX_NO_EXTERNAL_TEMPLATES)
+#define BOOST_REGEX_NARROW_INSTANTIATE
+
+#ifdef __BORLANDC__
+#pragma hrdstop
+#endif
+
+#include <boost/regex.hpp>
+
+#endif
diff --git a/src/boost/libs/regex/src/internals.hpp b/src/boost/libs/regex/src/internals.hpp
new file mode 100644
index 000000000..3a15cc67c
--- /dev/null
+++ b/src/boost/libs/regex/src/internals.hpp
@@ -0,0 +1,35 @@
+/*
+ *
+ * Copyright (c) 2011
+ * 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)
+ *
+ */
+
+#ifndef BOOST_REGEX_SRC_INTERNALS_HPP
+#define BOOST_REGEX_SRC_INTERNALS_HPP
+
+enum
+{
+ char_class_space=1<<0,
+ char_class_print=1<<1,
+ char_class_cntrl=1<<2,
+ char_class_upper=1<<3,
+ char_class_lower=1<<4,
+ char_class_alpha=1<<5,
+ char_class_digit=1<<6,
+ char_class_punct=1<<7,
+ char_class_xdigit=1<<8,
+ char_class_alnum=char_class_alpha|char_class_digit,
+ char_class_graph=char_class_alnum|char_class_punct,
+ char_class_blank=1<<9,
+ char_class_word=1<<10,
+ char_class_unicode=1<<11,
+ char_class_horizontal=1<<12,
+ char_class_vertical=1<<13
+};
+
+#endif // BOOST_REGEX_SRC_INTERNALS_HPP
diff --git a/src/boost/libs/regex/src/posix_api.cpp b/src/boost/libs/regex/src/posix_api.cpp
new file mode 100644
index 000000000..1531d948a
--- /dev/null
+++ b/src/boost/libs/regex/src/posix_api.cpp
@@ -0,0 +1,295 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: posix_api.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Implements the Posix API wrappers.
+ */
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/config.hpp>
+#include <cstdio>
+#include <boost/regex.hpp>
+#include <boost/cregex.hpp>
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::sprintf;
+ using ::strcpy;
+ using ::strcmp;
+}
+#endif
+
+
+namespace boost{
+
+namespace{
+
+unsigned int magic_value = 25631;
+
+const char* names[] = {
+ "REG_NOERROR",
+ "REG_NOMATCH",
+ "REG_BADPAT",
+ "REG_ECOLLATE",
+ "REG_ECTYPE",
+ "REG_EESCAPE",
+ "REG_ESUBREG",
+ "REG_EBRACK",
+ "REG_EPAREN",
+ "REG_EBRACE",
+ "REG_BADBR",
+ "REG_ERANGE",
+ "REG_ESPACE",
+ "REG_BADRPT",
+ "REG_EEND",
+ "REG_ESIZE",
+ "REG_ERPAREN",
+ "REG_EMPTY",
+ "REG_ECOMPLEXITY",
+ "REG_ESTACK",
+ "REG_E_PERL",
+ "REG_E_UNKNOWN",
+};
+} // namespace
+
+typedef boost::basic_regex<char, c_regex_traits<char> > c_regex_type;
+
+BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char* ptr, int f)
+{
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ expression->guts = new c_regex_type();
+#ifndef BOOST_NO_EXCEPTIONS
+ } catch(...)
+ {
+ expression->guts = 0;
+ return REG_ESPACE;
+ }
+#else
+ if(0 == expression->guts)
+ return REG_E_MEMORY;
+#endif
+ // set default flags:
+ boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
+ expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
+ // and translate those that are actually set:
+
+ if(f & REG_NOCOLLATE)
+ {
+ flags |= regex::nocollate;
+#ifndef BOOST_REGEX_V3
+ flags &= ~regex::collate;
+#endif
+ }
+
+ if(f & REG_NOSUB)
+ {
+ //expression->eflags |= match_any;
+ flags |= regex::nosubs;
+ }
+
+ if(f & REG_NOSPEC)
+ flags |= regex::literal;
+ if(f & REG_ICASE)
+ flags |= regex::icase;
+ if(f & REG_ESCAPE_IN_LISTS)
+ flags &= ~regex::no_escape_in_lists;
+ if(f & REG_NEWLINE_ALT)
+ flags |= regex::newline_alt;
+
+ const char* p2;
+ if(f & REG_PEND)
+ p2 = expression->re_endp;
+ else p2 = ptr + std::strlen(ptr);
+
+ int result;
+
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ expression->re_magic = magic_value;
+ static_cast<c_regex_type*>(expression->guts)->set_expression(ptr, p2, flags);
+ expression->re_nsub = static_cast<c_regex_type*>(expression->guts)->mark_count();
+ result = static_cast<c_regex_type*>(expression->guts)->error_code();
+#ifndef BOOST_NO_EXCEPTIONS
+ }
+ catch(const boost::regex_error& be)
+ {
+ result = be.code();
+ }
+ catch(...)
+ {
+ result = REG_E_UNKNOWN;
+ }
+#endif
+ if(result)
+ regfreeA(expression);
+ return result;
+
+}
+
+BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* e, char* buf, regsize_t buf_size)
+{
+ std::size_t result = 0;
+ if(code & REG_ITOA)
+ {
+ code &= ~REG_ITOA;
+ if(code <= (int)REG_E_UNKNOWN)
+ {
+ result = std::strlen(names[code]) + 1;
+ if(buf_size >= result)
+ BOOST_REGEX_DETAIL_NS::strcpy_s(buf, buf_size, names[code]);
+ return result;
+ }
+ return result;
+ }
+ if(code == REG_ATOI)
+ {
+ char localbuf[5];
+ if(e == 0)
+ return 0;
+ for(int i = 0; i <= (int)REG_E_UNKNOWN; ++i)
+ {
+ if(std::strcmp(e->re_endp, names[i]) == 0)
+ {
+ //
+ // We're converting an integer i to a string, and since i <= REG_E_UNKNOWN
+ // a five character string is *always* large enough:
+ //
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
+ int r = (::sprintf_s)(localbuf, 5, "%d", i);
+#else
+ int r = (std::sprintf)(localbuf, "%d", i);
+#endif
+ if(r < 0)
+ return 0; // sprintf failed
+ if(std::strlen(localbuf) < buf_size)
+ BOOST_REGEX_DETAIL_NS::strcpy_s(buf, buf_size, localbuf);
+ return std::strlen(localbuf) + 1;
+ }
+ }
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
+ int r = (::sprintf_s)(localbuf, 5, "%d", 0);
+#else
+ int r = (std::sprintf)(localbuf, "%d", 0);
+#endif
+ if(r < 0)
+ return 0; // sprintf failed
+ if(std::strlen(localbuf) < buf_size)
+ BOOST_REGEX_DETAIL_NS::strcpy_s(buf, buf_size, localbuf);
+ return std::strlen(localbuf) + 1;
+ }
+ if(code <= (int)REG_E_UNKNOWN)
+ {
+ std::string p;
+ if((e) && (e->re_magic == magic_value))
+ p = static_cast<c_regex_type*>(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code));
+ else
+ {
+ p = BOOST_REGEX_DETAIL_NS::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code));
+ }
+ std::size_t len = p.size();
+ if(len < buf_size)
+ {
+ BOOST_REGEX_DETAIL_NS::strcpy_s(buf, buf_size, p.c_str());
+ }
+ return len + 1;
+ }
+ if(buf_size)
+ *buf = 0;
+ return 0;
+}
+
+BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, const char* buf, regsize_t n, regmatch_t* array, int eflags)
+{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4267)
+#endif
+ bool result = false;
+ match_flag_type flags = match_default | expression->eflags;
+ const char* end;
+ const char* start;
+ cmatch m;
+
+ if(eflags & REG_NOTBOL)
+ flags |= match_not_bol;
+ if(eflags & REG_NOTEOL)
+ flags |= match_not_eol;
+ if(eflags & REG_STARTEND)
+ {
+ start = buf + array[0].rm_so;
+ end = buf + array[0].rm_eo;
+ }
+ else
+ {
+ start = buf;
+ end = buf + std::strlen(buf);
+ }
+
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ if(expression->re_magic == magic_value)
+ {
+ result = regex_search(start, end, m, *static_cast<c_regex_type*>(expression->guts), flags);
+ }
+ else
+ return result;
+#ifndef BOOST_NO_EXCEPTIONS
+ } catch(...)
+ {
+ return REG_E_UNKNOWN;
+ }
+#endif
+
+ if(result)
+ {
+ // extract what matched:
+ std::size_t i;
+ for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i)
+ {
+ array[i].rm_so = (m[i].matched == false) ? -1 : (m[i].first - buf);
+ array[i].rm_eo = (m[i].matched == false) ? -1 : (m[i].second - buf);
+ }
+ // and set anything else to -1:
+ for(i = expression->re_nsub + 1; i < n; ++i)
+ {
+ array[i].rm_so = -1;
+ array[i].rm_eo = -1;
+ }
+ return 0;
+ }
+ return REG_NOMATCH;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+}
+
+BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA* expression)
+{
+ if(expression->re_magic == magic_value)
+ {
+ delete static_cast<c_regex_type*>(expression->guts);
+ }
+ expression->re_magic = 0;
+}
+
+} // namespace boost
+
+
+
+
diff --git a/src/boost/libs/regex/src/regex.cpp b/src/boost/libs/regex/src/regex.cpp
new file mode 100644
index 000000000..5a8bbdc04
--- /dev/null
+++ b/src/boost/libs/regex/src/regex.cpp
@@ -0,0 +1,231 @@
+/*
+ *
+ * Copyright (c) 1998-2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: regex.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Misc boost::regbase member funnctions.
+ */
+
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/config.hpp>
+#include <new>
+#include <boost/regex.hpp>
+#include <boost/throw_exception.hpp>
+
+#if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && defined(_MSC_VER) && (_MSC_VER >= 1300)
+# include <malloc.h>
+#endif
+#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+#ifndef NOMINMAX
+# define NOMINMAX
+#endif
+#define NOGDI
+#define NOUSER
+#include <windows.h>
+#endif
+
+#if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_REGEX_V3)
+#if BOOST_REGEX_MAX_CACHE_BLOCKS == 0
+#include <new>
+#else
+#include <boost/regex/v4/mem_block_cache.hpp>
+#endif
+#endif
+
+#ifdef BOOST_INTEL
+#pragma warning(disable:383)
+#endif
+
+namespace boost{
+
+//
+// fix: these are declared out of line here to ensure
+// that dll builds contain the Virtual table for these
+// types - this ensures that exceptions can be thrown
+// from the dll and caught in an exe.
+regex_error::regex_error(const std::string& s, regex_constants::error_type err, std::ptrdiff_t pos)
+ : std::runtime_error(s)
+ , m_error_code(err)
+ , m_position(pos)
+{
+}
+
+regex_error::regex_error(regex_constants::error_type err)
+ : std::runtime_error(::boost::BOOST_REGEX_DETAIL_NS::get_default_error_string(err))
+ , m_error_code(err)
+ , m_position(0)
+{
+}
+
+regex_error::~regex_error() throw()
+{
+}
+
+void regex_error::raise()const
+{
+#ifndef BOOST_NO_EXCEPTIONS
+ ::boost::throw_exception(*this);
+#endif
+}
+
+
+
+namespace BOOST_REGEX_DETAIL_NS{
+
+BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex)
+{
+ ::boost::throw_exception(ex);
+}
+//
+// error checking API:
+//
+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:
+ //
+ if((mf & match_extra) && (mf & match_posix))
+ {
+ std::logic_error msg("Usage Error: Can't mix regular expression captures with POSIX matching rules");
+ throw_exception(msg);
+ }
+#endif
+}
+
+#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
+
+static void execute_eror()
+{
+ // we only get here after a stack overflow,
+ // this has to be a separate proceedure because we
+ // can't mix __try{}__except block with local objects
+ // that have destructors:
+ reset_stack_guard_page();
+ std::runtime_error err("Out of stack space, while attempting to match a regular expression.");
+ raise_runtime_error(err);
+}
+
+bool BOOST_REGEX_CALL abstract_protected_call::execute()const
+{
+ __try{
+ return this->call();
+ }__except(EXCEPTION_STACK_OVERFLOW == GetExceptionCode())
+ {
+ execute_eror();
+ }
+ // We never really get here at all:
+ return false;
+}
+
+BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page()
+{
+#if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && defined(_MSC_VER) && (_MSC_VER >= 1300)
+ _resetstkoflw();
+#else
+ //
+ // We need to locate the current page being used by the stack,
+ // move to the page below it and then deallocate and protect
+ // that page. Note that ideally we would protect only the lowest
+ // stack page that has been allocated: in practice there
+ // seems to be no easy way to locate this page, in any case as
+ // long as the next page is protected, then Windows will figure
+ // the rest out for us...
+ //
+ SYSTEM_INFO si;
+ GetSystemInfo(&si);
+ MEMORY_BASIC_INFORMATION mi;
+ DWORD previous_protection_status;
+ //
+ // this is an address in our stack space:
+ //
+ LPBYTE page = (LPBYTE)&page;
+ //
+ // Get the current memory page in use:
+ //
+ VirtualQuery(page, &mi, sizeof(mi));
+ //
+ // Go to the page one below this:
+ //
+ page = (LPBYTE)(mi.BaseAddress)-si.dwPageSize;
+ //
+ // Free and protect everything from the start of the
+ // allocation range, to the end of the page below the
+ // one in use:
+ //
+ if (!VirtualFree(mi.AllocationBase, (LPBYTE)page - (LPBYTE)mi.AllocationBase, MEM_DECOMMIT)
+ || !VirtualProtect(page, si.dwPageSize, PAGE_GUARD | PAGE_READWRITE, &previous_protection_status))
+ {
+ throw std::bad_exception();
+ }
+#endif
+}
+#endif
+
+#if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_REGEX_V3)
+
+#if BOOST_REGEX_MAX_CACHE_BLOCKS == 0
+
+BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block()
+{
+ return ::operator new(BOOST_REGEX_BLOCKSIZE);
+}
+
+BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void* p)
+{
+ ::operator delete(p);
+}
+
+#else
+
+#if defined(BOOST_REGEX_MEM_BLOCK_CACHE_LOCK_FREE)
+mem_block_cache block_cache = { { {nullptr} } } ;
+#elif defined(BOOST_HAS_THREADS)
+mem_block_cache block_cache = { 0, 0, BOOST_STATIC_MUTEX_INIT, };
+#else
+mem_block_cache block_cache = { 0, 0, };
+#endif
+
+BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block()
+{
+ return block_cache.get();
+}
+
+BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void* p)
+{
+ block_cache.put(p);
+}
+
+#endif
+
+#endif
+
+} // namespace BOOST_REGEX_DETAIL_NS
+
+
+
+} // namespace boost
+
+#if defined(BOOST_RE_USE_VCL) && defined(BOOST_REGEX_DYN_LINK)
+
+int WINAPI DllEntryPoint(HINSTANCE , unsigned long , void*)
+{
+ return 1;
+}
+#endif
+
diff --git a/src/boost/libs/regex/src/regex_debug.cpp b/src/boost/libs/regex/src/regex_debug.cpp
new file mode 100644
index 000000000..9306a82e7
--- /dev/null
+++ b/src/boost/libs/regex/src/regex_debug.cpp
@@ -0,0 +1,59 @@
+/*
+ *
+ * Copyright (c) 1998-2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: regex_debug.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Misc. debugging helpers.
+ */
+
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/regex/config.hpp>
+
+
+//
+// regex configuration information: this prints out the settings used
+// when the library was built - include in debugging builds only:
+//
+#ifdef BOOST_REGEX_CONFIG_INFO
+
+#define print_macro regex_lib_print_macro
+#define print_expression regex_lib_print_expression
+#define print_byte_order regex_lib_print_byte_order
+#define print_sign regex_lib_print_sign
+#define print_compiler_macros regex_lib_print_compiler_macros
+#define print_stdlib_macros regex_lib_print_stdlib_macros
+#define print_platform_macros regex_lib_print_platform_macros
+#define print_boost_macros regex_lib_print_boost_macros
+#define print_separator regex_lib_print_separator
+#define OLD_MAIN regex_lib_main
+#define NEW_MAIN regex_lib_main2
+#define NO_RECURSE
+
+#include <libs/regex/test/config_info/regex_config_info.cpp>
+
+BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info()
+{
+ std::cout << "\n\n";
+ print_separator();
+ std::cout << "Regex library build configuration:\n\n";
+ regex_lib_main2();
+}
+
+#endif
+
+
+
+
+
diff --git a/src/boost/libs/regex/src/regex_raw_buffer.cpp b/src/boost/libs/regex/src/regex_raw_buffer.cpp
new file mode 100644
index 000000000..bb4922977
--- /dev/null
+++ b/src/boost/libs/regex/src/regex_raw_buffer.cpp
@@ -0,0 +1,72 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_raw_buffer.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Member functions for class raw_storage.
+ */
+
+
+#define BOOST_REGEX_SOURCE
+#include <boost/config.hpp>
+#include <memory>
+#include <cstring>
+#include <boost/assert.hpp>
+#include <boost/regex/v4/regex_raw_buffer.hpp>
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::memcpy;
+ using ::memmove;
+}
+#endif
+
+
+namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
+
+void BOOST_REGEX_CALL raw_storage::resize(size_type n)
+{
+ size_type newsize = start ? last - start : 1024;
+ while(newsize < n)
+ newsize *= 2;
+ size_type datasize = end - start;
+ // extend newsize to WORD/DWORD boundary:
+ newsize = (newsize + padding_mask) & ~(padding_mask);
+
+ // allocate and copy data:
+ pointer ptr = static_cast<pointer>(::operator new(newsize));
+ BOOST_REGEX_NOEH_ASSERT(ptr)
+ if(start)
+ std::memcpy(ptr, start, datasize);
+
+ // get rid of old buffer:
+ ::operator delete(start);
+
+ // and set up pointers:
+ start = ptr;
+ end = ptr + datasize;
+ last = ptr + newsize;
+}
+
+void* BOOST_REGEX_CALL raw_storage::insert(size_type pos, size_type n)
+{
+ BOOST_ASSERT(pos <= size_type(end - start));
+ if(size_type(last - end) < n)
+ resize(n + (end - start));
+ void* result = start + pos;
+ std::memmove(start + pos + n, start + pos, (end - start) - pos);
+ end += n;
+ return result;
+}
+
+}} // namespaces
diff --git a/src/boost/libs/regex/src/regex_traits_defaults.cpp b/src/boost/libs/regex/src/regex_traits_defaults.cpp
new file mode 100644
index 000000000..0b66c68dc
--- /dev/null
+++ b/src/boost/libs/regex/src/regex_traits_defaults.cpp
@@ -0,0 +1,692 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_traits_defaults.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares API's for access to regex_traits default properties.
+ */
+
+#define BOOST_REGEX_SOURCE
+#include <boost/regex/regex_traits.hpp>
+
+#include <cctype>
+#ifndef BOOST_NO_WREGEX
+#include <cwctype>
+#endif
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::tolower;
+ using ::toupper;
+#ifndef BOOST_NO_WREGEX
+ using ::towlower;
+ using ::towupper;
+#endif
+}
+#endif
+
+
+namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
+
+BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants::syntax_type n)
+{
+ // if the user hasn't supplied a message catalog, then this supplies
+ // default "messages" for us to load in the range 1-100.
+ const char* messages[] = {
+ "",
+ "(",
+ ")",
+ "$",
+ "^",
+ ".",
+ "*",
+ "+",
+ "?",
+ "[",
+ "]",
+ "|",
+ "\\",
+ "#",
+ "-",
+ "{",
+ "}",
+ "0123456789",
+ "b",
+ "B",
+ "<",
+ ">",
+ "",
+ "",
+ "A`",
+ "z'",
+ "\n",
+ ",",
+ "a",
+ "f",
+ "n",
+ "r",
+ "t",
+ "v",
+ "x",
+ "c",
+ ":",
+ "=",
+ "e",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "E",
+ "Q",
+ "X",
+ "C",
+ "Z",
+ "G",
+ "!",
+ "p",
+ "P",
+ "N",
+ "gk",
+ "K",
+ "R",
+ };
+
+ return ((n >= (sizeof(messages) / sizeof(messages[1]))) ? "" : messages[n]);
+}
+
+BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n)
+{
+ static const char* const s_default_error_messages[] = {
+ "Success", /* REG_NOERROR 0 error_ok */
+ "No match", /* REG_NOMATCH 1 error_no_match */
+ "Invalid regular expression.", /* REG_BADPAT 2 error_bad_pattern */
+ "Invalid collation character.", /* REG_ECOLLATE 3 error_collate */
+ "Invalid character class name, collating name, or character range.", /* REG_ECTYPE 4 error_ctype */
+ "Invalid or unterminated escape sequence.", /* REG_EESCAPE 5 error_escape */
+ "Invalid back reference: specified capturing group does not exist.", /* REG_ESUBREG 6 error_backref */
+ "Unmatched [ or [^ in character class declaration.", /* REG_EBRACK 7 error_brack */
+ "Unmatched marking parenthesis ( or \\(.", /* REG_EPAREN 8 error_paren */
+ "Unmatched quantified repeat operator { or \\{.", /* REG_EBRACE 9 error_brace */
+ "Invalid content of repeat range.", /* REG_BADBR 10 error_badbrace */
+ "Invalid range end in character class", /* REG_ERANGE 11 error_range */
+ "Out of memory.", /* REG_ESPACE 12 error_space NOT USED */
+ "Invalid preceding regular expression prior to repetition operator.", /* REG_BADRPT 13 error_badrepeat */
+ "Premature end of regular expression", /* REG_EEND 14 error_end NOT USED */
+ "Regular expression is too large.", /* REG_ESIZE 15 error_size NOT USED */
+ "Unmatched ) or \\)", /* REG_ERPAREN 16 error_right_paren NOT USED */
+ "Empty regular expression.", /* REG_EMPTY 17 error_empty */
+ "The complexity of matching the regular expression exceeded predefined bounds. "
+ "Try refactoring the regular expression to make each choice made by the state machine unambiguous. "
+ "This exception is thrown to prevent \"eternal\" matches that take an "
+ "indefinite period time to locate.", /* REG_ECOMPLEXITY 18 error_complexity */
+ "Ran out of stack space trying to match the regular expression.", /* REG_ESTACK 19 error_stack */
+ "Invalid or unterminated Perl (?...) sequence.", /* REG_E_PERL 20 error_perl */
+ "Unknown error.", /* REG_E_UNKNOWN 21 error_unknown */
+ };
+
+ return (n > ::boost::regex_constants::error_unknown) ? s_default_error_messages[ ::boost::regex_constants::error_unknown] : s_default_error_messages[n];
+}
+
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(boost::uint_least16_t c)
+{
+ const boost::uint_least16_t combining_ranges[] = { 0x0300, 0x0361,
+ 0x0483, 0x0486,
+ 0x0903, 0x0903,
+ 0x093E, 0x0940,
+ 0x0949, 0x094C,
+ 0x0982, 0x0983,
+ 0x09BE, 0x09C0,
+ 0x09C7, 0x09CC,
+ 0x09D7, 0x09D7,
+ 0x0A3E, 0x0A40,
+ 0x0A83, 0x0A83,
+ 0x0ABE, 0x0AC0,
+ 0x0AC9, 0x0ACC,
+ 0x0B02, 0x0B03,
+ 0x0B3E, 0x0B3E,
+ 0x0B40, 0x0B40,
+ 0x0B47, 0x0B4C,
+ 0x0B57, 0x0B57,
+ 0x0B83, 0x0B83,
+ 0x0BBE, 0x0BBF,
+ 0x0BC1, 0x0BCC,
+ 0x0BD7, 0x0BD7,
+ 0x0C01, 0x0C03,
+ 0x0C41, 0x0C44,
+ 0x0C82, 0x0C83,
+ 0x0CBE, 0x0CBE,
+ 0x0CC0, 0x0CC4,
+ 0x0CC7, 0x0CCB,
+ 0x0CD5, 0x0CD6,
+ 0x0D02, 0x0D03,
+ 0x0D3E, 0x0D40,
+ 0x0D46, 0x0D4C,
+ 0x0D57, 0x0D57,
+ 0x0F7F, 0x0F7F,
+ 0x20D0, 0x20E1,
+ 0x3099, 0x309A,
+ 0xFE20, 0xFE23,
+ 0xffff, 0xffff, };
+
+ const boost::uint_least16_t* p = combining_ranges + 1;
+ while(*p < c) p += 2;
+ --p;
+ if((c >= *p) && (c <= *(p+1)))
+ return true;
+ return false;
+}
+
+//
+// these are the POSIX collating names:
+//
+BOOST_REGEX_DECL const char* def_coll_names[] = {
+"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "alert", "backspace", "tab", "newline",
+"vertical-tab", "form-feed", "carriage-return", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
+"SYN", "ETB", "CAN", "EM", "SUB", "ESC", "IS4", "IS3", "IS2", "IS1", "space", "exclamation-mark",
+"quotation-mark", "number-sign", "dollar-sign", "percent-sign", "ampersand", "apostrophe",
+"left-parenthesis", "right-parenthesis", "asterisk", "plus-sign", "comma", "hyphen",
+"period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
+"colon", "semicolon", "less-than-sign", "equals-sign", "greater-than-sign",
+"question-mark", "commercial-at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
+"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "left-square-bracket", "backslash",
+"right-square-bracket", "circumflex", "underscore", "grave-accent", "a", "b", "c", "d", "e", "f",
+"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "left-curly-bracket",
+"vertical-line", "right-curly-bracket", "tilde", "DEL", "",
+};
+
+// these multi-character collating elements
+// should keep most Western-European locales
+// happy - we should really localise these a
+// little more - but this will have to do for
+// now:
+
+BOOST_REGEX_DECL const char* def_multi_coll[] = {
+ "ae",
+ "Ae",
+ "AE",
+ "ch",
+ "Ch",
+ "CH",
+ "ll",
+ "Ll",
+ "LL",
+ "ss",
+ "Ss",
+ "SS",
+ "nj",
+ "Nj",
+ "NJ",
+ "dz",
+ "Dz",
+ "DZ",
+ "lj",
+ "Lj",
+ "LJ",
+ "",
+};
+
+
+
+BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name)
+{
+ unsigned int i = 0;
+ while(*def_coll_names[i])
+ {
+ if(def_coll_names[i] == name)
+ {
+ return std::string(1, char(i));
+ }
+ ++i;
+ }
+ i = 0;
+ while(*def_multi_coll[i])
+ {
+ if(def_multi_coll[i] == name)
+ {
+ return def_multi_coll[i];
+ }
+ ++i;
+ }
+ return std::string();
+}
+
+BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_lower(char c)
+{
+ return static_cast<char>((std::tolower)((unsigned char)c));
+}
+
+BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_upper(char c)
+{
+ return static_cast<char>((std::toupper)((unsigned char)c));
+}
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_lower(wchar_t c)
+{
+ return (std::towlower)(c);
+}
+
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_upper(wchar_t c)
+{
+ return (std::towupper)(c);
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_lower(unsigned short c)
+{
+ return (std::towlower)(c);
+}
+
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_upper(unsigned short c)
+{
+ return (std::towupper)(c);
+}
+#endif
+
+#endif
+
+BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_syntax_type(char c)
+{
+ //
+ // char_syntax determines how the compiler treats a given character
+ // in a regular expression.
+ //
+ static regex_constants::escape_syntax_type char_syntax[] = {
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /* */ // 32
+ regex_constants::escape_type_identity, /*!*/
+ regex_constants::escape_type_identity, /*"*/
+ regex_constants::escape_type_identity, /*#*/
+ regex_constants::escape_type_identity, /*$*/
+ regex_constants::escape_type_identity, /*%*/
+ regex_constants::escape_type_identity, /*&*/
+ regex_constants::escape_type_end_buffer, /*'*/
+ regex_constants::syntax_open_mark, /*(*/
+ regex_constants::syntax_close_mark, /*)*/
+ regex_constants::escape_type_identity, /***/
+ regex_constants::syntax_plus, /*+*/
+ regex_constants::escape_type_identity, /*,*/
+ regex_constants::escape_type_identity, /*-*/
+ regex_constants::escape_type_identity, /*.*/
+ regex_constants::escape_type_identity, /*/*/
+ regex_constants::escape_type_decimal, /*0*/
+ regex_constants::escape_type_backref, /*1*/
+ regex_constants::escape_type_backref, /*2*/
+ regex_constants::escape_type_backref, /*3*/
+ regex_constants::escape_type_backref, /*4*/
+ regex_constants::escape_type_backref, /*5*/
+ regex_constants::escape_type_backref, /*6*/
+ regex_constants::escape_type_backref, /*7*/
+ regex_constants::escape_type_backref, /*8*/
+ regex_constants::escape_type_backref, /*9*/
+ regex_constants::escape_type_identity, /*:*/
+ regex_constants::escape_type_identity, /*;*/
+ regex_constants::escape_type_left_word, /*<*/
+ regex_constants::escape_type_identity, /*=*/
+ regex_constants::escape_type_right_word, /*>*/
+ regex_constants::syntax_question, /*?*/
+ regex_constants::escape_type_identity, /*@*/
+ regex_constants::escape_type_start_buffer, /*A*/
+ regex_constants::escape_type_not_word_assert, /*B*/
+ regex_constants::escape_type_C, /*C*/
+ regex_constants::escape_type_not_class, /*D*/
+ regex_constants::escape_type_E, /*E*/
+ regex_constants::escape_type_not_class, /*F*/
+ regex_constants::escape_type_G, /*G*/
+ regex_constants::escape_type_not_class, /*H*/
+ regex_constants::escape_type_not_class, /*I*/
+ regex_constants::escape_type_not_class, /*J*/
+ regex_constants::escape_type_reset_start_mark, /*K*/
+ regex_constants::escape_type_not_class, /*L*/
+ regex_constants::escape_type_not_class, /*M*/
+ regex_constants::escape_type_named_char, /*N*/
+ regex_constants::escape_type_not_class, /*O*/
+ regex_constants::escape_type_not_property, /*P*/
+ regex_constants::escape_type_Q, /*Q*/
+ regex_constants::escape_type_line_ending, /*R*/
+ regex_constants::escape_type_not_class, /*S*/
+ regex_constants::escape_type_not_class, /*T*/
+ regex_constants::escape_type_not_class, /*U*/
+ regex_constants::escape_type_not_class, /*V*/
+ regex_constants::escape_type_not_class, /*W*/
+ regex_constants::escape_type_X, /*X*/
+ regex_constants::escape_type_not_class, /*Y*/
+ regex_constants::escape_type_Z, /*Z*/
+ regex_constants::escape_type_identity, /*[*/
+ regex_constants::escape_type_identity, /*\*/
+ regex_constants::escape_type_identity, /*]*/
+ regex_constants::escape_type_identity, /*^*/
+ regex_constants::escape_type_identity, /*_*/
+ regex_constants::escape_type_start_buffer, /*`*/
+ regex_constants::escape_type_control_a, /*a*/
+ regex_constants::escape_type_word_assert, /*b*/
+ regex_constants::escape_type_ascii_control, /*c*/
+ regex_constants::escape_type_class, /*d*/
+ regex_constants::escape_type_e, /*e*/
+ regex_constants::escape_type_control_f, /*f*/
+ regex_constants::escape_type_extended_backref, /*g*/
+ regex_constants::escape_type_class, /*h*/
+ regex_constants::escape_type_class, /*i*/
+ regex_constants::escape_type_class, /*j*/
+ regex_constants::escape_type_extended_backref, /*k*/
+ regex_constants::escape_type_class, /*l*/
+ regex_constants::escape_type_class, /*m*/
+ regex_constants::escape_type_control_n, /*n*/
+ regex_constants::escape_type_class, /*o*/
+ regex_constants::escape_type_property, /*p*/
+ regex_constants::escape_type_class, /*q*/
+ regex_constants::escape_type_control_r, /*r*/
+ regex_constants::escape_type_class, /*s*/
+ regex_constants::escape_type_control_t, /*t*/
+ regex_constants::escape_type_class, /*u*/
+ regex_constants::escape_type_control_v, /*v*/
+ regex_constants::escape_type_class, /*w*/
+ regex_constants::escape_type_hex, /*x*/
+ regex_constants::escape_type_class, /*y*/
+ regex_constants::escape_type_end_buffer, /*z*/
+ regex_constants::syntax_open_brace, /*{*/
+ regex_constants::syntax_or, /*|*/
+ regex_constants::syntax_close_brace, /*}*/
+ regex_constants::escape_type_identity, /*~*/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ };
+
+ return char_syntax[(unsigned char)c];
+}
+
+BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_syntax_type(char c)
+{
+ //
+ // char_syntax determines how the compiler treats a given character
+ // in a regular expression.
+ //
+ static regex_constants::syntax_type char_syntax[] = {
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_newline, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /* */ // 32
+ regex_constants::syntax_not, /*!*/
+ regex_constants::syntax_char, /*"*/
+ regex_constants::syntax_hash, /*#*/
+ regex_constants::syntax_dollar, /*$*/
+ regex_constants::syntax_char, /*%*/
+ regex_constants::syntax_char, /*&*/
+ regex_constants::escape_type_end_buffer, /*'*/
+ regex_constants::syntax_open_mark, /*(*/
+ regex_constants::syntax_close_mark, /*)*/
+ regex_constants::syntax_star, /***/
+ regex_constants::syntax_plus, /*+*/
+ regex_constants::syntax_comma, /*,*/
+ regex_constants::syntax_dash, /*-*/
+ regex_constants::syntax_dot, /*.*/
+ regex_constants::syntax_char, /*/*/
+ regex_constants::syntax_digit, /*0*/
+ regex_constants::syntax_digit, /*1*/
+ regex_constants::syntax_digit, /*2*/
+ regex_constants::syntax_digit, /*3*/
+ regex_constants::syntax_digit, /*4*/
+ regex_constants::syntax_digit, /*5*/
+ regex_constants::syntax_digit, /*6*/
+ regex_constants::syntax_digit, /*7*/
+ regex_constants::syntax_digit, /*8*/
+ regex_constants::syntax_digit, /*9*/
+ regex_constants::syntax_colon, /*:*/
+ regex_constants::syntax_char, /*;*/
+ regex_constants::escape_type_left_word, /*<*/
+ regex_constants::syntax_equal, /*=*/
+ regex_constants::escape_type_right_word, /*>*/
+ regex_constants::syntax_question, /*?*/
+ regex_constants::syntax_char, /*@*/
+ regex_constants::syntax_char, /*A*/
+ regex_constants::syntax_char, /*B*/
+ regex_constants::syntax_char, /*C*/
+ regex_constants::syntax_char, /*D*/
+ regex_constants::syntax_char, /*E*/
+ regex_constants::syntax_char, /*F*/
+ regex_constants::syntax_char, /*G*/
+ regex_constants::syntax_char, /*H*/
+ regex_constants::syntax_char, /*I*/
+ regex_constants::syntax_char, /*J*/
+ regex_constants::syntax_char, /*K*/
+ regex_constants::syntax_char, /*L*/
+ regex_constants::syntax_char, /*M*/
+ regex_constants::syntax_char, /*N*/
+ regex_constants::syntax_char, /*O*/
+ regex_constants::syntax_char, /*P*/
+ regex_constants::syntax_char, /*Q*/
+ regex_constants::syntax_char, /*R*/
+ regex_constants::syntax_char, /*S*/
+ regex_constants::syntax_char, /*T*/
+ regex_constants::syntax_char, /*U*/
+ regex_constants::syntax_char, /*V*/
+ regex_constants::syntax_char, /*W*/
+ regex_constants::syntax_char, /*X*/
+ regex_constants::syntax_char, /*Y*/
+ regex_constants::syntax_char, /*Z*/
+ regex_constants::syntax_open_set, /*[*/
+ regex_constants::syntax_escape, /*\*/
+ regex_constants::syntax_close_set, /*]*/
+ regex_constants::syntax_caret, /*^*/
+ regex_constants::syntax_char, /*_*/
+ regex_constants::syntax_char, /*`*/
+ regex_constants::syntax_char, /*a*/
+ regex_constants::syntax_char, /*b*/
+ regex_constants::syntax_char, /*c*/
+ regex_constants::syntax_char, /*d*/
+ regex_constants::syntax_char, /*e*/
+ regex_constants::syntax_char, /*f*/
+ regex_constants::syntax_char, /*g*/
+ regex_constants::syntax_char, /*h*/
+ regex_constants::syntax_char, /*i*/
+ regex_constants::syntax_char, /*j*/
+ regex_constants::syntax_char, /*k*/
+ regex_constants::syntax_char, /*l*/
+ regex_constants::syntax_char, /*m*/
+ regex_constants::syntax_char, /*n*/
+ regex_constants::syntax_char, /*o*/
+ regex_constants::syntax_char, /*p*/
+ regex_constants::syntax_char, /*q*/
+ regex_constants::syntax_char, /*r*/
+ regex_constants::syntax_char, /*s*/
+ regex_constants::syntax_char, /*t*/
+ regex_constants::syntax_char, /*u*/
+ regex_constants::syntax_char, /*v*/
+ regex_constants::syntax_char, /*w*/
+ regex_constants::syntax_char, /*x*/
+ regex_constants::syntax_char, /*y*/
+ regex_constants::syntax_char, /*z*/
+ regex_constants::syntax_open_brace, /*{*/
+ regex_constants::syntax_or, /*|*/
+ regex_constants::syntax_close_brace, /*}*/
+ regex_constants::syntax_char, /*~*/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ };
+
+ return char_syntax[(unsigned char)c];
+}
+
+
+} // BOOST_REGEX_DETAIL_NS
+} // boost
diff --git a/src/boost/libs/regex/src/static_mutex.cpp b/src/boost/libs/regex/src/static_mutex.cpp
new file mode 100644
index 000000000..35dd0c790
--- /dev/null
+++ b/src/boost/libs/regex/src/static_mutex.cpp
@@ -0,0 +1,185 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE static_mutex.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares static_mutex lock type.
+ */
+
+#define BOOST_REGEX_SOURCE
+#include <boost/config.hpp>
+#include <boost/assert.hpp>
+
+#ifdef BOOST_HAS_THREADS
+
+#include <boost/regex/pending/static_mutex.hpp>
+
+#if defined(BOOST_HAS_WINTHREADS)
+#ifndef NOMINMAX
+# define NOMINMAX
+#endif
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#include <boost/static_assert.hpp>
+#endif
+
+
+namespace boost{
+
+#if defined(BOOST_HAS_PTHREADS) && defined(PTHREAD_MUTEX_INITIALIZER)
+
+scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk)
+: m_mutex(m), m_have_lock(false)
+{
+ if(lk)
+ lock();
+}
+
+scoped_static_mutex_lock::~scoped_static_mutex_lock()
+{
+ if(m_have_lock)
+ unlock();
+}
+
+void scoped_static_mutex_lock::lock()
+{
+ if(0 == m_have_lock)
+ {
+ // Client code will throw if this fails:
+ m_have_lock = (pthread_mutex_lock(&(m_mutex.m_mutex)) == 0);
+ }
+}
+
+void scoped_static_mutex_lock::unlock()
+{
+ if(m_have_lock)
+ {
+ // If this fails there's nothing we can do except assert,
+ // exceptions are out of the question as this code is called
+ // from the lock's destructor:
+ BOOST_VERIFY(pthread_mutex_unlock(&(m_mutex.m_mutex)) == 0);
+ m_have_lock = false;
+ }
+}
+
+#elif defined(BOOST_HAS_WINTHREADS)
+
+BOOST_STATIC_ASSERT(sizeof(LONG) == sizeof(boost::int32_t));
+
+scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk)
+: m_mutex(m), m_have_lock(false)
+{
+ if(lk)
+ lock();
+}
+
+scoped_static_mutex_lock::~scoped_static_mutex_lock()
+{
+ if(m_have_lock)
+ unlock();
+}
+
+void scoped_static_mutex_lock::lock()
+{
+ if(0 == m_have_lock)
+ {
+#if !defined(InterlockedCompareExchangePointer)
+ while(0 != InterlockedCompareExchange(reinterpret_cast<void**>((boost::uint_least16_t*)&(m_mutex.m_mutex)), (void*)1, 0))
+#else
+ while(0 != InterlockedCompareExchange(reinterpret_cast<LONG*>(&(m_mutex.m_mutex)), 1, 0))
+#endif
+ {
+ Sleep(0);
+ }
+ m_have_lock = true;
+ }
+}
+
+void scoped_static_mutex_lock::unlock()
+{
+ if(m_have_lock)
+ {
+#if !defined(InterlockedCompareExchangePointer)
+ InterlockedExchange((LONG*)&(m_mutex.m_mutex), 0);
+#else
+ InterlockedExchange(reinterpret_cast<LONG*>(&(m_mutex.m_mutex)), 0);
+#endif
+ m_have_lock = false;
+ }
+}
+
+#else
+//
+// Portable version of a static mutex based on Boost.Thread library:
+//
+#include <stdlib.h>
+#include <boost/assert.hpp>
+
+boost::recursive_mutex* static_mutex::m_pmutex = 0;
+boost::once_flag static_mutex::m_once = BOOST_ONCE_INIT;
+
+extern "C" BOOST_REGEX_DECL void boost_regex_free_static_mutex()
+{
+ delete static_mutex::m_pmutex;
+ static_mutex::m_pmutex = 0;
+}
+
+void static_mutex::init()
+{
+ m_pmutex = new boost::recursive_mutex();
+ int r = atexit(boost_regex_free_static_mutex);
+ BOOST_ASSERT(0 == r);
+}
+
+scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& , bool lk)
+: m_plock(0), m_have_lock(false)
+{
+ if(lk)
+ lock();
+}
+
+scoped_static_mutex_lock::~scoped_static_mutex_lock()
+{
+ if(m_have_lock)
+ unlock();
+ delete m_plock;
+}
+
+void scoped_static_mutex_lock::lock()
+{
+ if(0 == m_have_lock)
+ {
+ boost::call_once(static_mutex::m_once,&static_mutex::init);
+ if(0 == m_plock)
+ m_plock = new boost::unique_lock<boost::recursive_mutex>(*static_mutex::m_pmutex, boost::defer_lock);
+ m_plock->lock();
+ m_have_lock = true;
+ }
+}
+
+void scoped_static_mutex_lock::unlock()
+{
+ if(m_have_lock)
+ {
+ m_plock->unlock();
+ m_have_lock = false;
+ }
+}
+
+#endif
+
+}
+
+#endif // BOOST_HAS_THREADS
diff --git a/src/boost/libs/regex/src/usinstances.cpp b/src/boost/libs/regex/src/usinstances.cpp
new file mode 100644
index 000000000..44ebd28df
--- /dev/null
+++ b/src/boost/libs/regex/src/usinstances.cpp
@@ -0,0 +1,81 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: winstances.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: regex unsigned short template instances (MSVC only).
+ */
+
+#define BOOST_REGEX_SOURCE
+#ifdef _MSC_VER
+#pragma warning(disable:4506) // 'no definition for inline function'
+#endif
+
+#include <boost/detail/workaround.hpp>
+#include <memory>
+#include <string>
+
+#if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \
+ && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\
+ && BOOST_WORKAROUND(BOOST_MSVC, <1600)
+//
+// This is a horrible workaround, but without declaring these symbols extern we get
+// duplicate symbol errors when linking if the application is built without
+// /Zc:wchar_t
+//
+#ifdef _CRTIMP2_PURE
+# define BOOST_REGEX_STDLIB_DECL _CRTIMP2_PURE
+#else
+# define BOOST_REGEX_STDLIB_DECL _CRTIMP2
+#endif
+
+namespace std{
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+template class BOOST_REGEX_STDLIB_DECL allocator<unsigned short>;
+template class BOOST_REGEX_STDLIB_DECL _String_val<unsigned short, allocator<unsigned short> >;
+template class BOOST_REGEX_STDLIB_DECL basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >;
+#endif
+
+#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
+template<> BOOST_REGEX_STDLIB_DECL std::size_t __cdecl char_traits<unsigned short>::length(unsigned short const*);
+#endif
+
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(
+ const unsigned short *,
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
+ const unsigned short *);
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator<(
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator>(
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
+}
+#endif
+
+#include <boost/regex/config.hpp>
+
+#if !defined(BOOST_NO_WREGEX) && defined(BOOST_REGEX_HAS_OTHER_WCHAR_T) && !defined(BOOST_REGEX_NO_EXTERNAL_TEMPLATES)
+#define BOOST_REGEX_US_INSTANTIATE
+
+#include <boost/regex.hpp>
+
+#endif
+
+
diff --git a/src/boost/libs/regex/src/w32_regex_traits.cpp b/src/boost/libs/regex/src/w32_regex_traits.cpp
new file mode 100644
index 000000000..5b5236aa8
--- /dev/null
+++ b/src/boost/libs/regex/src/w32_regex_traits.cpp
@@ -0,0 +1,654 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE w32_regex_traits.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Implements w32_regex_traits<char> (and associated helper classes).
+ */
+
+#define BOOST_REGEX_SOURCE
+#include <boost/regex/config.hpp>
+
+#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32) && !defined(BOOST_REGEX_NO_WIN32_LOCALE)
+#include <boost/regex/regex_traits.hpp>
+#include <boost/regex/pattern_except.hpp>
+
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+#ifndef NOMINMAX
+# define NOMINMAX
+#endif
+#define NOGDI
+#include <windows.h>
+
+#if defined(_MSC_VER) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
+#pragma comment(lib, "user32.lib")
+#endif
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::memset;
+}
+#endif
+
+namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
+
+#ifdef BOOST_NO_ANSI_APIS
+UINT get_code_page_for_locale_id(lcid_type idx)
+{
+ WCHAR code_page_string[7];
+ if (::GetLocaleInfoW(idx, LOCALE_IDEFAULTANSICODEPAGE, code_page_string, 7) == 0)
+ return 0;
+
+ return static_cast<UINT>(_wtol(code_page_string));
+}
+#endif
+
+
+void w32_regex_traits_char_layer<char>::init()
+{
+ // we need to start by initialising our syntax map so we know which
+ // character is used for which purpose:
+ std::memset(m_char_map, 0, sizeof(m_char_map));
+ cat_type cat;
+ std::string cat_name(w32_regex_traits<char>::get_catalog_name());
+ if(cat_name.size())
+ {
+ cat = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_open(cat_name);
+ if(!cat)
+ {
+ std::string m("Unable to open message catalog: ");
+ std::runtime_error err(m + cat_name);
+ ::boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err);
+ }
+ }
+ //
+ // if we have a valid catalog then load our messages:
+ //
+ if(cat)
+ {
+ for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
+ {
+ string_type mss = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_get(cat, this->m_locale, i, get_default_syntax(i));
+ for(string_type::size_type j = 0; j < mss.size(); ++j)
+ {
+ m_char_map[static_cast<unsigned char>(mss[j])] = i;
+ }
+ }
+ }
+ else
+ {
+ for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
+ {
+ const char* ptr = get_default_syntax(i);
+ while(ptr && *ptr)
+ {
+ m_char_map[static_cast<unsigned char>(*ptr)] = i;
+ ++ptr;
+ }
+ }
+ }
+ //
+ // finish off by calculating our escape types:
+ //
+ unsigned char i = 'A';
+ do
+ {
+ if(m_char_map[i] == 0)
+ {
+ if(::boost::BOOST_REGEX_DETAIL_NS::w32_is(this->m_locale, 0x0002u, (char)i))
+ m_char_map[i] = regex_constants::escape_type_class;
+ else if(::boost::BOOST_REGEX_DETAIL_NS::w32_is(this->m_locale, 0x0001u, (char)i))
+ m_char_map[i] = regex_constants::escape_type_not_class;
+ }
+ }while(0xFF != i++);
+
+ //
+ // fill in lower case map:
+ //
+ char char_map[1 << CHAR_BIT];
+ for(int ii = 0; ii < (1 << CHAR_BIT); ++ii)
+ char_map[ii] = static_cast<char>(ii);
+#ifndef BOOST_NO_ANSI_APIS
+ int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
+ BOOST_ASSERT(r != 0);
+#else
+ UINT code_page = get_code_page_for_locale_id(this->m_locale);
+ BOOST_ASSERT(code_page != 0);
+
+ WCHAR wide_char_map[1 << CHAR_BIT];
+ int conv_r = ::MultiByteToWideChar(code_page, 0, char_map, 1 << CHAR_BIT, wide_char_map, 1 << CHAR_BIT);
+ BOOST_ASSERT(conv_r != 0);
+
+ WCHAR wide_lower_map[1 << CHAR_BIT];
+ int r = ::LCMapStringW(this->m_locale, LCMAP_LOWERCASE, wide_char_map, 1 << CHAR_BIT, wide_lower_map, 1 << CHAR_BIT);
+ BOOST_ASSERT(r != 0);
+
+ conv_r = ::WideCharToMultiByte(code_page, 0, wide_lower_map, r, this->m_lower_map, 1 << CHAR_BIT, NULL, NULL);
+ BOOST_ASSERT(conv_r != 0);
+#endif
+ if(r < (1 << CHAR_BIT))
+ {
+ // if we have multibyte characters then not all may have been given
+ // a lower case mapping:
+ for(int jj = r; jj < (1 << CHAR_BIT); ++jj)
+ this->m_lower_map[jj] = static_cast<char>(jj);
+ }
+
+#ifndef BOOST_NO_ANSI_APIS
+ r = ::GetStringTypeExA(this->m_locale, CT_CTYPE1, char_map, 1 << CHAR_BIT, this->m_type_map);
+#else
+ r = ::GetStringTypeExW(this->m_locale, CT_CTYPE1, wide_char_map, 1 << CHAR_BIT, this->m_type_map);
+#endif
+ BOOST_ASSERT(0 != r);
+}
+
+BOOST_REGEX_DECL lcid_type BOOST_REGEX_CALL w32_get_default_locale()
+{
+ return ::GetUserDefaultLCID();
+}
+
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char c, lcid_type idx)
+{
+#ifndef BOOST_NO_ANSI_APIS
+ WORD mask;
+ if(::GetStringTypeExA(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
+ return true;
+ return false;
+#else
+ UINT code_page = get_code_page_for_locale_id(idx);
+ if (code_page == 0)
+ return false;
+
+ WCHAR wide_c;
+ if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
+ return false;
+
+ WORD mask;
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_LOWER))
+ return true;
+ return false;
+#endif
+}
+
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t c, lcid_type idx)
+{
+ WORD mask;
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
+ return true;
+ return false;
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type idx)
+{
+ WORD mask;
+ wchar_t c = ca;
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
+ return true;
+ return false;
+}
+#endif
+
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char c, lcid_type idx)
+{
+#ifndef BOOST_NO_ANSI_APIS
+ WORD mask;
+ if(::GetStringTypeExA(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
+ return true;
+ return false;
+#else
+ UINT code_page = get_code_page_for_locale_id(idx);
+ if (code_page == 0)
+ return false;
+
+ WCHAR wide_c;
+ if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
+ return false;
+
+ WORD mask;
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_UPPER))
+ return true;
+ return false;
+#endif
+}
+
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(wchar_t c, lcid_type idx)
+{
+ WORD mask;
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
+ return true;
+ return false;
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type idx)
+{
+ WORD mask;
+ wchar_t c = ca;
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
+ return true;
+ return false;
+}
+#endif
+
+void free_module(void* mod)
+{
+ ::FreeLibrary(static_cast<HMODULE>(mod));
+}
+
+BOOST_REGEX_DECL cat_type BOOST_REGEX_CALL w32_cat_open(const std::string& name)
+{
+#ifndef BOOST_NO_ANSI_APIS
+ cat_type result(::LoadLibraryA(name.c_str()), &free_module);
+ return result;
+#else
+ LPWSTR wide_name = (LPWSTR)_alloca( (name.size() + 1) * sizeof(WCHAR) );
+ if (::MultiByteToWideChar(CP_ACP, 0, name.c_str(), name.size(), wide_name, name.size() + 1) == 0)
+ return cat_type();
+
+ cat_type result(::LoadLibraryW(wide_name), &free_module);
+ return result;
+#endif
+}
+
+BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::string& def)
+{
+#ifndef BOOST_NO_ANSI_APIS
+ char buf[256];
+ if(0 == ::LoadStringA(
+ static_cast<HMODULE>(cat.get()),
+ i,
+ buf,
+ 256
+ ))
+ {
+ return def;
+ }
+#else
+ WCHAR wbuf[256];
+ int r = ::LoadStringW(
+ static_cast<HMODULE>(cat.get()),
+ i,
+ wbuf,
+ 256
+ );
+ if (r == 0)
+ return def;
+
+
+ int buf_size = 1 + ::WideCharToMultiByte(CP_ACP, 0, wbuf, r, NULL, 0, NULL, NULL);
+ LPSTR buf = (LPSTR)_alloca(buf_size);
+ if (::WideCharToMultiByte(CP_ACP, 0, wbuf, r, buf, buf_size, NULL, NULL) == 0)
+ return def; // failed conversion.
+#endif
+ return std::string(buf);
+}
+
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::wstring& def)
+{
+ wchar_t buf[256];
+ if(0 == ::LoadStringW(
+ static_cast<HMODULE>(cat.get()),
+ i,
+ buf,
+ 256
+ ))
+ {
+ return def;
+ }
+ return std::wstring(buf);
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::basic_string<unsigned short>& def)
+{
+ unsigned short buf[256];
+ if(0 == ::LoadStringW(
+ static_cast<HMODULE>(cat.get()),
+ i,
+ (LPWSTR)buf,
+ 256
+ ))
+ {
+ return def;
+ }
+ return std::basic_string<unsigned short>(buf);
+}
+#endif
+#endif
+BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type idx, const char* p1, const char* p2)
+{
+#ifndef BOOST_NO_ANSI_APIS
+ int bytes = ::LCMapStringA(
+ idx, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ 0, // destination buffer
+ 0 // size of destination buffer
+ );
+ if(!bytes)
+ return std::string(p1, p2);
+ std::string result(++bytes, '\0');
+ bytes = ::LCMapStringA(
+ idx, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ &*result.begin(), // destination buffer
+ bytes // size of destination buffer
+ );
+#else
+ UINT code_page = get_code_page_for_locale_id(idx);
+ if(code_page == 0)
+ return std::string(p1, p2);
+
+ int src_len = static_cast<int>(p2 - p1);
+ LPWSTR wide_p1 = (LPWSTR)_alloca( (src_len + 1) * 2 );
+ if(::MultiByteToWideChar(code_page, 0, p1, src_len, wide_p1, src_len + 1) == 0)
+ return std::string(p1, p2);
+
+ int bytes = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ wide_p1, // source string
+ src_len, // number of characters in source string
+ 0, // destination buffer
+ 0 // size of destination buffer
+ );
+ if(!bytes)
+ return std::string(p1, p2);
+ std::string result(++bytes, '\0');
+ bytes = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ wide_p1, // source string
+ src_len, // number of characters in source string
+ (LPWSTR)&*result.begin(), // destination buffer
+ bytes // size of destination buffer
+ );
+#endif
+ if(bytes > static_cast<int>(result.size()))
+ return std::string(p1, p2);
+ while(result.size() && result[result.size()-1] == '\0')
+ {
+ result.erase(result.size()-1);
+ }
+ return result;
+}
+
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type idx, const wchar_t* p1, const wchar_t* p2)
+{
+ int bytes = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ 0, // destination buffer
+ 0 // size of destination buffer
+ );
+ if(!bytes)
+ return std::wstring(p1, p2);
+ std::string result(++bytes, '\0');
+ bytes = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ reinterpret_cast<wchar_t*>(&*result.begin()), // destination buffer *of bytes*
+ bytes // size of destination buffer
+ );
+ if(bytes > static_cast<int>(result.size()))
+ return std::wstring(p1, p2);
+ while(result.size() && result[result.size()-1] == L'\0')
+ {
+ result.erase(result.size()-1);
+ }
+ std::wstring r2;
+ for(std::string::size_type i = 0; i < result.size(); ++i)
+ r2.append(1, static_cast<wchar_t>(static_cast<unsigned char>(result[i])));
+ return r2;
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transform(lcid_type idx, const unsigned short* p1, const unsigned short* p2)
+{
+ int bytes = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ (LPCWSTR)p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ 0, // destination buffer
+ 0 // size of destination buffer
+ );
+ if(!bytes)
+ return std::basic_string<unsigned short>(p1, p2);
+ std::string result(++bytes, '\0');
+ bytes = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ (LPCWSTR)p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ reinterpret_cast<wchar_t*>(&*result.begin()), // destination buffer *of bytes*
+ bytes // size of destination buffer
+ );
+ if(bytes > static_cast<int>(result.size()))
+ return std::basic_string<unsigned short>(p1, p2);
+ while(result.size() && result[result.size()-1] == L'\0')
+ {
+ result.erase(result.size()-1);
+ }
+ std::basic_string<unsigned short> r2;
+ for(std::string::size_type i = 0; i < result.size(); ++i)
+ r2.append(1, static_cast<unsigned short>(static_cast<unsigned char>(result[i])));
+ return r2;
+}
+#endif
+#endif
+BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type idx)
+{
+ char result[2];
+#ifndef BOOST_NO_ANSI_APIS
+ int b = ::LCMapStringA(
+ idx, // locale identifier
+ LCMAP_LOWERCASE, // mapping transformation type
+ &c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+#else
+ UINT code_page = get_code_page_for_locale_id(idx);
+ if (code_page == 0)
+ return c;
+
+ WCHAR wide_c;
+ if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
+ return c;
+
+ WCHAR wide_result;
+ int b = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_LOWERCASE, // mapping transformation type
+ &wide_c, // source string
+ 1, // number of characters in source string
+ &wide_result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+
+ if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0)
+ return c; // No single byte lower case equivalent available
+#endif
+ return result[0];
+}
+
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type idx)
+{
+ wchar_t result[2];
+ int b = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_LOWERCASE, // mapping transformation type
+ &c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type idx)
+{
+ wchar_t result[2];
+ int b = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_LOWERCASE, // mapping transformation type
+ (wchar_t const*)&c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
+}
+#endif
+#endif
+BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type idx)
+{
+ char result[2];
+#ifndef BOOST_NO_ANSI_APIS
+ int b = ::LCMapStringA(
+ idx, // locale identifier
+ LCMAP_UPPERCASE, // mapping transformation type
+ &c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+#else
+ UINT code_page = get_code_page_for_locale_id(idx);
+ if(code_page == 0)
+ return c;
+
+ WCHAR wide_c;
+ if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
+ return c;
+
+ WCHAR wide_result;
+ int b = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_UPPERCASE, // mapping transformation type
+ &wide_c, // source string
+ 1, // number of characters in source string
+ &wide_result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+
+ if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0)
+ return c; // No single byte upper case equivalent available.
+#endif
+ return result[0];
+}
+
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_toupper(wchar_t c, lcid_type idx)
+{
+ wchar_t result[2];
+ int b = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_UPPERCASE, // mapping transformation type
+ &c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_toupper(unsigned short c, lcid_type idx)
+{
+ wchar_t result[2];
+ int b = ::LCMapStringW(
+ idx, // locale identifier
+ LCMAP_UPPERCASE, // mapping transformation type
+ (wchar_t const*)&c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
+}
+#endif
+#endif
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type idx, boost::uint32_t m, char c)
+{
+ WORD mask;
+#ifndef BOOST_NO_ANSI_APIS
+ if(::GetStringTypeExA(idx, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<char>::mask_base))
+ return true;
+#else
+ UINT code_page = get_code_page_for_locale_id(idx);
+ if(code_page == 0)
+ return false;
+
+ WCHAR wide_c;
+ if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
+ return false;
+
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & m & w32_regex_traits_implementation<char>::mask_base))
+ return true;
+#endif
+ if((m & w32_regex_traits_implementation<char>::mask_word) && (c == '_'))
+ return true;
+ return false;
+}
+
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type idx, boost::uint32_t m, wchar_t c)
+{
+ WORD mask;
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<wchar_t>::mask_base))
+ return true;
+ if((m & w32_regex_traits_implementation<wchar_t>::mask_word) && (c == '_'))
+ return true;
+ if((m & w32_regex_traits_implementation<wchar_t>::mask_unicode) && (c > 0xff))
+ return true;
+ return false;
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type idx, boost::uint32_t m, unsigned short c)
+{
+ WORD mask;
+ if(::GetStringTypeExW(idx, CT_CTYPE1, (wchar_t const*)&c, 1, &mask) && (mask & m & w32_regex_traits_implementation<wchar_t>::mask_base))
+ return true;
+ if((m & w32_regex_traits_implementation<wchar_t>::mask_word) && (c == '_'))
+ return true;
+ if((m & w32_regex_traits_implementation<wchar_t>::mask_unicode) && (c > 0xff))
+ return true;
+ return false;
+}
+#endif
+#endif
+
+} // BOOST_REGEX_DETAIL_NS
+} // boost
+
+#endif
+
diff --git a/src/boost/libs/regex/src/wc_regex_traits.cpp b/src/boost/libs/regex/src/wc_regex_traits.cpp
new file mode 100644
index 000000000..e7fcfb8ea
--- /dev/null
+++ b/src/boost/libs/regex/src/wc_regex_traits.cpp
@@ -0,0 +1,314 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: wc_regex_traits.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Implements out of line members for c_regex_traits<wchar_t>
+ */
+
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/detail/workaround.hpp>
+#include <memory>
+#include <string>
+#include "internals.hpp"
+
+#if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \
+ && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\
+ && BOOST_WORKAROUND(BOOST_MSVC, <1600)
+//
+// This is a horrible workaround, but without declaring these symbols extern we get
+// duplicate symbol errors when linking if the application is built without
+// /Zc:wchar_t
+//
+#ifdef _CRTIMP2_PURE
+# define BOOST_REGEX_STDLIB_DECL _CRTIMP2_PURE
+#else
+# define BOOST_REGEX_STDLIB_DECL _CRTIMP2
+#endif
+
+namespace std{
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+template class BOOST_REGEX_STDLIB_DECL allocator<unsigned short>;
+template class BOOST_REGEX_STDLIB_DECL _String_val<unsigned short, allocator<unsigned short> >;
+template class BOOST_REGEX_STDLIB_DECL basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >;
+#endif
+
+#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
+template<> BOOST_REGEX_STDLIB_DECL std::size_t __cdecl char_traits<unsigned short>::length(unsigned short const*);
+#endif
+
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(
+ const unsigned short *,
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
+ const unsigned short *);
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator<(
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator>(
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);
+}
+#endif
+
+#include <boost/regex/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+
+#include <boost/regex/v4/c_regex_traits.hpp>
+#ifndef BOOST_NO_WREGEX
+#include <boost/regex/v4/primary_transform.hpp>
+#include <boost/regex/v4/regex_traits_defaults.hpp>
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::wcstol;
+}
+#endif
+
+namespace boost{
+
+c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::transform(const wchar_t* p1, const wchar_t* p2)
+{
+ std::size_t r;
+ std::size_t s = 10;
+ std::wstring src(p1, p2);
+ std::wstring result(s, L' ');
+ while(s < (r = std::wcsxfrm(&*result.begin(), src.c_str(), s)))
+ {
+#if defined(_CPPLIB_VER)
+ //
+ // A bug in VC11 and 12 causes the program to hang if we pass a null-string
+ // to std::strxfrm, but only for certain locales :-(
+ // Probably effects Intel and Clang or any compiler using the VC std library (Dinkumware).
+ //
+ if(r == INT_MAX)
+ {
+ result.erase();
+ result.insert(result.begin(), static_cast<wchar_t>(0));
+ return result;
+ }
+#endif
+ result.append(r - s + 3, L' ');
+ s = result.size();
+ }
+ result.erase(r);
+ return result;
+}
+
+c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::transform_primary(const wchar_t* p1, const wchar_t* p2)
+{
+ static wchar_t s_delim;
+ static const int s_collate_type = ::boost::BOOST_REGEX_DETAIL_NS::find_sort_syntax(static_cast<const c_regex_traits<wchar_t>*>(0), &s_delim);
+ std::wstring result;
+ //
+ // What we do here depends upon the format of the sort key returned by
+ // sort key returned by this->transform:
+ //
+ switch(s_collate_type)
+ {
+ case ::boost::BOOST_REGEX_DETAIL_NS::sort_C:
+ case ::boost::BOOST_REGEX_DETAIL_NS::sort_unknown:
+ // the best we can do is translate to lower case, then get a regular sort key:
+ {
+ result.assign(p1, p2);
+ for(std::wstring::size_type i = 0; i < result.size(); ++i)
+ result[i] = (std::towlower)(result[i]);
+ result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());
+ break;
+ }
+ case ::boost::BOOST_REGEX_DETAIL_NS::sort_fixed:
+ {
+ // get a regular sort key, and then truncate it:
+ result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());
+ result.erase(s_delim);
+ break;
+ }
+ case ::boost::BOOST_REGEX_DETAIL_NS::sort_delim:
+ // get a regular sort key, and then truncate everything after the delim:
+ result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());
+ if(result.size() && (result[0] == s_delim))
+ break;
+ std::size_t i;
+ for(i = 0; i < result.size(); ++i)
+ {
+ if(result[i] == s_delim)
+ break;
+ }
+ result.erase(i);
+ break;
+ }
+ if(result.empty())
+ result = std::wstring(1, char(0));
+ return result;
+}
+
+c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_classname(const wchar_t* p1, const wchar_t* p2)
+{
+ static const char_class_type masks[] =
+ {
+ 0,
+ char_class_alnum,
+ char_class_alpha,
+ char_class_blank,
+ char_class_cntrl,
+ char_class_digit,
+ char_class_digit,
+ char_class_graph,
+ char_class_horizontal,
+ char_class_lower,
+ char_class_lower,
+ char_class_print,
+ char_class_punct,
+ char_class_space,
+ char_class_space,
+ char_class_upper,
+ char_class_unicode,
+ char_class_upper,
+ char_class_vertical,
+ char_class_alnum | char_class_word,
+ char_class_alnum | char_class_word,
+ char_class_xdigit,
+ };
+
+ int idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(p1, p2);
+ if(idx < 0)
+ {
+ std::wstring s(p1, p2);
+ for(std::wstring::size_type i = 0; i < s.size(); ++i)
+ s[i] = (std::towlower)(s[i]);
+ idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
+ }
+ BOOST_ASSERT(idx+1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));
+ return masks[idx+1];
+}
+
+bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::isctype(wchar_t c, char_class_type mask)
+{
+ return
+ ((mask & char_class_space) && (std::iswspace)(c))
+ || ((mask & char_class_print) && (std::iswprint)(c))
+ || ((mask & char_class_cntrl) && (std::iswcntrl)(c))
+ || ((mask & char_class_upper) && (std::iswupper)(c))
+ || ((mask & char_class_lower) && (std::iswlower)(c))
+ || ((mask & char_class_alpha) && (std::iswalpha)(c))
+ || ((mask & char_class_digit) && (std::iswdigit)(c))
+ || ((mask & char_class_punct) && (std::iswpunct)(c))
+ || ((mask & char_class_xdigit) && (std::iswxdigit)(c))
+ || ((mask & char_class_blank) && (std::iswspace)(c) && !::boost::BOOST_REGEX_DETAIL_NS::is_separator(c))
+ || ((mask & char_class_word) && (c == '_'))
+ || ((mask & char_class_unicode) && (c & ~static_cast<wchar_t>(0xff)))
+ || ((mask & char_class_vertical) && (::boost::BOOST_REGEX_DETAIL_NS::is_separator(c) || (c == L'\v')))
+ || ((mask & char_class_horizontal) && (std::iswspace)(c) && !::boost::BOOST_REGEX_DETAIL_NS::is_separator(c) && (c != L'\v'));
+}
+
+c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_collatename(const wchar_t* p1, const wchar_t* p2)
+{
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
+ && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\
+ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
+ std::string name(p1, p2);
+#else
+ std::string name;
+ const wchar_t* p0 = p1;
+ while(p0 != p2)
+ name.append(1, char(*p0++));
+#endif
+ name = ::boost::BOOST_REGEX_DETAIL_NS::lookup_default_collate_name(name);
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
+ && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\
+ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
+ if(name.size())
+ return string_type(name.begin(), name.end());
+#else
+ if(name.size())
+ {
+ string_type result;
+ typedef std::string::const_iterator iter;
+ iter b = name.begin();
+ iter e = name.end();
+ while(b != e)
+ result.append(1, wchar_t(*b++));
+ return result;
+ }
+#endif
+ if(p2 - p1 == 1)
+ return string_type(1, *p1);
+ return string_type();
+}
+
+int BOOST_REGEX_CALL c_regex_traits<wchar_t>::value(wchar_t c, int radix)
+{
+#ifdef __BORLANDC__
+ // workaround for broken wcstol:
+ if((std::iswxdigit)(c) == 0)
+ return -1;
+#endif
+ wchar_t b[2] = { c, '\0', };
+ wchar_t* ep;
+ int result = std::wcstol(b, &ep, radix);
+ if(ep == b)
+ return -1;
+ return result;
+}
+
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+c_regex_traits<unsigned short>::string_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::transform(const unsigned short* p1, const unsigned short* p2)
+{
+ std::wstring result = c_regex_traits<wchar_t>::transform((const wchar_t*)p1, (const wchar_t*)p2);
+ return string_type(result.begin(), result.end());
+}
+
+c_regex_traits<unsigned short>::string_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::transform_primary(const unsigned short* p1, const unsigned short* p2)
+{
+ std::wstring result = c_regex_traits<wchar_t>::transform_primary((const wchar_t*)p1, (const wchar_t*)p2);
+ return string_type(result.begin(), result.end());
+}
+
+c_regex_traits<unsigned short>::char_class_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::lookup_classname(const unsigned short* p1, const unsigned short* p2)
+{
+ return c_regex_traits<wchar_t>::lookup_classname((const wchar_t*)p1, (const wchar_t*)p2);
+}
+
+c_regex_traits<unsigned short>::string_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::lookup_collatename(const unsigned short* p1, const unsigned short* p2)
+{
+ std::wstring result = c_regex_traits<wchar_t>::lookup_collatename((const wchar_t*)p1, (const wchar_t*)p2);
+ return string_type(result.begin(), result.end());
+}
+
+bool BOOST_REGEX_CALL c_regex_traits<unsigned short>::isctype(unsigned short c, char_class_type m)
+{
+ return c_regex_traits<wchar_t>::isctype(c, m);
+}
+
+int BOOST_REGEX_CALL c_regex_traits<unsigned short>::value(unsigned short c, int radix)
+{
+ return c_regex_traits<wchar_t>::value(c, radix);
+}
+
+#endif
+
+}
+
+#endif // BOOST_NO_WREGEX
+
+#endif // __BORLANDC__
+
diff --git a/src/boost/libs/regex/src/wide_posix_api.cpp b/src/boost/libs/regex/src/wide_posix_api.cpp
new file mode 100644
index 000000000..bc1c0af2a
--- /dev/null
+++ b/src/boost/libs/regex/src/wide_posix_api.cpp
@@ -0,0 +1,312 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: wide_posix_api.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Implements the wide character POSIX API wrappers.
+ */
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/regex/config.hpp>
+
+#ifndef BOOST_NO_WREGEX
+
+#include <boost/regex.hpp>
+#include <boost/cregex.hpp>
+
+#include <cwchar>
+#include <cstring>
+#include <cstdio>
+
+#ifdef BOOST_INTEL
+#pragma warning(disable:981)
+#endif
+
+#if defined(BOOST_NO_STDC_NAMESPACE) || defined(__NetBSD__)
+namespace std{
+# ifndef BOOST_NO_SWPRINTF
+ using ::swprintf;
+# endif
+}
+#endif
+
+
+namespace boost{
+
+namespace {
+
+unsigned int wmagic_value = 28631;
+
+const wchar_t* wnames[] = {
+ L"REG_NOERROR",
+ L"REG_NOMATCH",
+ L"REG_BADPAT",
+ L"REG_ECOLLATE",
+ L"REG_ECTYPE",
+ L"REG_EESCAPE",
+ L"REG_ESUBREG",
+ L"REG_EBRACK",
+ L"REG_EPAREN",
+ L"REG_EBRACE",
+ L"REG_BADBR",
+ L"REG_ERANGE",
+ L"REG_ESPACE",
+ L"REG_BADRPT",
+ L"REG_EEND",
+ L"REG_ESIZE",
+ L"REG_ERPAREN",
+ L"REG_EMPTY",
+ L"REG_ECOMPLEXITY",
+ L"REG_ESTACK",
+ L"REG_E_PERL",
+ L"REG_E_UNKNOWN",
+};
+}
+
+typedef boost::basic_regex<wchar_t, c_regex_traits<wchar_t> > wc_regex_type;
+
+BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f)
+{
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ expression->guts = new wc_regex_type();
+#ifndef BOOST_NO_EXCEPTIONS
+ } catch(...)
+ {
+ expression->guts = 0;
+ return REG_ESPACE;
+ }
+#else
+ if(0 == expression->guts)
+ return REG_E_MEMORY;
+#endif
+ // set default flags:
+ boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? wregex::extended : wregex::basic);
+ expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
+
+ // and translate those that are actually set:
+ if(f & REG_NOCOLLATE)
+ {
+ flags |= wregex::nocollate;
+#ifndef BOOST_REGEX_V3
+ flags &= ~wregex::collate;
+#endif
+ }
+
+ if(f & REG_NOSUB)
+ {
+ //expression->eflags |= match_any;
+ flags |= wregex::nosubs;
+ }
+
+ if(f & REG_NOSPEC)
+ flags |= wregex::literal;
+ if(f & REG_ICASE)
+ flags |= wregex::icase;
+ if(f & REG_ESCAPE_IN_LISTS)
+ flags &= ~wregex::no_escape_in_lists;
+ if(f & REG_NEWLINE_ALT)
+ flags |= wregex::newline_alt;
+
+ const wchar_t* p2;
+ if(f & REG_PEND)
+ p2 = expression->re_endp;
+ else p2 = ptr + std::wcslen(ptr);
+
+ int result;
+
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ expression->re_magic = wmagic_value;
+ static_cast<wc_regex_type*>(expression->guts)->set_expression(ptr, p2, flags);
+ expression->re_nsub = static_cast<wc_regex_type*>(expression->guts)->mark_count();
+ result = static_cast<wc_regex_type*>(expression->guts)->error_code();
+#ifndef BOOST_NO_EXCEPTIONS
+ }
+ catch(const boost::regex_error& be)
+ {
+ result = be.code();
+ }
+ catch(...)
+ {
+ result = REG_E_UNKNOWN;
+ }
+#endif
+ if(result)
+ regfreeW(expression);
+ return result;
+
+}
+
+BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW* e, wchar_t* buf, regsize_t buf_size)
+{
+ std::size_t result = 0;
+ if(code & REG_ITOA)
+ {
+ code &= ~REG_ITOA;
+ if((code <= (int)REG_E_UNKNOWN) && (code >= 0))
+ {
+ result = std::wcslen(wnames[code]) + 1;
+ if(buf_size >= result)
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
+ ::wcscpy_s(buf, buf_size, wnames[code]);
+#else
+ std::wcscpy(buf, wnames[code]);
+#endif
+ return result;
+ }
+ return result;
+ }
+#if !defined(BOOST_NO_SWPRINTF)
+ if(code == REG_ATOI)
+ {
+ wchar_t localbuf[5];
+ if(e == 0)
+ return 0;
+ for(int i = 0; i <= (int)REG_E_UNKNOWN; ++i)
+ {
+ if(std::wcscmp(e->re_endp, wnames[i]) == 0)
+ {
+#if defined(_WIN32_WCE) && !defined(UNDER_CE)
+ (std::swprintf)(localbuf, L"%d", i);
+#else
+ (std::swprintf)(localbuf, 5, L"%d", i);
+#endif
+ if(std::wcslen(localbuf) < buf_size)
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
+ ::wcscpy_s(buf, buf_size, localbuf);
+#else
+ std::wcscpy(buf, localbuf);
+#endif
+ return std::wcslen(localbuf) + 1;
+ }
+ }
+#if defined(_WIN32_WCE) && !defined(UNDER_CE)
+ (std::swprintf)(localbuf, L"%d", 0);
+#else
+ (std::swprintf)(localbuf, 5, L"%d", 0);
+#endif
+ if(std::wcslen(localbuf) < buf_size)
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
+ ::wcscpy_s(buf, buf_size, localbuf);
+#else
+ std::wcscpy(buf, localbuf);
+#endif
+ return std::wcslen(localbuf) + 1;
+ }
+#endif
+ if(code <= (int)REG_E_UNKNOWN)
+ {
+ std::string p;
+ if((e) && (e->re_magic == wmagic_value))
+ p = static_cast<wc_regex_type*>(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code));
+ else
+ {
+ p = BOOST_REGEX_DETAIL_NS::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code));
+ }
+ std::size_t len = p.size();
+ if(len < buf_size)
+ {
+ BOOST_REGEX_DETAIL_NS::copy(p.c_str(), p.c_str() + p.size() + 1, buf);
+ }
+ return len + 1;
+ }
+ if(buf_size)
+ *buf = 0;
+ return 0;
+}
+
+BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, const wchar_t* buf, regsize_t n, regmatch_t* array, int eflags)
+{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4267)
+#endif
+ bool result = false;
+ match_flag_type flags = match_default | expression->eflags;
+ const wchar_t* end;
+ const wchar_t* start;
+ wcmatch m;
+
+ if(eflags & REG_NOTBOL)
+ flags |= match_not_bol;
+ if(eflags & REG_NOTEOL)
+ flags |= match_not_eol;
+ if(eflags & REG_STARTEND)
+ {
+ start = buf + array[0].rm_so;
+ end = buf + array[0].rm_eo;
+ }
+ else
+ {
+ start = buf;
+ end = buf + std::wcslen(buf);
+ }
+
+#ifndef BOOST_NO_EXCEPTIONS
+ try{
+#endif
+ if(expression->re_magic == wmagic_value)
+ {
+ result = regex_search(start, end, m, *static_cast<wc_regex_type*>(expression->guts), flags);
+ }
+ else
+ return result;
+#ifndef BOOST_NO_EXCEPTIONS
+ } catch(...)
+ {
+ return REG_E_UNKNOWN;
+ }
+#endif
+ if(result)
+ {
+ // extract what matched:
+ std::size_t i;
+ for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i)
+ {
+ array[i].rm_so = (m[i].matched == false) ? -1 : (m[i].first - buf);
+ array[i].rm_eo = (m[i].matched == false) ? -1 : (m[i].second - buf);
+ }
+ // and set anything else to -1:
+ for(i = expression->re_nsub + 1; i < n; ++i)
+ {
+ array[i].rm_so = -1;
+ array[i].rm_eo = -1;
+ }
+ return 0;
+ }
+ return REG_NOMATCH;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+}
+
+BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW* expression)
+{
+ if(expression->re_magic == wmagic_value)
+ {
+ delete static_cast<wc_regex_type*>(expression->guts);
+ }
+ expression->re_magic = 0;
+}
+
+} // namespace boost;
+
+#endif
+
+
+
+
diff --git a/src/boost/libs/regex/src/winstances.cpp b/src/boost/libs/regex/src/winstances.cpp
new file mode 100644
index 000000000..1e0b85962
--- /dev/null
+++ b/src/boost/libs/regex/src/winstances.cpp
@@ -0,0 +1,35 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: winstances.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: regex wide character template instances.
+ */
+
+#define BOOST_REGEX_SOURCE
+
+#include <boost/regex/config.hpp>
+
+#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_REGEX_NO_EXTERNAL_TEMPLATES)
+#define BOOST_REGEX_WIDE_INSTANTIATE
+
+#ifdef __BORLANDC__
+#pragma hrdstop
+#endif
+
+#include <boost/regex.hpp>
+
+#endif
+
+
+
diff --git a/src/boost/libs/regex/test/Jamfile.v2 b/src/boost/libs/regex/test/Jamfile.v2
new file mode 100644
index 000000000..49ed730bb
--- /dev/null
+++ b/src/boost/libs/regex/test/Jamfile.v2
@@ -0,0 +1,203 @@
+# copyright John Maddock 2003
+# 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
+ <toolset>msvc-7.0:<define>TEST_MFC=1
+ <toolset>msvc:<asynch-exceptions>on
+ # There are unidentified linker problems on these platforms:
+ <toolset>mipspro-7.4:<link>static
+ <toolset>sun-5.9:<link>static
+ <warnings>all
+ <toolset>gcc:<cxxflags>-Wextra
+ <toolset>gcc:<cxxflags>-Wshadow
+ <define>U_USING_ICU_NAMESPACE=0
+ #<toolset>gcc-mw:<link>static
+ #<toolset>gcc-mingw:<link>static
+ #<toolset>gcc-cygwin:<link>static
+ <toolset>sun:<link>static
+ ;
+
+#
+# rule for simple regex test programs:
+#
+rule regex-test ( name : sources + : requirements * : input-files * )
+{
+ return [ run $(sources) ../build//boost_regex
+ :
+ : $(input-files)
+ : $(requirements)
+ : $(name) ] ;
+}
+
+R_SOURCE =
+basic_tests.cpp
+main.cpp
+test_alt.cpp
+test_anchors.cpp
+test_asserts.cpp
+test_backrefs.cpp
+test_deprecated.cpp
+test_emacs.cpp
+test_escapes.cpp
+test_grep.cpp
+test_locale.cpp
+test_mfc.cpp
+test_non_greedy_repeats.cpp
+test_perl_ex.cpp
+test_replace.cpp
+test_sets.cpp
+test_simple_repeats.cpp
+test_tricky_cases.cpp
+test_icu.cpp
+test_unicode.cpp
+test_overloads.cpp
+test_operators.cpp
+;
+
+lib boost_regex_recursive :
+ ../src/c_regex_traits.cpp
+ ../src/cpp_regex_traits.cpp
+ ../src/cregex.cpp
+ ../src/fileiter.cpp
+ ../src/icu.cpp
+ ../src/instances.cpp
+ ../src/posix_api.cpp
+ ../src/regex.cpp
+ ../src/regex_debug.cpp
+ ../src/regex_raw_buffer.cpp
+ ../src/regex_traits_defaults.cpp
+ ../src/static_mutex.cpp
+ ../src/w32_regex_traits.cpp
+ ../src/wc_regex_traits.cpp
+ ../src/wide_posix_api.cpp
+ ../src/winstances.cpp
+ ../src/usinstances.cpp
+ ../build//icu_options
+ :
+ <define>BOOST_REGEX_RECURSIVE=1
+ <link>shared:<define>BOOST_REGEX_DYN_LINK=1
+ :
+ ;
+
+local regress-sources = regress/$(R_SOURCE) ;
+
+test-suite regex
+ :
+ [ run regress/$(R_SOURCE) ../build//boost_regex ../build//icu_options
+ : # command line
+ : # input files
+ : # requirements
+ : regex_regress ]
+
+ [ run regress/$(R_SOURCE) ../build//boost_regex
+ ../../thread/build//boost_thread ../build//icu_options
+ : # command line
+ : # input files
+ : # requirements
+ <define>TEST_THREADS
+ : regex_regress_threaded ]
+
+ [ regex-test posix_api_check : c_compiler_checks/posix_api_check.c ]
+
+ [ compile c_compiler_checks/wide_posix_api_check.c
+ : : wide_posix_api_check_c ]
+
+ [ regex-test posix_api_check_cpp : c_compiler_checks/posix_api_check.cpp ]
+
+ [ regex-test wide_posix_api_check_cpp
+ : c_compiler_checks/wide_posix_api_check.cpp ]
+
+ [ run pathology/bad_expression_test.cpp
+ ../build//boost_regex
+ ]
+
+ [ run pathology/recursion_test.cpp
+ ../build//boost_regex
+ ]
+
+ [ run named_subexpressions/named_subexpressions_test.cpp
+ ../build//boost_regex
+ ]
+
+ [ run unicode/unicode_iterator_test.cpp ../build//boost_regex : : : release <define>TEST_UTF8 : unicode_iterator_test_utf8 ]
+ [ run unicode/unicode_iterator_test.cpp ../build//boost_regex : : : release <define>TEST_UTF16 : unicode_iterator_test_utf16 ]
+ [ run static_mutex/static_mutex_test.cpp
+ ../../thread/build//boost_thread ../build//boost_regex
+ ]
+ [ run object_cache/object_cache_test.cpp ../build//boost_regex
+ ]
+
+ [ run config_info/regex_config_info.cpp
+ ../build//boost_regex/<link>static
+ : # command line
+ : # input files
+ : <test-info>always_show_run_output
+ ]
+ [ run config_info/regex_config_info.cpp ../build//boost_regex
+ : # command line
+ : # input files
+ : <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 ../build//boost_regex ]
+ [ link concepts/icu_concept_check.cpp ../build//boost_regex ]
+ [ link concepts/range_concept_check.cpp ../build//boost_regex ]
+ [ run concepts/test_bug_11988.cpp ../build//boost_regex ]
+
+ [ run
+ # sources
+ captures/captures_test.cpp
+ captures//boost_regex_extra ../build//icu_options
+ : # additional args
+ : # test-files
+ : # requirements
+ <threading>multi
+ <define>BOOST_REGEX_MATCH_EXTRA=1
+ <define>BOOST_REGEX_NO_LIB=1
+ : # test name
+ captures_test
+ ]
+
+[ run regress/$(R_SOURCE) .//boost_regex_recursive
+ ../build//icu_options
+ : # command line
+ : # input files
+ : # requirements
+ <define>BOOST_REGEX_RECURSIVE=1
+ : regex_regress_recursive ]
+
+[ run regress/$(R_SOURCE) ./noeh_test//boost_regex_noeh
+ ../build//icu_options
+ : # command line
+ : # input files
+ : # requirements
+ <define>BOOST_NO_EXCEPTIONS=1
+ <exception-handling>off
+ <link>static
+ <runtime-link>shared
+ : regex_regress_noeh ]
+
+;
+
+compile test_consolidated.cpp ;
+
+build-project ../example ;
+
+# `quick` target (for CI)
+run quick.cpp ../build//boost_regex ;
+
+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 ;
diff --git a/src/boost/libs/regex/test/c_compiler_checks/posix_api_check.c b/src/boost/libs/regex/test/c_compiler_checks/posix_api_check.c
new file mode 100644
index 000000000..34abca142
--- /dev/null
+++ b/src/boost/libs/regex/test/c_compiler_checks/posix_api_check.c
@@ -0,0 +1,64 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE posix_api_compiler_check.c
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
+ * time check only.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <boost/regex.h>
+
+const char* expression = "^";
+const char* text = "\n ";
+regmatch_t matches[1];
+int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
+ REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
+ REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
+
+
+int main()
+{
+ regex_tA re;
+ int result;
+ result = regcompA(&re, expression, REG_AWK);
+ if(result > (int)REG_NOERROR)
+ {
+ char buf[256];
+ regerrorA(result, &re, buf, sizeof(buf));
+ puts(buf);
+ return result;
+ }
+ assert(re.re_nsub == 0);
+ matches[0].rm_so = 0;
+ matches[0].rm_eo = strlen(text);
+ result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
+ if(result > (int)REG_NOERROR)
+ {
+ char buf[256];
+ regerrorA(result, &re, buf, sizeof(buf));
+ puts(buf);
+ regfreeA(&re);
+ return result;
+ }
+ assert((matches[0].rm_so == matches[0].rm_eo) && (matches[0].rm_eo == 1));
+ regfreeA(&re);
+ printf("no errors found\n");
+ return 0;
+}
+
+
+
diff --git a/src/boost/libs/regex/test/c_compiler_checks/posix_api_check.cpp b/src/boost/libs/regex/test/c_compiler_checks/posix_api_check.cpp
new file mode 100644
index 000000000..d3ff326a4
--- /dev/null
+++ b/src/boost/libs/regex/test/c_compiler_checks/posix_api_check.cpp
@@ -0,0 +1,65 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE posix_api_compiler_check.c
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
+ * time check only.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <boost/assert.hpp>
+#include <boost/regex.h>
+#include "../test_macros.hpp"
+
+const char* expression = "^";
+const char* text = "\n ";
+regmatch_t matches[1];
+int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
+ REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
+ REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
+
+
+int main()
+{
+ regex_tA re;
+ unsigned int result;
+ result = regcompA(&re, expression, REG_AWK);
+ if(result > REG_NOERROR)
+ {
+ char buf[256];
+ regerrorA(result, &re, buf, sizeof(buf));
+ printf("%s", buf);
+ return result;
+ }
+ BOOST_CHECK(re.re_nsub == 0);
+ matches[0].rm_so = 0;
+ matches[0].rm_eo = strlen(text);
+ result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
+ if(result > REG_NOERROR)
+ {
+ char buf[256];
+ regerrorA(result, &re, buf, sizeof(buf));
+ printf("%s", buf);
+ regfreeA(&re);
+ return result;
+ }
+ BOOST_CHECK(matches[0].rm_so == matches[0].rm_eo);
+ regfreeA(&re);
+ printf("no errors found\n");
+ return boost::report_errors();
+}
+
+
+
diff --git a/src/boost/libs/regex/test/c_compiler_checks/wide_posix_api_check.c b/src/boost/libs/regex/test/c_compiler_checks/wide_posix_api_check.c
new file mode 100644
index 000000000..cd1a287da
--- /dev/null
+++ b/src/boost/libs/regex/test/c_compiler_checks/wide_posix_api_check.c
@@ -0,0 +1,89 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE wide_posix_api_compiler_check.c
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
+ * time check only.
+ */
+
+#define UNICODE
+#define _UNICODE
+
+#include <boost/regex.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
+
+#ifndef BOOST_NO_WREGEX
+#include <wchar.h>
+
+const wchar_t* expression = L"^";
+const wchar_t* text = L"\n ";
+regmatch_t matches[1];
+int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
+ REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
+ REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
+
+
+int main()
+{
+ regex_t re;
+ int result;
+ wchar_t buf[256];
+ char nbuf[256];
+ int i;
+ result = regcomp(&re, expression, REG_AWK);
+ if(result > (int)REG_NOERROR)
+ {
+ regerror(result, &re, buf, sizeof(buf));
+ for(i = 0; i < 256; ++i)
+ nbuf[i] = (char)(buf[i]);
+ puts(nbuf);
+ return result;
+ }
+ if(re.re_nsub != 0)
+ {
+ regfree(&re);
+ exit(-1);
+ }
+ matches[0].rm_so = 0;
+ matches[0].rm_eo = wcslen(text);
+ result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
+ if(result > (int)REG_NOERROR)
+ {
+ regerror(result, &re, buf, sizeof(buf));
+ for(i = 0; i < 256; ++i)
+ nbuf[i] = (char)(buf[i]);
+ puts(nbuf);
+ regfree(&re);
+ return result;
+ }
+ if((matches[0].rm_so != matches[0].rm_eo) || (matches[0].rm_eo != 1))
+ {
+ regfree(&re);
+ exit(-1);
+ }
+ regfree(&re);
+ printf("no errors found\n");
+ return 0;
+}
+
+#else
+# error "This library has not been configured for wide character support"
+#endif
+
+
+
+
diff --git a/src/boost/libs/regex/test/c_compiler_checks/wide_posix_api_check.cpp b/src/boost/libs/regex/test/c_compiler_checks/wide_posix_api_check.cpp
new file mode 100644
index 000000000..5c14cb229
--- /dev/null
+++ b/src/boost/libs/regex/test/c_compiler_checks/wide_posix_api_check.cpp
@@ -0,0 +1,102 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE wide_posix_api_compiler_check.c
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
+ * time check only.
+ */
+
+#define UNICODE
+#define _UNICODE
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <boost/regex.h>
+#include <wchar.h>
+#include <iostream>
+#include <iomanip>
+
+#ifndef BOOST_NO_WREGEX
+
+const wchar_t* expression = L"^";
+const wchar_t* text = L"\n ";
+regmatch_t matches[1];
+int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
+ REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
+ REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
+
+
+int main()
+{
+ regex_t re;
+ unsigned result;
+ result = regcomp(&re, expression, REG_AWK);
+ if(result > REG_NOERROR)
+ {
+ wchar_t buf[256];
+ regerror(result, &re, buf, sizeof(buf));
+ char nbuf[256];
+ for(int i = 0; i < 256; ++i)
+ nbuf[i] = static_cast<char>(buf[i]);
+ printf("%s", nbuf);
+ return result;
+ }
+ if(re.re_nsub != 0)
+ {
+ regfree(&re);
+ exit(-1);
+ }
+ matches[0].rm_so = 0;
+ matches[0].rm_eo = wcslen(text);
+ result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
+ if(result > REG_NOERROR)
+ {
+ wchar_t buf[256];
+ regerror(result, &re, buf, sizeof(buf));
+ char nbuf[256];
+ for(int i = 0; i < 256; ++i)
+ nbuf[i] = static_cast<char>(buf[i]);
+ printf("%s", nbuf);
+ regfree(&re);
+ return result;
+ }
+ if((matches[0].rm_so != matches[0].rm_eo) || (matches[0].rm_eo != 1))
+ {
+ regfree(&re);
+ exit(-1);
+ }
+ regfree(&re);
+ printf("%s", "no errors found\n");
+ return 0;
+}
+
+#else
+
+#include <iostream>
+
+int main()
+{
+ std::cout <<
+ "\n<note>\n"
+ "This platform does not provide the needed wide character support for this test.\n"
+ "</note>\n";
+ return 0;
+}
+#endif
+
+
+
+
diff --git a/src/boost/libs/regex/test/captures/Jamfile.v2 b/src/boost/libs/regex/test/captures/Jamfile.v2
new file mode 100644
index 000000000..f3ee89055
--- /dev/null
+++ b/src/boost/libs/regex/test/captures/Jamfile.v2
@@ -0,0 +1,38 @@
+# copyright John Maddock 2003
+# 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
+ : source-location ../../src
+ ;
+
+EX_SOURCES =
+ c_regex_traits.cpp
+ cpp_regex_traits.cpp
+ cregex.cpp
+ fileiter.cpp
+ icu.cpp
+ instances.cpp
+ posix_api.cpp
+ regex.cpp
+ regex_debug.cpp
+ regex_raw_buffer.cpp
+ regex_traits_defaults.cpp
+ static_mutex.cpp
+ w32_regex_traits.cpp
+ wc_regex_traits.cpp
+ wide_posix_api.cpp
+ winstances.cpp
+ usinstances.cpp ;
+
+lib boost_regex_extra : $(EX_SOURCES) ../../build//icu_options
+ :
+ <define>BOOST_REGEX_MATCH_EXTRA=1
+ <link>shared:<define>BOOST_REGEX_DYN_LINK=1
+ :
+ ;
+
+
+
+
diff --git a/src/boost/libs/regex/test/captures/captures_test.cpp b/src/boost/libs/regex/test/captures/captures_test.cpp
new file mode 100644
index 000000000..641d1b9b0
--- /dev/null
+++ b/src/boost/libs/regex/test/captures/captures_test.cpp
@@ -0,0 +1,177 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE captures_test.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Basic tests for additional captures information.
+ */
+
+#include <boost/regex.hpp>
+#include <boost/detail/lightweight_main.hpp>
+#include "../test_macros.hpp"
+#include <boost/array.hpp>
+#include <cstring>
+
+#ifdef BOOST_HAS_ICU
+#include <boost/regex/icu.hpp>
+#endif
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+
+template <int N>
+size_t array_size(const char* (&p)[N])
+{
+ for(size_t i = 0; i < N; ++i)
+ if(p[i] == 0)
+ return i;
+ return N;
+}
+
+std::wstring make_wstring(const char* p)
+{
+ return std::wstring(p, p + std::strlen(p));
+}
+
+#ifdef __sgi
+template <class T>
+void test_captures(const std::string& regx, const std::string& text, const T& expected)
+#else
+template <class T>
+void test_captures(const std::string& regx, const std::string& text, T& expected)
+#endif
+{
+ boost::regex e(regx);
+ boost::smatch what;
+ if(boost::regex_match(text, what, e, boost::match_extra))
+ {
+ unsigned i, j;
+#ifndef __sgi
+ // strange type deduction causes this test to fail on SGI:
+ BOOST_CHECK(what.size() == ARRAY_SIZE(expected));
+#endif
+ for(i = 0; i < what.size(); ++i)
+ {
+ BOOST_CHECK(what.captures(i).size() == array_size(expected[i]));
+ for(j = 0; j < what.captures(i).size(); ++j)
+ {
+ BOOST_CHECK(what.captures(i)[j] == expected[i][j]);
+ }
+ }
+ }
+
+ std::wstring wre(regx.begin(), regx.end());
+ std::wstring wtext(text.begin(), text.end());
+ boost::wregex we(wre);
+ boost::wsmatch wwhat;
+ if(boost::regex_match(wtext, wwhat, we, boost::match_extra))
+ {
+ unsigned i, j;
+#ifndef __sgi
+ // strange type deduction causes this test to fail on SGI:
+ BOOST_CHECK(wwhat.size() == ARRAY_SIZE(expected));
+#endif
+ for(i = 0; i < wwhat.size(); ++i)
+ {
+ BOOST_CHECK(wwhat.captures(i).size() == array_size(expected[i]));
+ for(j = 0; j < wwhat.captures(i).size(); ++j)
+ {
+ BOOST_CHECK(wwhat.captures(i)[j] == make_wstring(expected[i][j]));
+ }
+ }
+ }
+
+#ifdef BOOST_HAS_ICU
+ boost::u32regex ure = boost::make_u32regex(regx);
+ what = boost::smatch();
+ if(boost::u32regex_match(text, what, ure, boost::match_extra))
+ {
+ unsigned i, j;
+#ifndef __sgi
+ // strange type deduction causes this test to fail on SGI:
+ BOOST_CHECK(what.size() == ARRAY_SIZE(expected));
+#endif
+ for(i = 0; i < what.size(); ++i)
+ {
+ BOOST_CHECK(what.captures(i).size() == array_size(expected[i]));
+ for(j = 0; j < what.captures(i).size(); ++j)
+ {
+ BOOST_CHECK(what.captures(i)[j] == expected[i][j]);
+ }
+ }
+ }
+#endif
+}
+
+int cpp_main(int , char* [])
+{
+ typedef const char* pchar;
+ pchar e1[4][5] =
+ {
+ { "aBBcccDDDDDeeeeeeee", },
+ { "a", "BB", "ccc", "DDDDD", "eeeeeeee", },
+ { "a", "ccc", "eeeeeeee", },
+ { "BB", "DDDDD", },
+ };
+ test_captures("(([[:lower:]]+)|([[:upper:]]+))+", "aBBcccDDDDDeeeeeeee", e1);
+ pchar e2[4][2] =
+ {
+ { "abd" },
+ { "b", "" },
+ { "" },
+ };
+ test_captures("a(b+|((c)*))+d", "abd", e2);
+ pchar e3[3][1] =
+ {
+ { "abcbar" },
+ { "abc" },
+ };
+ test_captures("(.*)bar|(.*)bah", "abcbar", e3);
+ pchar e4[3][1] =
+ {
+ { "abcbah" },
+ { 0, },
+ { "abc" },
+ };
+ test_captures("(.*)bar|(.*)bah", "abcbah", e4);
+ pchar e5[2][16] =
+ {
+ { "now is the time for all good men to come to the aid of the party" },
+ { "now", "is", "the", "time", "for", "all", "good", "men", "to", "come", "to", "the", "aid", "of", "the", "party" },
+ };
+ test_captures("^(?:(\\w+)|(?>\\W+))*$", "now is the time for all good men to come to the aid of the party", e5);
+ pchar e6[2][16] =
+ {
+ { "now is the time for all good men to come to the aid of the party" },
+ { "now", "is", "the", "time", "for", "all", "good", "men", "to", "come", "to", "the", "aid", "of", "the", "party" },
+ };
+ test_captures("^(?>(\\w+)\\W*)*$", "now is the time for all good men to come to the aid of the party", e6);
+ pchar e7[4][14] =
+ {
+ { "now is the time for all good men to come to the aid of the party" },
+ { "now" },
+ { "is", "the", "time", "for", "all", "good", "men", "to", "come", "to", "the", "aid", "of", "the" },
+ { "party" },
+ };
+ test_captures("^(\\w+)\\W+(?>(\\w+)\\W+)*(\\w+)$", "now is the time for all good men to come to the aid of the party", e7);
+ pchar e8[5][9] =
+ {
+ { "now is the time for all good men to come to the aid of the party" } ,
+ { "now" },
+ { "is", "for", "men", "to", "of" },
+ { "the", "time", "all", "good", "to", "come", "the", "aid", "the" },
+ { "party" },
+ };
+ test_captures("^(\\w+)\\W+(?>(\\w+)\\W+(?:(\\w+)\\W+){0,2})*(\\w+)$", "now is the time for all good men to come to the aid of the party", e8);
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/test/collate_info/collate_info.cpp b/src/boost/libs/regex/test/collate_info/collate_info.cpp
new file mode 100644
index 000000000..da96745c2
--- /dev/null
+++ b/src/boost/libs/regex/test/collate_info/collate_info.cpp
@@ -0,0 +1,255 @@
+/*
+ *
+ * Copyright (c) 2005
+ * 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)
+ *
+ */
+
+// most of the workarounds and headers we need are already in here:
+#include <boost/regex.hpp>
+#include <boost/regex/v4/primary_transform.hpp>
+#include <assert.h>
+#include <boost/detail/lightweight_main.hpp>
+#include <iostream>
+#include <iomanip>
+
+#ifdef BOOST_INTEL
+#pragma warning(disable:1418 981 983 2259)
+#endif
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::strxfrm;
+#ifndef BOOST_NO_WREGEX
+ using ::wcsxfrm;
+#endif
+}
+#endif
+
+#include <iostream>
+
+template <class charT>
+int make_int(charT c)
+{
+ return c;
+}
+
+int make_int(char c)
+{
+ return static_cast<unsigned char>(c);
+}
+
+template <class charT>
+void print_string(const std::basic_string<charT>& s)
+{
+ typedef typename std::basic_string<charT>::size_type size_type;
+ std::cout.put(static_cast<unsigned char>('"'));
+ for(size_type i = 0; i < s.size(); ++i)
+ {
+ if((s[i] > ' ') && (s[i] <= 'z'))
+ {
+ std::cout.put(static_cast<unsigned char>(s[i]));
+ }
+ else
+ {
+ std::cout << "\\x" << std::hex << make_int(s[i]);
+ }
+ }
+ std::cout.put(static_cast<unsigned char>('"'));
+}
+
+void print_c_char(char c)
+{
+ char buf[50];
+ const char cbuf[2] = { c, 0, };
+ std::size_t len = std::strxfrm(buf, cbuf, 50);
+ std:: cout << len << " ";
+ std::string s(buf);
+ print_string(s);
+}
+#ifndef BOOST_NO_WREGEX
+void print_c_char(wchar_t c)
+{
+ wchar_t buf[50];
+ const wchar_t cbuf[2] = { c, 0, };
+ std::size_t len = std::wcsxfrm(buf, cbuf, 50);
+ std:: cout << len << " ";
+ std::wstring s(buf);
+ print_string(s);
+}
+#endif
+template <class charT>
+void print_c_info(charT, const char* name)
+{
+ std::cout << "Info for " << name << " C API's:" << std::endl;
+ std::cout << " \"a\" : ";
+ print_c_char(charT('a'));
+ std::cout << std::endl;
+ std::cout << " \"A\" : ";
+ print_c_char(charT('A'));
+ std::cout << std::endl;
+ std::cout << " \"z\" : ";
+ print_c_char(charT('z'));
+ std::cout << std::endl;
+ std::cout << " \"Z\" : ";
+ print_c_char(charT('Z'));
+ std::cout << std::endl;
+ std::cout << " \";\" : ";
+ print_c_char(charT(';'));
+ std::cout << std::endl;
+ std::cout << " \"{\" : ";
+ print_c_char(charT('{'));
+ std::cout << std::endl;
+}
+
+template <class charT>
+void print_cpp_char(charT c)
+{
+#ifndef BOOST_NO_STD_LOCALE
+ std::locale l;
+ const std::collate<charT>& col = BOOST_USE_FACET(std::collate<charT>, l);
+ std::basic_string<charT> result = col.transform(&c, &c+1);
+ std::cout << result.size() << " ";
+ print_string(result);
+ std::size_t n = result.find(charT(0));
+ if(n != std::basic_string<charT>::npos)
+ {
+ std::cerr << "(Error in location of null, found: " << n << ")";
+ }
+#endif
+}
+
+template <class charT>
+void print_cpp_info(charT, const char* name)
+{
+ std::cout << "Info for " << name << " C++ locale API's:" << std::endl;
+ std::cout << " \"a\" : ";
+ print_cpp_char(charT('a'));
+ std::cout << std::endl;
+ std::cout << " \"A\" : ";
+ print_cpp_char(charT('A'));
+ std::cout << std::endl;
+ std::cout << " \"z\" : ";
+ print_cpp_char(charT('z'));
+ std::cout << std::endl;
+ std::cout << " \"Z\" : ";
+ print_cpp_char(charT('Z'));
+ std::cout << std::endl;
+ std::cout << " \";\" : ";
+ print_cpp_char(charT(';'));
+ std::cout << std::endl;
+ std::cout << " \"{\" : ";
+ print_cpp_char(charT('{'));
+ std::cout << std::endl;
+}
+
+template <class traits>
+void print_sort_syntax(const traits& pt, const char* name)
+{
+ std::cout << "Sort Key Syntax for type " << name << ":\n";
+ typedef typename traits::char_type char_type;
+ char_type delim;
+ unsigned result = ::boost::BOOST_REGEX_DETAIL_NS::find_sort_syntax(&pt, &delim);
+ std::cout << " ";
+ switch(result)
+ {
+ case boost::BOOST_REGEX_DETAIL_NS::sort_C:
+ std::cout << "sort_C";
+ break;
+ case boost::BOOST_REGEX_DETAIL_NS::sort_fixed:
+ std::cout << "sort_fixed" << " " << static_cast<int>(delim);
+ break;
+ case boost::BOOST_REGEX_DETAIL_NS::sort_delim:
+ {
+ std::cout << "sort_delim" << " ";
+ std::basic_string<char_type> s(1, delim);
+ print_string(s);
+ }
+ break;
+ case boost::BOOST_REGEX_DETAIL_NS::sort_unknown:
+ std::cout << "sort_unknown";
+ break;
+ default:
+ std::cout << "bad_value";
+ break;
+ }
+ std::cout << std::endl;
+
+ typedef typename traits::string_type string_type;
+ typedef typename traits::char_type char_type;
+
+ char_type c[5] = { 'a', 'A', ';', '{', '}', };
+ for(int i = 0; i < 5; ++i)
+ {
+ string_type s(1, c[i]);
+ string_type sk = pt.transform(s.c_str(), s.c_str() + s.size());
+ string_type skp = pt.transform_primary(s.c_str(), s.c_str() + s.size());
+ print_string(s);
+ std::cout << " ";
+ print_string(sk);
+ std::cout << " ";
+ print_string(skp);
+ std::cout << std::endl;
+ }
+}
+
+#ifndef BOOST_NO_STD_LOCALE
+template <class charT>
+void print_ctype_info(charT, const char* name)
+{
+ std::locale l;
+ const std::ctype<charT>& ct = BOOST_USE_FACET(std::ctype<charT>, l);
+ typedef typename std::ctype<charT>::mask mask_type;
+ mask_type m = static_cast<mask_type>(std::ctype<charT>::lower | std::ctype<charT>::upper);
+ bool result = ct.is(m, static_cast<charT>('a')) && ct.is(m , static_cast<charT>('A'));
+ std::cout << "Checking std::ctype<" << name << ">::is(mask, c):" << std::endl;
+#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
+ std::cout << " Boost.Regex believes this facet to be buggy..." << std::endl;
+#else
+ std::cout << " Boost.Regex believes this facet to be correct..." << std::endl;
+#endif
+ std::cout << " Actual behavior, appears to be " << (result ? "correct." : "buggy.") << std::endl;
+ assert(ct.is(std::ctype<charT>::alnum, 'a'));
+ assert(ct.is(std::ctype<charT>::alnum, 'A'));
+ assert(ct.is(std::ctype<charT>::alnum, '0'));
+}
+#endif
+
+int cpp_main(int /*argc*/, char * /*argv*/[])
+{
+ print_c_info(char(0), "char");
+#ifndef BOOST_NO_WREGEX
+ print_c_info(wchar_t(0), "wchar_t");
+#endif
+ print_cpp_info(char(0), "char");
+#ifndef BOOST_NO_WREGEX
+ print_cpp_info(wchar_t(0), "wchar_t");
+#endif
+
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+ boost::c_regex_traits<char> a;
+ print_sort_syntax(a, "boost::c_regex_traits<char>");
+#ifndef BOOST_NO_WREGEX
+ boost::c_regex_traits<wchar_t> b;
+ print_sort_syntax(b, "boost::c_regex_traits<wchar_t>");
+#endif
+#endif
+#ifndef BOOST_NO_STD_LOCALE
+ boost::cpp_regex_traits<char> c;
+ print_sort_syntax(c, "boost::cpp_regex_traits<char>");
+#ifndef BOOST_NO_WREGEX
+ boost::cpp_regex_traits<wchar_t> d;
+ print_sort_syntax(d, "boost::cpp_regex_traits<wchar_t>");
+#endif
+ print_ctype_info(char(0), "char");
+#ifndef BOOST_NO_WREGEX
+ print_ctype_info(wchar_t(0), "wchar_t");
+#endif
+#endif
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/test/concepts/concept_check.cpp b/src/boost/libs/regex/test/concepts/concept_check.cpp
new file mode 100644
index 000000000..21448f210
--- /dev/null
+++ b/src/boost/libs/regex/test/concepts/concept_check.cpp
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright (c) 2003
+ * 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/config.hpp>
+
+#if defined(BOOST_MSVC)
+// this lets us compile at warning level 4 without seeing concept-check related warnings
+# pragma warning(disable:4100)
+#endif
+#ifdef __BORLANDC__
+#pragma option -w-8019 -w-8004 -w-8008
+#endif
+#ifdef BOOST_INTEL
+#pragma warning(disable:1418 981 983 595 383)
+#endif
+
+#include <boost/regex.hpp>
+#include <boost/detail/workaround.hpp>
+#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
+#include <boost/regex/concepts.hpp>
+#endif
+
+
+int main()
+{
+ // VC6 and VC7 can't cope with the iterator architypes,
+ // don't bother testing as it doesn't work:
+#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
+ boost::function_requires<
+ boost::RegexTraitsConcept<
+ boost::regex_traits<char>
+ >
+ >();
+#ifndef BOOST_NO_STD_LOCALE
+ boost::function_requires<
+ boost::BoostRegexConcept<
+ boost::basic_regex<char, boost::cpp_regex_traits<char> >
+ >
+ >();
+#ifndef BOOST_NO_WREGEX
+ boost::function_requires<
+ boost::BoostRegexConcept<
+ boost::basic_regex<wchar_t, boost::cpp_regex_traits<wchar_t> >
+ >
+ >();
+#endif
+#endif
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+ boost::function_requires<
+ boost::BoostRegexConcept<
+ boost::basic_regex<char, boost::c_regex_traits<char> >
+ >
+ >();
+#ifndef BOOST_NO_WREGEX
+ boost::function_requires<
+ boost::BoostRegexConcept<
+ boost::basic_regex<wchar_t, boost::c_regex_traits<wchar_t> >
+ >
+ >();
+#endif
+#endif
+#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
+ boost::function_requires<
+ boost::BoostRegexConcept<
+ boost::basic_regex<char, boost::w32_regex_traits<char> >
+ >
+ >();
+#ifndef BOOST_NO_WREGEX
+ boost::function_requires<
+ boost::BoostRegexConcept<
+ boost::basic_regex<wchar_t, boost::w32_regex_traits<wchar_t> >
+ >
+ >();
+#endif
+#endif
+ //
+ // now test the regex_traits concepts:
+ //
+ typedef boost::basic_regex<char, boost::regex_traits_architype<char> > regex_traits_tester_type1;
+ boost::function_requires<
+ boost::BoostRegexConcept<
+ regex_traits_tester_type1
+ >
+ >();
+#if !defined(__MWERKS__) && !defined(__SUNPRO_CC) // MWCW tries to instantiate std::basic_string<boost::char_architype>, not sure whose bug this is....
+ typedef boost::basic_regex<boost::char_architype, boost::regex_traits_architype<boost::char_architype> > regex_traits_tester_type2;
+ boost::function_requires<
+ boost::BaseRegexConcept<
+ regex_traits_tester_type2
+ >
+ >();
+#endif // __MWERKS__
+#endif
+ return 0;
+}
+
+
diff --git a/src/boost/libs/regex/test/concepts/icu_concept_check.cpp b/src/boost/libs/regex/test/concepts/icu_concept_check.cpp
new file mode 100644
index 000000000..a55bb387e
--- /dev/null
+++ b/src/boost/libs/regex/test/concepts/icu_concept_check.cpp
@@ -0,0 +1,249 @@
+/*
+ *
+ * Copyright (c) 2003
+ * 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)
+ *
+ */
+
+//
+// This define keep ICU in it's own namespace: helps us to track bugs that would
+// otherwise go unnoticed:
+//
+#define U_USING_ICU_NAMESPACE 0
+
+#include <boost/regex/config.hpp>
+
+#if defined(BOOST_MSVC)
+// this lets us compile at warning level 4 without seeing concept-check related warnings
+# pragma warning(disable:4100)
+#endif
+#ifdef __BORLANDC__
+#pragma option -w-8019 -w-8004 -w-8008
+#endif
+
+#ifdef BOOST_HAS_ICU
+
+#include <boost/regex/icu.hpp>
+#include <boost/detail/workaround.hpp>
+#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
+#include <boost/regex/concepts.hpp>
+#endif
+
+template <class I>
+void check_token_iterator(I i)
+{
+ typedef typename I::value_type value_type;
+ typedef typename value_type::value_type char_type;
+ typedef std::basic_string<char_type> string_type;
+
+ I j;
+
+ std::vector<string_type> v;
+
+ while (i != j)
+ {
+ v.push_back(i->str());
+ ++i;
+ }
+
+}
+
+template <class I>
+void check_iterator(I i)
+{
+ typedef typename I::value_type value_type;
+
+ std::vector <value_type> v(i, I());
+ (void)v;
+
+}
+int main()
+{
+ // VC6 and VC7 can't cope with the iterator architypes,
+ // don't bother testing as it doesn't work:
+#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
+ boost::function_requires<
+ boost::RegexTraitsConcept<
+ boost::icu_regex_traits
+ >
+ >();
+ boost::function_requires<
+ boost::BoostRegexConcept<
+ boost::u32regex
+ >
+ >();
+ //
+ // Now test additional function overloads:
+ //
+ bool b;
+ unsigned long buf[2] = { 0, };
+ const void* pb = buf;
+ typedef boost::bidirectional_iterator_archetype<char> utf8_arch1;
+ typedef boost::bidirectional_iterator_archetype<unsigned char> utf8_arch2;
+ typedef boost::bidirectional_iterator_archetype<UChar> utf16_arch;
+ typedef boost::bidirectional_iterator_archetype<wchar_t> wchar_arch;
+ boost::match_results<utf8_arch1> m1;
+ boost::match_results<utf8_arch2> m2;
+ boost::match_results<utf16_arch> m3;
+ boost::match_results<wchar_arch> m4;
+ boost::match_results<const char*> cm1;
+ boost::match_results<const unsigned char*> cm2;
+ boost::match_results<const UChar*> cm3;
+ boost::match_results<const wchar_t*> cm4;
+ boost::match_results<std::string::const_iterator> sm1;
+ boost::match_results<std::wstring::const_iterator> sm2;
+ boost::u32regex e1;
+ boost::regex_constants::match_flag_type flgs = boost::regex_constants::match_default;
+ std::string s1;
+ std::wstring s2;
+ U_NAMESPACE_QUALIFIER UnicodeString us;
+ b = boost::u32regex_match(utf8_arch1(), utf8_arch1(), m1, e1, flgs);
+ b = boost::u32regex_match(utf8_arch1(), utf8_arch1(), m1, e1);
+ b = boost::u32regex_match(utf8_arch2(), utf8_arch2(), m2, e1, flgs);
+ b = boost::u32regex_match(utf8_arch2(), utf8_arch2(), m2, e1);
+ b = boost::u32regex_match(utf16_arch(), utf16_arch(), m3, e1, flgs);
+ b = boost::u32regex_match(utf16_arch(), utf16_arch(), m3, e1);
+ b = boost::u32regex_match(wchar_arch(), wchar_arch(), m4, e1, flgs);
+ b = boost::u32regex_match(wchar_arch(), wchar_arch(), m4, e1);
+ b = boost::u32regex_match((const char*)(pb), cm1, e1, flgs);
+ b = boost::u32regex_match((const char*)(pb), cm1, e1);
+ b = boost::u32regex_match((const unsigned char*)(pb), cm2, e1, flgs);
+ b = boost::u32regex_match((const unsigned char*)(pb), cm2, e1);
+ b = boost::u32regex_match((const UChar*)(pb), cm3, e1, flgs);
+ b = boost::u32regex_match((const UChar*)(pb), cm3, e1);
+ b = boost::u32regex_match((const wchar_t*)(pb), cm4, e1, flgs);
+ b = boost::u32regex_match((const wchar_t*)(pb), cm4, e1);
+ b = boost::u32regex_match(s1, sm1, e1, flgs);
+ b = boost::u32regex_match(s1, sm1, e1);
+ b = boost::u32regex_match(s2, sm2, e1, flgs);
+ b = boost::u32regex_match(s2, sm2, e1);
+ b = boost::u32regex_match(us, cm3, e1, flgs);
+ b = boost::u32regex_match(us, cm3, e1);
+
+ b = boost::u32regex_search(utf8_arch1(), utf8_arch1(), m1, e1, flgs);
+ b = boost::u32regex_search(utf8_arch1(), utf8_arch1(), m1, e1);
+ b = boost::u32regex_search(utf8_arch2(), utf8_arch2(), m2, e1, flgs);
+ b = boost::u32regex_search(utf8_arch2(), utf8_arch2(), m2, e1);
+ b = boost::u32regex_search(utf16_arch(), utf16_arch(), m3, e1, flgs);
+ b = boost::u32regex_search(utf16_arch(), utf16_arch(), m3, e1);
+ b = boost::u32regex_search(wchar_arch(), wchar_arch(), m4, e1, flgs);
+ b = boost::u32regex_search(wchar_arch(), wchar_arch(), m4, e1);
+ b = boost::u32regex_search((const char*)(pb), cm1, e1, flgs);
+ b = boost::u32regex_search((const char*)(pb), cm1, e1);
+ b = boost::u32regex_search((const unsigned char*)(pb), cm2, e1, flgs);
+ b = boost::u32regex_search((const unsigned char*)(pb), cm2, e1);
+ b = boost::u32regex_search((const UChar*)(pb), cm3, e1, flgs);
+ b = boost::u32regex_search((const UChar*)(pb), cm3, e1);
+ b = boost::u32regex_search((const wchar_t*)(pb), cm4, e1, flgs);
+ b = boost::u32regex_search((const wchar_t*)(pb), cm4, e1);
+ b = boost::u32regex_search(s1, sm1, e1, flgs);
+ b = boost::u32regex_search(s1, sm1, e1);
+ b = boost::u32regex_search(s2, sm2, e1, flgs);
+ b = boost::u32regex_search(s2, sm2, e1);
+ b = boost::u32regex_search(us, cm3, e1, flgs);
+ b = boost::u32regex_search(us, cm3, e1);
+ boost::output_iterator_archetype<char> out1 = boost::detail::dummy_constructor();
+ out1 = boost::u32regex_replace(out1, utf8_arch1(), utf8_arch1(), e1, (const char*)(pb), flgs);
+ boost::output_iterator_archetype<unsigned char> out2 = boost::detail::dummy_constructor();
+ out2 = boost::u32regex_replace(out2, utf8_arch2(), utf8_arch2(), e1, (const unsigned char*)(pb), flgs);
+ boost::output_iterator_archetype<UChar> out3 = boost::detail::dummy_constructor();
+ out3 = boost::u32regex_replace(out3, utf16_arch(), utf16_arch(), e1, (const UChar*)(pb), flgs);
+ boost::output_iterator_archetype<wchar_t> out4 = boost::detail::dummy_constructor();
+ out4 = boost::u32regex_replace(out4, wchar_arch(), wchar_arch(), e1, (const wchar_t*)(pb), flgs);
+
+ out1 = boost::u32regex_replace(out1, utf8_arch1(), utf8_arch1(), e1, s1, flgs);
+ out2 = boost::u32regex_replace(out2, utf8_arch2(), utf8_arch2(), e1, s1, flgs);
+ out3 = boost::u32regex_replace(out3, utf16_arch(), utf16_arch(), e1, s1, flgs);
+ out4 = boost::u32regex_replace(out4, wchar_arch(), wchar_arch(), e1, s1, flgs);
+ out1 = boost::u32regex_replace(out1, utf8_arch1(), utf8_arch1(), e1, s2, flgs);
+ out2 = boost::u32regex_replace(out2, utf8_arch2(), utf8_arch2(), e1, s2, flgs);
+ out3 = boost::u32regex_replace(out3, utf16_arch(), utf16_arch(), e1, s2, flgs);
+ out4 = boost::u32regex_replace(out4, wchar_arch(), wchar_arch(), e1, s2, flgs);
+ out1 = boost::u32regex_replace(out1, utf8_arch1(), utf8_arch1(), e1, us, flgs);
+ out2 = boost::u32regex_replace(out2, utf8_arch2(), utf8_arch2(), e1, us, flgs);
+ out3 = boost::u32regex_replace(out3, utf16_arch(), utf16_arch(), e1, us, flgs);
+ out4 = boost::u32regex_replace(out4, wchar_arch(), wchar_arch(), e1, us, flgs);
+ // string overloads:
+ s1 = boost::u32regex_replace(s1, e1, (const char*)(pb), flgs);
+ s2 = boost::u32regex_replace(s2, e1, (const wchar_t*)(pb), flgs);
+ s1 = boost::u32regex_replace(s1, e1, s1, flgs);
+ s2 = boost::u32regex_replace(s2, e1, s2, flgs);
+ s1 = boost::u32regex_replace(s1, e1, (const char*)(pb));
+ s2 = boost::u32regex_replace(s2, e1, (const wchar_t*)(pb));
+ s1 = boost::u32regex_replace(s1, e1, s1);
+ s2 = boost::u32regex_replace(s2, e1, s2);
+
+ std::vector<int> subs1;
+ int subs2[2] = { 1, 2 };
+
+ check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, 0, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, 0));
+ check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1));
+ check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, 0, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, 0));
+ check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1));
+ check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, 0, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, 0));
+ check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1));
+ check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, 0, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, 0));
+ check_token_iterator(boost::make_u32regex_token_iterator(s1, e1));
+ check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, 0, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, 0));
+ check_token_iterator(boost::make_u32regex_token_iterator(s2, e1));
+ check_token_iterator(boost::make_u32regex_token_iterator(us, e1, 0, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator(us, e1, 0));
+ check_token_iterator(boost::make_u32regex_token_iterator(us, e1));
+
+ check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs2, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs2));
+ check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs2, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs2));
+ check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs2, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs2));
+ check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs2, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs2));
+ check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs2, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs2));
+ check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs2, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs2));
+
+ check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs1, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs1));
+ check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs1, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs1));
+ check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs1, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs1));
+ check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs1, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs1));
+ check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs1, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs1));
+ check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs1, boost::regex_constants::match_default));
+ check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs1));
+
+ check_iterator(boost::make_u32regex_iterator((const char*)(pb), e1, boost::regex_constants::match_default));
+ check_iterator(boost::make_u32regex_iterator((const char*)(pb), e1));
+ check_iterator(boost::make_u32regex_iterator((const UChar*)(pb), e1, boost::regex_constants::match_default));
+ check_iterator(boost::make_u32regex_iterator((const UChar*)(pb), e1));
+ check_iterator(boost::make_u32regex_iterator((const wchar_t*)(pb), e1, boost::regex_constants::match_default));
+ check_iterator(boost::make_u32regex_iterator((const wchar_t*)(pb), e1));
+ check_iterator(boost::make_u32regex_iterator(s1, e1, boost::regex_constants::match_default));
+ check_iterator(boost::make_u32regex_iterator(s2, e1));
+ check_iterator(boost::make_u32regex_iterator(us, e1));
+
+#endif
+ return 0;
+}
+
+#else
+
+int main()
+{
+ return 0;
+}
+
+#endif
diff --git a/src/boost/libs/regex/test/concepts/range_concept_check.cpp b/src/boost/libs/regex/test/concepts/range_concept_check.cpp
new file mode 100644
index 000000000..f6afd700c
--- /dev/null
+++ b/src/boost/libs/regex/test/concepts/range_concept_check.cpp
@@ -0,0 +1,41 @@
+/*
+*
+* Copyright (c) 2015
+* 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>
+#include <boost/range/concepts.hpp>
+
+template <class T>
+void use_val(const T&){}
+
+template <class T>
+void check()
+{
+ BOOST_CONCEPT_ASSERT((boost::ForwardRangeConcept<T>));
+ BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept<typename boost::range_iterator<T>::type>));
+ BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversalConcept<typename boost::range_iterator<T>::type>));
+
+#ifndef BOOST_NO_CXX11_RANGE_BASED_FOR
+ const T val;
+ for(auto item : val)
+ {
+ use_val(item);
+ }
+#endif
+}
+
+int main()
+{
+ check<boost::smatch>();
+ check<boost::cmatch>();
+
+ check <boost::sub_match<const char*> >();
+ return 0;
+}
diff --git a/src/boost/libs/regex/test/concepts/test_bug_11988.cpp b/src/boost/libs/regex/test/concepts/test_bug_11988.cpp
new file mode 100644
index 000000000..7376f39a4
--- /dev/null
+++ b/src/boost/libs/regex/test/concepts/test_bug_11988.cpp
@@ -0,0 +1,115 @@
+/*
+*
+* Copyright (c) 2016
+* 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/config.hpp>
+
+#ifndef BOOST_NO_CXX11_CHAR32_T
+
+#include <cstddef>
+
+namespace boost {
+
+ std::size_t hash_value(char32_t const& c) { return c; }
+
+}
+
+#include <boost/regex.hpp>
+
+struct char32_traits
+{
+ typedef char32_t char_type;
+ typedef std::size_t size_type;
+ typedef std::vector<char32_t> string_type;
+ typedef int locale_type; // not used
+ typedef unsigned char_class_type;
+
+ static size_type length(const char32_t* p)
+ {
+ size_type result = 0;
+ while(*p)
+ {
+ ++p;
+ ++result;
+ }
+ return result;
+ }
+ static char_type translate(char_type c) { return c; }
+ static char_type translate_nocase(char_type c) { return c; }
+ static string_type transform(const char32_t* p1, const char32_t* p2)
+ {
+ return string_type(p1, p2);
+ }
+ static string_type transform_primary(const char32_t* p1, const char32_t* p2)
+ {
+ return string_type(p1, p2);
+ }
+ static char_class_type lookup_classname(const char32_t* p1, const char32_t* p2)
+ {
+ std::string s(p1, p2);
+ return boost::c_regex_traits<char>::lookup_classname(s.c_str(), s.c_str() + s.length());
+ return 0;
+ }
+ static string_type lookup_collatename(const char32_t* p1, const char32_t* p2)
+ {
+ return string_type(p1, p2);
+ }
+ static bool isctype(char_type c, char_class_type t)
+ {
+ if(c < 0xff)
+ return boost::c_regex_traits<char>::isctype(c, t);
+ return false;
+ }
+ static boost::intmax_t value(char_type c, int radix)
+ {
+ switch(radix)
+ {
+ case 8:
+ if((c >= '0') && (c <= '7'))
+ return c - '0';
+ break;
+ case 10:
+ if((c >= '0') && (c <= '9'))
+ return c - '0';
+ break;
+ case 16:
+ if((c >= '0') && (c <= '9'))
+ return c - '0';
+ if((c >= 'a') && (c <= 'f'))
+ return (c - 'a') + 10;
+ if((c >= 'A') && (c <= 'F'))
+ return (c - 'A') + 10;
+ break;
+ }
+ return -1;
+ }
+ static locale_type imbue(locale_type) { return 0; }
+ static locale_type getloc() { return 0; }
+};
+
+
+int main()
+{
+ char32_t big_char[] = { 0xF, 0xFF, 0xFFF, 0xFFFF, 0xFFFFF, 0xFFFFFF, 0xFFFFFFF, 0xFFFFFFFF, 0 };
+
+ boost::basic_regex<char32_t, char32_traits> e(U"\\x{F}\\x{FF}\\x{FFF}\\x{FFFF}\\x{FFFFF}\\x{FFFFFF}\\x{FFFFFFF}\\x{FFFFFFFF}");
+
+ if(!regex_match(big_char, e))
+ {
+ return 1;
+ }
+ return 0;
+}
+
+#else
+
+int main() { return 0; }
+
+#endif
diff --git a/src/boost/libs/regex/test/config_info/regex_config_info.cpp b/src/boost/libs/regex/test/config_info/regex_config_info.cpp
new file mode 100644
index 000000000..211e9ec0c
--- /dev/null
+++ b/src/boost/libs/regex/test/config_info/regex_config_info.cpp
@@ -0,0 +1,73 @@
+/*
+ *
+ * Copyright (c) 2003
+ * 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)
+ *
+ */
+
+//
+// This program extends config_info to print out regex library
+// configuration information. We do this by redfining the main
+// provided by config_info, our real main will call it later:
+//
+#ifndef OLD_MAIN
+# define OLD_MAIN info_main
+#endif
+
+#define main OLD_MAIN
+#include <libs/config/test/config_info.cpp>
+#undef main
+#ifndef NEW_MAIN
+# define NEW_MAIN main
+#endif
+#include <boost/regex.hpp>
+
+int NEW_MAIN()
+{
+ OLD_MAIN();
+
+ print_separator();
+ PRINT_MACRO(BOOST_REGEX_USER_CONFIG);
+ PRINT_MACRO(BOOST_REGEX_USE_C_LOCALE);
+ PRINT_MACRO(BOOST_REGEX_USE_CPP_LOCALE);
+ PRINT_MACRO(BOOST_REGEX_HAS_DLL_RUNTIME);
+ PRINT_MACRO(BOOST_REGEX_DYN_LINK);
+ PRINT_MACRO(BOOST_REGEX_NO_LIB);
+ PRINT_MACRO(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE);
+ PRINT_MACRO(BOOST_REGEX_NO_W32);
+ PRINT_MACRO(BOOST_REGEX_NO_BOOL);
+ PRINT_MACRO(BOOST_REGEX_NO_EXTERNAL_TEMPLATES);
+ PRINT_MACRO(BOOST_REGEX_NO_FWD);
+ PRINT_MACRO(BOOST_REGEX_V3);
+ PRINT_MACRO(BOOST_REGEX_HAS_MS_STACK_GUARD);
+ PRINT_MACRO(BOOST_REGEX_RECURSIVE);
+ PRINT_MACRO(BOOST_REGEX_NON_RECURSIVE);
+ PRINT_MACRO(BOOST_REGEX_BLOCKSIZE);
+ PRINT_MACRO(BOOST_REGEX_MAX_BLOCKS);
+ PRINT_MACRO(BOOST_REGEX_MAX_CACHE_BLOCKS);
+ PRINT_MACRO(BOOST_NO_WREGEX);
+ PRINT_MACRO(BOOST_REGEX_NO_FILEITER);
+ PRINT_MACRO(BOOST_REGEX_STATIC_LINK);
+ PRINT_MACRO(BOOST_REGEX_DYN_LINK);
+ PRINT_MACRO(BOOST_REGEX_DECL);
+ PRINT_MACRO(BOOST_REGEX_CALL);
+ PRINT_MACRO(BOOST_REGEX_CCALL);
+ PRINT_MACRO(BOOST_REGEX_MAX_STATE_COUNT);
+ PRINT_MACRO(BOOST_REGEX_BUGGY_CTYPE_FACET);
+ PRINT_MACRO(BOOST_REGEX_MATCH_EXTRA);
+ PRINT_MACRO(BOOST_HAS_ICU);
+ PRINT_MACRO(BOOST_REGEX_HAS_OTHER_WCHAR_T);
+
+#if defined(BOOST_REGEX_CONFIG_INFO) && !defined(NO_RECURSE)
+ print_regex_library_info();
+#endif
+
+ return 0;
+}
+
+
+
diff --git a/src/boost/libs/regex/test/de_fuzz/Jamfile.v2 b/src/boost/libs/regex/test/de_fuzz/Jamfile.v2
new file mode 100644
index 000000000..4306ba7c1
--- /dev/null
+++ b/src/boost/libs/regex/test/de_fuzz/Jamfile.v2
@@ -0,0 +1,37 @@
+# copyright John Maddock 2003
+# 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.
+
+import testing ;
+
+lib Fuzzer : : <search>. ;
+
+run narrow.cpp [ glob ../../src/*.cpp ] Fuzzer
+ : # additional args
+ -dict=dictionary.txt -workers=3 corpus -runs=5000
+ : # test-files
+ : # requirements
+ <toolset>clang <cxxflags>-fsanitize-coverage=trace-pc-guard
+ <cxxflags>-fsanitize=address <cxxflags>-fsanitize=undefined
+ <cxxflags>-fno-sanitize-recover=undefined <cxxflags>-fno-optimize-sibling-calls
+ <cxxflags>-fno-omit-frame-pointer
+ <include>../../../..
+ <linkflags>-fsanitize=address <linkflags>-fsanitize=undefined
+ debug
+;
+
+run wide.cpp [ glob ../../src/*.cpp ] Fuzzer
+ : # additional args
+ -dict=dictionary.txt -workers=3 corpus -runs=5000
+ : # test-files
+ : # requirements
+ <toolset>clang <cxxflags>-fsanitize-coverage=trace-pc-guard
+ <cxxflags>-fsanitize=address <cxxflags>-fsanitize=undefined
+ <cxxflags>-fno-sanitize-recover=undefined <cxxflags>-fno-optimize-sibling-calls
+ <cxxflags>-fno-omit-frame-pointer
+ <include>../../../..
+ <linkflags>-fsanitize=address <linkflags>-fsanitize=undefined
+ debug
+;
+
diff --git a/src/boost/libs/regex/test/de_fuzz/dictionary.txt b/src/boost/libs/regex/test/de_fuzz/dictionary.txt
new file mode 100644
index 000000000..bd1450503
--- /dev/null
+++ b/src/boost/libs/regex/test/de_fuzz/dictionary.txt
@@ -0,0 +1,195 @@
+
+r1="."
+r2="["
+r3="{"
+r4="}"
+r5="("
+r6=")"
+r7="\\"
+r8="*"
+r9="+"
+r10="?"
+r11="|"
+r12="^"
+r13="$"
+r14="]"
+r15="{4}"
+r15="{4,}"
+r16="{4, 10}"
+r17="*?"
+r18="+?"
+r19="??"
+r20="*+"
+r21="++"
+r22="?+"
+r23="{4}?"
+r24="{4,}?"
+r25="{4, 10}?"
+r26="{4}"
+r27="{4,}"
+r28="{4, 10}"
+r29="\\1"
+r30="g1"
+r31="g{1}"
+r32="g-1"
+r33="g{one}"
+r34="\\k<one>"
+r35="[abc]"
+r36="[a-c]"
+r36="[^abc]"
+r37="[[:alnum:]]"
+r38="[[:alpha:]]"
+r39="[[:blank:]]"
+r40="[[:cntrl:]]"
+r41="[[:d:]]"
+r42="[[:digit:]]"
+r43="[[:grpah:]]"
+r44="[[:l:]]"
+r45="[[:lower:]]"
+r46="[[:print:]]"
+r47="[[:punct:]]"
+r48="[[:s:]]"
+r49="[[:space:]]"
+r50="[[:unicode:]]"
+r51="[[:u:]]"
+r52="[[:upper:]]"
+r53="[[:w:]]"
+r54="[[:word:]]"
+r55="[[:xdigit:]]"
+r56="[[:ASCII:]]"
+r57="[[:Any:]]"
+r58="[[:Assigned:]]"
+r59="[[:Other:]]"
+r60="[[:Control:]]"
+r61="[[:Format:]]"
+r62="[[:Not Assigned:]]"
+r63="[[:Private Use:]]"
+r64="[[:Surrogate:]]"
+r65="[[:Letter:]]"
+r66="[[:Lowercase Letter:]]"
+r67="[[:Modifier Letter:]]"
+r68="[[:Other Letter:]]"
+r69="[[:Titlecase:]]"
+r70="[[:Uppercae Letter:]]"
+r71="[[:Mark:]]"
+r72="[[:Mc:]]"
+r73="[[:Me:]]"
+r74="[[:Mn:]]"
+r75="[[:N*:]]"
+r76="[[:Md:]]"
+r77="[[:Nl:]]"
+r78="[[:No:]]"
+r79="[[:P*:]]"
+r80="[[:Pc:]]"
+r81="[[:Pd:]]"
+r82="[[:Pd:]]"
+r83="[[:Pe:]]"
+r84="[[:Pf:]]"
+r85="[[:Pi:]]"
+r86="[[:Po:]]"
+r87="[[:Ps:]]"
+r88="[[:S*:]]"
+r89="[[:Sc:]]"
+r90="[[:Sk:]]"
+r91="[[:Sm:]]"
+r92="[[:So:]]"
+r93="[[:Z*:]]"
+r94="[[:Zl:]]"
+r95="[[:Zp:]]"
+r96="[[:Zs:]]"
+r98="[[.NUL.]]"
+r99="[[.SOH.]]"
+r100="[[.alert.]]"
+r101="[[=a=]]"
+r102="\\a"
+r103="\\e"
+r104="\\r"
+r105="\\n"
+r106="\\t"
+r107="\\v"
+r108="\\b"
+r109="\\C9"
+r110="\\xcf"
+r111="\\x{13}"
+r112="\\x{01f4}"
+r113="\\0456"
+r114="\\N{newline}"
+r115="\\d"
+r116="\\l"
+r117="\\s"
+r118="\\u"
+r119="\\w"
+r120="\\h"
+r121="\\v"
+r122="\\D"
+r123="\\L"
+r124="\\S"
+r125="\\U"
+r126="\\W"
+r127="\\H"
+r128="\\V"
+r129="\\pd"
+r130="\\p{digit}"
+r131="\\Pd"
+r132="\\P{digit}"
+r133="\\<"
+r134="\\>"
+r135="\\b"
+r136="\\B"
+r137="\\`"
+r138="\\'"
+r139="\\A"
+r140="\\z"
+r141="\\Z"
+r142="\\G"
+r143="\\Q"
+r144="\\E"
+r145="\\C"
+r146="\\R"
+r147="\\K"
+r148="(?<one>abc)"
+r149="(?<one>"
+r150="(?'one'abc)"
+r151="(?'one'"
+r152="(?#annansnsbdgh)"
+r153="(?i)"
+r154="(?-i)"
+r155="(?s)"
+r156="(?-s)"
+r157="(?m)"
+r158="(?-m)"
+r153="(?x)"
+r154="(?-x)"
+r153="(?i:abcd)"
+r154="(?-i:abcd)"
+r155="(?:"
+r156="(?|"
+r157="(?="
+r158="(?!"
+r159="(?<="
+r160="(?<!"
+r170="(>"
+r171="(?1)"
+r172="(?-1)"
+r173="(?+1)"
+r174="(?R)"
+r175="(?0)"
+r176="(?&one)"
+r177="(?(?=\\>)"
+r178="(?(?!\\>)"
+r179="(?(1)"
+r180="(?(<one>)"
+r181="(?('one')"
+r182="(?(R)"
+r183="(?(R1)"
+r184="(?(R&one)"
+r185="(?(DEFINE)"
+r186="(*PRUNE)"
+r187="(*SKIP)"
+r188="(*THEN)"
+r189="(*COMMIT)"
+r190="(*FAIL)"
+r191="(*ACCEPT)"
+
+
+
diff --git a/src/boost/libs/regex/test/de_fuzz/narrow.cpp b/src/boost/libs/regex/test/de_fuzz/narrow.cpp
new file mode 100644
index 000000000..448c6b784
--- /dev/null
+++ b/src/boost/libs/regex/test/de_fuzz/narrow.cpp
@@ -0,0 +1,20 @@
+
+#include <boost/regex.hpp>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
+ if(Size < 2)
+ return 0;
+ try{
+ size_t len = (Data[1] << 8) | Data[0];
+ if(len > Size - 2) len = Size - 2;
+ std::string str((char*)(Data + 2), len);
+ std::string text((char*)(Data + len), Size - len);
+ boost::regex e(str);
+ boost::smatch what;
+ regex_search(text, what, e, boost::match_default|boost::match_partial);
+ }
+ catch(const std::exception&){}
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/test/de_fuzz/wide.cpp b/src/boost/libs/regex/test/de_fuzz/wide.cpp
new file mode 100644
index 000000000..b719adaa3
--- /dev/null
+++ b/src/boost/libs/regex/test/de_fuzz/wide.cpp
@@ -0,0 +1,21 @@
+
+#include <boost/regex.hpp>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
+ if(Size < 2)
+ return 0;
+ std::vector<wchar_t> v(Data, Data + Size);
+ try{
+ size_t len = (Data[1] << 8) | Data[0];
+ if(len > Size - 2) len = Size - 2;
+ std::wstring str(&v[0] + 2, len);
+ std::wstring text(&v[0] + len, Size - len);
+ boost::wregex e(str);
+ boost::wsmatch what;
+ regex_search(text, what, e, boost::match_default|boost::match_partial);
+ }
+ catch(const std::exception&){}
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/test/named_subexpressions/named_subexpressions_test.cpp b/src/boost/libs/regex/test/named_subexpressions/named_subexpressions_test.cpp
new file mode 100644
index 000000000..a92c02b84
--- /dev/null
+++ b/src/boost/libs/regex/test/named_subexpressions/named_subexpressions_test.cpp
@@ -0,0 +1,112 @@
+/*
+ *
+ * Copyright (c) 2009
+ * 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>
+#include <boost/detail/lightweight_main.hpp>
+#include "../test_macros.hpp"
+
+#ifdef BOOST_INTEL
+#pragma warning(disable:1418 981 983 383)
+#endif
+
+template <class charT>
+void test_named_subexpressions(charT)
+{
+ //
+ // Really this is just a test that the overloaded access functions work correctly:
+ //
+ static const charT e[] =
+ {
+ '(', '?', '\'', 'o', 'n', 'e', '\'', 'a', '+', ')', '(', '?', '<', 't', 'w', 'o', '>', 'b', '+', ')', '\0'
+ };
+ static const charT t[] =
+ {
+ 'm', 'm', 'a', 'a', 'a', 'b', 'b', 'n', 'n', '\0'
+ };
+ static const charT one[] =
+ {
+ 'o', 'n', 'e', '\0'
+ };
+ static const charT two[] =
+ {
+ 't', 'w', 'o', '\0'
+ };
+ static const std::basic_string<charT> s_one(one);
+ static const std::basic_string<charT> s_two(two);
+ static const charT result1[] = { 'a', 'a', 'a', '\0' };
+ static const charT result2[] = { 'b', 'b', '\0' };
+ static const std::basic_string<charT> s_result1(result1);
+ static const std::basic_string<charT> s_result2(result2);
+
+ static const char* c_one = "one";
+ static const char* c_two = "two";
+ static const std::string cs_one(c_one);
+ static const std::string cs_two(c_two);
+
+ boost::basic_regex<charT> expression(e);
+ boost::match_results<const charT*> what;
+ if(regex_search(t, what, expression))
+ {
+ BOOST_CHECK(what.length(1) == 3);
+ BOOST_CHECK(what.length(one) == 3);
+ BOOST_CHECK(what.length(s_one) == 3);
+ BOOST_CHECK(what.length(c_one) == 3);
+ BOOST_CHECK(what.length(cs_one) == 3);
+ BOOST_CHECK(what.position(1) == 2);
+ BOOST_CHECK(what.position(one) == 2);
+ BOOST_CHECK(what.position(s_one) == 2);
+ BOOST_CHECK(what.position(c_one) == 2);
+ BOOST_CHECK(what.position(cs_one) == 2);
+ BOOST_CHECK(what.str(1) == s_result1);
+ BOOST_CHECK(what.str(one) == s_result1);
+ BOOST_CHECK(what.str(s_one) == s_result1);
+ BOOST_CHECK(what.str(c_one) == s_result1);
+ BOOST_CHECK(what.str(cs_one) == s_result1);
+ BOOST_CHECK(what[1] == s_result1);
+ BOOST_CHECK(what[one] == s_result1);
+ BOOST_CHECK(what[s_one] == s_result1);
+ BOOST_CHECK(what[c_one] == s_result1);
+ BOOST_CHECK(what[cs_one] == s_result1);
+
+ BOOST_CHECK(what.length(2) == 2);
+ BOOST_CHECK(what.length(two) == 2);
+ BOOST_CHECK(what.length(s_two) == 2);
+ BOOST_CHECK(what.length(c_two) == 2);
+ BOOST_CHECK(what.length(cs_two) == 2);
+ BOOST_CHECK(what.position(2) == 5);
+ BOOST_CHECK(what.position(two) == 5);
+ BOOST_CHECK(what.position(s_two) == 5);
+ BOOST_CHECK(what.position(c_two) == 5);
+ BOOST_CHECK(what.position(cs_two) == 5);
+ BOOST_CHECK(what.str(2) == s_result2);
+ BOOST_CHECK(what.str(two) == s_result2);
+ BOOST_CHECK(what.str(s_two) == s_result2);
+ BOOST_CHECK(what.str(c_two) == s_result2);
+ BOOST_CHECK(what.str(cs_two) == s_result2);
+ BOOST_CHECK(what[2] == s_result2);
+ BOOST_CHECK(what[two] == s_result2);
+ BOOST_CHECK(what[s_two] == s_result2);
+ BOOST_CHECK(what[c_two] == s_result2);
+ BOOST_CHECK(what[cs_two] == s_result2);
+ }
+ else
+ {
+ BOOST_ERROR("Expected match not found");
+ }
+}
+
+int cpp_main( int , char* [] )
+{
+ test_named_subexpressions(char(0));
+ test_named_subexpressions(wchar_t(0));
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/test/noeh_test/Jamfile.v2 b/src/boost/libs/regex/test/noeh_test/Jamfile.v2
new file mode 100644
index 000000000..dcaa84b96
--- /dev/null
+++ b/src/boost/libs/regex/test/noeh_test/Jamfile.v2
@@ -0,0 +1,50 @@
+# copyright John Maddock 2011
+# 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
+ <toolset>msvc-7.0:<define>TEST_MFC=1
+ <toolset>msvc:<asynch-exceptions>on
+ # There are unidentified linker problems on these platforms:
+ <toolset>mipspro-7.4:<link>static
+ <toolset>sun-5.9:<link>static
+ <warnings>all
+ <toolset>gcc:<cxxflags>-Wextra
+ <toolset>gcc:<cxxflags>-Wshadow
+ <define>U_USING_ICU_NAMESPACE=0
+ #<toolset>gcc-mw:<link>static
+ #<toolset>gcc-mingw:<link>static
+ <toolset>gcc-cygwin:<link>static
+ ;
+
+
+lib boost_regex_noeh :
+ ../../src/c_regex_traits.cpp
+ ../../src/cpp_regex_traits.cpp
+ ../../src/cregex.cpp
+ ../../src/fileiter.cpp
+ ../../src/icu.cpp
+ ../../src/instances.cpp
+ ../../src/posix_api.cpp
+ ../../src/regex.cpp
+ ../../src/regex_debug.cpp
+ ../../src/regex_raw_buffer.cpp
+ ../../src/regex_traits_defaults.cpp
+ ../../src/static_mutex.cpp
+ ../../src/w32_regex_traits.cpp
+ ../../src/wc_regex_traits.cpp
+ ../../src/wide_posix_api.cpp
+ ../../src/winstances.cpp
+ ../../src/usinstances.cpp
+ ../../build//icu_options
+ :
+ <link>static
+ <define>BOOST_NO_EXCEPTIONS=1
+ <exception-handling>off
+ :
+ ; \ No newline at end of file
diff --git a/src/boost/libs/regex/test/object_cache/object_cache_test.cpp b/src/boost/libs/regex/test/object_cache/object_cache_test.cpp
new file mode 100644
index 000000000..50d883be6
--- /dev/null
+++ b/src/boost/libs/regex/test/object_cache/object_cache_test.cpp
@@ -0,0 +1,77 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE object_cache_test.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Test code for a generic object cache.
+ */
+#include <boost/regex/pending/object_cache.hpp>
+#include <boost/detail/lightweight_main.hpp>
+#include "../test_macros.hpp"
+
+class test_object
+{
+public:
+ test_object(int i)
+ : m_value(i)
+ {
+ ++s_count;
+ }
+ int value()const
+ {
+ return m_value;
+ }
+ static int count()
+ {
+ return s_count;
+ }
+private:
+ int m_value;
+ static int s_count;
+};
+
+int test_object::s_count = 0;
+
+static const int max_cache_size = 5;
+
+int cpp_main(int /*argc*/, char * /*argv*/[])
+{
+ int i;
+ for(i = 0; i < 20; ++i)
+ {
+ boost::shared_ptr<const test_object> p = boost::object_cache<int, test_object>::get(i, max_cache_size);
+ BOOST_CHECK(p->value() == i);
+ p = boost::object_cache<int, test_object>::get(i, max_cache_size);
+ BOOST_CHECK(p->value() == i);
+ if(i)
+ {
+ p = boost::object_cache<int, test_object>::get(i-1, max_cache_size);
+ BOOST_CHECK(p->value() == i-1);
+ }
+ }
+ int current_count = test_object::count();
+ for(int j = 0; j < 10; ++j)
+ {
+ for(i = 20 - max_cache_size; i < 20; ++i)
+ {
+ boost::shared_ptr<const test_object> p = boost::object_cache<int, test_object>::get(i, max_cache_size);
+ BOOST_CHECK(p->value() == i);
+ p = boost::object_cache<int, test_object>::get(i, max_cache_size);
+ BOOST_CHECK(p->value() == i);
+ }
+ }
+ BOOST_CHECK(current_count == test_object::count());
+ return 0;
+}
+
+
diff --git a/src/boost/libs/regex/test/pathology/bad_expression_test.cpp b/src/boost/libs/regex/test/pathology/bad_expression_test.cpp
new file mode 100644
index 000000000..6e701539a
--- /dev/null
+++ b/src/boost/libs/regex/test/pathology/bad_expression_test.cpp
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: recursion_test.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Test for indefinite recursion and/or stack overrun.
+ */
+
+#include <boost/regex.hpp>
+#include <boost/detail/lightweight_main.hpp>
+#include "../test_macros.hpp"
+#include <string>
+
+#ifdef BOOST_INTEL
+#pragma warning(disable:1418 981 983 383)
+#endif
+
+int cpp_main( int , char* [] )
+{
+ std::string bad_text(1024, ' ');
+ std::string good_text(200, ' ');
+ good_text.append("xyz");
+
+ boost::smatch what;
+
+ boost::regex e1("(.+)+xyz");
+
+ BOOST_CHECK(boost::regex_search(good_text, what, e1));
+ BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e1), std::runtime_error);
+ BOOST_CHECK(boost::regex_search(good_text, what, e1));
+
+ BOOST_CHECK(boost::regex_match(good_text, what, e1));
+ BOOST_CHECK_THROW(boost::regex_match(bad_text, what, e1), std::runtime_error);
+ BOOST_CHECK(boost::regex_match(good_text, what, e1));
+
+ boost::regex e2("abc|[[:space:]]+(xyz)?[[:space:]]+xyz");
+
+ BOOST_CHECK(boost::regex_search(good_text, what, e2));
+ BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e2), std::runtime_error);
+ BOOST_CHECK(boost::regex_search(good_text, what, e2));
+
+ bad_text.assign((std::string::size_type)500000, 'a');
+ e2.assign("aaa*@");
+ BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e2), std::runtime_error);
+ good_text.assign((std::string::size_type)5000, 'a');
+ BOOST_CHECK(0 == boost::regex_search(good_text, what, e2));
+
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/test/pathology/recursion_test.cpp b/src/boost/libs/regex/test/pathology/recursion_test.cpp
new file mode 100644
index 000000000..c0438e6e7
--- /dev/null
+++ b/src/boost/libs/regex/test/pathology/recursion_test.cpp
@@ -0,0 +1,65 @@
+/*
+ *
+ * Copyright (c) 1998-2002
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: recursion_test.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Test for indefinite recursion and/or stack overrun.
+ */
+
+#include <boost/regex.hpp>
+#include <boost/detail/lightweight_main.hpp>
+#include "../test_macros.hpp"
+#include <string>
+
+#ifdef BOOST_INTEL
+#pragma warning(disable:1418 981 983 383)
+#endif
+
+int cpp_main( int , char* [] )
+{
+ // this regex will recurse twice for each whitespace character matched:
+ boost::regex e("([[:space:]]|.)+");
+
+ std::string bad_text(1024*1024*4, ' ');
+ std::string good_text(200, ' ');
+
+ boost::smatch what;
+
+ //
+ // Over and over: We want to make sure that after a stack error has
+ // been triggered, that we can still conduct a good search and that
+ // subsequent stack failures still do the right thing:
+ //
+ BOOST_CHECK(boost::regex_search(good_text, what, e));
+ BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e), std::runtime_error);
+ BOOST_CHECK(boost::regex_search(good_text, what, e));
+ BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e), std::runtime_error);
+ BOOST_CHECK(boost::regex_search(good_text, what, e));
+ BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e), std::runtime_error);
+ BOOST_CHECK(boost::regex_search(good_text, what, e));
+ BOOST_CHECK_THROW(boost::regex_search(bad_text, what, e), std::runtime_error);
+ BOOST_CHECK(boost::regex_search(good_text, what, e));
+
+ BOOST_CHECK(boost::regex_match(good_text, what, e));
+ BOOST_CHECK_THROW(boost::regex_match(bad_text, what, e), std::runtime_error);
+ BOOST_CHECK(boost::regex_match(good_text, what, e));
+ BOOST_CHECK_THROW(boost::regex_match(bad_text, what, e), std::runtime_error);
+ BOOST_CHECK(boost::regex_match(good_text, what, e));
+ BOOST_CHECK_THROW(boost::regex_match(bad_text, what, e), std::runtime_error);
+ BOOST_CHECK(boost::regex_match(good_text, what, e));
+ BOOST_CHECK_THROW(boost::regex_match(bad_text, what, e), std::runtime_error);
+ BOOST_CHECK(boost::regex_match(good_text, what, e));
+
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/test/profile/Makefile b/src/boost/libs/regex/test/profile/Makefile
new file mode 100644
index 000000000..f1b3def7b
--- /dev/null
+++ b/src/boost/libs/regex/test/profile/Makefile
@@ -0,0 +1,16 @@
+# copyright John Maddock 2003
+# 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.
+
+
+regress :
+ g++ -fprofile-arcs -ftest-coverage -DBOOST_REGEX_RECURSIVE -DBOOST_REGEX_BLOCKSIZE=512 -DBOOST_REGEX_MAX_CACHE_BLOCKS=0 -DBOOST_REGEX_MATCH_EXTRA -g -I../../../../ -o regress ../regress/*.cpp ../../src/*.cpp ../../../test/src/ex*.cpp ../../../test/src/cpp_main.cpp
+ ./regress
+ gcov basic_tests.cpp
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/test/quick.cpp b/src/boost/libs/regex/test/quick.cpp
new file mode 100644
index 000000000..0598823d6
--- /dev/null
+++ b/src/boost/libs/regex/test/quick.cpp
@@ -0,0 +1,55 @@
+
+// Copyright 1998-2002 John Maddock
+// Copyright 2017 Peter Dimov
+//
+// 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
+
+// See library home page at http://www.boost.org/libs/regex
+
+#include <boost/regex.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <string>
+
+bool validate_card_format(const std::string& s)
+{
+ static const boost::regex e("(\\d{4}[- ]){3}\\d{4}");
+ return boost::regex_match(s, e);
+}
+
+const boost::regex card_rx("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z");
+const std::string machine_format("\\1\\2\\3\\4");
+const std::string human_format("\\1-\\2-\\3-\\4");
+
+std::string machine_readable_card_number(const std::string& s)
+{
+ return boost::regex_replace(s, card_rx, machine_format, boost::match_default | boost::format_sed);
+}
+
+std::string human_readable_card_number(const std::string& s)
+{
+ return boost::regex_replace(s, card_rx, human_format, boost::match_default | boost::format_sed);
+}
+
+int main()
+{
+ std::string s[ 4 ] = { "0000111122223333", "0000 1111 2222 3333", "0000-1111-2222-3333", "000-1111-2222-3333" };
+
+ BOOST_TEST( !validate_card_format( s[0] ) );
+ BOOST_TEST_EQ( machine_readable_card_number( s[0] ), s[0] );
+ BOOST_TEST_EQ( human_readable_card_number( s[0] ), s[2] );
+
+ BOOST_TEST( validate_card_format( s[1] ) );
+ BOOST_TEST_EQ( machine_readable_card_number( s[1] ), s[0] );
+ BOOST_TEST_EQ( human_readable_card_number( s[1] ), s[2] );
+
+ BOOST_TEST( validate_card_format( s[2] ) );
+ BOOST_TEST_EQ( machine_readable_card_number( s[2] ), s[0] );
+ BOOST_TEST_EQ( human_readable_card_number( s[2] ), s[2] );
+
+ BOOST_TEST( !validate_card_format( s[3] ) );
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/regex/test/regress/basic_tests.cpp b/src/boost/libs/regex/test/regress/basic_tests.cpp
new file mode 100644
index 000000000..25f00c24c
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/basic_tests.cpp
@@ -0,0 +1,212 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE basic_tests.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: main regex test declarations.
+ */
+
+#include <boost/detail/workaround.hpp>
+
+#if BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+// we get unresolved externals from basic_string
+// unless we do this, a well known Borland bug:
+#define _RWSTD_COMPILE_INSTANTIATE
+#endif
+
+#include "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void basic_tests()
+{
+ using namespace boost::regex_constants;
+ TEST_REGEX_SEARCH("a", basic, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a", basic, "bba", match_default, make_array(2, 3, -2, -2));
+ TEST_REGEX_SEARCH("Z", perl, "aaa", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("Z", perl, "xxxxZZxxx", match_default, make_array(4, 5, -2, 5, 6, -2, -2));
+ // and some simple brackets:
+ TEST_REGEX_SEARCH("(a)", perl, "zzzaazz", match_default, make_array(3, 4, 3, 4, -2, 4, 5, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("()", perl, "zzz", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, 3, 3, 3, 3, -2, -2));
+ TEST_REGEX_SEARCH("()", perl, "", match_default, make_array(0, 0, 0, 0, -2, -2));
+ TEST_INVALID_REGEX("(", perl);
+ TEST_INVALID_REGEX("", perl|no_empty_expressions);
+ TEST_REGEX_SEARCH("", perl, "abc", match_default, make_array(0, 0, -2, 1, 1, -2, 2, 2, -2, 3, 3, -2, -2));
+ TEST_INVALID_REGEX(")", perl);
+ TEST_INVALID_REGEX("(aa", perl);
+ TEST_INVALID_REGEX("aa)", perl);
+ TEST_REGEX_SEARCH("a", perl, "b", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\(\\)", perl, "()", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\)", perl, "(a)", match_default, make_array(0, 3, -2, -2));
+ TEST_INVALID_REGEX("\\()", perl);
+ TEST_INVALID_REGEX("(\\)", perl);
+ TEST_REGEX_SEARCH("p(a)rameter", perl, "ABCparameterXYZ", match_default, make_array(3, 12, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("[pq](a)rameter", perl, "ABCparameterXYZ", match_default, make_array(3, 12, 4, 5, -2, -2));
+
+ // now try escaped brackets:
+ TEST_REGEX_SEARCH("\\(a\\)", basic, "zzzaazz", match_default, make_array(3, 4, 3, 4, -2, 4, 5, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\(\\)", basic, "zzz", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, 3, 3, 3, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\(\\)", basic, "", match_default, make_array(0, 0, 0, 0, -2, -2));
+ TEST_INVALID_REGEX("\\(", basic);
+ TEST_INVALID_REGEX("\\)", basic);
+ TEST_INVALID_REGEX("\\", basic);
+ TEST_INVALID_REGEX("\\(aa", basic);
+ TEST_INVALID_REGEX("aa\\)", basic);
+ TEST_REGEX_SEARCH("()", basic, "()", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(a)", basic, "(a)", match_default, make_array(0, 3, -2, -2));
+ TEST_INVALID_REGEX("\\()", basic);
+ TEST_INVALID_REGEX("(\\)", basic);
+ TEST_REGEX_SEARCH("p\\(a\\)rameter", basic, "ABCparameterXYZ", match_default, make_array(3, 12, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("[pq]\\(a\\)rameter", basic, "ABCparameterXYZ", match_default, make_array(3, 12, 4, 5, -2, -2));
+
+ // now move on to "." wildcards
+ TEST_REGEX_SEARCH(".", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\n", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\r", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", perl, "a", match_not_dot_newline, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\n", match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\r", match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\0", match_not_dot_newline, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\n", match_not_dot_null | match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\r", match_not_dot_null | match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\0", match_not_dot_null | match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", basic, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", basic, "\n", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", basic, "\r", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", basic, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", basic, "a", match_not_dot_newline, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", basic, "\n", match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", basic, "\r", match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", basic, "\0", match_not_dot_newline, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", basic, "\n", match_not_dot_null | match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", basic, "\r", match_not_dot_null | match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", basic, "\0", match_not_dot_null | match_not_dot_newline, make_array(-2, -2));
+}
+
+void test_non_marking_paren()
+{
+ using namespace boost::regex_constants;
+ //
+ // non-marking parenthesis added 25/04/00
+ //
+ TEST_REGEX_SEARCH("(?:abc)+", perl, "xxabcabcxx", match_default, make_array(2, 8, -2, -2));
+ TEST_REGEX_SEARCH("(?:a+)(b+)", perl, "xaaabbbx", match_default, make_array(1, 7, 4, 7, -2, -2));
+ TEST_REGEX_SEARCH("(a+)(?:b+)", perl, "xaaabbba", match_default, make_array(1, 7, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?:(a+)b+)", perl, "xaaabbba", match_default, make_array(1, 7, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?:a+(b+))", perl, "xaaabbba", match_default, make_array(1, 7, 4, 7, -2, -2));
+ TEST_REGEX_SEARCH("a+(?#b+)b+", perl, "xaaabbba", match_default, make_array(1, 7, -2, -2));
+ TEST_REGEX_SEARCH("(a)(?:b|$)", perl, "ab", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a)(?:b|$)", perl, "a", match_default, make_array(0, 1, 0, 1, -2, -2));
+}
+
+void test_partial_match()
+{
+ using namespace boost::regex_constants;
+ //
+ // try some partial matches:
+ //
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", perl, "xyzaaab", match_default|match_partial, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", perl, "xyz", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", perl, "xy", match_default|match_partial, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", perl, "x", match_default|match_partial, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", perl, "", match_default|match_partial, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", perl, "aaaa", match_default|match_partial, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".abc", perl, "aaab", match_default|match_partial, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("a[_]", perl, "xxa", match_default|match_partial, make_array(2, 3, -2, -2));
+ TEST_REGEX_SEARCH(".{4,}", perl, "xxa", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH(".{4,}", perl, "xxa", match_default|match_partial|match_not_dot_null, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("[\\x0-\\xff]{4,}", perl, "xxa", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a{4,}", perl, "aaa", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\w{4,}", perl, "aaa", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH(".*?<tag>", perl, "aaa", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a*?<tag>", perl, "aaa", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\w*?<tag>", perl, "aaa", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(\\w)*?<tag>", perl, "aaa", match_default|match_partial, make_array(0, 3, -2, -2));
+
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", boost::regex::extended, "xyzaaab", match_default|match_partial, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", boost::regex::extended, "xyz", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", boost::regex::extended, "xy", match_default|match_partial, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", boost::regex::extended, "x", match_default|match_partial, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", boost::regex::extended, "", match_default|match_partial, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(xyz)(.*)abc", boost::regex::extended, "aaaa", match_default|match_partial, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".abc", boost::regex::extended, "aaab", match_default|match_partial, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("a[_]", boost::regex::extended, "xxa", match_default|match_partial, make_array(2, 3, -2, -2));
+ TEST_REGEX_SEARCH(".{4,}", boost::regex::extended, "xxa", match_default|match_partial, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH(".{4,}", boost::regex::extended, "xxa", match_default|match_partial|match_not_dot_null, make_array(0, 3, -2, -2));
+}
+
+void test_nosubs()
+{
+ using namespace boost::regex_constants;
+ // subtleties of matching with no sub-expressions marked
+ TEST_REGEX_SEARCH("a(b?c)+d", perl, "accd", match_default|match_nosubs, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(wee|week)(knights|night)", perl, "weeknights", match_default|match_nosubs, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH(".*", perl, "abc", match_default|match_nosubs, make_array(0, 3, -2, 3, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", perl, "abd", match_default|match_nosubs, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", perl, "acd", match_default|match_nosubs, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl, "abbd", match_default|match_nosubs, make_array(0, 4, -2, -2));
+
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl, "acd", match_default|match_nosubs, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl, "ad", match_default|match_nosubs, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b?)c", perl, "abc", match_default|match_nosubs, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b?)c", perl, "ac", match_default|match_nosubs, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b+)c", perl, "abc", match_default|match_nosubs, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b+)c", perl, "abbbc", match_default|match_nosubs, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a(b*)c", perl, "ac", match_default|match_nosubs, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(a|ab)(bc([de]+)f|cde)", perl, "abcdef", match_default|match_nosubs, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]?)c", perl, "abc", match_default|match_nosubs, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]?)c", perl, "ac", match_default|match_nosubs, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("a([bc]+)c", perl, "abc", match_default|match_nosubs, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)c", perl, "abcc", match_default|match_nosubs, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)bc", perl, "abcbc", match_default|match_nosubs, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a(bb+|b)b", perl, "abb", match_default|match_nosubs, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)b", perl, "abb", match_default|match_nosubs, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)b", perl, "abbb", match_default|match_nosubs, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)bb", perl, "abbb", match_default|match_nosubs, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(.*).*", perl, "abcdef", match_default|match_nosubs, make_array(0, 6, -2, 6, 6, -2, -2));
+ TEST_REGEX_SEARCH("(a*)*", perl, "bc", match_default|match_nosubs, make_array(0, 0, -2, 1, 1, -2, 2, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("a(b?c)+d", perl|nosubs, "accd", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(wee|week)(knights|night)", perl|nosubs, "weeknights", match_default, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH(".*", perl|nosubs, "abc", match_default, make_array(0, 3, -2, 3, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", perl|nosubs, "abd", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", perl|nosubs, "acd", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl|nosubs, "abbd", match_default, make_array(0, 4, -2, -2));
+
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl|nosubs, "acd", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl|nosubs, "ad", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b?)c", perl|nosubs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b?)c", perl|nosubs, "ac", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b+)c", perl|nosubs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b+)c", perl|nosubs, "abbbc", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a(b*)c", perl|nosubs, "ac", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(a|ab)(bc([de]+)f|cde)", perl|nosubs, "abcdef", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]?)c", perl|nosubs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]?)c", perl|nosubs, "ac", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("a([bc]+)c", perl|nosubs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)c", perl|nosubs, "abcc", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)bc", perl|nosubs, "abcbc", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a(bb+|b)b", perl|nosubs, "abb", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)b", perl|nosubs, "abb", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)b", perl|nosubs, "abbb", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)bb", perl|nosubs, "abbb", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(.*).*", perl|nosubs, "abcdef", match_default, make_array(0, 6, -2, 6, 6, -2, -2));
+ TEST_REGEX_SEARCH("(a*)*", perl|nosubs, "bc", match_default, make_array(0, 0, -2, 1, 1, -2, 2, 2, -2, -2));
+}
+
+
diff --git a/src/boost/libs/regex/test/regress/bcb6.mak b/src/boost/libs/regex/test/regress/bcb6.mak
new file mode 100644
index 000000000..319ef60be
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/bcb6.mak
@@ -0,0 +1,215 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for regress
+#
+# Borland C++ tools
+#
+# BCROOT defines the root directory of your bcb install
+#
+!ifndef BCROOT
+BCROOT=$(MAKEDIR)\..
+!endif
+#
+# sources to compile for each test:
+#
+SOURCES=*.cpp
+
+BCC32 = $(BCROOT)\bin\Bcc32.exe
+TLINK32 = $(BCROOT)\bin\ILink32.exe
+
+IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
+LINKOPTS= -ap -Tpe -x
+CFLAGS= -tWC -DSTRICT; -Vx -Ve -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\..\..\stage\lib -L$(BCROOT)\lib\obj -L$(BCROOT)\lib\release -L..\..\build\bcb $(CXXFLAGS)
+
+BPI= vcl.bpi rtl.bpi vclx.bpi vcle.lib
+
+BPL= vcl.lib rtl.lib vcle.lib
+
+
+all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1v.exe r2v.exe r3v.exe r4v.exe r5v.exe r6v.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe r1lv.exe r2lv.exe r3lv.exe r4lv.exe r5lv.exe r6lv.exe
+ -copy ..\..\build\bcb6\*.dll
+ -copy ..\..\..\..\stage\lib\*bcb*.dll
+ echo testing static single threaded version....
+ r1 tests.txt test1252.txt
+ r2 tests.txt
+ r3 tests.txt
+ r4 tests.txt test1252.txt
+ r5 tests.txt
+ r6 tests.txt
+ echo testing static multi-threaded version....
+ r1m tests.txt test1252.txt
+ r2m tests.txt
+ r3m tests.txt
+ r4m tests.txt test1252.txt
+ r5m tests.txt
+ r6m tests.txt
+ echo testing static VCL version....
+ r1v tests.txt test1252.txt
+ r2v tests.txt
+ r3v tests.txt
+ r4v tests.txt test1252.txt
+ r5v tests.txt
+ r6v tests.txt
+ echo testing dll single threaded version....
+ r1l tests.txt test1252.txt
+ r2l tests.txt
+ r3l tests.txt
+ r4l tests.txt test1252.txt
+ r5l tests.txt
+ r6l tests.txt
+ echo testing dll multi-threaded version....
+ r1lm tests.txt test1252.txt
+ r2lm tests.txt
+ r3lm tests.txt
+ r4lm tests.txt test1252.txt
+ r5lm tests.txt
+ r6lm tests.txt
+ echo testing dll VCL version....
+ r1lv tests.txt test1252.txt
+ r2lv tests.txt
+ r3lv tests.txt
+ r4lv tests.txt test1252.txt
+ r5lv tests.txt
+ r6lv tests.txt
+
+
+r1.exe : $(SOURCES)
+ $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er1.exe -DBOOST_RE_TEST_LOCALE_W32 $(SOURCES)
+
+r2.exe : $(SOURCES)
+ $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er2.exe -DBOOST_RE_TEST_LOCALE_C $(SOURCES)
+
+r3.exe : $(SOURCES)
+ $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er3.exe -DBOOST_RE_TEST_LOCALE_CPP $(SOURCES)
+
+r4.exe : $(SOURCES)
+ $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er4.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE $(SOURCES)
+
+r5.exe : $(SOURCES)
+ $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er5.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE $(SOURCES)
+
+r6.exe : $(SOURCES)
+ $(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er6.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE $(SOURCES)
+
+
+r1m.exe : $(SOURCES)
+ $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe -DBOOST_RE_TEST_LOCALE_W32 $(SOURCES)
+
+r2m.exe : $(SOURCES)
+ $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe -DBOOST_RE_TEST_LOCALE_C $(SOURCES)
+
+r3m.exe : $(SOURCES)
+ $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe -DBOOST_RE_TEST_LOCALE_CPP $(SOURCES)
+
+r4m.exe : $(SOURCES)
+ $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE $(SOURCES)
+
+r5m.exe : $(SOURCES)
+ $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE $(SOURCES)
+
+r6m.exe : $(SOURCES)
+ $(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE $(SOURCES)
+
+
+r1v.exe : $(SOURCES)
+ $(BCC32) -tWM -tWV $(CFLAGS) -er1v.exe -DBOOST_RE_TEST_LOCALE_W32 $(SOURCES) $(BPL)
+
+r2v.exe : $(SOURCES)
+ $(BCC32) -tWM -tWV $(CFLAGS) -er2v.exe -DBOOST_RE_TEST_LOCALE_C $(SOURCES) $(BPL)
+
+r3v.exe : $(SOURCES)
+ $(BCC32) -tWM -tWV $(CFLAGS) -er3v.exe -DBOOST_RE_TEST_LOCALE_CPP $(SOURCES) $(BPL)
+
+r4v.exe : $(SOURCES)
+ $(BCC32) -tWM -tWV $(CFLAGS) -er4v.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE $(SOURCES) $(BPL)
+
+r5v.exe : $(SOURCES)
+ $(BCC32) -tWM -tWV $(CFLAGS) -er5v.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE $(SOURCES) $(BPL)
+
+r6v.exe : $(SOURCES)
+ $(BCC32) -tWM -tWV $(CFLAGS) -er6v.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE $(SOURCES) $(BPL)
+
+
+r1l.exe : $(SOURCES)
+ $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_W32 $(SOURCES)
+
+r2l.exe : $(SOURCES)
+ $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_C $(SOURCES)
+
+r3l.exe : $(SOURCES)
+ $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_CPP $(SOURCES)
+
+r4l.exe : $(SOURCES)
+ $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE $(SOURCES)
+
+r5l.exe : $(SOURCES)
+ $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE $(SOURCES)
+
+r6l.exe : $(SOURCES)
+ $(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE $(SOURCES)
+
+
+r1lm.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_W32 $(SOURCES)
+
+r2lm.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_C $(SOURCES)
+
+r3lm.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_CPP $(SOURCES)
+
+r4lm.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE $(SOURCES)
+
+r5lm.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE $(SOURCES)
+
+r6lm.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE $(SOURCES)
+
+
+r1lv.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er1lv.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_W32 $(SOURCES) $(BPI)
+
+r2lv.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er2lv.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_C $(SOURCES) $(BPI)
+
+r3lv.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er3lv.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_CPP $(SOURCES) $(BPI)
+
+r4lv.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er4lv.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE $(SOURCES) $(BPI)
+
+r5lv.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er5lv.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE $(SOURCES) $(BPI)
+
+r6lv.exe : $(SOURCES)
+ $(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er6lv.exe -DBOOST_REGEX_DYN_LINK -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE $(SOURCES) $(BPI)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/test/regress/gcc.mak b/src/boost/libs/regex/test/regress/gcc.mak
new file mode 100644
index 000000000..83b2ea3b9
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/gcc.mak
@@ -0,0 +1,74 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for regression tests
+#
+# g++ 2.95 and greater
+#
+CXX= g++ $(INCLUDES) -L../../../../stage/lib -I../../../../ -I./ $(CXXFLAGS) -L../../build/gcc $(LDFLAGS)
+#
+# sources to compile for each test:
+#
+SOURCES=*.cpp
+
+total : gcc_regress
+ export LD_LIBRARY_PATH="../../build/gcc:$LD_LIBRARY_PATH" && ./gcc_regress tests.txt
+
+gcc_regress : $(SOURCES)
+ $(CXX) -O2 -o gcc_regress $(SOURCES) ../../build/gcc/libboost_regex-gcc*.a $(LIBS)
+
+debug : $(SOURCES)
+ $(CXX) -g -o gcc_regress $(SOURCES) ../../build/gcc/libboost_regex-gcc-d*.a $(LIBS)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/test/regress/info.hpp b/src/boost/libs/regex/test/regress/info.hpp
new file mode 100644
index 000000000..5c08961e2
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/info.hpp
@@ -0,0 +1,268 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE info.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Error handling for test cases.
+ */
+
+#ifndef BOOST_REGEX_REGRESS_INFO_HPP
+#define BOOST_REGEX_REGRESS_INFO_HPP
+#include <iostream>
+#include <string>
+#include <boost/regex.hpp>
+
+#ifdef TEST_THREADS
+#include <boost/thread/once.hpp>
+#include <boost/thread.hpp>
+#endif
+
+#ifdef GENERATE_CORPUS
+#include <boost/lexical_cast.hpp>
+#include <fstream>
+//
+// class de_fuzz_output
+// Generates de-fuzzing corpus files
+//
+template <class charT>
+class de_fuzz_output
+{
+public:
+ de_fuzz_output() {}
+ template <class U>
+ void add(const U&, const U&) {}
+};
+template<>
+class de_fuzz_output<char>
+{
+ std::set<std::pair<std::string, std::string> > data;
+public:
+ de_fuzz_output() {}
+ void add(const std::string& re, const std::string& text)
+ {
+ data.insert(std::make_pair(re, text));
+ }
+ ~de_fuzz_output()
+ {
+ unsigned j = 0;
+ for(typename std::set<std::pair<std::string, std::string> >::const_iterator i = data.begin(); i != data.end(); ++i)
+ {
+ std::string filename = "corpus_" + boost::lexical_cast<std::string>(j);
+ std::fstream ofs(filename.c_str(), std::ios_base::out | std::ios_base::binary);
+ ofs.put(static_cast<char>(i->first.size() >> 8));
+ ofs.put(static_cast<char>(i->first.size() & 0xff));
+ ofs.write(i->first.c_str(), i->first.size());
+ ofs.write(i->second.c_str(), i->second.size());
+ ++j;
+ }
+ }
+};
+#endif
+//
+// class test info,
+// store information about the test we are about to conduct:
+//
+template <class charT>
+class test_info_base
+{
+public:
+ typedef std::basic_string<charT> string_type;
+private:
+ struct data_type
+ {
+ std::string file;
+ int line;
+ string_type expression;
+ boost::regex_constants::syntax_option_type options;
+ string_type search_text;
+ boost::regex_constants::match_flag_type match_options;
+ const int* answer_table;
+ string_type format_string;
+ string_type result_string;
+ bool need_to_print;
+ std::string expression_type_name;
+ };
+#ifdef TEST_THREADS
+ static data_type& do_get_data()
+ {
+ static boost::thread_specific_ptr<data_type> pd;
+ if(pd.get() == 0)
+ pd.reset(new data_type());
+ return *(pd.get());
+ }
+ static void init_data()
+ {
+ do_get_data();
+ }
+#endif
+ static data_type& data()
+ {
+#ifdef TEST_THREADS
+ static boost::once_flag f = BOOST_ONCE_INIT;
+ boost::call_once(f,&init_data);
+ return do_get_data();
+#else
+ static data_type d;
+ return d;
+#endif
+ }
+public:
+ test_info_base(){};
+ static void set_info(
+ const char* file,
+ int line,
+ const string_type& ex,
+ boost::regex_constants::syntax_option_type opt,
+ const string_type& search_text = string_type(),
+ boost::regex_constants::match_flag_type match_options = boost::match_default,
+ const int* answer_table = 0,
+ const string_type& format_string = string_type(),
+ const string_type& result_string = string_type())
+ {
+ data_type& dat = data();
+ dat.file = file;
+ dat.line = line;
+ dat.expression = ex;
+ dat.options = opt;
+ dat.search_text = search_text;
+ dat.match_options = match_options;
+ dat.answer_table = answer_table;
+ dat.format_string = format_string;
+ dat.result_string = result_string;
+ dat.need_to_print = true;
+#ifdef GENERATE_CORPUS
+ static de_fuzz_output<charT> corpus;
+ corpus.add(ex, search_text);
+#endif
+ }
+ static void set_typename(const std::string& n)
+ {
+ data().expression_type_name = n;
+ }
+
+ static const string_type& expression()
+ {
+ return data().expression;
+ }
+ static boost::regex_constants::syntax_option_type syntax_options()
+ {
+ return data().options;
+ }
+ static const string_type& search_text()
+ {
+ return data().search_text;
+ }
+ static boost::regex_constants::match_flag_type match_options()
+ {
+ return data().match_options;
+ }
+ static const int* answer_table()
+ {
+ return data().answer_table;
+ }
+ static const string_type& format_string()
+ {
+ return data().format_string;
+ }
+ static const string_type& result_string()
+ {
+ return data().result_string;
+ }
+ static bool need_to_print()
+ {
+ return data().need_to_print;
+ }
+ static const std::string& file()
+ {
+ return data().file;
+ }
+ static int line()
+ {
+ return data().line;
+ }
+ static void clear()
+ {
+ data().need_to_print = false;
+ }
+ static std::string& expression_typename()
+ {
+ return data().expression_type_name;
+ }
+};
+
+template <class T>
+struct test_info
+ : public test_info_base<wchar_t>
+{};
+
+template<>
+struct test_info<char>
+ : public test_info_base<char>
+{};
+
+#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
+
+// Some template instantiation modes (namely local, implicit local, and weak) of
+// this compiler need an explicit instantiation because otherwise we end up with
+// multiple copies of the static variable defined in this method. This explicit
+// instantiation generates the static variable with common linkage, which makes
+// the linker choose only one of the available definitions. For more details,
+// see "man ld".
+
+template test_info_base<wchar_t>::data_type & test_info_base<wchar_t>::data();
+template test_info_base<char>::data_type & test_info_base<char>::data();
+
+#endif
+
+template <class charT>
+std::ostream& operator<<(std::ostream& os, const test_info<charT>&)
+{
+ if(test_info<charT>::need_to_print())
+ {
+ os << test_info<charT>::file() << ":" << test_info<charT>::line() << ": Error in test here:" << std::endl;
+ test_info<charT>::clear();
+ }
+ return os;
+}
+//
+// define some test macros:
+//
+extern int error_count;
+
+#define BOOST_REGEX_TEST_ERROR(msg, charT)\
+ ++error_count;\
+ std::cerr << test_info<charT>();\
+ std::cerr << " " << __FILE__ << ":" << __LINE__ << ":" << msg \
+ << " (While testing " << test_info<charT>::expression_typename() << ")" << std::endl
+
+class errors_as_warnings
+{
+public:
+ errors_as_warnings()
+ {
+ m_saved_error_count = error_count;
+ }
+ ~errors_as_warnings()
+ {
+ if(m_saved_error_count != error_count)
+ {
+ std::cerr << "<note>The above " << (error_count - m_saved_error_count) << " errors are treated as warnings only.</note>" << std::endl;
+ error_count = m_saved_error_count;
+ }
+ }
+private:
+ int m_saved_error_count;
+};
+
+#endif
+
diff --git a/src/boost/libs/regex/test/regress/main.cpp b/src/boost/libs/regex/test/regress/main.cpp
new file mode 100644
index 000000000..e3e3dd7fe
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/main.cpp
@@ -0,0 +1,239 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE main.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: entry point for test program.
+ */
+
+#include "test.hpp"
+#include "test_locale.hpp"
+#include <stdarg.h>
+#include <iostream>
+#include <iomanip>
+
+#ifdef BOOST_HAS_ICU
+#include <unicode/uloc.h>
+#endif
+
+#ifdef TEST_THREADS
+#include <list>
+#include <boost/thread.hpp>
+#include <boost/thread/tss.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/array.hpp>
+
+int* get_array_data();
+
+#endif
+
+int error_count = 0;
+
+#ifndef TEST_THREADS
+#define RUN_TESTS(name) \
+ std::cout << "Running test case \"" #name "\".\n";\
+ name();
+#else
+#define RUN_TESTS(name) \
+ name();
+#endif
+
+
+void run_tests()
+{
+ RUN_TESTS(basic_tests);
+ RUN_TESTS(test_simple_repeats);
+ RUN_TESTS(test_alt);
+ RUN_TESTS(test_sets);
+ RUN_TESTS(test_sets2);
+ RUN_TESTS(test_anchors);
+ RUN_TESTS(test_backrefs);
+ RUN_TESTS(test_character_escapes);
+ RUN_TESTS(test_assertion_escapes);
+ RUN_TESTS(test_tricky_cases);
+ RUN_TESTS(test_grep);
+ RUN_TESTS(test_replace);
+ RUN_TESTS(test_non_greedy_repeats);
+ RUN_TESTS(test_non_marking_paren);
+ RUN_TESTS(test_partial_match);
+ RUN_TESTS(test_forward_lookahead_asserts);
+ RUN_TESTS(test_fast_repeats);
+ RUN_TESTS(test_fast_repeats2);
+ RUN_TESTS(test_independent_subs);
+ RUN_TESTS(test_nosubs);
+ RUN_TESTS(test_conditionals);
+ RUN_TESTS(test_options);
+ RUN_TESTS(test_options2);
+#ifndef TEST_THREADS
+ RUN_TESTS(test_en_locale);
+#endif
+ RUN_TESTS(test_emacs);
+ RUN_TESTS(test_operators);
+ RUN_TESTS(test_overloads);
+ RUN_TESTS(test_unicode);
+ RUN_TESTS(test_pocessive_repeats);
+ RUN_TESTS(test_mark_resets);
+ RUN_TESTS(test_recursion);
+ RUN_TESTS(test_verbs);
+}
+
+int cpp_main(int /*argc*/, char * /*argv*/[])
+{
+#ifdef BOOST_HAS_ICU
+ //
+ // We need to set the default locale used by ICU,
+ // otherwise some of our tests using equivalence classes fail.
+ //
+ UErrorCode err = U_ZERO_ERROR;
+ uloc_setDefault("en", &err);
+ if(err != U_ZERO_ERROR)
+ {
+ std::cerr << "Unable to set the default ICU locale to \"en\"." << std::endl;
+ return -1;
+ }
+#endif
+#ifdef TEST_THREADS
+ try{
+ get_array_data(); // initialises data.
+ }
+ catch(const std::exception& e)
+ {
+ std::cerr << "TSS Initialisation failed with message: " << e.what() << std::endl;
+ return -1;
+ }
+
+ std::list<boost::shared_ptr<boost::thread> > threads;
+ for(int i = 0; i < 5; ++i)
+ {
+ try{
+ threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&run_tests)));
+ }
+ catch(const std::exception& e)
+ {
+ std::cerr << "<note>Thread creation failed with message: " << e.what() << "</note>" << std::endl;
+ }
+ }
+ std::list<boost::shared_ptr<boost::thread> >::const_iterator a(threads.begin()), b(threads.end());
+ while(a != b)
+ {
+ (*a)->join();
+ ++a;
+ }
+#else
+ run_tests();
+#endif
+ return error_count;
+}
+
+#ifdef TEST_THREADS
+
+int* get_array_data()
+{
+ static boost::thread_specific_ptr<boost::array<int, 200> > tp;
+
+ if(tp.get() == 0)
+ tp.reset(new boost::array<int, 200>);
+
+ return tp.get()->data();
+}
+
+#endif
+
+const int* make_array(int first, ...)
+{
+ //
+ // this function takes a variable number of arguments
+ // and packs them into an array that we can pass through
+ // our testing macros (ideally we would use an array literal
+ // but these can't apparently be used as macro arguments).
+ //
+#ifdef TEST_THREADS
+ int* data = get_array_data();
+#else
+ static int data[200];
+#endif
+ std::fill_n(data, 200, -2);
+ va_list ap;
+ va_start(ap, first);
+ //
+ // keep packing args, until we get two successive -2 values:
+ //
+ int terminator_count;
+ int next_position = 1;
+ data[0] = first;
+ if(first == -2)
+ terminator_count = 1;
+ else
+ terminator_count = 0;
+ while(terminator_count < 2)
+ {
+ data[next_position] = va_arg(ap, int);
+ if(data[next_position] == -2)
+ ++terminator_count;
+ else
+ terminator_count = 0;
+ ++next_position;
+ }
+ va_end(ap);
+ return data;
+}
+
+void test(const char& c, const test_regex_replace_tag& tag)
+{
+ do_test(c, tag);
+}
+void test(const char& c, const test_regex_search_tag& tag)
+{
+ do_test(c, tag);
+}
+void test(const char& c, const test_invalid_regex_tag& tag)
+{
+ do_test(c, tag);
+}
+
+#ifndef BOOST_NO_WREGEX
+void test(const wchar_t& c, const test_regex_replace_tag& tag)
+{
+ do_test(c, tag);
+}
+void test(const wchar_t& c, const test_regex_search_tag& tag)
+{
+ do_test(c, tag);
+}
+void test(const wchar_t& c, const test_invalid_regex_tag& tag)
+{
+ do_test(c, tag);
+}
+#endif
+
+#ifdef BOOST_NO_EXCEPTIONS
+namespace boost{
+
+void throw_exception( std::exception const & e )
+{
+ std::cerr << e.what() << std::endl;
+ std::exit(1);
+}
+
+}
+
+int main(int argc, char * argv[])
+{
+ return cpp_main(argc, argv);
+}
+
+#else
+
+#include <boost/detail/lightweight_main.hpp>
+
+#endif
diff --git a/src/boost/libs/regex/test/regress/sunpro.mak b/src/boost/libs/regex/test/regress/sunpro.mak
new file mode 100644
index 000000000..828a64817
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/sunpro.mak
@@ -0,0 +1,145 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for regression tests
+# tests every library combination, static/dynamic/multimthread/singlethread/narrow/wide
+#
+# Sun Workshop 6 and greater:
+#
+CXX= CC $(INCLUDES) -I../../../../ -I./ $(CXXFLAGS) -L../../../../stage/lib -L../../build/sunpro $(LDFLAGS)
+#
+# sources to compile for each test:
+#
+SOURCES=*.cpp
+
+total : r rm r/regress rm/regress rs rms rs/regress rms/regress rw rmw rw/regress rmw/regress rsw rmsw rsw/regress rmsw/regress
+ echo testsing narrow character versions:
+ ./r/regress tests.txt
+ ./rm/regress tests.txt
+ ./rs/regress tests.txt
+ ./rms/regress tests.txt
+ echo testsing wide character versions;
+ ./rw/regress tests.txt
+ ./rmw/regress tests.txt
+ ./rsw/regress tests.txt
+ ./rmsw/regress tests.txt
+
+#
+# delete the cache before each build.
+# NB this precludes multithread builds:
+#
+r/regress : $(SOURCES)
+ rm -f *.o
+ rm -fr SunWS_cache
+ $(CXX) -O2 -o r/regress $(SOURCES) -lboost_regex$(LIBSUFFIX) $(LIBS)
+
+rm/regress : $(SOURCES)
+ rm -f *.o
+ rm -fr SunWS_cache
+ $(CXX) -O2 -mt -o rm/regress $(SOURCES) -lboost_regex_mt$(LIBSUFFIX) $(LIBS)
+
+rs/regress : $(SOURCES)
+ rm -f *.o
+ rm -fr SunWS_cache
+ $(CXX) -O2 -o rs/regress $(SOURCES) -Bstatic -lboost_regex$(LIBSUFFIX) -Bdynamic $(LIBS)
+
+rms/regress : $(SOURCES)
+ rm -f *.o
+ rm -fr SunWS_cache
+ $(CXX) -O2 -mt -o rms/regress $(SOURCES) -Bstatic -lboost_regex_mt$(LIBSUFFIX) -Bdynamic $(LIBS)
+
+rw/regress : $(SOURCES)
+ rm -f *.o
+ rm -fr SunWS_cache
+ $(CXX) -O2 -DTEST_UNICODE -o rw/regress $(SOURCES) -lboost_regex$(LIBSUFFIX) $(LIBS)
+
+rmw/regress : $(SOURCES)
+ rm -f *.o
+ rm -fr SunWS_cache
+ $(CXX) -O2 -mt -DTEST_UNICODE -o rmw/regress $(SOURCES) -lboost_regex_mt$(LIBSUFFIX) $(LIBS)
+
+rsw/regress : $(SOURCES)
+ rm -f *.o
+ rm -fr SunWS_cache
+ $(CXX) -O2 -DTEST_UNICODE -o rsw/regress $(SOURCES) -Bstatic -lboost_regex$(LIBSUFFIX) -Bdynamic $(LIBS)
+
+rmsw/regress : $(SOURCES)
+ rm -f *.o
+ rm -fr SunWS_cache
+ $(CXX) -O2 -mt -DTEST_UNICODE -o rmsw/regress $(SOURCES) -Bstatic -lboost_regex_mt$(LIBSUFFIX) -Bdynamic $(LIBS)
+
+r:
+ mkdir -p r
+
+rm:
+ mkdir -p rm
+
+rs:
+ mkdir -p rs
+
+rms:
+ mkdir -p rms
+
+rw:
+ mkdir -p rw
+
+rmw:
+ mkdir -p rmw
+
+rsw:
+ mkdir -p rsw
+
+rmsw:
+ mkdir -p rmsw
+
+clean:
+ rm -f *.o
+ rm -fr SunWS_cache
+ rm -fr r rm rs rms rw rmw rsw rmsw
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/boost/libs/regex/test/regress/test.hpp b/src/boost/libs/regex/test/regress/test.hpp
new file mode 100644
index 000000000..d9224e8eb
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test.hpp
@@ -0,0 +1,293 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Macros for test cases.
+ */
+
+
+#ifndef BOOST_REGEX_REGRESS_TEST_HPP
+#define BOOST_REGEX_REGRESS_TEST_HPP
+
+#include <boost/regex.hpp>
+
+#ifdef BOOST_INTEL
+// disable Intel's "remarks":
+#pragma warning(disable:1418 981 383 1419 7)
+#endif
+
+#include <typeinfo>
+#include "test_not_regex.hpp"
+#include "test_regex_search.hpp"
+#include "test_regex_replace.hpp"
+#include "test_deprecated.hpp"
+#include "test_mfc.hpp"
+#include "test_icu.hpp"
+#include "test_locale.hpp"
+
+#ifdef TEST_THREADS
+#include <boost/thread/once.hpp>
+#endif
+
+//
+// define test entry proc, this forwards on to the appropriate
+// real test:
+//
+template <class charT, class tagT>
+void do_test(const charT& c, const tagT& tag);
+
+template <class charT, class tagT>
+void test(const charT& c, const tagT& tag)
+{
+ do_test(c, tag);
+}
+//
+// make these non-templates to speed up compilation times:
+//
+void test(const char&, const test_regex_replace_tag&);
+void test(const char&, const test_regex_search_tag&);
+void test(const char&, const test_invalid_regex_tag&);
+
+#ifndef BOOST_NO_WREGEX
+void test(const wchar_t&, const test_regex_replace_tag&);
+void test(const wchar_t&, const test_regex_search_tag&);
+void test(const wchar_t&, const test_invalid_regex_tag&);
+#endif
+
+template <class Regex>
+struct call_once_func
+{
+ Regex* pregex;
+ void operator()()const
+ {
+ return test_empty(*pregex);
+ }
+};
+
+template <class charT, class tagT>
+void do_test(const charT& c, const tagT& tag)
+{
+#ifndef BOOST_NO_STD_LOCALE
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) && defined(TEST_THREADS)
+ // typeid appears to fail in multithreaded environments:
+ test_info<charT>::set_typename("");
+#else
+ test_info<charT>::set_typename(typeid(boost::basic_regex<charT, boost::cpp_regex_traits<charT> >).name());
+#endif
+ boost::basic_regex<charT, boost::cpp_regex_traits<charT> > e1;
+#ifndef TEST_THREADS
+ static bool done_empty_test = false;
+ if(done_empty_test == false)
+ {
+ test_empty(e1);
+ done_empty_test = true;
+ }
+#else
+ boost::once_flag f = BOOST_ONCE_INIT;
+ call_once_func<boost::basic_regex<charT, boost::cpp_regex_traits<charT> > > proc = { &e1 };
+ boost::call_once(f, proc);
+#endif
+ if(test_locale::cpp_locale_state() == test_locale::test_with_locale)
+ e1.imbue(test_locale::cpp_locale());
+ if(test_locale::cpp_locale_state() != test_locale::no_test)
+ test(e1, tag);
+#endif
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) && defined(TEST_THREADS)
+ // typeid appears to fail in multithreaded environments:
+ test_info<charT>::set_typename("");
+#else
+ test_info<charT>::set_typename(typeid(boost::basic_regex<charT, boost::c_regex_traits<charT> >).name());
+#endif
+ boost::basic_regex<charT, boost::c_regex_traits<charT> > e2;
+ if(test_locale::c_locale_state() != test_locale::no_test)
+ test(e2, tag);
+#endif
+#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) && defined(TEST_THREADS)
+ // typeid appears to fail in multithreaded environments:
+ test_info<charT>::set_typename("");
+#else
+ test_info<charT>::set_typename(typeid(boost::basic_regex<charT, boost::w32_regex_traits<charT> >).name());
+#endif
+ boost::basic_regex<charT, boost::w32_regex_traits<charT> > e3;
+ if(test_locale::win_locale_state() == test_locale::test_with_locale)
+ e3.imbue(test_locale::win_locale());
+ if(test_locale::win_locale_state() != test_locale::no_test)
+ test(e3, tag);
+#endif
+ // test old depecated code:
+ test_info<charT>::set_typename("Deprecated interfaces");
+ if((test_locale::win_locale_state() == test_locale::test_no_locale)
+ && (test_locale::c_locale_state() == test_locale::test_no_locale)
+ &&(test_locale::cpp_locale_state() == test_locale::test_no_locale))
+ test_deprecated(c, tag);
+ // test MFC/ATL wrappers:
+ test_info<charT>::set_typename("MFC/ATL interfaces");
+ if((test_locale::win_locale_state() == test_locale::test_no_locale)
+ && (test_locale::c_locale_state() == test_locale::test_no_locale)
+ &&(test_locale::cpp_locale_state() == test_locale::test_no_locale))
+ test_mfc(c, tag);
+ // test ICU code:
+ test_info<charT>::set_typename("ICU interfaces");
+ test_icu(c, tag);
+}
+
+//
+// define function to pack args into an array:
+//
+const int* make_array(int first, ...);
+
+
+//
+// define macros for testing invalid regexes:
+//
+#define TEST_INVALID_REGEX_N(s, f)\
+ do{\
+ const char e[] = { s };\
+ std::string se(e, sizeof(e) - 1);\
+ test_info<char>::set_info(__FILE__, __LINE__, se, f);\
+ test(char(0), test_invalid_regex_tag());\
+ }while(0)
+
+#ifndef BOOST_NO_WREGEX
+#define TEST_INVALID_REGEX_W(s, f)\
+ do{\
+ const wchar_t e[] = { s };\
+ std::wstring se(e, (sizeof(e) / sizeof(wchar_t)) - 1);\
+ test_info<wchar_t>::set_info(__FILE__, __LINE__, se, f);\
+ test(wchar_t(0), test_invalid_regex_tag());\
+ }while(0)
+#else
+#define TEST_INVALID_REGEX_W(s, f)
+#endif
+
+#define TEST_INVALID_REGEX(s, f)\
+ TEST_INVALID_REGEX_N(s, f);\
+ TEST_INVALID_REGEX_W(BOOST_JOIN(L, s), f)
+
+//
+// define macros for testing regex searches:
+//
+#define TEST_REGEX_SEARCH_N(s, f, t, m, a)\
+ do{\
+ const char e[] = { s };\
+ std::string se(e, sizeof(e) - 1);\
+ const char st[] = { t };\
+ std::string sst(st, sizeof(st) - 1);\
+ test_info<char>::set_info(__FILE__, __LINE__, se, f, sst, m, a);\
+ test(char(0), test_regex_search_tag());\
+ }while(0)
+
+#ifndef BOOST_NO_WREGEX
+#define TEST_REGEX_SEARCH_W(s, f, t, m, a)\
+ do{\
+ const wchar_t e[] = { s };\
+ std::wstring se(e, (sizeof(e) / sizeof(wchar_t)) - 1);\
+ const wchar_t st[] = { t };\
+ std::wstring sst(st, (sizeof(st) / sizeof(wchar_t)) - 1);\
+ test_info<wchar_t>::set_info(__FILE__, __LINE__, se, f, sst, m, a);\
+ test(wchar_t(0), test_regex_search_tag());\
+ }while(0)
+#else
+#define TEST_REGEX_SEARCH_W(s, f, t, m, a)
+#endif
+
+#define TEST_REGEX_SEARCH(s, f, t, m, a)\
+ TEST_REGEX_SEARCH_N(s, f, t, m, a);\
+ TEST_REGEX_SEARCH_W(BOOST_JOIN(L, s), f, BOOST_JOIN(L, t), m, a)
+
+#if (defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))
+#define TEST_REGEX_SEARCH_L(s, f, t, m, a) TEST_REGEX_SEARCH_W(BOOST_JOIN(L, s), f, BOOST_JOIN(L, t), m, a)
+#else
+#define TEST_REGEX_SEARCH_L(s, f, t, m, a) TEST_REGEX_SEARCH(s, f, t, m, a)
+#endif
+
+//
+// define macros for testing regex replaces:
+//
+#define TEST_REGEX_REPLACE_N(s, f, t, m, fs, r)\
+ do{\
+ const char e[] = { s };\
+ std::string se(e, sizeof(e) - 1);\
+ const char st[] = { t };\
+ std::string sst(st, sizeof(st) - 1);\
+ const char ft[] = { fs };\
+ std::string sft(ft, sizeof(ft) - 1);\
+ const char rt[] = { r };\
+ std::string srt(rt, sizeof(rt) - 1);\
+ test_info<char>::set_info(__FILE__, __LINE__, se, f, sst, m, 0, sft, srt);\
+ test(char(0), test_regex_replace_tag());\
+ }while(0)
+
+#ifndef BOOST_NO_WREGEX
+#define TEST_REGEX_REPLACE_W(s, f, t, m, fs, r)\
+ do{\
+ const wchar_t e[] = { s };\
+ std::wstring se(e, (sizeof(e) / sizeof(wchar_t)) - 1);\
+ const wchar_t st[] = { t };\
+ std::wstring sst(st, (sizeof(st) / sizeof(wchar_t)) - 1);\
+ const wchar_t ft[] = { fs };\
+ std::wstring sft(ft, (sizeof(ft) / sizeof(wchar_t)) - 1);\
+ const wchar_t rt[] = { r };\
+ std::wstring srt(rt, (sizeof(rt) / sizeof(wchar_t)) - 1);\
+ test_info<wchar_t>::set_info(__FILE__, __LINE__, se, f, sst, m, 0, sft, srt);\
+ test(wchar_t(0), test_regex_replace_tag());\
+ }while(0)
+#else
+#define TEST_REGEX_REPLACE_W(s, f, t, m, fs, r)
+#endif
+
+#define TEST_REGEX_REPLACE(s, f, t, m, fs, r)\
+ TEST_REGEX_REPLACE_N(s, f, t, m, fs, r);\
+ TEST_REGEX_REPLACE_W(BOOST_JOIN(L, s), f, BOOST_JOIN(L, t), m, BOOST_JOIN(L, fs), BOOST_JOIN(L, r))
+
+//
+// define the test group proceedures:
+//
+void basic_tests();
+void test_simple_repeats();
+void test_alt();
+void test_sets();
+void test_sets2();
+void test_anchors();
+void test_backrefs();
+void test_character_escapes();
+void test_assertion_escapes();
+void test_tricky_cases();
+void test_grep();
+void test_replace();
+void test_non_greedy_repeats();
+void test_non_marking_paren();
+void test_partial_match();
+void test_forward_lookahead_asserts();
+void test_fast_repeats();
+void test_fast_repeats2();
+void test_tricky_cases2();
+void test_independent_subs();
+void test_nosubs();
+void test_conditionals();
+void test_options();
+void test_options2();
+void test_en_locale();
+void test_emacs();
+void test_operators();
+void test_overloads();
+void test_unicode();
+void test_pocessive_repeats();
+void test_mark_resets();
+void test_recursion();
+void test_verbs();
+
+#endif
diff --git a/src/boost/libs/regex/test/regress/test_alt.cpp b/src/boost/libs/regex/test/regress/test_alt.cpp
new file mode 100644
index 000000000..7eb187fc0
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_alt.cpp
@@ -0,0 +1,55 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_alt()
+{
+ using namespace boost::regex_constants;
+ // now test the alternation operator |
+ TEST_REGEX_SEARCH("a|b", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a|b", perl, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a|b|c", perl, "c", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a|(b)|.", perl, "b", match_default, make_array(0, 1, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a)|b|.", perl, "a", match_default, make_array(0, 1, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c)", perl, "ab", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c)", perl, "ac", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c)", perl, "ad", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a|b|c)", perl, "c", match_default, make_array(0, 1, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a|(b)|.)", perl, "b", match_default, make_array(0, 1, 0, 1, 0, 1, -2, -2));
+ TEST_INVALID_REGEX("|c", perl|no_empty_expressions);
+ TEST_REGEX_SEARCH("|c", perl, " c", match_default, make_array(0, 0, -2, 1, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_INVALID_REGEX("c|", perl|no_empty_expressions);
+ TEST_REGEX_SEARCH("c|", perl, " c", match_default, make_array(0, 0, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_INVALID_REGEX("(|)", perl|no_empty_expressions);
+ TEST_REGEX_SEARCH("(|)", perl, " c", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, -2));
+ TEST_INVALID_REGEX("(a|)", perl|no_empty_expressions);
+ TEST_REGEX_SEARCH("(a|)", perl, " a", match_default, make_array(0, 0, 0, 0, -2, 1, 2, 1, 2, -2, 2, 2, 2, 2, -2, -2));
+ TEST_INVALID_REGEX("(|a)", perl|no_empty_expressions);
+ TEST_REGEX_SEARCH("(|a)", perl, " a", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 1, 2, 1, 2, -2, 2, 2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\|", perl, "a|", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("a|", basic, "a|", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\|", basic, "a|", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("|", basic, "|", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a|", basic|bk_vbar, "a|", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\|b", basic|bk_vbar, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\\|b", basic|bk_vbar, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\nb", grep, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\nb", grep, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\nb", egrep, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\nb", egrep, "a", match_default, make_array(0, 1, -2, -2));
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_anchors.cpp b/src/boost/libs/regex/test/regress/test_anchors.cpp
new file mode 100644
index 000000000..b2aabdfd7
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_anchors.cpp
@@ -0,0 +1,67 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_anchors()
+{
+ // line anchors:
+ using namespace boost::regex_constants;
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "xxabxx", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "xx\nabzz", match_default, make_array(3, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "abxx", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "ab\nzz", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "\n\n a", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("^ab", basic, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^ab", basic, "xxabxx", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^ab", basic, "xx\nabzz", match_default, make_array(3, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab$", basic, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab$", basic, "abxx", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab$", basic, "ab\nzz", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "ab", match_default | match_not_bol | match_not_eol, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "xxabxx", match_default | match_not_bol | match_not_eol, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "xx\nabzz", match_default | match_not_bol | match_not_eol, make_array(3, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "ab", match_default | match_not_bol | match_not_eol, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "abxx", match_default | match_not_bol | match_not_eol, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "ab\nzz", match_default | match_not_bol | match_not_eol, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "ab", match_default | match_single_line, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "xxabxx", match_default | match_single_line, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "xx\nabzz", match_default | match_single_line, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "ab", match_default | match_single_line, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "abxx", match_default | match_single_line, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "ab\nzz", match_default | match_single_line, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "ab", match_default | match_not_bol | match_not_eol | match_single_line, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "xxabxx", match_default | match_not_bol | match_not_eol | match_single_line, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^ab", boost::regex::extended, "xx\nabzz", match_default | match_not_bol | match_not_eol | match_single_line, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "ab", match_default | match_not_bol | match_not_eol | match_single_line, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "abxx", match_default | match_not_bol | match_not_eol | match_single_line, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab$", boost::regex::extended, "ab\nzz", match_default | match_not_bol | match_not_eol | match_single_line, make_array(-2, -2));
+ //
+ // changes to newline handling with 2.11:
+ //
+ TEST_REGEX_SEARCH("^.", boost::regex::extended, " \n \r\n ", match_default, make_array(0, 1, -2, 3, 4, -2, 7, 8, -2, -2));
+ TEST_REGEX_SEARCH(".$", boost::regex::extended, " \n \r\n ", match_default, make_array(1, 2, -2, 4, 5, -2, 8, 9, -2, -2));
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+ TEST_REGEX_SEARCH_W(L"^.", boost::regex::extended, L"\x2028 \x2028", match_default, make_array(0, 1, -2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH_W(L".$", boost::regex::extended, L" \x2028 \x2028", match_default, make_array(0, 1, -2, 2, 3, -2, 3, 4, -2, -2));
+#endif
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_asserts.cpp b/src/boost/libs/regex/test/regress/test_asserts.cpp
new file mode 100644
index 000000000..6ec2e4508
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_asserts.cpp
@@ -0,0 +1,72 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_forward_lookahead_asserts()
+{
+ //
+ // forward lookahead asserts added 21/01/02
+ //
+ using namespace boost::regex_constants;
+ TEST_REGEX_SEARCH("((?:(?!a|b)\\w)+)(\\w+)", perl, " xxxabaxxx ", match_default, make_array(2, 11, 2, 5, 5, 11, -2, -2));
+ TEST_REGEX_SEARCH("/\\*(?:(?!\\*/).)*\\*/", perl, " /**/ ", match_default, make_array(2, 6, -2, -2));
+ TEST_REGEX_SEARCH("/\\*(?:(?!\\*/).)*\\*/", perl, " /***/ ", match_default, make_array(2, 7, -2, -2));
+ TEST_REGEX_SEARCH("/\\*(?:(?!\\*/).)*\\*/", perl, " /********/ ", match_default, make_array(2, 12, -2, -2));
+ TEST_REGEX_SEARCH("/\\*(?:(?!\\*/).)*\\*/", perl, " /* comment */ ", match_default, make_array(2, 15, -2, -2));
+ TEST_REGEX_SEARCH("<\\s*a[^>]*>((?:(?!<\\s*/\\s*a\\s*>).)*)<\\s*/\\s*a\\s*>", perl, " <a href=\"here\">here</a> ", match_default, make_array(1, 24, 16, 20, -2, -2));
+ TEST_REGEX_SEARCH("<\\s*a[^>]*>((?:(?!<\\s*/\\s*a\\s*>).)*)<\\s*/\\s*a\\s*>", perl, " <a href=\"here\">here< / a > ", match_default, make_array(1, 28, 16, 20, -2, -2));
+ TEST_REGEX_SEARCH("<\\s*a[^>]*>((?:(?!<\\s*/\\s*a\\s*>).)*)(?=<\\s*/\\s*a\\s*>)", perl, " <a href=\"here\">here</a> ", match_default, make_array(1, 20, 16, 20, -2, -2));
+ TEST_REGEX_SEARCH("<\\s*a[^>]*>((?:(?!<\\s*/\\s*a\\s*>).)*)(?=<\\s*/\\s*a\\s*>)", perl, " <a href=\"here\">here< / a > ", match_default, make_array(1, 20, 16, 20, -2, -2));
+ TEST_REGEX_SEARCH("^(?!^(?:PRN|AUX|CLOCK\\$|NUL|CON|COM\\d|LPT\\d|\\..*)(?:\\..+)?$)[^\\x00-\\x1f\\\\?*:\"|/]+$", perl, "command.com", match_default, make_array(0, 11, -2, -2));
+ TEST_REGEX_SEARCH("^(?!^(?:PRN|AUX|CLOCK\\$|NUL|CON|COM\\d|LPT\\d|\\..*)(?:\\..+)?$)[^\\x00-\\x1f\\\\?*:\"|/]+$", perl, "PRN", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?!^(?:PRN|AUX|CLOCK\\$|NUL|CON|COM\\d|LPT\\d|\\..*)(?:\\..+)?$)[^\\x00-\\x1f\\\\?*:\"|/]+$", perl, "COM2", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?=.*\\d).{4,8}$", perl, "abc3", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("^(?=.*\\d).{4,8}$", perl, "abc3def4", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("^(?=.*\\d).{4,8}$", perl, "ab2", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?=.*\\d).{4,8}$", perl, "abcdefg", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$", perl, "abc3", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$", perl, "abC3", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$", perl, "ABCD3", match_default, make_array(-2, -2));
+
+ // bug report test cases:
+ TEST_REGEX_SEARCH("(?=.{1,10}$).*.", perl, "AAAAA", match_default, make_array(0, 5, -2, -2));
+
+ // lookbehind assertions, added 2004-04-30
+ TEST_REGEX_SEARCH("/\\*.*(?<=\\*)/", perl, "/**/", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("/\\*.*(?<=\\*)/", perl, "/*****/ ", match_default, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?<=['\"]).*?(?=['\"])", perl, " 'ac' ", match_default, make_array(2, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?<=['\"]).*?(?=['\"])", perl, " \"ac\" ", match_default, make_array(2, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?<=['\"]).*?(?<!\\\\)(?=['\"])", perl, " \"ac\" ", match_default, make_array(2, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?<=['\"]).*?(?<!\\\\)(?=['\"])", perl, " \"ac\\\" \" ", match_default, make_array(2, 7, -2, -2));
+ // lookbehind, with nested lookahead! :
+ TEST_REGEX_SEARCH("/\\*.*(?<=(?=[[:punct:]])\\*)/", perl, "/**/", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("/\\*.*(?<=(?![[:alnum:]])\\*)/", perl, "/**/", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("/\\*.*(?<=(?>\\*))/", perl, "/**/", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("/\\*.*(?<=(?:\\*))/", perl, "/**/", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("/\\*.*(?<=(\\*))/", perl, "/**/", match_default, make_array(0, 4, 2, 3, -2, -2));
+ // lookbehind with invalid content:
+ TEST_INVALID_REGEX("(/)\\*.*(?<=\\1)/", perl);
+ TEST_INVALID_REGEX("/\\*.*(?<=\\*+)/", perl);
+ TEST_INVALID_REGEX("/\\*.*(?<=\\X)/", perl);
+ TEST_INVALID_REGEX("/\\*.*(?<=[[.ae.]])/", perl);
+
+ TEST_INVALID_REGEX("(?<=[abc]", perl);
+ TEST_INVALID_REGEX("(?<=", perl);
+ TEST_INVALID_REGEX("(?<", perl);
+ TEST_INVALID_REGEX("(?<*", perl);
+ TEST_INVALID_REGEX("(?", perl);
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_backrefs.cpp b/src/boost/libs/regex/test/regress/test_backrefs.cpp
new file mode 100644
index 000000000..58f4dedb2
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_backrefs.cpp
@@ -0,0 +1,107 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_backrefs()
+{
+ using namespace boost::regex_constants;
+ TEST_INVALID_REGEX("a(b)\\2c", perl);
+ TEST_INVALID_REGEX("a(b\\1)c", perl);
+ TEST_REGEX_SEARCH("a(b*)c\\1d", perl, "abbcbbd", match_default, make_array(0, 7, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\1d", perl, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\1d", perl, "abbcbbbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(.)\\1", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a([bc])\\1d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
+ TEST_REGEX_SEARCH("a\\([bc]\\)\\1d", basic, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
+ // strictly speaking this is at best ambiguous, at worst wrong, this is what most
+ // re implimentations will match though.
+ TEST_REGEX_SEARCH("a(([bc])\\2)*d", perl, "abbccd", match_default, make_array(0, 6, 3, 5, 3, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(([bc])\\2)*d", perl, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a((b)*\\2)*d", perl, "abbbd", match_default, make_array(0, 5, 1, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("(ab*)[ab]*\\1", perl, "ababaaa", match_default, make_array(0, 4, 0, 2, -2, 4, 7, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("(a)\\1bcd", perl, "aabcd", match_default, make_array(0, 5, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a)\\1bc*d", perl, "aabcd", match_default, make_array(0, 5, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a)\\1bc*d", perl, "aabd", match_default, make_array(0, 4, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a)\\1bc*d", perl, "aabcccd", match_default, make_array(0, 7, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a)\\1bc*[ce]d", perl, "aabcccd", match_default, make_array(0, 7, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("^(a)\\1b(c)*cd$", perl, "aabcccd", match_default, make_array(0, 7, 0, 1, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("a\\(b*\\)c\\1d", basic, "abbcbbd", match_default, make_array(0, 7, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a\\(b*\\)c\\1d", basic, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\(b*\\)c\\1d", basic, "abbcbbbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^\\(.\\)\\1", basic, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\([bc]\\)\\1d", basic, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
+ // strictly speaking this is at best ambiguous, at worst wrong, this is what most
+ // re implimentations will match though.
+ TEST_REGEX_SEARCH("a\\(\\([bc]\\)\\2\\)*d", basic, "abbccd", match_default, make_array(0, 6, 3, 5, 3, 4, -2, -2));
+ TEST_REGEX_SEARCH("a\\(\\([bc]\\)\\2\\)*d", basic, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\(\\(b\\)*\\2\\)*d", basic, "abbbd", match_default, make_array(0, 5, 1, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\)\\1bcd", basic, "aabcd", match_default, make_array(0, 5, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\)\\1bc*d", basic, "aabcd", match_default, make_array(0, 5, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\)\\1bc*d", basic, "aabd", match_default, make_array(0, 4, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\)\\1bc*d", basic, "aabcccd", match_default, make_array(0, 7, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\)\\1bc*[ce]d", basic, "aabcccd", match_default, make_array(0, 7, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("^\\(a\\)\\1b\\(c\\)*cd$", basic, "aabcccd", match_default, make_array(0, 7, 0, 1, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\(ab*\\)[ab]*\\1", basic, "ababaaa", match_default, make_array(0, 7, 0, 1, -2, -2));
+ //
+ // Now test the \g version:
+ //
+ TEST_INVALID_REGEX("a(b)\\g2c", perl);
+ TEST_INVALID_REGEX("a(b\\g1)c", perl);
+ TEST_INVALID_REGEX("a(b\\g0)c", perl);
+ TEST_REGEX_SEARCH("a(b*)c\\g1d", perl, "abbcbbd", match_default, make_array(0, 7, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\g1d", perl, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\g1d", perl, "abbcbbbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(.)\\g1", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a([bc])\\g1d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
+ TEST_INVALID_REGEX("a(b)\\g{2}c", perl);
+ TEST_INVALID_REGEX("a(b\\g{1})c", perl);
+ TEST_INVALID_REGEX("a(b\\g{0})c", perl);
+ TEST_REGEX_SEARCH("a(b*)c\\g{1}d", perl, "abbcbbd", match_default, make_array(0, 7, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\g{1}d", perl, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\g{1}d", perl, "abbcbbbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(.)\\g{1}", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a([bc])\\g{1}d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
+ // And again but with negative indexes:
+ TEST_INVALID_REGEX("a(b)\\g-2c", perl);
+ TEST_INVALID_REGEX("a(b\\g-1)c", perl);
+ TEST_INVALID_REGEX("a(b\\g-0)c", perl);
+ TEST_REGEX_SEARCH("a(b*)c\\g-1d", perl, "abbcbbd", match_default, make_array(0, 7, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\g-1d", perl, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\g-1d", perl, "abbcbbbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(.)\\g1", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a([bc])\\g1d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
+ TEST_INVALID_REGEX("a(b)\\g{-2}c", perl);
+ TEST_INVALID_REGEX("a(b\\g{-1})c", perl);
+ TEST_REGEX_SEARCH("a(b*)c\\g{-1}d", perl, "abbcbbd", match_default, make_array(0, 7, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\g{-1}d", perl, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(b*)c\\g{-1}d", perl, "abbcbbbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(.)\\g{-1}", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a([bc])\\g{-1}d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
+
+ // And again but with named subexpressions:
+ TEST_REGEX_SEARCH("a(?<foo>(?<bar>(?<bb>(?<aa>b*))))c\\g{foo}d", perl, "abbcbbd", match_default, make_array(0, 7, 1, 3, 1, 3, 1, 3, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(?<foo>(?<bar>(?<bb>(?<aa>b*))))c\\g{foo}d", perl, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(?<foo>(?<bar>(?<bb>(?<aa>b*))))c\\g{foo}d", perl, "abbcbbbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?<foo>.)\\g{foo}", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(?<foo>[bc])\\g{foo}d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
+
+ TEST_REGEX_SEARCH("a(?'foo'(?'bar'(?'bb'(?'aa'b*))))c\\g{foo}d", perl, "abbcbbd", match_default, make_array(0, 7, 1, 3, 1, 3, 1, 3, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(?'foo'(?'bar'(?'bb'(?'aa'b*))))c\\g{foo}d", perl, "abbcbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(?'foo'(?'bar'(?'bb'(?'aa'b*))))c\\g{foo}d", perl, "abbcbbbd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?'foo'.)\\g{foo}", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(?'foo'[bc])\\g{foo}d", perl, "abcdabbd", match_default, make_array(4, 8, 5, 6, -2, -2));
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_deprecated.cpp b/src/boost/libs/regex/test/regress/test_deprecated.cpp
new file mode 100644
index 000000000..493c02b2e
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_deprecated.cpp
@@ -0,0 +1,386 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_deprecated.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Tests for deprecated interfaces.
+ */
+
+#include "test.hpp"
+#include <boost/cregex.hpp>
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4267)
+#endif
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::atoi;
+ using ::wcstol;
+}
+#endif
+
+int get_posix_compile_options(boost::regex_constants::syntax_option_type opts)
+{
+ using namespace boost;
+ int result = 0;
+ switch(opts & regbase::main_option_type)
+ {
+ case regbase::perl:
+ result = (opts & regbase::no_perl_ex) ? REG_EXTENDED : REG_PERL;
+ if(opts & (regbase::no_bk_refs|regbase::no_mod_m|regbase::mod_x|regbase::mod_s|regbase::no_mod_s|regbase::no_escape_in_lists|regbase::no_empty_expressions))
+ return -1;
+ break;
+ case regbase::basic:
+ result = REG_BASIC;
+ if(opts & (regbase::no_char_classes|regbase::no_intervals|regbase::bk_plus_qm|regbase::bk_vbar))
+ return -1;
+ if((opts & regbase::no_escape_in_lists) == 0)
+ return -1;
+ break;
+ default:
+ return -1;
+ }
+
+ if(opts & regbase::icase)
+ result |= REG_ICASE;
+ if(opts & regbase::nosubs)
+ result |= REG_NOSUB;
+ if(opts & regbase::newline_alt)
+ result |= REG_NEWLINE;
+ if((opts & regbase::collate) == 0)
+ result |= REG_NOCOLLATE;
+
+ return result;
+}
+
+int get_posix_match_flags(boost::regex_constants::match_flag_type f)
+{
+ int result = 0;
+ if(f & boost::regex_constants::match_not_bol)
+ result |= boost::REG_NOTBOL;
+ if(f & boost::regex_constants::match_not_eol)
+ result |= boost::REG_NOTEOL;
+ if(f & ~(boost::regex_constants::match_not_bol|boost::regex_constants::match_not_eol))
+ return -1;
+ return result;
+}
+
+void test_deprecated(const char&, const test_regex_search_tag&)
+{
+ const std::string& expression = test_info<char>::expression();
+ if(expression.find('\0') != std::string::npos)
+ return;
+ const std::string& search_text = test_info<char>::search_text();
+ if(search_text.find('\0') != std::string::npos)
+ return;
+ int posix_options = get_posix_compile_options(test_info<char>::syntax_options());
+ if(posix_options < 0)
+ return;
+ int posix_match_options = get_posix_match_flags(test_info<char>::match_options());
+ if(posix_match_options < 0)
+ return;
+ const int* results = test_info<char>::answer_table();
+
+ // OK try and compile the expression:
+ boost::regex_tA re;
+ if(boost::regcompA(&re, expression.c_str(), posix_options) != 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" did not compile with the POSIX C API.", char);
+ return;
+ }
+ // try and find the first occurance:
+ static const unsigned max_subs = 100;
+ boost::regmatch_t matches[max_subs];
+ if(boost::regexecA(&re, search_text.c_str(), max_subs, matches, posix_match_options) == 0)
+ {
+ int i = 0;
+ while(results[2*i] != -2)
+ {
+ if((int)max_subs > i)
+ {
+ if(results[2*i] != matches[i].rm_so)
+ {
+ BOOST_REGEX_TEST_ERROR("Mismatch in start of subexpression " << i << " found with the POSIX C API.", char);
+ }
+ if(results[2*i+1] != matches[i].rm_eo)
+ {
+ BOOST_REGEX_TEST_ERROR("Mismatch in end of subexpression " << i << " found with the POSIX C API.", char);
+ }
+ }
+ ++i;
+ }
+ }
+ else
+ {
+ if(results[0] >= 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" was not found with the POSIX C API.", char);
+ }
+ }
+ // clean up whatever:
+ boost::regfreeA(&re);
+
+ //
+ // now try the RegEx class:
+ //
+ if(test_info<char>::syntax_options() & ~boost::regex::icase)
+ return;
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+ boost::RegEx e(expression, (test_info<char>::syntax_options() & boost::regex::icase) != 0);
+ if(e.error_code())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << e.error_code(), char);
+ }
+ if(e.Search(search_text, test_info<char>::match_options()))
+ {
+ int i = 0;
+ while(results[i*2] != -2)
+ {
+ if(e.Matched(i))
+ {
+ if(results[2*i] != static_cast<int>(e.Position(i)))
+ {
+ BOOST_REGEX_TEST_ERROR("Mismatch in start of subexpression " << i << " found with the RegEx class (found " << e.Position(i) << " expected " << results[2*i] << ").", char);
+ }
+ if(results[2*i+1] != static_cast<int>(e.Position(i) + e.Length(i)))
+ {
+ BOOST_REGEX_TEST_ERROR("Mismatch in end of subexpression " << i << " found with the RegEx class (found " << e.Position(i) + e.Length(i) << " expected " << results[2*i+1] << ").", char);
+ }
+ }
+ else
+ {
+ if(results[2*i] >= 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Mismatch in start of subexpression " << i << " found with the RegEx class (found " << e.Position(i) << " expected " << results[2*i] << ").", char);
+ }
+ if(results[2*i+1] >= 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Mismatch in end of subexpression " << i << " found with the RegEx class (found " << e.Position(i) + e.Length(i) << " expected " << results[2*i+1] << ").", char);
+ }
+ }
+ ++i;
+ }
+ }
+ else
+ {
+ if(results[0] >= 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" was not found with class RegEx.", char);
+ }
+ }
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(const boost::bad_expression& r)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile with RegEx class: " << r.what(), char);
+ }
+ catch(const std::runtime_error& r)
+ {
+ BOOST_REGEX_TEST_ERROR("Unexpected std::runtime_error : " << r.what(), char);
+ }
+ catch(const std::exception& r)
+ {
+ BOOST_REGEX_TEST_ERROR("Unexpected std::exception: " << r.what(), char);
+ }
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Unexpected exception of unknown type", char);
+ }
+#endif
+}
+
+void test_deprecated(const wchar_t&, const test_regex_search_tag&)
+{
+#ifndef BOOST_NO_WREGEX
+ const std::wstring& expression = test_info<wchar_t>::expression();
+ if(expression.find(L'\0') != std::wstring::npos)
+ return;
+ const std::wstring& search_text = test_info<wchar_t>::search_text();
+ if(search_text.find(L'\0') != std::wstring::npos)
+ return;
+ int posix_options = get_posix_compile_options(test_info<wchar_t>::syntax_options());
+ if(posix_options < 0)
+ return;
+ int posix_match_options = get_posix_match_flags(test_info<wchar_t>::match_options());
+ if(posix_match_options < 0)
+ return;
+ const int* results = test_info<wchar_t>::answer_table();
+
+ // OK try and compile the expression:
+ boost::regex_tW re;
+ if(boost::regcompW(&re, expression.c_str(), posix_options) != 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" did not compile with the POSIX C API.", wchar_t);
+ return;
+ }
+ // try and find the first occurance:
+ static const unsigned max_subs = 100;
+ boost::regmatch_t matches[max_subs];
+ if(boost::regexecW(&re, search_text.c_str(), max_subs, matches, posix_match_options) == 0)
+ {
+ int i = 0;
+ while(results[2*i] != -2)
+ {
+ if((int)max_subs > i)
+ {
+ if(results[2*i] != matches[i].rm_so)
+ {
+ BOOST_REGEX_TEST_ERROR("Mismatch in start of subexpression " << i << " found with the POSIX C API.", wchar_t);
+ }
+ if(results[2*i+1] != matches[i].rm_eo)
+ {
+ BOOST_REGEX_TEST_ERROR("Mismatch in end of subexpression " << i << " found with the POSIX C API.", wchar_t);
+ }
+ }
+ ++i;
+ }
+ }
+ else
+ {
+ if(results[0] >= 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" was not found with the POSIX C API.", wchar_t);
+ }
+ }
+ // clean up whatever:
+ boost::regfreeW(&re);
+#endif
+}
+
+void test_deprecated(const char&, const test_invalid_regex_tag&)
+{
+ const std::string& expression = test_info<char>::expression();
+ if(expression.find('\0') != std::string::npos)
+ return;
+ int posix_options = get_posix_compile_options(test_info<char>::syntax_options());
+ if(posix_options < 0)
+ return;
+
+ // OK try and compile the expression:
+ boost::regex_tA re;
+ int code = boost::regcompA(&re, expression.c_str(), posix_options);
+ if(code == 0)
+ {
+ boost::regfreeA(&re);
+ BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" unexpectedly compiled with the POSIX C API.", char);
+ }
+ else
+ {
+ char buf[100];
+ int s = boost::regerrorA(code, &re, 0, 0);
+ if(s < 100)
+ s = boost::regerrorA(code, &re, buf, 100);
+ s = boost::regerrorA(code | boost::REG_ITOA, &re, 0, 0);
+ if(s < 100)
+ {
+ s = boost::regerrorA(code | boost::REG_ITOA, &re, buf, 100);
+ re.re_endp = buf;
+ s = boost::regerrorA(code | boost::REG_ATOI, &re, buf, 100);
+ if(s)
+ {
+ int code2 = std::atoi(buf);
+ if(code2 != code)
+ {
+ BOOST_REGEX_TEST_ERROR("Got a bad error code from regerrA with REG_ATOI set: ", char);
+ }
+ }
+ }
+ }
+ //
+ // now try the RegEx class:
+ //
+ if(test_info<char>::syntax_options() & ~boost::regex::icase)
+ return;
+ bool have_catch = false;
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+ boost::RegEx e(expression, (test_info<char>::syntax_options() & boost::regex::icase) != 0);
+ if(e.error_code())
+ have_catch = true;
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(const boost::bad_expression&)
+ {
+ have_catch = true;
+ }
+ catch(const std::runtime_error& r)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << r.what(), char);
+ }
+ catch(const std::exception& r)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << r.what(), char);
+ }
+ catch(...)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but got an exception of unknown type instead", char);
+ }
+#endif
+ if(!have_catch)
+ {
+ // oops expected exception was not thrown:
+ BOOST_REGEX_TEST_ERROR("Expected an exception, but didn't find one.", char);
+ }
+}
+
+void test_deprecated(const wchar_t&, const test_invalid_regex_tag&)
+{
+#ifndef BOOST_NO_WREGEX
+ const std::wstring& expression = test_info<wchar_t>::expression();
+ if(expression.find(L'\0') != std::string::npos)
+ return;
+ int posix_options = get_posix_compile_options(test_info<wchar_t>::syntax_options());
+ if(posix_options < 0)
+ return;
+
+ // OK try and compile the expression:
+ boost::regex_tW re;
+ int code = boost::regcompW(&re, expression.c_str(), posix_options);
+ if(code == 0)
+ {
+ boost::regfreeW(&re);
+ BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" unexpectedly compiled with the POSIX C API.", wchar_t);
+ }
+ else
+ {
+ wchar_t buf[100];
+ int s = boost::regerrorW(code, &re, 0, 0);
+ if(s < 100)
+ s = boost::regerrorW(code, &re, buf, 100);
+ s = boost::regerrorW(code | boost::REG_ITOA, &re, 0, 0);
+ if(s < 100)
+ {
+ s = boost::regerrorW(code | boost::REG_ITOA, &re, buf, 100);
+ re.re_endp = buf;
+ s = boost::regerrorW(code | boost::REG_ATOI, &re, buf, 100);
+ if(s)
+ {
+ long code2 = std::wcstol(buf, 0, 10);
+ if(code2 != code)
+ {
+ BOOST_REGEX_TEST_ERROR("Got a bad error code from regerrW with REG_ATOI set: ", char);
+ }
+ }
+ }
+ }
+#endif
+}
diff --git a/src/boost/libs/regex/test/regress/test_deprecated.hpp b/src/boost/libs/regex/test/regress/test_deprecated.hpp
new file mode 100644
index 000000000..dc0595063
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_deprecated.hpp
@@ -0,0 +1,35 @@
+/*
+ *
+ * Copyright (c) 1998-2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_deprecated.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Forward declare deprecated test functions.
+ */
+
+#ifndef BOOST_REGEX_TEST_DEPRECATED
+#define BOOST_REGEX_TEST_DEPRECATED
+
+template <class charT, class Tag>
+void test_deprecated(const charT&, const Tag&)
+{
+ // do nothing
+}
+
+void test_deprecated(const char&, const test_regex_search_tag&);
+void test_deprecated(const wchar_t&, const test_regex_search_tag&);
+void test_deprecated(const char&, const test_invalid_regex_tag&);
+void test_deprecated(const wchar_t&, const test_invalid_regex_tag&);
+
+
+#endif
+
diff --git a/src/boost/libs/regex/test/regress/test_emacs.cpp b/src/boost/libs/regex/test/regress/test_emacs.cpp
new file mode 100644
index 000000000..c91478c16
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_emacs.cpp
@@ -0,0 +1,166 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_emacs2();
+
+void test_emacs()
+{
+ using namespace boost::regex_constants;
+ // now try operator + :
+ TEST_REGEX_SEARCH("ab+", emacs, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab+", emacs, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab+", emacs, "sssabbbbbbsss", match_default, make_array(3, 10, -2, -2));
+ TEST_REGEX_SEARCH("ab+c+", emacs, "abbb", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab+c+", emacs, "accc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab+c+", emacs, "abbcc", match_default, make_array(0, 5, -2, -2));
+ TEST_INVALID_REGEX("\\<+", emacs);
+ TEST_INVALID_REGEX("\\>+", emacs);
+ TEST_REGEX_SEARCH("\n+", emacs, "\n\n", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\+", emacs, "+", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\+", emacs, "++", match_default, make_array(0, 1, -2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\++", emacs, "++", match_default, make_array(0, 2, -2, -2));
+
+ // now try operator ?
+ TEST_REGEX_SEARCH("a?", emacs, "b", match_default, make_array(0, 0, -2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("ab?", emacs, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("ab?", emacs, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab?", emacs, "sssabbbbbbsss", match_default, make_array(3, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab?c?", emacs, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("ab?c?", emacs, "abbb", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab?c?", emacs, "accc", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab?c?", emacs, "abcc", match_default, make_array(0, 3, -2, -2));
+ TEST_INVALID_REGEX("\\<?", emacs);
+ TEST_INVALID_REGEX("\\>?", emacs);
+ TEST_REGEX_SEARCH("\n?", emacs, "\n\n", match_default, make_array(0, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\?", emacs, "?", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\?", emacs, "?", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\??", emacs, "??", match_default, make_array(0, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("a*?", emacs, "aa", match_default, make_array(0, 0, -2, 0, 1, -2, 1, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("^a*?$", emacs, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^.*?$", emacs, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^\\(a\\)*?$", emacs, "aa", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("^[ab]*?$", emacs, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a??", emacs, "aa", match_default, make_array(0, 0, -2, 0, 1, -2, 1, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("a+?", emacs, "aa", match_default, make_array(0, 1, -2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\{1,3\\}?", emacs, "aaa", match_default, make_array(0, 1, -2, 1, 2, -2, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\w+?w", emacs, "...ccccccwcccccw", match_default, make_array(3, 10, -2, 10, 16, -2, -2));
+ TEST_REGEX_SEARCH("\\W+\\w+?w", emacs, "...ccccccwcccccw", match_default, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH("abc\\|\\w+?", emacs, "abd", match_default, make_array(0, 1, -2, 1, 2, -2, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\|\\w+?", emacs, "abcd", match_default, make_array(0, 3, -2, 3, 4, -2, -2));
+ TEST_REGEX_SEARCH("<\\ss*tag[^>]*>\\(.*?\\)<\\ss*/tag\\ss*>", emacs, " <tag>here is some text</tag> <tag></tag>", match_default, make_array(1, 29, 6, 23, -2, 30, 41, 35, 35, -2, -2));
+ TEST_REGEX_SEARCH("<\\ss*tag[^>]*>\\(.*?\\)<\\ss*/tag\\ss*>", emacs, " < tag attr=\"something\">here is some text< /tag > <tag></tag>", match_default, make_array(1, 49, 24, 41, -2, 50, 61, 55, 55, -2, -2));
+ TEST_INVALID_REGEX("a\\{1,3\\}\\{1\\}", emacs);
+ TEST_INVALID_REGEX("a**", emacs);
+ TEST_INVALID_REGEX("a++", emacs);
+
+ TEST_REGEX_SEARCH("\\<abcd", emacs, " abcd", match_default, make_array(2, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\<ab", emacs, "cab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<ab", emacs, "\nab", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\<tag", emacs, "::tag", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\<abcd", emacs, "abcd", match_default|match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<abcd", emacs, " abcd", match_default|match_not_bow, make_array(2, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\<", emacs, "ab ", match_default|match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".\\<.", emacs, "ab", match_default|match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".\\<.", emacs, " b", match_default|match_not_bow, make_array(0, 2, -2, -2));
+ // word end:
+ TEST_REGEX_SEARCH("abc\\>", emacs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\>", emacs, "abcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\>", emacs, "abc\n", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\>", emacs, "abc::", match_default, make_array(0,3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\(?:\\>..\\|$\\)", emacs, "abc::", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\>", emacs, " ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".\\>.", emacs, " ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\>", emacs, "abc", match_default|match_not_eow, make_array(-2, -2));
+ // word boundary:
+ TEST_REGEX_SEARCH("\\babcd", emacs, " abcd", match_default, make_array(2, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\bab", emacs, "cab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\bab", emacs, "\nab", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\btag", emacs, "::tag", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("abc\\b", emacs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\b", emacs, "abcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\b", emacs, "abc\n", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\b", emacs, "abc::", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\babcd", emacs, "abcd", match_default|match_not_bow, make_array(-2, -2));
+ // within word:
+ TEST_REGEX_SEARCH("\\B", emacs, "ab", match_default, make_array(1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\\Bb", emacs, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\B", emacs, "ab", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\\B", emacs, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\B", emacs, "a ", match_default, make_array(-2, -2));
+ // buffer operators:
+ TEST_REGEX_SEARCH("\\`abc", emacs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\`abc", emacs, "\nabc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\`abc", emacs, " abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\'", emacs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\'", emacs, "abc\n", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\'", emacs, "abc ", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("a\\|b", emacs, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\\|b", emacs, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\\|b\\|c", emacs, "c", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\\|\\(b\\)\\|.", emacs, "b", match_default, make_array(0, 1, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\)\\|b\\|.", emacs, "a", match_default, make_array(0, 1, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\\(b\\|c\\)", emacs, "ab", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\(b\\|c\\)", emacs, "ac", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\(b\\|c\\)", emacs, "ad", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\(a\\|b\\|c\\)", emacs, "c", match_default, make_array(0, 1, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\|\\(b\\)\\|.\\)", emacs, "b", match_default, make_array(0, 1, 0, 1, 0, 1, -2, -2));
+ TEST_INVALID_REGEX("\\|c", emacs);
+ TEST_INVALID_REGEX("c\\|", emacs);
+ TEST_INVALID_REGEX("\\(\\|\\)", emacs);
+ TEST_INVALID_REGEX("\\(a\\|\\)", emacs);
+ TEST_INVALID_REGEX("\\(\\|a\\)", emacs);
+
+ TEST_REGEX_SEARCH("\\(?:abc\\)+", emacs, "xxabcabcxx", match_default, make_array(2, 8, -2, -2));
+ TEST_REGEX_SEARCH("\\(?:a+\\)\\(b+\\)", emacs, "xaaabbbx", match_default, make_array(1, 7, 4, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\(a+\\)\\(?:b+\\)", emacs, "xaaabbba", match_default, make_array(1, 7, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\(?:\\(a+\\)b+\\)", emacs, "xaaabbba", match_default, make_array(1, 7, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\(?:a+\\(b+\\)\\)", emacs, "xaaabbba", match_default, make_array(1, 7, 4, 7, -2, -2));
+ TEST_REGEX_SEARCH("a+\\(?#b+\\)b+", emacs, "xaaabbba", match_default, make_array(1, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\)\\(?:b\\|$\\)", emacs, "ab", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\(a\\)\\(?:b\\|$\\)", emacs, "a", match_default, make_array(0, 1, 0, 1, -2, -2));
+ test_emacs2();
+}
+
+void test_emacs2()
+{
+ using namespace boost::regex_constants;
+
+
+ TEST_REGEX_SEARCH("\\ss+", emacs, "a b", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\Ss+", emacs, " ab ", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\sw+", emacs, " ab ", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\Sw+", emacs, "a b", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\s_+", emacs, " $&*+-_<> ", match_default, make_array(1, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\S_+", emacs, "$&*+-_<>b", match_default, make_array(8, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\s.+", emacs, " .,;!? ", match_default, make_array(1, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\S.+", emacs, ".,;!?b", match_default, make_array(5, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\s(+", emacs, "([{ ", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\S(+", emacs, "([{ ", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\s)+", emacs, ")]} ", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\S)+", emacs, ")]} ", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\s\"+", emacs, "\"'` ", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\S\"+", emacs, "\"'` ", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\s'+", emacs, "',# ", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\S'+", emacs, "',# ", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\s<+", emacs, "; ", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\S<+", emacs, "; ", match_default, make_array(1, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\s>+", emacs, "\n\f ", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\S>+", emacs, "\n\f ", match_default, make_array(2, 3, -2, -2));
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_escapes.cpp b/src/boost/libs/regex/test/regress/test_escapes.cpp
new file mode 100644
index 000000000..c9bc951b1
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_escapes.cpp
@@ -0,0 +1,216 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127 4428)
+#endif
+
+void test_character_escapes()
+{
+ using namespace boost::regex_constants;
+ // characters by code
+ TEST_REGEX_SEARCH("\\0101", perl, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\00", perl, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\0", perl, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\0172", perl, "z", match_default, make_array(0, 1, -2, -2));
+ // extra escape sequences:
+ TEST_REGEX_SEARCH("\\a", perl, "\a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\f", perl, "\f", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\n", perl, "\n", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\r", perl, "\r", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\v", perl, "\v", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\t", perl, "\t", match_default, make_array(0, 1, -2, -2));
+
+ // updated tests for version 2:
+ TEST_REGEX_SEARCH("\\x41", perl, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\xff", perl, "\xff", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\xFF", perl, "\xff", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\c@", perl, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\cA", perl, "\x1", match_default, make_array(0, 1, -2, -2));
+ //TEST_REGEX_SEARCH("\\cz", perl, "\x3A", match_default, make_array(0, 1, -2, -2));
+ //TEST_INVALID_REGEX("\\c=", boost::regex::extended);
+ //TEST_INVALID_REGEX("\\c?", boost::regex::extended);
+ TEST_REGEX_SEARCH("=:", perl, "=:", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("\\e", perl, "\x1B", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\x1b", perl, "\x1B", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\x{1b}", perl, "\x1B", match_default, make_array(0, 1, -2, -2));
+ TEST_INVALID_REGEX("\\x{}", perl);
+ TEST_INVALID_REGEX("\\x{", perl);
+ TEST_INVALID_REGEX("\\", perl);
+ TEST_INVALID_REGEX("\\c", perl);
+ TEST_INVALID_REGEX("\\x}", perl);
+ TEST_INVALID_REGEX("\\x", perl);
+ TEST_INVALID_REGEX("\\x{yy", perl);
+ TEST_INVALID_REGEX("\\x{1b", perl);
+ // \Q...\E sequences:
+ TEST_INVALID_REGEX("\\Qabc\\", perl);
+ TEST_REGEX_SEARCH("\\Qabc\\E", perl, "abcd", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\Qabc\\Ed", perl, "abcde", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\Q+*?\\\\E", perl, "+*?\\", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a\\Q+*?\\\\Eb", perl, "a+*?\\b", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\C+", perl, "abcde", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\X+", perl, "abcde", match_default, make_array(0, 5, -2, -2));
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+ TEST_REGEX_SEARCH_W(L"\\X", perl, L"a\x0300\x0301", match_default, make_array(0, 3, -2, -2));
+#endif
+ // unknown escape sequences match themselves:
+ TEST_REGEX_SEARCH("\\~", perl, "~", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\~", basic, "~", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\~", boost::regex::extended, "~", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\j", boost::regex::extended, "j", match_default, make_array(0, 1, -2, -2));
+}
+
+void test_assertion_escapes()
+{
+ using namespace boost::regex_constants;
+ // word start:
+ TEST_REGEX_SEARCH("\\<abcd", perl, " abcd", match_default, make_array(2, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\<ab", perl, "cab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<ab", perl, "\nab", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\<tag", perl, "::tag", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\<abcd", perl, "abcd", match_default|match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<abcd", perl, " abcd", match_default|match_not_bow, make_array(2, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\<", perl, "ab ", match_default|match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".\\<.", perl, "ab", match_default|match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".\\<.", perl, " b", match_default|match_not_bow, make_array(0, 2, -2, -2));
+ // word end:
+ TEST_REGEX_SEARCH("abc\\>", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\>", perl, "abcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\>", perl, "abc\n", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\>", perl, "abc::", match_default, make_array(0,3, -2, -2));
+ TEST_REGEX_SEARCH("abc(?:\\>..|$)", perl, "abc::", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\>", perl, " ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".\\>.", perl, " ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\>", perl, "abc", match_default|match_not_eow, make_array(-2, -2));
+ // word boundary:
+ TEST_REGEX_SEARCH("\\babcd", perl, " abcd", match_default, make_array(2, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\bab", perl, "cab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\bab", perl, "\nab", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\btag", perl, "::tag", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("abc\\b", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\b", perl, "abcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\b", perl, "abc\n", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\b", perl, "abc::", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\babcd", perl, "abcd", match_default|match_not_bow, make_array(-2, -2));
+ // within word:
+ TEST_REGEX_SEARCH("\\B", perl, "ab", match_default, make_array(1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\\Bb", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\B", perl, "ab", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a\\B", perl, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\B", perl, "a ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\By\\b", perl, "xy", match_default, make_array(1, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\by\\B", perl, "yz", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\B\\*\\B", perl, " * ", match_default, make_array(1, 2, -2, -2));
+ // buffer operators:
+ TEST_REGEX_SEARCH("\\`abc", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\`abc", perl, "\nabc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\`abc", perl, " abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\'", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\'", perl, "abc\n", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\'", perl, "abc ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc(?:\\'|$)", perl, "abc", match_default, make_array(0, 3, -2, -2));
+
+ // word start:
+ TEST_REGEX_SEARCH("[[:<:]]abcd", perl, " abcd", match_default, make_array(2, 6, -2, -2));
+ TEST_REGEX_SEARCH("[[:<:]]ab", perl, "cab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[[:<:]]ab", perl, "\nab", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("[[:<:]]tag", perl, "::tag", match_default, make_array(2, 5, -2, -2));
+ // word end
+ TEST_REGEX_SEARCH("abc[[:>:]]", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc[[:>:]]", perl, "abcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc[[:>:]]", perl, "abc\n", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc[[:>:]]", perl, "abc::", match_default, make_array(0, 3, -2, -2));
+
+ TEST_REGEX_SEARCH("\\Aabc", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\Aabc", perl, "aabc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\z", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\z", perl, "abcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\Z", perl, "abc\n\n", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc\\Z", perl, "abc\n\n", match_default|match_not_eob, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc\\Z", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\Gabc", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\Gabc", perl, "dabcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\Gbc", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\Aab", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc(?:\\Z|$)", perl, "abc\n\n", match_default, make_array(0, 3, -2, -2));
+
+ // Buffer reset \K:
+ TEST_REGEX_SEARCH("(foo)\\Kbar", perl, "foobar", match_default, make_array(3, 6, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(foo)(\\Kbar|baz)", perl, "foobar", match_default, make_array(3, 6, 0, 3, 3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(foo)(\\Kbar|baz)", perl, "foobaz", match_default, make_array(0, 6, 0, 3, 3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(foo\\Kbar)baz", perl, "foobarbaz", match_default, make_array(3, 9, 0, 6, -2, -2));
+
+ // Line ending \R:
+ TEST_REGEX_SEARCH("\\R", perl, "foo\nbar", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\R", perl, "foo\rbar", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\R", perl, "foo\r\nbar", match_default, make_array(3, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\r\nbar", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\012bar", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\013bar", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\013bar", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\205bar", match_default, make_array(0, 4, -2, -2));
+ // see if \u works:
+ const wchar_t* w = L"\u2028";
+ if(*w == 0x2028u)
+ {
+ TEST_REGEX_SEARCH_W(L"\\R", perl, L"foo\u2028bar", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\R", perl, L"foo\u2029bar", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2028bar", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2029bar", match_default, make_array(0, 4, -2, -2));
+ }
+ // Bug report: https://github.com/boostorg/regex/issues/40
+ TEST_REGEX_SEARCH("\\b", perl, "", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b", perl, "", match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b", perl, "", match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b", perl, "", match_not_bow | match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b", perl, "-", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b", perl, "-", match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b", perl, "-", match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b", perl, "-", match_not_bow | match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<", perl, "", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<", perl, "", match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<", perl, "", match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<", perl, "", match_not_bow | match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<", perl, "-", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<", perl, "-", match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<", perl, "-", match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\<", perl, "-", match_not_bow | match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\>", perl, "", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\>", perl, "", match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\>", perl, "", match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\>", perl, "", match_not_bow | match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\>", perl, "-", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\>", perl, "-", match_not_bow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\>", perl, "-", match_not_eow, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\>", perl, "-", match_not_bow | match_not_eow, make_array(-2, -2));
+ // Bug report https://github.com/boostorg/regex/issues/57
+ // Line ending \R:
+ TEST_REGEX_SEARCH("\\R", perl | no_escape_in_lists, "foo\nbar", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\R", perl | no_escape_in_lists, "foo\rbar", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\R", perl | no_escape_in_lists, "foo\r\nbar", match_default, make_array(3, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl | no_escape_in_lists, "abc\r\nbar", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl | no_escape_in_lists, "abc\012bar", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl | no_escape_in_lists, "abc\013bar", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl | no_escape_in_lists, "abc\013bar", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?x) abc \\R", perl | no_escape_in_lists, "abc\205bar", match_default, make_array(0, 4, -2, -2));
+ // see if \u works:
+ if(*w == 0x2028u)
+ {
+ TEST_REGEX_SEARCH_W(L"\\R", perl | no_escape_in_lists, L"foo\u2028bar", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\R", perl | no_escape_in_lists, L"foo\u2029bar", match_default, make_array(3, 4, -2, -2));
+ TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl | no_escape_in_lists, L"abc\u2028bar", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl | no_escape_in_lists, L"abc\u2029bar", match_default, make_array(0, 4, -2, -2));
+ }
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_grep.cpp b/src/boost/libs/regex/test/regress/test_grep.cpp
new file mode 100644
index 000000000..501ee87e0
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_grep.cpp
@@ -0,0 +1,67 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_grep()
+{
+ //
+ // now test grep,
+ // basically check all our restart types - line, word, etc
+ // checking each one for null and non-null matches.
+ //
+ using namespace boost::regex_constants;
+ TEST_REGEX_SEARCH("a", perl|nosubs, " a a a aa", match_default, make_array(1, 2, -2, 3, 4, -2, 5, 6, -2, 7, 8, -2, 8, 9, -2, -2));
+ TEST_REGEX_SEARCH("a+b+", perl|nosubs, "aabaabbb ab", match_default, make_array(0, 3, -2, 3, 8, -2, 9, 11, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl|nosubs, "adabbdacd", match_default, make_array(0, 2, -2, 2, 6, -2, 6, 9, -2, -2));
+ TEST_REGEX_SEARCH("a", perl|nosubs, "\na\na\na\naa", match_default, make_array(1, 2, -2, 3, 4, -2, 5, 6, -2, 7, 8, -2, 8, 9, -2, -2));
+ TEST_REGEX_SEARCH("^", perl|nosubs, " \n\n \n\n\n", match_default, make_array(0, 0, -2, 4, 4, -2, 5, 5, -2, 8, 8, -2, 9, 9, -2, 10, 10, -2, -2));
+ TEST_REGEX_SEARCH("^ab", perl|nosubs, "ab \nab ab\n", match_default, make_array(0, 2, -2, 5, 7, -2, -2));
+ TEST_REGEX_SEARCH("^[^\\n]*\n", perl|nosubs, " \n \n\n \n", match_default, make_array(0, 4, -2, 4, 7, -2, 7, 8, -2, 8, 11, -2, -2));
+ TEST_REGEX_SEARCH("\\<abc", perl|nosubs, "abcabc abc\n\nabc", match_default, make_array(0, 3, -2, 7, 10, -2, 12, 15, -2, -2));
+ TEST_REGEX_SEARCH("\\<", perl|nosubs, " ab a aaa ", match_default, make_array(2, 2, -2, 5, 5, -2, 7, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\<\\w+\\W+", perl|nosubs, " aa aa a ", match_default, make_array(1, 5, -2, 5, 9, -2, 9, 11, -2, -2));
+
+ TEST_REGEX_SEARCH("\\Aabc", perl|nosubs, "abc abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\G\\w+\\W+", perl|nosubs, "abc abc a cbbb ", match_default, make_array(0, 5, -2, 5, 9, -2, 9, 11, -2, 11, 18, -2, -2));
+ TEST_REGEX_SEARCH("\\Ga+b+", perl|nosubs, "aaababb abb", match_default, make_array(0, 4, -2, 4, 7, -2, -2));
+ TEST_REGEX_SEARCH("abc", perl|nosubs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc", perl|nosubs, " abc abcabc", match_default, make_array(1, 4, -2, 5, 8, -2, 8, 11, -2, -2));
+ TEST_REGEX_SEARCH("\\n\\n", perl|nosubs, " \n\n\n \n \n\n\n\n ", match_default, make_array(1, 3, -2, 18, 20, -2, 20, 22, -2, -2));
+ TEST_REGEX_SEARCH("$", perl|nosubs, " \n\n \n\n\n", match_default, make_array(3, 3, -2, 4, 4, -2, 7, 7, -2, 8, 8, -2, 9, 9, -2, 10, 10, -2, -2));
+ TEST_REGEX_SEARCH("\\b", perl|nosubs, " abb a abbb ", match_default, make_array(2, 2, -2, 5, 5, -2, 6, 6, -2, 7, 7, -2, 8, 8, -2, 12, 12, -2, -2));
+ TEST_REGEX_SEARCH("A", perl|icase|nosubs, " a a a aa", match_default, make_array(1, 2, -2, 3, 4, -2, 5, 6, -2, 7, 8, -2, 8, 9, -2, -2));
+ TEST_REGEX_SEARCH("A+B+", perl|icase|nosubs, "aabaabbb ab", match_default, make_array(0, 3, -2, 3, 8, -2, 9, 11, -2, -2));
+ TEST_REGEX_SEARCH("A(B*|c|e)D", perl|icase|nosubs, "adabbdacd", match_default, make_array(0, 2, -2, 2, 6, -2, 6, 9, -2, -2));
+ TEST_REGEX_SEARCH("A", perl|icase|nosubs, "\na\na\na\naa", match_default, make_array(1, 2, -2, 3, 4, -2, 5, 6, -2, 7, 8, -2, 8, 9, -2, -2));
+ TEST_REGEX_SEARCH("^aB", perl|icase|nosubs, "Ab \nab Ab\n", match_default, make_array(0, 2, -2, 5, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\<abc", perl|icase|nosubs, "Abcabc aBc\n\nabc", match_default, make_array(0, 3, -2, 7, 10, -2, 12, 15, -2, -2));
+ TEST_REGEX_SEARCH("ABC", perl|icase|nosubs, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc", perl|icase|nosubs, " ABC ABCABC ", match_default, make_array(1, 4, -2, 5, 8, -2, 8, 11, -2, -2));
+ TEST_REGEX_SEARCH("a|\\Ab", perl, "b ab", match_default, make_array(0, 1, -2, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a|^b", perl, "b ab\nb", match_default, make_array(0, 1, -2, 2, 3, -2, 5, 6, -2, -2));
+ TEST_REGEX_SEARCH("a|\\<b", perl, "b ab\nb", match_default, make_array(0, 1, -2, 2, 3, -2, 5, 6, -2, -2));
+
+ TEST_REGEX_SEARCH("\\Aabc", perl, "abcabc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("^abc", perl, "abcabc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\<abc", perl, "abcabc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\babc", perl, "abcabc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?<=\\Aabc)?abc", perl, "abcabc", match_default, make_array(0, 3, -2, 3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?<=^abc)?abc", perl, "abcabc", match_default, make_array(0, 3, -2, 3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?<=\\<abc)?abc", perl, "abcabc", match_default, make_array(0, 3, -2, 3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?<=\\babc)?abc", perl, "abcabc", match_default, make_array(0, 3, -2, 3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?<=^).{2}|(?<=^.{3}).{2}", perl, "123456789", match_default, make_array(0, 2, -2, 3, 5, -2, -2));
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_icu.cpp b/src/boost/libs/regex/test/regress/test_icu.cpp
new file mode 100644
index 000000000..1ef9fa962
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_icu.cpp
@@ -0,0 +1,703 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_icu.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Test code for Unicode regexes with ICU support.
+ */
+
+//
+// We can only build this if we have ICU support:
+//
+#include <boost/regex/config.hpp>
+#if defined(BOOST_HAS_ICU) && !defined(BOOST_NO_STD_WSTRING)
+
+#include <boost/regex/icu.hpp>
+#include "test.hpp"
+
+namespace unnecessary_fix{
+//
+// Some outrageously broken std lib's don't have a conforming
+// back_insert_iterator, which means we can't use the std version
+// as an argument to regex_replace, sigh... use our own:
+//
+template <class Seq>
+class back_insert_iterator
+{
+private:
+ Seq* container;
+public:
+ typedef const typename Seq::value_type value_type;
+ typedef Seq container_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+ typedef std::output_iterator_tag iterator_category;
+
+ explicit back_insert_iterator(Seq& x) : container(&x) {}
+ back_insert_iterator& operator=(const value_type& val)
+ {
+ container->push_back(val);
+ return *this;
+ }
+ back_insert_iterator& operator*() { return *this; }
+ back_insert_iterator& operator++() { return *this; }
+ back_insert_iterator operator++(int) { return *this; }
+};
+
+template <class Seq>
+inline back_insert_iterator<Seq> back_inserter(Seq& x)
+{
+ return back_insert_iterator<Seq>(x);
+}
+
+}
+
+//
+// compare two match_results struct's for equality,
+// converting the iterator as needed:
+//
+template <class MR1, class MR2>
+void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<2> const*)
+{
+ typedef typename MR2::value_type MR2_value_type;
+ typedef typename MR2_value_type::const_iterator MR2_iterator_type;
+ typedef boost::u16_to_u32_iterator<MR2_iterator_type> iterator_type;
+ //typedef typename MR1::size_type size_type;
+ if(w1.size() != w2.size())
+ {
+ BOOST_REGEX_TEST_ERROR("Size mismatch in match_results class", UChar32);
+ }
+ for(int i = 0; i < (int)w1.size(); ++i)
+ {
+ if(w1[i].matched)
+ {
+ if(w2[i].matched == 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
+ }
+ if((w1.position(i) != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2[i].first))) || (w1.length(i) != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2[i].first), iterator_type(w2[i].second))))
+ {
+ BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
+ }
+ }
+ else if(w2[i].matched)
+ {
+ BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
+ }
+ }
+ //
+ // We don't have a way to access a list of named sub-expressions since we only store
+ // hashes, but "abc" and "N" are common names used in our tests, so check those:
+ //
+ if (w1["abc"].matched)
+ {
+ if (w2["abc"].matched == 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
+ }
+ if ((w1.position("abc") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2["abc"].first))) || (w1.length("abc") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2["abc"].first), iterator_type(w2["abc"].second))))
+ {
+ BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
+ }
+ }
+ else if (w2["abc"].matched)
+ {
+ BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
+ }
+ if (w1["N"].matched)
+ {
+ if (w2["N"].matched == 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
+ }
+ if ((w1.position("N") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2["N"].first))) || (w1.length("N") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2["N"].first), iterator_type(w2["N"].second))))
+ {
+ BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
+ }
+ }
+ else if (w2["N"].matched)
+ {
+ BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
+ }
+}
+template <class MR1, class MR2>
+void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<1> const*)
+{
+ typedef typename MR2::value_type MR2_value_type;
+ typedef typename MR2_value_type::const_iterator MR2_iterator_type;
+ typedef boost::u8_to_u32_iterator<MR2_iterator_type> iterator_type;
+ //typedef typename MR1::size_type size_type;
+ if(w1.size() != w2.size())
+ {
+ BOOST_REGEX_TEST_ERROR("Size mismatch in match_results class", UChar32);
+ }
+ for(int i = 0; i < (int)w1.size(); ++i)
+ {
+ if(w1[i].matched)
+ {
+ if(w2[i].matched == 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
+ }
+ if((w1.position(i) != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2[i].first))) || (w1.length(i) != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2[i].first), iterator_type(w2[i].second))))
+ {
+ BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
+ }
+ }
+ else if(w2[i].matched)
+ {
+ BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
+ }
+ }
+}
+
+void test_icu_grep(const boost::u32regex& r, const std::vector< ::UChar32>& search_text)
+{
+ typedef std::vector< ::UChar32>::const_iterator const_iterator;
+ typedef boost::u32regex_iterator<const_iterator> test_iterator;
+ boost::regex_constants::match_flag_type opts = test_info<wchar_t>::match_options();
+ const int* answer_table = test_info<wchar_t>::answer_table();
+ test_iterator start(search_text.begin(), search_text.end(), r, opts), end;
+ test_iterator copy(start);
+ const_iterator last_end = search_text.begin();
+ while(start != end)
+ {
+ if(start != copy)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", wchar_t);
+ }
+ if(!(start == copy))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", wchar_t);
+ }
+ test_result(*start, search_text.begin(), answer_table);
+ // test $` and $' :
+ if(start->prefix().first != last_end)
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for start of $`", wchar_t);
+ }
+ if(start->prefix().second != (*start)[0].first)
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for end of $`", wchar_t);
+ }
+ if(start->prefix().matched != (start->prefix().first != start->prefix().second))
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for matched member of $`", wchar_t);
+ }
+ if(start->suffix().first != (*start)[0].second)
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for start of $'", wchar_t);
+ }
+ if(start->suffix().second != search_text.end())
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for end of $'", wchar_t);
+ }
+ if(start->suffix().matched != (start->suffix().first != start->suffix().second))
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for matched member of $'", wchar_t);
+ }
+ last_end = (*start)[0].second;
+ ++start;
+ ++copy;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", wchar_t);
+ }
+}
+
+void test_icu(const wchar_t&, const test_regex_search_tag& )
+{
+ boost::u32regex r;
+ if(*test_locale::c_str())
+ {
+ U_NAMESPACE_QUALIFIER Locale l(test_locale::c_str());
+ if(l.isBogus())
+ return;
+ r.imbue(l);
+ }
+
+ std::vector< ::UChar32> expression;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ expression.assign(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end());
+#else
+ std::copy(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end(), std::back_inserter(expression));
+#endif
+ boost::regex_constants::syntax_option_type syntax_options = test_info<UChar32>::syntax_options();
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
+ r.assign(expression.begin(), expression.end(), syntax_options);
+#else
+ if(expression.size())
+ r.assign(&*expression.begin(), expression.size(), syntax_options);
+ else
+ r.assign(static_cast<UChar32 const*>(0), expression.size(), syntax_options);
+#endif
+ if(r.status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), UChar32);
+ }
+ std::vector< ::UChar32> search_text;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ search_text.assign(test_info<wchar_t>::search_text().begin(), test_info<wchar_t>::search_text().end());
+#else
+ std::copy(test_info<wchar_t>::search_text().begin(), test_info<wchar_t>::search_text().end(), std::back_inserter(search_text));
+#endif
+ boost::regex_constants::match_flag_type opts = test_info<wchar_t>::match_options();
+ const int* answer_table = test_info<wchar_t>::answer_table();
+ boost::match_results<std::vector< ::UChar32>::const_iterator> what;
+ if(boost::u32regex_search(
+ const_cast<std::vector< ::UChar32>const&>(search_text).begin(),
+ const_cast<std::vector< ::UChar32>const&>(search_text).end(),
+ what,
+ r,
+ opts))
+ {
+ test_result(what, const_cast<std::vector< ::UChar32>const&>(search_text).begin(), answer_table);
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", UChar32);
+ }
+
+ if(0 == *test_locale::c_str())
+ {
+ //
+ // Now try UTF-16 construction:
+ //
+ typedef boost::u32_to_u16_iterator<std::vector<UChar32>::const_iterator> u16_conv;
+ std::vector<UChar> expression16, text16;
+ boost::match_results<std::vector<UChar>::const_iterator> what16;
+ boost::match_results<const UChar*> what16c;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ expression16.assign(u16_conv(expression.begin()), u16_conv(expression.end()));
+ text16.assign(u16_conv(search_text.begin()), u16_conv(search_text.end()));
+#else
+ expression16.clear();
+ std::copy(u16_conv(expression.begin()), u16_conv(expression.end()), std::back_inserter(expression16));
+ text16.clear();
+ std::copy(u16_conv(search_text.begin()), u16_conv(search_text.end()), std::back_inserter(text16));
+#endif
+ r = boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options);
+ if(boost::u32regex_search(const_cast<const std::vector<UChar>&>(text16).begin(), const_cast<const std::vector<UChar>&>(text16).end(), what16, r, opts))
+ {
+ compare_result(what, what16, static_cast<boost::mpl::int_<2> const*>(0));
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", UChar32);
+ }
+ if(std::find(expression16.begin(), expression16.end(), 0) == expression16.end())
+ {
+ expression16.push_back(0);
+ r = boost::make_u32regex(&*expression16.begin(), syntax_options);
+ if(std::find(text16.begin(), text16.end(), 0) == text16.end())
+ {
+ text16.push_back(0);
+ if(boost::u32regex_search((const UChar*)&*text16.begin(), what16c, r, opts))
+ {
+ compare_result(what, what16c, static_cast<boost::mpl::int_<2> const*>(0));
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", UChar32);
+ }
+ }
+ }
+ //
+ // Now try UTF-8 construction:
+ //
+ typedef boost::u32_to_u8_iterator<std::vector<UChar32>::const_iterator, unsigned char> u8_conv;
+ std::vector<unsigned char> expression8, text8;
+ boost::match_results<std::vector<unsigned char>::const_iterator> what8;
+ boost::match_results<const unsigned char*> what8c;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ expression8.assign(u8_conv(expression.begin()), u8_conv(expression.end()));
+ text8.assign(u8_conv(search_text.begin()), u8_conv(search_text.end()));
+#else
+ expression8.clear();
+ std::copy(u8_conv(expression.begin()), u8_conv(expression.end()), std::back_inserter(expression8));
+ text8.clear();
+ std::copy(u8_conv(search_text.begin()), u8_conv(search_text.end()), std::back_inserter(text8));
+#endif
+ r = boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options);
+ if(boost::u32regex_search(const_cast<const std::vector<unsigned char>&>(text8).begin(), const_cast<const std::vector<unsigned char>&>(text8).end(), what8, r, opts))
+ {
+ compare_result(what, what8, static_cast<boost::mpl::int_<1> const*>(0));
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", UChar32);
+ }
+ if(std::find(expression8.begin(), expression8.end(), 0) == expression8.end())
+ {
+ expression8.push_back(0);
+ r = boost::make_u32regex(&*expression8.begin(), syntax_options);
+ if(std::find(text8.begin(), text8.end(), 0) == text8.end())
+ {
+ text8.push_back(0);
+ if(boost::u32regex_search((const unsigned char*)&*text8.begin(), what8c, r, opts))
+ {
+ compare_result(what, what8c, static_cast<boost::mpl::int_<1> const*>(0));
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", UChar32);
+ }
+ }
+ }
+ }
+ //
+ // finally try a grep:
+ //
+ test_icu_grep(r, search_text);
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(const boost::bad_expression& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), UChar32);
+ }
+ catch(const std::runtime_error& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << e.what(), UChar32);
+ }
+ catch(const std::exception& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << e.what(), UChar32);
+ }
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", UChar32);
+ }
+#endif
+}
+
+void test_icu(const wchar_t&, const test_invalid_regex_tag&)
+{
+ //typedef boost::u16_to_u32_iterator<std::wstring::const_iterator, ::UChar32> conv_iterator;
+ std::vector< ::UChar32> expression;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ expression.assign(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end());
+#else
+ std::copy(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end(), std::back_inserter(expression));
+#endif
+ boost::regex_constants::syntax_option_type syntax_options = test_info<wchar_t>::syntax_options();
+ boost::u32regex r;
+ if(*test_locale::c_str())
+ {
+ U_NAMESPACE_QUALIFIER Locale l(test_locale::c_str());
+ if(l.isBogus())
+ return;
+ r.imbue(l);
+ }
+ //
+ // try it with exceptions disabled first:
+ //
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
+ if(0 == r.assign(expression.begin(), expression.end(), syntax_options | boost::regex_constants::no_except).status())
+#else
+ if(expression.size())
+ r.assign(&*expression.begin(), expression.size(), syntax_options | boost::regex_constants::no_except);
+ else
+ r.assign(static_cast<UChar32 const*>(0), static_cast<boost::u32regex::size_type>(0), syntax_options | boost::regex_constants::no_except);
+ if(0 == r.status())
+#endif
+ {
+ BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
+ }
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Unexpected exception thrown.", wchar_t);
+ }
+#endif
+ //
+ // now try again with exceptions:
+ //
+ bool have_catch = false;
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
+ r.assign(expression.begin(), expression.end(), syntax_options);
+#else
+ if(expression.size())
+ r.assign(&*expression.begin(), expression.size(), syntax_options);
+ else
+ r.assign(static_cast<UChar32 const*>(0), static_cast<boost::u32regex::size_type>(0), syntax_options);
+#endif
+#ifdef BOOST_NO_EXCEPTIONS
+ if(r.status())
+ have_catch = true;
+#endif
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(const boost::bad_expression&)
+ {
+ have_catch = true;
+ }
+ catch(const std::runtime_error& e)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << e.what(), wchar_t);
+ }
+ catch(const std::exception& e)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << e.what(), wchar_t);
+ }
+ catch(...)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but got an exception of unknown type instead", wchar_t);
+ }
+#endif
+ if(!have_catch)
+ {
+ // oops expected exception was not thrown:
+ BOOST_REGEX_TEST_ERROR("Expected an exception, but didn't find one.", wchar_t);
+ }
+
+ if(0 == *test_locale::c_str())
+ {
+ //
+ // Now try UTF-16 construction:
+ //
+ typedef boost::u32_to_u16_iterator<std::vector<UChar32>::const_iterator> u16_conv;
+ std::vector<UChar> expression16;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ expression16.assign(u16_conv(expression.begin()), u16_conv(expression.end()));
+#else
+ std::copy(u16_conv(expression.begin()), u16_conv(expression.end()), std::back_inserter(expression16));
+#endif
+ if(0 == boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options | boost::regex_constants::no_except).status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
+ }
+ if(std::find(expression16.begin(), expression16.end(), 0) == expression16.end())
+ {
+ expression16.push_back(0);
+ if(0 == boost::make_u32regex(&*expression16.begin(), syntax_options | boost::regex_constants::no_except).status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
+ }
+ }
+ //
+ // Now try UTF-8 construction:
+ //
+ typedef boost::u32_to_u8_iterator<std::vector<UChar32>::const_iterator> u8_conv;
+ std::vector<unsigned char> expression8;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ expression8.assign(u8_conv(expression.begin()), u8_conv(expression.end()));
+#else
+ std::copy(u8_conv(expression.begin()), u8_conv(expression.end()), std::back_inserter(expression8));
+#endif
+ if(0 == boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options | boost::regex_constants::no_except).status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
+ }
+ if(std::find(expression8.begin(), expression8.end(), 0) == expression8.end())
+ {
+ expression8.push_back(0);
+ if(0 == boost::make_u32regex(&*expression8.begin(), syntax_options | boost::regex_constants::no_except).status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
+ }
+ }
+ }
+}
+
+void test_icu(const wchar_t&, const test_regex_replace_tag&)
+{
+ std::vector< ::UChar32> expression;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ expression.assign(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end());
+#else
+ std::copy(test_info<wchar_t>::expression().begin(), test_info<wchar_t>::expression().end(), std::back_inserter(expression));
+#endif
+ boost::regex_constants::syntax_option_type syntax_options = test_info<UChar32>::syntax_options();
+ boost::u32regex r;
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
+ r.assign(expression.begin(), expression.end(), syntax_options);
+#else
+ if(expression.size())
+ r.assign(&*expression.begin(), expression.size(), syntax_options);
+ else
+ r.assign(static_cast<UChar32 const*>(0), static_cast<boost::u32regex::size_type>(0), syntax_options);
+#endif
+ if(r.status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), UChar32);
+ }
+ typedef std::vector<UChar32> string_type;
+ string_type search_text;
+ boost::regex_constants::match_flag_type opts = test_info<UChar32>::match_options();
+ string_type format_string;
+ string_type result_string;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ search_text.assign(test_info<UChar32>::search_text().begin(), test_info<UChar32>::search_text().end());
+ format_string.assign(test_info<UChar32>::format_string().begin(), test_info<UChar32>::format_string().end());
+ format_string.push_back(0);
+ result_string.assign(test_info<UChar32>::result_string().begin(), test_info<UChar32>::result_string().end());
+#else
+ std::copy(test_info<UChar32>::search_text().begin(), test_info<UChar32>::search_text().end(), std::back_inserter(search_text));
+ std::copy(test_info<UChar32>::format_string().begin(), test_info<UChar32>::format_string().end(), std::back_inserter(format_string));
+ format_string.push_back(0);
+ std::copy(test_info<UChar32>::result_string().begin(), test_info<UChar32>::result_string().end(), std::back_inserter(result_string));
+#endif
+ string_type result;
+
+ boost::u32regex_replace(unnecessary_fix::back_inserter(result), search_text.begin(), search_text.end(), r, &*format_string.begin(), opts);
+ if(result != result_string)
+ {
+ BOOST_REGEX_TEST_ERROR("regex_replace generated an incorrect string result", UChar32);
+ }
+ //
+ // Mixed mode character encoding:
+ //
+ if(0 == *test_locale::c_str())
+ {
+ //
+ // Now try UTF-16 construction:
+ //
+ typedef boost::u32_to_u16_iterator<std::vector<UChar32>::const_iterator> u16_conv;
+ std::vector<UChar> expression16, text16, format16, result16, found16;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ expression16.assign(u16_conv(expression.begin()), u16_conv(expression.end()));
+ text16.assign(u16_conv(search_text.begin()), u16_conv(search_text.end()));
+ format16.assign(u16_conv(format_string.begin()), u16_conv(format_string.end()));
+ result16.assign(u16_conv(result_string.begin()), u16_conv(result_string.end()));
+#else
+ std::copy(u16_conv(expression.begin()), u16_conv(expression.end()), std::back_inserter(expression16));
+ std::copy(u16_conv(search_text.begin()), u16_conv(search_text.end()), std::back_inserter(text16));
+ std::copy(u16_conv(format_string.begin()), u16_conv(format_string.end()), std::back_inserter(format16));
+ std::copy(u16_conv(result_string.begin()), u16_conv(result_string.end()), std::back_inserter(result16));
+#endif
+ r = boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options);
+ boost::u32regex_replace(unnecessary_fix::back_inserter(found16), text16.begin(), text16.end(), r, &*format16.begin(), opts);
+ if(result16 != found16)
+ {
+ BOOST_REGEX_TEST_ERROR("u32regex_replace with UTF-16 string returned incorrect result", UChar32);
+ }
+ //
+ // Now with UnicodeString:
+ //
+ U_NAMESPACE_QUALIFIER UnicodeString expression16u, text16u, format16u, result16u, found16u;
+ if(expression16.size())
+ expression16u.setTo(&*expression16.begin(), expression16.size());
+ if(text16.size())
+ text16u.setTo(&*text16.begin(), text16.size());
+ format16u.setTo(&*format16.begin(), format16.size()-1);
+ if(result16.size())
+ result16u.setTo(&*result16.begin(), result16.size());
+ r = boost::make_u32regex(expression16.begin(), expression16.end(), syntax_options);
+ found16u = boost::u32regex_replace(text16u, r, format16u, opts);
+ if(result16u != found16u)
+ {
+ BOOST_REGEX_TEST_ERROR("u32regex_replace with UTF-16 string returned incorrect result", UChar32);
+ }
+
+ //
+ // Now try UTF-8 construction:
+ //
+ typedef boost::u32_to_u8_iterator<std::vector<UChar32>::const_iterator, unsigned char> u8_conv;
+ std::vector<char> expression8, text8, format8, result8, found8;
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
+ expression8.assign(u8_conv(expression.begin()), u8_conv(expression.end()));
+ text8.assign(u8_conv(search_text.begin()), u8_conv(search_text.end()));
+ format8.assign(u8_conv(format_string.begin()), u8_conv(format_string.end()));
+ result8.assign(u8_conv(result_string.begin()), u8_conv(result_string.end()));
+#else
+ std::copy(u8_conv(expression.begin()), u8_conv(expression.end()), std::back_inserter(expression8));
+ std::copy(u8_conv(search_text.begin()), u8_conv(search_text.end()), std::back_inserter(text8));
+ std::copy(u8_conv(format_string.begin()), u8_conv(format_string.end()), std::back_inserter(format8));
+ std::copy(u8_conv(result_string.begin()), u8_conv(result_string.end()), std::back_inserter(result8));
+#endif
+ r = boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options);
+ boost::u32regex_replace(unnecessary_fix::back_inserter(found8), text8.begin(), text8.end(), r, &*format8.begin(), opts);
+ if(result8 != found8)
+ {
+ BOOST_REGEX_TEST_ERROR("u32regex_replace with UTF-8 string returned incorrect result", UChar32);
+ }
+ //
+ // Now with std::string and UTF-8:
+ //
+ std::string expression8s, text8s, format8s, result8s, found8s;
+ if(expression8.size())
+ expression8s.assign(&*expression8.begin(), expression8.size());
+ if(text8.size())
+ text8s.assign(&*text8.begin(), text8.size());
+ format8s.assign(&*format8.begin(), format8.size()-1);
+ if(result8.size())
+ result8s.assign(&*result8.begin(), result8.size());
+ r = boost::make_u32regex(expression8.begin(), expression8.end(), syntax_options);
+ found8s = boost::u32regex_replace(text8s, r, format8s, opts);
+ if(result8s != found8s)
+ {
+ BOOST_REGEX_TEST_ERROR("u32regex_replace with UTF-8 string returned incorrect result", UChar32);
+ }
+ }
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(const boost::bad_expression& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), UChar32);
+ }
+ catch(const std::runtime_error& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << e.what(), UChar32);
+ }
+ catch(const std::exception& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << e.what(), UChar32);
+ }
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", UChar32);
+ }
+#endif
+}
+
+#else
+
+#include "test.hpp"
+
+void test_icu(const wchar_t&, const test_regex_search_tag&){}
+void test_icu(const wchar_t&, const test_invalid_regex_tag&){}
+void test_icu(const wchar_t&, const test_regex_replace_tag&){}
+
+#endif
+
diff --git a/src/boost/libs/regex/test/regress/test_icu.hpp b/src/boost/libs/regex/test/regress/test_icu.hpp
new file mode 100644
index 000000000..cd90e984f
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_icu.hpp
@@ -0,0 +1,33 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_icu.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: MFC/ATL test handlers.
+ */
+
+#ifndef TEST_ICU_HPP
+#define TEST_ICU_HPP
+
+template <class charT, class Tag>
+void test_icu(const charT&, const Tag&)
+{
+ // do nothing
+}
+
+void test_icu(const wchar_t&, const test_regex_search_tag&);
+void test_icu(const wchar_t&, const test_invalid_regex_tag&);
+void test_icu(const wchar_t&, const test_regex_replace_tag&);
+
+
+#endif
diff --git a/src/boost/libs/regex/test/regress/test_locale.cpp b/src/boost/libs/regex/test/regress/test_locale.cpp
new file mode 100644
index 000000000..54cd56aba
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_locale.cpp
@@ -0,0 +1,220 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+#include <clocale>
+#if defined(BOOST_WINDOWS) && !defined(BOOST_DISABLE_WIN32)
+#include <boost/scoped_array.hpp>
+#include <windows.h>
+#endif
+#include <iostream>
+#include <iomanip>
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{ using ::setlocale; }
+#endif
+
+test_locale::test_locale(const char* c_name, boost::uint32_t lcid)
+{
+#ifndef UNDER_CE
+ // store the name:
+ m_old_name = m_name;
+ m_name = c_name;
+ // back up C locale and then set it's new name:
+ const char* pl = std::setlocale(LC_ALL, 0);
+ m_old_c_locale = pl ? pl : "";
+ m_old_c_state = s_c_locale;
+ if(std::setlocale(LC_ALL, c_name))
+ {
+ s_c_locale = test_with_locale;
+ std::cout << "Testing the global C locale: " << c_name << std::endl;
+ }
+ else
+ {
+ s_c_locale = no_test;
+ std::cout << "The global C locale: " << c_name << " is not available and will not be tested." << std::endl;
+ }
+#else
+ s_c_locale = no_test;
+#endif
+ // Disabled for VC15.7 (and later?) as the C runtime asserts if you pass an invalid
+ // locale name to std::locale, rather than throwing the expected exception.
+#if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_EXCEPTIONS) && !BOOST_WORKAROUND(BOOST_MSVC, > 1913)
+ // back up the C++ locale and create the new one:
+ m_old_cpp_locale = s_cpp_locale_inst;
+ m_old_cpp_state = s_cpp_locale;
+ try{
+ s_cpp_locale_inst = std::locale(c_name);
+ s_cpp_locale = test_with_locale;
+ std::cout << "Testing the C++ locale: " << c_name << std::endl;
+ }
+ catch(std::runtime_error const &)
+ {
+ s_cpp_locale = no_test;
+ std::cout << "The C++ locale: " << c_name << " is not available and will not be tested." << std::endl;
+ }
+#else
+ m_old_cpp_locale = s_cpp_locale_inst;
+ m_old_cpp_state = s_cpp_locale;
+ s_cpp_locale = no_test;
+#endif
+
+ // back up win locale and create the new one:
+ m_old_win_locale = s_win_locale_inst;
+ m_old_win_state = s_win_locale;
+ s_win_locale_inst = lcid;
+#if defined(BOOST_WINDOWS) && !defined(BOOST_DISABLE_WIN32)
+ //
+ // Start by geting the printable name of the locale.
+ // We use this for debugging purposes only:
+ //
+#ifndef BOOST_NO_ANSI_APIS
+ boost::scoped_array<char> p;
+ int r = ::GetLocaleInfoA(
+ lcid, // locale identifier
+ LOCALE_SCOUNTRY, // information type
+ 0, // information buffer
+ 0 // size of buffer
+ );
+ p.reset(new char[r+1]);
+ r = ::GetLocaleInfoA(
+ lcid, // locale identifier
+ LOCALE_SCOUNTRY, // information type
+ p.get(), // information buffer
+ r+1 // size of buffer
+ );
+#else
+ WCHAR code_page_string[7];
+ int r = ::GetLocaleInfoW(
+ lcid,
+ LOCALE_IDEFAULTANSICODEPAGE,
+ code_page_string,
+ 7);
+ BOOST_ASSERT(r != 0);
+
+ UINT code_page = static_cast<UINT>(_wtol(code_page_string));
+
+ boost::scoped_array<wchar_t> wp;
+ r = ::GetLocaleInfoW(
+ lcid, // locale identifier
+ LOCALE_SCOUNTRY, // information type
+ 0, // information buffer
+ 0 // size of buffer
+ );
+ wp.reset(new wchar_t[r+1]);
+ r = ::GetLocaleInfoW(
+ lcid, // locale identifier
+ LOCALE_SCOUNTRY, // information type
+ wp.get(), // information buffer
+ r+1 // size of buffer
+ );
+
+ int name_size = (r+1) * 2;
+ boost::scoped_array<char> p(new char[name_size]);
+ int conv_r = ::WideCharToMultiByte(
+ code_page,
+ 0,
+ wp.get(), r,
+ p.get(), name_size,
+ NULL, NULL
+ );
+ BOOST_ASSERT(conv_r != 0);
+#endif
+ //
+ // now see if locale is installed and behave accordingly:
+ //
+ if(::IsValidLocale(lcid, LCID_INSTALLED))
+ {
+ s_win_locale = test_with_locale;
+ std::cout << "Testing the Win32 locale: \"" << p.get() << "\" (0x" << std::hex << lcid << ")" << std::endl;
+ }
+ else
+ {
+ s_win_locale = no_test;
+ std::cout << "The Win32 locale: \"" << p.get() << "\" (0x" << std::hex << lcid << ") is not available and will not be tested." << std::endl;
+ }
+#else
+ s_win_locale = no_test;
+#endif
+}
+
+test_locale::~test_locale()
+{
+ // restore to previous state:
+#ifndef UNDER_CE
+ std::setlocale(LC_ALL, m_old_c_locale.c_str());
+ s_c_locale = m_old_c_state;
+#endif
+#ifndef BOOST_NO_STD_LOCALE
+ s_cpp_locale_inst = m_old_cpp_locale;
+#endif
+ s_cpp_locale = m_old_cpp_state;
+ s_win_locale_inst = m_old_win_locale;
+ s_win_locale = m_old_win_state;
+ m_name = m_old_name;
+}
+
+int test_locale::s_c_locale = test_no_locale;
+int test_locale::s_cpp_locale = test_no_locale;
+int test_locale::s_win_locale = test_no_locale;
+#ifndef BOOST_NO_STD_LOCALE
+std::locale test_locale::s_cpp_locale_inst;
+#endif
+boost::uint32_t test_locale::s_win_locale_inst = 0;
+std::string test_locale::m_name;
+
+
+void test_en_locale(const char* name, boost::uint32_t lcid)
+{
+ using namespace boost::regex_constants;
+ errors_as_warnings w;
+ test_locale l(name, lcid);
+ TEST_REGEX_SEARCH_L("[[:lower:]]+", perl, "\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xf7", match_default, make_array(1, 32, -2, -2));
+ TEST_REGEX_SEARCH_L("[[:upper:]]+", perl, "\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf", match_default, make_array(1, 31, -2, -2));
+// TEST_REGEX_SEARCH_L("[[:punct:]]+", perl, "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0", match_default, make_array(0, 31, -2, -2));
+ TEST_REGEX_SEARCH_L("[[:print:]]+", perl, "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe", match_default, make_array(0, 93, -2, -2));
+ TEST_REGEX_SEARCH_L("[[:graph:]]+", perl, "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe", match_default, make_array(0, 93, -2, -2));
+ TEST_REGEX_SEARCH_L("[[:word:]]+", perl, "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe", match_default, make_array(0, 61, -2, -2));
+ // collation sensitive ranges:
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
+ // these tests are disabled for Borland C++: a bug in std::collate<wchar_t>
+ // causes these tests to crash (pointer overrun in std::collate<wchar_t>::do_transform).
+ TEST_REGEX_SEARCH_L("[a-z]+", perl|::boost::regex_constants::collate, "\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc", match_default, make_array(0, 28, -2, -2));
+ TEST_REGEX_SEARCH_L("[a-z]+", perl|::boost::regex_constants::collate, "\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc", match_default, make_array(1, 28, -2, -2));
+ if (lcid != 0x09)
+ {
+ // and equivalence classes, these fail for locale "en" but pass for "en_UK" and "en_US":
+ TEST_REGEX_SEARCH_L("[[=a=]]+", perl, "aA\xe0\xe1\xe2\xe3\xe4\xe5\xc0\xc1\xc2\xc3\xc4\xc5", match_default, make_array(0, 14, -2, -2));
+ }
+ // case mapping:
+ TEST_REGEX_SEARCH_L("[A-Z]+", perl|icase|::boost::regex_constants::collate, "\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc", match_default, make_array(0, 28, -2, -2));
+ TEST_REGEX_SEARCH_L("[a-z]+", perl|icase|::boost::regex_constants::collate, "\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc", match_default, make_array(1, 28, -2, -2));
+ TEST_REGEX_SEARCH_L("\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd", perl|icase, "\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe", match_default, make_array(1, 30, -2, -2));
+#endif
+}
+
+void test_en_locale()
+{
+ // VC6 seems to have problems with std::setlocale, I've never
+ // gotten to the bottem of this as the program runs fine under the
+ // debugger, but hangs when run from bjam:
+#if !BOOST_WORKAROUND(BOOST_MSVC, <1300) && !(defined(__ICL) && defined(_MSC_VER) && (_MSC_VER == 1200))
+ test_en_locale("en_US", 0x09 | 0x01 << 10);
+ test_en_locale("en_UK", 0x09 | 0x02 << 10);
+ test_en_locale("en", 0x09);
+#endif
+}
+
+
diff --git a/src/boost/libs/regex/test/regress/test_locale.hpp b/src/boost/libs/regex/test/regress/test_locale.hpp
new file mode 100644
index 000000000..dfc72d78f
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_locale.hpp
@@ -0,0 +1,90 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_locale.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Helper classes for testing locale-specific expressions.
+ */
+
+
+#ifndef BOOST_REGEX_REGRESS_TEST_LOCALE_HPP
+#define BOOST_REGEX_REGRESS_TEST_LOCALE_HPP
+//
+// defines class test_locale that handles the locale used for testing:
+//
+class test_locale
+{
+public:
+ enum{
+ no_test,
+ test_no_locale,
+ test_with_locale
+ };
+
+ test_locale(const char* c_name, boost::uint32_t lcid);
+ ~test_locale();
+
+ static int c_locale_state()
+ {
+ return s_c_locale;
+ }
+ static int cpp_locale_state()
+ {
+ return s_cpp_locale;
+ }
+ static int win_locale_state()
+ {
+ return s_win_locale;
+ }
+ static const char* c_str()
+ {
+ return m_name.c_str();
+ }
+#ifndef BOOST_NO_STD_LOCALE
+ static std::locale cpp_locale()
+ {
+ return s_cpp_locale_inst;
+ }
+#endif
+ static boost::uint32_t win_locale()
+ {
+ return s_win_locale_inst;
+ }
+
+private:
+ // the actions to take for each locale type:
+ static int s_c_locale;
+ static int s_cpp_locale;
+ static int s_win_locale;
+ // current locales:
+#ifndef BOOST_NO_STD_LOCALE
+ static std::locale s_cpp_locale_inst;
+#endif
+ static boost::uint32_t s_win_locale_inst;
+ static std::string m_name;
+
+ // backed up versions of the previous locales and their action state:
+ std::string m_old_c_locale;
+ std::string m_old_name;
+ int m_old_c_state;
+#ifndef BOOST_NO_STD_LOCALE
+ std::locale m_old_cpp_locale;
+#endif
+ int m_old_cpp_state;
+ boost::uint32_t m_old_win_locale;
+ int m_old_win_state;
+
+};
+
+#endif
+
diff --git a/src/boost/libs/regex/test/regress/test_mfc.cpp b/src/boost/libs/regex/test/regress/test_mfc.cpp
new file mode 100644
index 000000000..0d855cef8
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_mfc.cpp
@@ -0,0 +1,551 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_mfc.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Test code for MFC/ATL strings with Boost.Regex.
+ */
+
+//
+// We can only build this if we have ATL support:
+//
+#include <boost/config.hpp>
+
+#ifdef TEST_MFC
+
+#include <boost/regex/mfc.hpp>
+#include "test.hpp"
+#include "atlstr.h"
+
+#pragma warning(disable:4267)
+
+void test_mfc(const char&, const test_regex_search_tag&)
+{
+ const std::string& ss = test_info<char>::search_text();
+ const std::string& ss2 = test_info<char>::expression();
+ CAtlStringA s(ss.c_str(), ss.size());
+ CAtlStringA s2(ss2.c_str(), ss2.size());
+ boost::regex_constants::match_flag_type opts = test_info<char>::match_options();
+ const int* answer_table = test_info<char>::answer_table();
+ boost::regex r = boost::make_regex(s2, test_info<char>::syntax_options());
+ boost::cmatch what;
+ if(boost::regex_search(
+ s,
+ what,
+ r,
+ opts))
+ {
+ test_result(what, s.GetString(), answer_table);
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", char);
+ }
+ //
+ // regex_match tests:
+ //
+ if(answer_table[0] < 0)
+ {
+ if(boost::regex_match(s, r, opts))
+ {
+ BOOST_REGEX_TEST_ERROR("boost::regex_match found a match when it should not have done so.", char);
+ }
+ }
+ else
+ {
+ if((answer_table[0] > 0) && boost::regex_match(s, r, opts))
+ {
+ BOOST_REGEX_TEST_ERROR("boost::regex_match found a match when it should not have done so.", char);
+ }
+ else if((answer_table[0] == 0) && (answer_table[1] == static_cast<int>(ss.size())))
+ {
+ if(boost::regex_match(
+ s,
+ what,
+ r,
+ opts))
+ {
+ test_result(what, s.GetString(), answer_table);
+ if(!boost::regex_match(s, r, opts))
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", char);
+ }
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", char);
+ }
+ }
+ }
+ //
+ // test regex_iterator:
+ //
+ boost::cregex_iterator start(boost::make_regex_iterator(s, r, opts)), end;
+ boost::cregex_iterator copy(start);
+ while(start != end)
+ {
+ if(start != copy)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", char);
+ }
+ if(!(start == copy))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", char);
+ }
+ test_result(*start, s.GetString(), answer_table);
+ ++start;
+ ++copy;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", char);
+ }
+ //
+ // test regex_token_iterator:
+ //
+ typedef boost::regex_token_iterator<const char*> token_iterator;
+ answer_table = test_info<char>::answer_table();
+ //
+ // we start by testing sub-expression 0:
+ //
+ token_iterator tstart(boost::make_regex_token_iterator(s, r, 0, opts)), tend;
+ token_iterator tcopy(tstart);
+ while(tstart != tend)
+ {
+ if(tstart != tcopy)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", char);
+ }
+ if(!(tstart == tcopy))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", char);
+ }
+ test_sub_match(*tstart, s.GetString(), answer_table, 0);
+ ++tstart;
+ ++tcopy;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", char);
+ }
+ //
+ // and now field spitting:
+ //
+ token_iterator tstart2(boost::make_regex_token_iterator(s, r, -1, opts)), tend2;
+ token_iterator tcopy2(tstart2);
+ int last_end2 = 0;
+ answer_table = test_info<char>::answer_table();
+ while(tstart2 != tend2)
+ {
+ if(tstart2 != tcopy2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", char);
+ }
+ if(!(tstart2 == tcopy2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", char);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4244)
+#endif
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->first) != last_end2)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of start of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->first)
+ << ", expected: "
+ << last_end2
+ << ".", char);
+ }
+ int expected_end = static_cast<int>(answer_table[0] < 0 ? s.GetLength() : answer_table[0]);
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->second) != expected_end)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of end2 of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->second)
+ << ", expected: "
+ << expected_end
+ << ".", char);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+ last_end2 = answer_table[1];
+ ++tstart2;
+ ++tcopy2;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", char);
+ }
+
+}
+
+void test_mfc(const wchar_t&, const test_regex_search_tag&)
+{
+ const std::wstring& ss = test_info<wchar_t>::search_text();
+ const std::wstring& ss2 = test_info<wchar_t>::expression();
+ CAtlStringW s(ss.c_str(), ss.size());
+ CAtlStringW s2(ss2.c_str(), ss2.size());
+ boost::regex_constants::match_flag_type opts = test_info<wchar_t>::match_options();
+ const int* answer_table = test_info<wchar_t>::answer_table();
+ boost::wregex r = boost::make_regex(s2, test_info<wchar_t>::syntax_options());
+ boost::wcmatch what;
+ if(boost::regex_search(
+ s,
+ what,
+ r,
+ opts))
+ {
+ test_result(what, s.GetString(), answer_table);
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", wchar_t);
+ }
+ //
+ // regex_match tests:
+ //
+ if(answer_table[0] < 0)
+ {
+ if(boost::regex_match(s, r, opts))
+ {
+ BOOST_REGEX_TEST_ERROR("boost::regex_match found a match when it should not have done so.", wchar_t);
+ }
+ }
+ else
+ {
+ if((answer_table[0] > 0) && boost::regex_match(s, r, opts))
+ {
+ BOOST_REGEX_TEST_ERROR("boost::regex_match found a match when it should not have done so.", wchar_t);
+ }
+ else if((answer_table[0] == 0) && (answer_table[1] == static_cast<int>(ss.size())))
+ {
+ if(boost::regex_match(
+ s,
+ what,
+ r,
+ opts))
+ {
+ test_result(what, s.GetString(), answer_table);
+ if(!boost::regex_match(s, r, opts))
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", wchar_t);
+ }
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", wchar_t);
+ }
+ }
+ }
+ //
+ // test regex_iterator:
+ //
+ boost::wcregex_iterator start(boost::make_regex_iterator(s, r, opts)), end;
+ boost::wcregex_iterator copy(start);
+ while(start != end)
+ {
+ if(start != copy)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", wchar_t);
+ }
+ if(!(start == copy))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", wchar_t);
+ }
+ test_result(*start, s.GetString(), answer_table);
+ ++start;
+ ++copy;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", wchar_t);
+ }
+ //
+ // test regex_token_iterator:
+ //
+ typedef boost::regex_token_iterator<const wchar_t*> token_iterator;
+ answer_table = test_info<wchar_t>::answer_table();
+ //
+ // we start by testing sub-expression 0:
+ //
+ token_iterator tstart(boost::make_regex_token_iterator(s, r, 0, opts)), tend;
+ token_iterator tcopy(tstart);
+ while(tstart != tend)
+ {
+ if(tstart != tcopy)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", wchar_t);
+ }
+ if(!(tstart == tcopy))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", wchar_t);
+ }
+ test_sub_match(*tstart, s.GetString(), answer_table, 0);
+ ++tstart;
+ ++tcopy;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", wchar_t);
+ }
+ //
+ // and now field spitting:
+ //
+ token_iterator tstart2(boost::make_regex_token_iterator(s, r, -1, opts)), tend2;
+ token_iterator tcopy2(tstart2);
+ int last_end2 = 0;
+ answer_table = test_info<wchar_t>::answer_table();
+ while(tstart2 != tend2)
+ {
+ if(tstart2 != tcopy2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", wchar_t);
+ }
+ if(!(tstart2 == tcopy2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", wchar_t);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4244)
+#endif
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->first) != last_end2)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of start of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->first)
+ << ", expected: "
+ << last_end2
+ << ".", wchar_t);
+ }
+ int expected_end = static_cast<int>(answer_table[0] < 0 ? s.GetLength() : answer_table[0]);
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->second) != expected_end)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of end2 of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->second)
+ << ", expected: "
+ << expected_end
+ << ".", wchar_t);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+ last_end2 = answer_table[1];
+ ++tstart2;
+ ++tcopy2;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", wchar_t);
+ }
+
+}
+
+void test_mfc(const char&, const test_invalid_regex_tag&)
+{
+ std::string ss = test_info<char>::expression();
+ CAtlStringA s(ss.c_str(), ss.size());
+ bool have_catch = false;
+ try{
+ boost::regex e = boost::make_regex(s, test_info<char>::syntax_options());
+ if(e.error_code())
+ have_catch = true;
+ }
+ catch(const boost::bad_expression&)
+ {
+ have_catch = true;
+ }
+ catch(const std::runtime_error& r)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << r.what(), char);
+ }
+ catch(const std::exception& r)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << r.what(), char);
+ }
+ catch(...)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but got an exception of unknown type instead", char);
+ }
+ if(!have_catch)
+ {
+ // oops expected exception was not thrown:
+ BOOST_REGEX_TEST_ERROR("Expected an exception, but didn't find one.", char);
+ }
+
+}
+
+void test_mfc(const wchar_t&, const test_invalid_regex_tag&)
+{
+ std::wstring ss = test_info<wchar_t>::expression();
+ CAtlStringW s(ss.c_str(), ss.size());
+ bool have_catch = false;
+ try{
+ boost::wregex e = boost::make_regex(s, test_info<wchar_t>::syntax_options());
+ if(e.error_code())
+ have_catch = true;
+ }
+ catch(const boost::bad_expression&)
+ {
+ have_catch = true;
+ }
+ catch(const std::runtime_error& r)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << r.what(), wchar_t);
+ }
+ catch(const std::exception& r)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << r.what(), wchar_t);
+ }
+ catch(...)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but got an exception of unknown type instead", wchar_t);
+ }
+ if(!have_catch)
+ {
+ // oops expected exception was not thrown:
+ BOOST_REGEX_TEST_ERROR("Expected an exception, but didn't find one.", wchar_t);
+ }
+}
+
+void test_mfc(const char&, const test_regex_replace_tag&)
+{
+ const CStringA expression(test_info<char>::expression().c_str(), test_info<char>::expression().size());
+ boost::regex_constants::syntax_option_type syntax_options = test_info<char>::syntax_options();
+ try{
+ boost::regex r = boost::make_regex(expression, syntax_options);
+ if(r.status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), char);
+ }
+ const CStringA search_text(test_info<char>::search_text().c_str(), test_info<char>::search_text().size());
+ boost::regex_constants::match_flag_type opts = test_info<char>::match_options();
+ const CStringA format_string(test_info<char>::format_string().c_str(), test_info<char>::format_string().size());
+ const CStringA result_string(test_info<char>::result_string().c_str(), test_info<char>::result_string().size());
+
+ CStringA result = boost::regex_replace(search_text, r, format_string, opts);
+ if(result != result_string)
+ {
+ BOOST_REGEX_TEST_ERROR("regex_replace generated an incorrect string result", char);
+ }
+ }
+ catch(const boost::bad_expression& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), char);
+ }
+ catch(const std::runtime_error& r)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << r.what(), char);
+ }
+ catch(const std::exception& r)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << r.what(), char);
+ }
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", char);
+ }
+}
+
+void test_mfc(const wchar_t&, const test_regex_replace_tag&)
+{
+ const CStringW expression(test_info<wchar_t>::expression().c_str(), test_info<wchar_t>::expression().size());
+ boost::regex_constants::syntax_option_type syntax_options = test_info<wchar_t>::syntax_options();
+ try{
+ boost::wregex r = boost::make_regex(expression, syntax_options);
+ if(r.status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), wchar_t);
+ }
+ const CStringW search_text(test_info<wchar_t>::search_text().c_str(), test_info<wchar_t>::search_text().size());
+ boost::regex_constants::match_flag_type opts = test_info<wchar_t>::match_options();
+ const CStringW format_string(test_info<wchar_t>::format_string().c_str(), test_info<wchar_t>::format_string().size());
+ const CStringW result_string(test_info<wchar_t>::result_string().c_str(), test_info<wchar_t>::result_string().size());
+
+ CStringW result = boost::regex_replace(search_text, r, format_string, opts);
+ if(result != result_string)
+ {
+ BOOST_REGEX_TEST_ERROR("regex_replace generated an incorrect string result", wchar_t);
+ }
+ }
+ catch(const boost::bad_expression& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), wchar_t);
+ }
+ catch(const std::runtime_error& r)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << r.what(), wchar_t);
+ }
+ catch(const std::exception& r)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << r.what(), wchar_t);
+ }
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", wchar_t);
+ }
+}
+
+#else
+
+#include "test.hpp"
+
+void test_mfc(const char&, const test_regex_search_tag&){}
+void test_mfc(const wchar_t&, const test_regex_search_tag&){}
+void test_mfc(const char&, const test_invalid_regex_tag&){}
+void test_mfc(const wchar_t&, const test_invalid_regex_tag&){}
+void test_mfc(const char&, const test_regex_replace_tag&){}
+void test_mfc(const wchar_t&, const test_regex_replace_tag&){}
+
+
+#endif
diff --git a/src/boost/libs/regex/test/regress/test_mfc.hpp b/src/boost/libs/regex/test/regress/test_mfc.hpp
new file mode 100644
index 000000000..befee1c78
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_mfc.hpp
@@ -0,0 +1,36 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_mfc.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: MFC/ATL test handlers.
+ */
+
+#ifndef TEST_MFC_HPP
+#define TEST_MFC_HPP
+
+template <class charT, class Tag>
+void test_mfc(const charT&, const Tag&)
+{
+ // do nothing
+}
+
+void test_mfc(const char&, const test_regex_search_tag&);
+void test_mfc(const wchar_t&, const test_regex_search_tag&);
+void test_mfc(const char&, const test_invalid_regex_tag&);
+void test_mfc(const wchar_t&, const test_invalid_regex_tag&);
+void test_mfc(const char&, const test_regex_replace_tag&);
+void test_mfc(const wchar_t&, const test_regex_replace_tag&);
+
+
+#endif
diff --git a/src/boost/libs/regex/test/regress/test_non_greedy_repeats.cpp b/src/boost/libs/regex/test/regress/test_non_greedy_repeats.cpp
new file mode 100644
index 000000000..3196f5acd
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_non_greedy_repeats.cpp
@@ -0,0 +1,45 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_non_greedy_repeats()
+{
+ //
+ // non-greedy repeats added 21/04/00
+ //
+ using namespace boost::regex_constants;
+ TEST_REGEX_SEARCH("a*?", perl, "aa", match_default, make_array(0, 0, -2, 0, 1, -2, 1, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("^a*?$", perl, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^.*?$", perl, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^(a)*?$", perl, "aa", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("^[ab]*?$", perl, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a??", perl, "aa", match_default, make_array(0, 0, -2, 0, 1, -2, 1, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("a+?", perl, "aa", match_default, make_array(0, 1, -2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{1,3}?", perl, "aaa", match_default, make_array(0, 1, -2, 1, 2, -2, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\w+?w", perl, "...ccccccwcccccw", match_default, make_array(3, 10, -2, 10, 16, -2, -2));
+ TEST_REGEX_SEARCH("\\W+\\w+?w", perl, "...ccccccwcccccw", match_default, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH("abc|\\w+?", perl, "abd", match_default, make_array(0, 1, -2, 1, 2, -2, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("abc|\\w+?", perl, "abcd", match_default, make_array(0, 3, -2, 3, 4, -2, -2));
+ TEST_REGEX_SEARCH("<\\s*tag[^>]*>(.*?)<\\s*/tag\\s*>", perl, " <tag>here is some text</tag> <tag></tag>", match_default, make_array(1, 29, 6, 23, -2, 30, 41, 35, 35, -2, -2));
+ TEST_REGEX_SEARCH("<\\s*tag[^>]*>(.*?)<\\s*/tag\\s*>", perl, " < tag attr=\"something\">here is some text< /tag > <tag></tag>", match_default, make_array(1, 49, 24, 41, -2, 50, 61, 55, 55, -2, -2));
+ TEST_REGEX_SEARCH("xx-{0,2}?(?:[+-][0-9])??\\z", perl, "xx--", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("xx.{0,2}?(?:[+-][0-9])??\\z", perl, "xx--", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("xx.{0,2}?(?:[+-][0-9])??\\z", perl, "xx--", match_default|match_not_dot_newline, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("xx[/-]{0,2}?(?:[+-][0-9])??\\z", perl, "xx--", match_default, make_array(0, 4, -2, -2));
+ TEST_INVALID_REGEX("a{1,3}{1}", perl);
+ TEST_INVALID_REGEX("a**", perl);
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_not_regex.hpp b/src/boost/libs/regex/test/regress/test_not_regex.hpp
new file mode 100644
index 000000000..24c22ff38
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_not_regex.hpp
@@ -0,0 +1,127 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_not_regex.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares tests for invalid regexes.
+ */
+
+
+#ifndef BOOST_REGEX_REGRESS_TEST_NOT_REGEX_HPP
+#define BOOST_REGEX_REGRESS_TEST_NOT_REGEX_HPP
+#include "info.hpp"
+//
+// this file implements a test for a regular expression that should not compile:
+//
+struct test_invalid_regex_tag{};
+
+template<class charT, class traits>
+void test_empty(boost::basic_regex<charT, traits>& r)
+{
+ if(!r.empty())
+ {
+ BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::empty().", charT);
+ }
+ if(r.size())
+ {
+ BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::size().", charT);
+ }
+ if(r.str().size())
+ {
+ BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::str().", charT);
+ }
+ if(r.begin() != r.end())
+ {
+ BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::begin().", charT);
+ }
+ if(r.status() == 0)
+ {
+ BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::status().", charT);
+ }
+ if(r.begin() != r.end())
+ {
+ BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::begin().", charT);
+ }
+}
+
+template<class charT, class traits>
+void test(boost::basic_regex<charT, traits>& r, const test_invalid_regex_tag&)
+{
+ const std::basic_string<charT>& expression = test_info<charT>::expression();
+ boost::regex_constants::syntax_option_type syntax_options = test_info<charT>::syntax_options();
+ //
+ // try it with exceptions disabled first:
+ //
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+ if(0 == r.assign(expression, syntax_options | boost::regex_constants::no_except).status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", charT);
+ }
+ test_empty(r);
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Unexpected exception thrown.", charT);
+ }
+#endif
+ //
+ // now try again with exceptions:
+ //
+ bool have_catch = false;
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+ r.assign(expression, syntax_options);
+#ifdef BOOST_NO_EXCEPTIONS
+ if(r.status())
+ have_catch = true;
+#endif
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(const boost::bad_expression&)
+ {
+ have_catch = true;
+ test_empty(r);
+ }
+ catch(const std::runtime_error& e)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << e.what(), charT);
+ }
+ catch(const std::exception& e)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << e.what(), charT);
+ }
+ catch(...)
+ {
+ have_catch = true;
+ BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but got an exception of unknown type instead", charT);
+ }
+#endif
+ if(!have_catch)
+ {
+ // oops expected exception was not thrown:
+ BOOST_REGEX_TEST_ERROR("Expected an exception, but didn't find one.", charT);
+ }
+
+}
+
+
+
+#endif
diff --git a/src/boost/libs/regex/test/regress/test_operators.cpp b/src/boost/libs/regex/test/regress/test_operators.cpp
new file mode 100644
index 000000000..2f4a017bd
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_operators.cpp
@@ -0,0 +1,178 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+#include <iostream>
+#include <iomanip>
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)\
+ && !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))\
+ && !(defined(__GNUC__) && (__GNUC__ < 3) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)))
+
+template <class T1, class T2>
+void test_less(const T1& t1, const T2& t2)
+{
+ if(!(t1 < t2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed < comparison", char);
+ }
+ if(!(t1 <= t2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed <= comparison", char);
+ }
+ if(!(t1 != t2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed != comparison", char);
+ }
+ if(t1 == t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed == comparison", char);
+ }
+ if(t1 >= t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed >= comparison", char);
+ }
+ if(t1 > t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed > comparison", char);
+ }
+}
+
+template <class T1, class T2>
+void test_greater(const T1& t1, const T2& t2)
+{
+ if(t1 < t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed < comparison", char);
+ }
+ if(t1 <= t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed <= comparison", char);
+ }
+ if(!(t1 != t2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed != comparison", char);
+ }
+ if(t1 == t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed == comparison", char);
+ }
+ if(!(t1 >= t2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed >= comparison", char);
+ }
+ if(!(t1 > t2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed > comparison", char);
+ }
+}
+
+template <class T1, class T2>
+void test_equal(const T1& t1, const T2& t2)
+{
+ if(t1 < t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed < comparison", char);
+ }
+ if(!(t1 <= t2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed <= comparison", char);
+ }
+ if(t1 != t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed != comparison", char);
+ }
+ if(!(t1 == t2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed == comparison", char);
+ }
+ if(!(t1 >= t2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed >= comparison", char);
+ }
+ if(t1 > t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed > comparison", char);
+ }
+}
+
+template <class T1, class T2, class T3>
+void test_plus(const T1& t1, const T2& t2, const T3& t3)
+{
+ if(t1 + t2 != t3)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed addition", char);
+ }
+ if(t3 != t1 + t2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed addition", char);
+ }
+}
+
+void test_operators()
+{
+ test_info<char>::set_typename("sub_match operators");
+
+ std::string s1("a");
+ std::string s2("b");
+ boost::sub_match<std::string::const_iterator> sub1, sub2;
+ sub1.first = s1.begin();
+ sub1.second = s1.end();
+ sub1.matched = true;
+ sub2.first = s2.begin();
+ sub2.second = s2.end();
+ sub2.matched = true;
+
+ test_less(sub1, sub2);
+ test_less(sub1, s2.c_str());
+ test_less(s1.c_str(), sub2);
+ test_less(sub1, *s2.c_str());
+ test_less(*s1.c_str(), sub2);
+ test_less(sub1, s2);
+ test_less(s1, sub2);
+ test_greater(sub2, sub1);
+ test_greater(sub2, s1.c_str());
+ test_greater(s2.c_str(), sub1);
+ test_greater(sub2, *s1.c_str());
+ test_greater(*s2.c_str(), sub1);
+ test_greater(sub2, s1);
+ test_greater(s2, sub1);
+ test_equal(sub1, sub1);
+ test_equal(sub1, s1.c_str());
+ test_equal(s1.c_str(), sub1);
+ test_equal(sub1, *s1.c_str());
+ test_equal(*s1.c_str(), sub1);
+ test_equal(sub1, s1);
+ test_equal(s1, sub1);
+ test_plus(sub2, sub1, "ba");
+ test_plus(sub2, s1.c_str(), "ba");
+ test_plus(s2.c_str(), sub1, "ba");
+ test_plus(sub2, *s1.c_str(), "ba");
+ test_plus(*s2.c_str(), sub1, "ba");
+ test_plus(sub2, s1, "ba");
+ test_plus(s2, sub1, "ba");
+}
+
+#else
+
+#include <iostream>
+
+void test_operators()
+{
+ std::cout <<
+ "\n<note>\n"
+ "This compiler version does not support the sub_match comparison operators\n"
+ "tests for these operators are not carried out\n"
+ "</note>\n";
+}
+
+#endif
+
diff --git a/src/boost/libs/regex/test/regress/test_overloads.cpp b/src/boost/libs/regex/test/regress/test_overloads.cpp
new file mode 100644
index 000000000..847cd4983
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_overloads.cpp
@@ -0,0 +1,56 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#define BOOST_REGEX_TEST(x)\
+ if(!(x)){ BOOST_REGEX_TEST_ERROR("Error in: " BOOST_STRINGIZE(x), char); }
+
+void test_overloads()
+{
+ test_info<char>::set_typename("sub_match operators");
+
+ // test all the available overloads with *one* simple
+ // expression, doing all these tests with all the test
+ // cases would just take to long...
+
+ boost::regex e("abc");
+ std::string s("abc");
+ const std::string& cs = s;
+ boost::smatch sm;
+ boost::cmatch cm;
+ // regex_match:
+ BOOST_REGEX_TEST(boost::regex_match(cs.begin(), cs.end(), sm, e))
+ BOOST_REGEX_TEST(boost::regex_match(cs.begin(), cs.end(), sm, e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_match(cs.begin(), cs.end(), e))
+ BOOST_REGEX_TEST(boost::regex_match(cs.begin(), cs.end(), e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_match(s.c_str(), cm, e))
+ BOOST_REGEX_TEST(boost::regex_match(s.c_str(), cm, e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_match(s.c_str(), e))
+ BOOST_REGEX_TEST(boost::regex_match(s.c_str(), e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_match(s, sm, e))
+ BOOST_REGEX_TEST(boost::regex_match(s, sm, e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_match(s, e))
+ BOOST_REGEX_TEST(boost::regex_match(s, e, boost::regex_constants::match_default))
+ // regex_search:
+ BOOST_REGEX_TEST(boost::regex_search(cs.begin(), cs.end(), sm, e))
+ BOOST_REGEX_TEST(boost::regex_search(cs.begin(), cs.end(), sm, e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_search(cs.begin(), cs.end(), e))
+ BOOST_REGEX_TEST(boost::regex_search(cs.begin(), cs.end(), e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_search(s.c_str(), cm, e))
+ BOOST_REGEX_TEST(boost::regex_search(s.c_str(), cm, e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_search(s.c_str(), e))
+ BOOST_REGEX_TEST(boost::regex_search(s.c_str(), e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_search(s, sm, e))
+ BOOST_REGEX_TEST(boost::regex_search(s, sm, e, boost::regex_constants::match_default))
+ BOOST_REGEX_TEST(boost::regex_search(s, e))
+ BOOST_REGEX_TEST(boost::regex_search(s, e, boost::regex_constants::match_default))
+}
diff --git a/src/boost/libs/regex/test/regress/test_partial_match.hpp b/src/boost/libs/regex/test/regress/test_partial_match.hpp
new file mode 100644
index 000000000..19e45866e
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_partial_match.hpp
@@ -0,0 +1,389 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_regex_search.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares tests for regex search and iteration.
+ */
+
+#ifndef BOOST_REGEX_REGRESS_REGEX_PARTIAL_MATCH_HPP
+#define BOOST_REGEX_REGRESS_REGEX_PARTIAL_MATCH_HPP
+#include "info.hpp"
+//
+// this file implements a test for a regular expression that should compile,
+// followed by a search for that expression:
+//
+struct test_regex_search_tag{};
+
+template <class BidirectionalIterator>
+void test_sub_match(const boost::sub_match<BidirectionalIterator>& sub, BidirectionalIterator base, const int* answer_table, int i)
+{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4244)
+#endif
+ typedef typename boost::sub_match<BidirectionalIterator>::value_type charT;
+ if((sub.matched == 0)
+ &&
+ !((i == 0)
+ && (test_info<charT>::match_options() & boost::match_partial)) )
+ {
+ if(answer_table[2*i] >= 0)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Sub-expression " << i
+ << " was not matched when it should have been.", charT);
+ }
+ }
+ else
+ {
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.first) != answer_table[2*i])
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in start location of sub-expression "
+ << i << ", found " << boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.first)
+ << ", expected " << answer_table[2*i] << ".", charT);
+ }
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.second) != answer_table[1+ 2*i])
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in end location of sub-expression "
+ << i << ", found " << boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.second)
+ << ", expected " << answer_table[1 + 2*i] << ".", charT);
+ }
+ }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+}
+
+template <class BidirectionalIterator, class Allocator>
+void test_result(const boost::match_results<BidirectionalIterator, Allocator>& what, BidirectionalIterator base, const int* answer_table)
+{
+ for(unsigned i = 0; i < what.size(); ++i)
+ {
+ test_sub_match(what[i], base, answer_table, i);
+ }
+}
+
+template<class charT, class traits>
+void test_simple_search(boost::basic_regex<charT, traits>& r)
+{
+ typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ boost::match_results<const_iterator> what;
+ if(boost::regex_search(
+ search_text.begin(),
+ search_text.end(),
+ what,
+ r,
+ opts))
+ {
+ test_result(what, search_text.begin(), answer_table);
+ // setting match_any should have no effect on the result returned:
+ if(!boost::regex_search(
+ search_text.begin(),
+ search_text.end(),
+ r,
+ opts|boost::regex_constants::match_any))
+ {
+ BOOST_REGEX_TEST_ERROR("Expected match was not found when using the match_any flag.", charT);
+ }
+ }
+ else
+ {
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+ // setting match_any should have no effect on the result returned:
+ else if(boost::regex_search(
+ search_text.begin(),
+ search_text.end(),
+ r,
+ opts|boost::regex_constants::match_any))
+ {
+ BOOST_REGEX_TEST_ERROR("Unexpected match was found when using the match_any flag.", charT);
+ }
+ }
+}
+
+template<class charT, class traits>
+void test_regex_iterator(boost::basic_regex<charT, traits>& r)
+{
+ typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ typedef boost::regex_iterator<const_iterator, charT, traits> test_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ test_iterator start(search_text.begin(), search_text.end(), r, opts), end;
+ test_iterator copy(start);
+ const_iterator last_end = search_text.begin();
+ while(start != end)
+ {
+ if(start != copy)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", charT);
+ }
+ if(!(start == copy))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", charT);
+ }
+ test_result(*start, search_text.begin(), answer_table);
+ // test $` and $' :
+ if(start->prefix().first != last_end)
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for start of $`", charT);
+ }
+ if(start->prefix().second != (*start)[0].first)
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for end of $`", charT);
+ }
+ if(start->prefix().matched != (start->prefix().first != start->prefix().second))
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for matched member of $`", charT);
+ }
+ if(start->suffix().first != (*start)[0].second)
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for start of $'", charT);
+ }
+ if(start->suffix().second != search_text.end())
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for end of $'", charT);
+ }
+ if(start->suffix().matched != (start->suffix().first != start->suffix().second))
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for matched member of $'", charT);
+ }
+ last_end = (*start)[0].second;
+ ++start;
+ ++copy;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+}
+
+template<class charT, class traits>
+void test_regex_token_iterator(boost::basic_regex<charT, traits>& r)
+{
+ typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ typedef boost::regex_token_iterator<const_iterator, charT, traits> test_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ //
+ // we start by testing sub-expression 0:
+ //
+ test_iterator start(search_text.begin(), search_text.end(), r, 0, opts), end;
+ test_iterator copy(start);
+ while(start != end)
+ {
+ if(start != copy)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", charT);
+ }
+ if(!(start == copy))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", charT);
+ }
+ test_sub_match(*start, search_text.begin(), answer_table, 0);
+ ++start;
+ ++copy;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+ //
+ // and now field spitting:
+ //
+ test_iterator start2(search_text.begin(), search_text.end(), r, -1, opts), end2;
+ test_iterator copy2(start2);
+ int last_end2 = 0;
+ answer_table = test_info<charT>::answer_table();
+ while(start2 != end2)
+ {
+ if(start2 != copy2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", charT);
+ }
+ if(!(start2 == copy2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", charT);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4244)
+#endif
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first) != last_end2)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of start of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first)
+ << ", expected: "
+ << last_end2
+ << ".", charT);
+ }
+ int expected_end = static_cast<int>(answer_table[0] < 0 ? search_text.size() : answer_table[0]);
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second) != expected_end)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of end2 of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second)
+ << ", expected: "
+ << expected_end
+ << ".", charT);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+ last_end2 = answer_table[1];
+ ++start2;
+ ++copy2;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+}
+
+template <class charT, class traits>
+struct grep_test_predicate
+{
+ typedef typename std::basic_string<charT>::const_iterator test_iter;
+
+ grep_test_predicate(test_iter b, const int* a)
+ : m_base(b), m_table(a)
+ {}
+ bool operator()(const boost::match_results<test_iter>& what)
+ {
+ test_result(what, m_base, m_table);
+ // move on the answer table to next set of answers;
+ if(*m_table != -2)
+ while(*m_table++ != -2){}
+ return true;
+ }
+private:
+ test_iter m_base;
+ const int* m_table;
+};
+
+template<class charT, class traits>
+void test_regex_grep(boost::basic_regex<charT, traits>& r)
+{
+ typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ grep_test_predicate<charT, traits> pred(search_text.begin(), answer_table);
+ boost::regex_grep(pred, search_text.begin(), search_text.end(), r, opts);
+}
+
+template<class charT, class traits>
+void test_regex_match(boost::basic_regex<charT, traits>& r)
+{
+ typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ boost::match_results<const_iterator> what;
+ if(answer_table[0] < 0)
+ {
+ if(boost::regex_match(search_text, r, opts))
+ {
+ BOOST_REGEX_TEST_ERROR("boost::regex_match found a match when it should not have done so.", charT);
+ }
+ }
+ else
+ {
+ if((answer_table[0] > 0) && boost::regex_match(search_text, r, opts))
+ {
+ BOOST_REGEX_TEST_ERROR("boost::regex_match found a match when it should not have done so.", charT);
+ }
+ else if((answer_table[0] == 0) && (answer_table[1] == static_cast<int>(search_text.size())))
+ {
+ if(boost::regex_match(
+ search_text.begin(),
+ search_text.end(),
+ what,
+ r,
+ opts))
+ {
+ test_result(what, search_text.begin(), answer_table);
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+ }
+ }
+}
+
+template<class charT, class traits>
+void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
+{
+ const std::basic_string<charT>& expression = test_info<charT>::expression();
+ boost::regex_constants::syntax_option_type syntax_options = test_info<charT>::syntax_options();
+ try{
+ r.assign(expression, syntax_options);
+ if(r.status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), charT);
+ }
+ test_simple_search(r);
+ test_regex_iterator(r);
+ test_regex_token_iterator(r);
+ test_regex_grep(r);
+ test_regex_match(r);
+ }
+ catch(const boost::bad_expression& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), charT);
+ }
+ catch(const std::runtime_error& r)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << r.what(), charT);
+ }
+ catch(const std::exception& r)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << r.what(), charT);
+ }
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", charT);
+ }
+
+}
+
+
+
+#endif
+
diff --git a/src/boost/libs/regex/test/regress/test_perl_ex.cpp b/src/boost/libs/regex/test/regress/test_perl_ex.cpp
new file mode 100644
index 000000000..6a53256d1
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_perl_ex.cpp
@@ -0,0 +1,1019 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_options3();
+
+void test_independent_subs()
+{
+ using namespace boost::regex_constants;
+ TEST_REGEX_SEARCH("(?>^abc)", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?>^abc)", perl, "def\nabc", match_default, make_array(4, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?>^abc)", perl, "defabc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?>.*/)foo", perl, "/this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?>.*/)foo", perl, "/this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo", match_default, make_array(0, 67, -2, -2));
+ TEST_REGEX_SEARCH("(?>(\\.\\d\\d[1-9]?))\\d+", perl, "1.230003938", match_default, make_array(1, 11, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?>(\\.\\d\\d[1-9]?))\\d+", perl, "1.875000282", match_default, make_array(1, 11, 1, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?>(\\.\\d\\d[1-9]?))\\d+", perl, "1.235", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^((?>\\w+)|(?>\\s+))*$", perl, "now is the time for all good men to come to the aid of the party", match_default, make_array(0, 64, 59, 64, -2, -2));
+ TEST_REGEX_SEARCH("^((?>\\w+)|(?>\\s+))*$", perl, "this is not a line with only words and spaces!", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("((?>\\d+))(\\w)", perl, "12345a", match_default, make_array(0, 6, 0, 5, 5, 6, -2, -2));
+ TEST_REGEX_SEARCH("((?>\\d+))(\\w)", perl, "12345+", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("((?>\\d+))(\\d)", perl, "12345", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?>a+)b", perl, "aaab", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("((?>a+)b)", perl, "aaab", match_default, make_array(0, 4, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?>(a+))b", perl, "aaab", match_default, make_array(0, 4, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?>b)+", perl, "aaabbbccc", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?>a+|b+|c+)*c", perl, "aaabbbbccccd", match_default, make_array(0, 8, -2, 8, 9, -2, 9, 10, -2, 10, 11, -2, -2));
+ TEST_REGEX_SEARCH("((?>[^()]+)|\\([^()]*\\))+", perl, "((abc(ade)ufh()()x", match_default, make_array(2, 18, 17, 18, -2, -2));
+ TEST_REGEX_SEARCH("\\(((?>[^()]+)|\\([^()]+\\))+\\)", perl, "(abc)", match_default, make_array(0, 5, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\(((?>[^()]+)|\\([^()]+\\))+\\)", perl, "(abc(def)xyz)", match_default, make_array(0, 13, 9, 12, -2, -2));
+ TEST_REGEX_SEARCH("\\(((?>[^()]+)|\\([^()]+\\))+\\)", perl, "((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?>a*)*", perl, "a", match_default, make_array(0, 1, -2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?>a*)*", perl, "aa", match_default, make_array(0, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?>a*)*", perl, "aaaa", match_default, make_array(0, 4, -2, 4, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?>a*)*", perl, "a", match_default, make_array(0, 1, -2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?>a*)*", perl, "aaabcde", match_default, make_array(0, 3, -2, 3, 3, -2, 4, 4, -2, 5, 5, -2, 6, 6, -2, 7, 7, -2, -2));
+ TEST_REGEX_SEARCH("((?>a*))*", perl, "aaaaa", match_default, make_array(0, 5, 5, 5, -2, 5, 5, 5, 5, -2, -2));
+ TEST_REGEX_SEARCH("((?>a*))*", perl, "aabbaa", match_default, make_array(0, 2, 2, 2, -2, 2, 2, 2, 2, -2, 3, 3, 3, 3, -2, 4, 6, 6, 6, -2, 6, 6, 6, 6, -2, -2));
+ TEST_REGEX_SEARCH("((?>a*?))*", perl, "aaaaa", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, 3, 3, 3, 3, -2, 4, 4, 4, 4, -2, 5, 5, 5, 5, -2, -2));
+ TEST_REGEX_SEARCH("((?>a*?))*", perl, "aabbaa", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, 3, 3, 3, 3, -2, 4, 4, 4, 4, -2, 5, 5, 5, 5, -2, 6, 6, 6, 6, -2, -2));
+ TEST_REGEX_SEARCH("word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword", perl, "word cat dog elephant mussel cow horse canary baboon snake shark otherword", match_default, make_array(0, 74, -2, -2));
+ TEST_REGEX_SEARCH("word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword", perl, "word cat dog elephant mussel cow horse canary baboon snake shark", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("word (?>[a-zA-Z0-9]+ ){0,30}otherword", perl, "word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("word (?>[a-zA-Z0-9]+ ){0,30}otherword", perl, "word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I really really hope otherword", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("((?>Z)+|A)+", perl, "ZABCDEFG", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_INVALID_REGEX("((?>)+|A)+", perl);
+}
+
+void test_conditionals()
+{
+ using namespace boost::regex_constants;
+ TEST_REGEX_SEARCH("(?:(a)|b)(?(1)A|B)", perl, "aA", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?:(a)|b)(?(1)A|B)", perl, "bB", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?:(a)|b)(?(1)A|B)", perl, "aB", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:(a)|b)(?(1)A|B)", perl, "bA", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(a)?(?(1)A)B", perl, "aAB", match_default, make_array(0, 3, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a)?(?(1)A)B", perl, "B", match_default, make_array(0, 1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(a)?(?(1)|A)B", perl, "aB", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a)?(?(1)|A)B", perl, "AB", match_default, make_array(0, 2, -1, -1, -2, -2));
+
+ TEST_REGEX_SEARCH("^(a)?(?(1)a|b)+$", perl, "aa", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("^(a)?(?(1)a|b)+$", perl, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("^(a)?(?(1)a|b)+$", perl, "bb", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^(a)?(?(1)a|b)+$", perl, "ab", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("^(?(?=abc)\\w{3}:|\\d\\d)$", perl, "abc:", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("^(?(?=abc)\\w{3}:|\\d\\d)$", perl, "12", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^(?(?=abc)\\w{3}:|\\d\\d)$", perl, "123", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?(?=abc)\\w{3}:|\\d\\d)$", perl, "xyz", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("^(?(?!abc)\\d\\d|\\w{3}:)$", perl, "abc:", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("^(?(?!abc)\\d\\d|\\w{3}:)$", perl, "12", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^(?(?!abc)\\d\\d|\\w{3}:)$", perl, "123", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?(?!abc)\\d\\d|\\w{3}:)$", perl, "xyz", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?(?<=foo)bar|cat)", perl, "foobar", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?(?<=foo)bar|cat)", perl, "cat", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?(?<=foo)bar|cat)", perl, "fcat", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?(?<=foo)bar|cat)", perl, "focat", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?(?<=foo)bar|cat)", perl, "foocat", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?(?<!foo)cat|bar)", perl, "foobar", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?(?<!foo)cat|bar)", perl, "cat", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?(?<!foo)cat|bar)", perl, "fcat", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?(?<!foo)cat|bar)", perl, "focat", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?(?<!foo)cat|bar)", perl, "foocat", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(\\()?[^()]+(?(1)\\))", perl, "abcd", match_default, make_array(0, 4, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(\\()?[^()]+(?(1)\\))", perl, "(abcd)", match_default, make_array(0, 6, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(\\()?[^()]+(?(1)\\))", perl, "the quick (abcd) fox", match_default, make_array(0, 10, -1, -1, -2, 10, 16, 10, 11, -2, 16, 20, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(\\()?[^()]+(?(1)\\))", perl, "(abcd", match_default, make_array(1, 5, -1, -1, -2, -2));
+
+ TEST_REGEX_SEARCH("^(?(2)a|(1)(2))+$", perl, "12", match_default, make_array(0, 2, 0, 1, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("^(?(2)a|(1)(2))+$", perl, "12a", match_default, make_array(0, 3, 0, 1, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("^(?(2)a|(1)(2))+$", perl, "12aa", match_default, make_array(0, 4, 0, 1, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("^(?(2)a|(1)(2))+$", perl, "1234", match_default, make_array(-2, -2));
+
+ TEST_INVALID_REGEX("(a)(?(1)a|b|c)", perl);
+ TEST_INVALID_REGEX("(?(?=a)a|b|c)", perl);
+ TEST_INVALID_REGEX("(?(1a)", perl);
+ TEST_INVALID_REGEX("(?:(a)|b)(?(", perl);
+ TEST_INVALID_REGEX("(?:(a)|b)(?(1", perl);
+ TEST_INVALID_REGEX("(?:(a)|b)(?(1)", perl);
+ TEST_INVALID_REGEX("(?:(a)|b)(?(a", perl);
+ TEST_INVALID_REGEX("(?:(a)|b)(?(?", perl);
+ TEST_INVALID_REGEX("(?:(a)|b)(?(?:", perl);
+ TEST_INVALID_REGEX("(?:(a)|b)(?(?<", perl);
+ TEST_INVALID_REGEX("(?:(a)|b)(?(?<a", perl);
+
+ TEST_INVALID_REGEX("(?(?!#?)+)", perl);
+ TEST_INVALID_REGEX("(?(?=:-){0})", perl);
+ TEST_INVALID_REGEX("(?(123){1})", perl);
+ TEST_INVALID_REGEX("(?(?<=A)*)", perl);
+ TEST_INVALID_REGEX("(?(?<=A)+)", perl);
+
+ TEST_INVALID_REGEX("(?<!*|^)", perl);
+ TEST_INVALID_REGEX("(?<!*|A)", perl);
+ TEST_INVALID_REGEX("(?<=?|A)", perl);
+ TEST_INVALID_REGEX("(?<=*|\\B)", perl);
+ TEST_INVALID_REGEX("(?<!a|bc)de", perl);
+ TEST_INVALID_REGEX("(?<=a|bc)de", perl);
+
+ // Bug reports:
+ TEST_REGEX_SEARCH("\\b(?:(?:(one)|(two)|(three))(?:,|\\b)){3,}(?(1)|(?!))(?(2)|(?!))(?(3)|(?!))", perl, "one,two,two, one", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b(?:(?:(one)|(two)|(three))(?:,|\\b)){3,}(?(1)|(?!))(?(2)|(?!))(?(3)|(?!))", perl, "one,three,two", match_default, make_array(0, 13, 0, 3, 10, 13, 4, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\b(?:(?:(one)|(two)|(three))(?:,|\\b)){3,}(?(1)|(?!))(?(2)|(?!))(?(3)|(?!))", perl, "one,two,two,one,three,four", match_default, make_array(0, 22, 12, 15, 8, 11, 16, 21, -2, -2));
+}
+
+void test_options()
+{
+ // test the (?imsx) construct:
+ using namespace boost::regex_constants;
+ TEST_INVALID_REGEX("(?imsx", perl);
+ TEST_INVALID_REGEX("(?g", perl);
+ TEST_INVALID_REGEX("(?im-sx", perl);
+ TEST_INVALID_REGEX("(?im-sx:", perl);
+ TEST_INVALID_REGEX("(?-g)", perl);
+ TEST_REGEX_SEARCH("(?-m)^abc", perl, "abc\nabc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?m)^abc", perl|no_mod_m, "abc\nabc", match_default, make_array(0, 3, -2, 4, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?-m)^abc", perl, "abc\nabc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?m)^abc", perl|no_mod_m, "abc\nabc", match_default, make_array(0, 3, -2, 4, 7, -2, -2));
+
+ TEST_REGEX_SEARCH(" ^ a (?# begins with a) b\\sc (?# then b c) $ (?# then end)", perl|mod_x, "ab c", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH(" ^ a (?# begins with a) b\\sc (?# then b c) $ (?# then end)", perl|mod_x, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH(" ^ a (?# begins with a) b\\sc (?# then b c) $ (?# then end)", perl|mod_x, "ab cde", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?x) ^ a (?# begins with a) b\\sc (?# then b c) $ (?# then end)", perl, "ab c", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?x) ^ a (?# begins with a) b\\sc (?# then b c) $ (?# then end)", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?x) ^ a (?# begins with a) b\\sc (?# then b c) $ (?# then end)", perl, "ab cde", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^ a\\ b[c ]d $", perl|mod_x, "a bcd", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("^ a\\ b[c ]d $", perl|mod_x, "a b d", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("^ a\\ b[c ]d $", perl|mod_x, "abcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^ a\\ b[c ]d $", perl|mod_x, "ab d", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("^1234(?# test newlines\n inside)", perl|mod_x, "1234", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("^1234 #comment in boost::regex::extended re\n", perl|mod_x, "1234", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("#rhubarb\n abcd", perl|mod_x, "abcd", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("^1234 #comment in boost::regex::extended re\r\n", perl|mod_x, "1234", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("#rhubarb\r\n abcd", perl|mod_x, "abcd", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("^abcd#rhubarb", perl|mod_x, "abcd", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("^abcd#rhubarb", perl, "abcd#rhubarb", match_default, make_array(0, 12, -2, -2));
+ TEST_REGEX_SEARCH("^a b\n\n c", perl|mod_x, "abc", match_default, make_array(0, 3, -2, -2));
+
+ TEST_REGEX_SEARCH("(?(?=[^a-z]+[a-z]) \\d{2}-[a-z]{3}-\\d{2} | \\d{2}-\\d{2}-\\d{2} ) ", perl|mod_x, "12-sep-98", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("(?(?=[^a-z]+[a-z]) \\d{2}-[a-z]{3}-\\d{2} | \\d{2}-\\d{2}-\\d{2} ) ", perl|mod_x, "12-09-98", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("(?(?=[^a-z]+[a-z]) \\d{2}-[a-z]{3}-\\d{2} | \\d{2}-\\d{2}-\\d{2} ) ", perl|mod_x, "sep-12-98", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^a (?#xxx) (?#yyy) {3}c", perl|mod_x, "aaac", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a b", perl|mod_x, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH(" abc\\Q abc\\Eabc", perl|mod_x, "abc abcabc", match_default, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH(" abc\\Q abc\\Eabc", perl|mod_x, "abcabcabc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("abc#comment\n \\Q#not comment\n literal\\E", perl|mod_x, "abc#not comment\n literal", match_default, make_array(0, 27, -2, -2));
+ TEST_REGEX_SEARCH("abc#comment\n \\Q#not comment\n literal", perl|mod_x, "abc#not comment\n literal", match_default, make_array(0, 27, -2, -2));
+ TEST_REGEX_SEARCH("abc#comment\n \\Q#not comment\n literal\\E #more comment\n ", perl|mod_x, "abc#not comment\n literal", match_default, make_array(0, 27, -2, -2));
+ TEST_REGEX_SEARCH("abc#comment\n \\Q#not comment\n literal\\E #more comment", perl|mod_x, "abc#not comment\n literal", match_default, make_array(0, 27, -2, -2));
+
+ TEST_REGEX_SEARCH("(a (?x)b c)d e", perl, "a bcd e", match_default, make_array(0, 7, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(a (?x)b c)d e", perl, "a b cd e", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a (?x)b c)d e", perl, "abcd e", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a (?x)b c)d e", perl, "a bcde", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a b(?x)c d (?-x)e f)", perl, "a bcde f", match_default, make_array(0, 8, 0, 8, -2, -2));
+ TEST_REGEX_SEARCH("(a b(?x)c d (?-x)e f)", perl, "abcdef", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("a(?x: b c )d", perl, "XabcdY", match_default, make_array(1, 5, -2, -2));
+ TEST_REGEX_SEARCH("a(?x: b c )d", perl, "Xa b c d Y", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("((?x)x y z | a b c)", perl, "XabcY", match_default, make_array(1, 4, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("((?x)x y z | a b c)", perl, "AxyzB", match_default, make_array(1, 4, 1, 4, -2, -2));
+
+ TEST_REGEX_SEARCH("(a (?x)b c)d e", perl, "a bcd e", match_default, make_array(0, 7, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(a (?x)b c)d e", perl, "a b cd e", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a (?x)b c)d e", perl, "abcd e", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a (?x)b c)d e", perl, "a bcde", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a b(?x)c d (?-x)e f)", perl, "a bcde f", match_default, make_array(0, 8, 0, 8, -2, -2));
+ TEST_REGEX_SEARCH("(a b(?x)c d (?-x)e f)", perl, "abcdef", match_default, make_array(-2, -2));
+
+ TEST_INVALID_REGEX("a++(?#abc)+", perl);
+ TEST_INVALID_REGEX("a++(?#abc)?", perl);
+ TEST_INVALID_REGEX("a++(?#abc)*", perl);
+ TEST_INVALID_REGEX("a++(?#abc){2}", perl);
+ TEST_INVALID_REGEX("a++(?#abc)(?#more)+", perl);
+ TEST_REGEX_SEARCH("(?x) ab (?#first comment) (?#more) +", perl, "abbbb", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab(?#first comment)(?#more)+", perl, "abbbb", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?x) ab (?#first comment) (?#more) (c)", perl, "abc", match_default, make_array(0, 3, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("ab(?#first comment)(?#more)(c)", perl, "abc", match_default, make_array(0, 3, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?x) ab (?#first comment) (?#more) (?:c)", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("ab(?#first comment)(?#more)(?:c)", perl, "abc", match_default, make_array(0, 3, -2, -2));
+}
+
+void test_options2()
+{
+ using namespace boost::regex_constants;
+ TEST_INVALID_REGEX("(?i-", perl);
+ TEST_INVALID_REGEX("(?i-s", perl);
+ TEST_INVALID_REGEX("(?i-sd)", perl);
+ TEST_REGEX_SEARCH("(a(?i)b)c", perl, "abc", match_default, make_array(0, 3, 0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(a(?i)b)c", perl, "aBc", match_default, make_array(0, 3, 0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(a(?i)b)c", perl, "abC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)b)c", perl, "aBC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)b)c", perl, "Abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)b)c", perl, "ABc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)b)c", perl, "ABC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)b)c", perl, "AbC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?i)[dh]og", perl, "hog", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?i)[dh]og", perl, "dog", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?i)[dh]og", perl, "Hog", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?i)[dh]og", perl, "Dog", match_default, make_array(0, 3, -2, -2));
+
+ TEST_REGEX_SEARCH("(a(?i)B)c", perl, "abc", match_default, make_array(0, 3, 0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(a(?i)B)c", perl, "aBc", match_default, make_array(0, 3, 0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(a(?i)B)c", perl, "abC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)B)c", perl, "aBC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)B)c", perl, "Abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)B)c", perl, "ABc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)B)c", perl, "ABC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?i)B)c", perl, "AbC", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("a(?i:b)c", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(?i:b)c", perl, "aBc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(?i:b)c", perl, "ABC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(?i:b)c", perl, "abC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(?i:b)c", perl, "aBC", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("a(?i:b)*c", perl, "aBc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(?i:b)*c", perl, "aBBc", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(?i:b)*c", perl, "aBC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(?i:b)*c", perl, "aBBC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?i:j)|h", perl, "J", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?i:j)|h", perl, "j", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?i:j)|h", perl, "h", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?i:j)|h", perl, "H", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("a(?=b(?i)c)\\w\\wd", perl, "abcd", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(?=b(?i)c)\\w\\wd", perl, "abCd", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(?=b(?i)c)\\w\\wd", perl, "aBCd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(?=b(?i)c)\\w\\wd", perl, "abcD", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?s-i:more.*than).*million", perl|icase, "more than million", match_default, make_array(0, 17, -2, -2));
+ TEST_REGEX_SEARCH("(?s-i:more.*than).*million", perl|icase, "more than MILLION", match_default, make_array(0, 17, -2, -2));
+ TEST_REGEX_SEARCH("(?s-i:more.*than).*million", perl|icase, "more \n than Million", match_default, make_array(0, 19, -2, -2));
+ TEST_REGEX_SEARCH("(?s-i:more.*than).*million", perl|icase, "MORE THAN MILLION", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?s-i:more.*than).*million", perl|icase|no_mod_s|no_mod_m, "more \n than \n million", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?:(?s-i)more.*than).*million", perl|icase, "more than million", match_default, make_array(0, 17, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?s-i)more.*than).*million", perl|icase, "more than MILLION", match_default, make_array(0, 17, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?s-i)more.*than).*million", perl|icase, "more \n than Million", match_default, make_array(0, 19, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?s-i)more.*than).*million", perl|icase, "MORE THAN MILLION", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:(?s-i)more.*than).*million", perl|icase|no_mod_s|no_mod_m, "more \n than \n million", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?>a(?i)b+)+c", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?>a(?i)b+)+c", perl, "aBbc", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?>a(?i)b+)+c", perl, "aBBc", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?>a(?i)b+)+c", perl, "Abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?>a(?i)b+)+c", perl, "abAb", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?>a(?i)b+)+c", perl, "abbC", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?=a(?i)b)\\w\\wc", perl, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?=a(?i)b)\\w\\wc", perl, "aBc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?=a(?i)b)\\w\\wc", perl, "Ab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?=a(?i)b)\\w\\wc", perl, "abC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?=a(?i)b)\\w\\wc", perl, "aBC", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?<=a(?i)b)(\\w\\w)c", perl, "abxxc", match_default, make_array(2, 5, 2, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?<=a(?i)b)(\\w\\w)c", perl, "aBxxc", match_default, make_array(2, 5, 2, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?<=a(?i)b)(\\w\\w)c", perl, "Abxxc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?<=a(?i)b)(\\w\\w)c", perl, "ABxxc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?<=a(?i)b)(\\w\\w)c", perl, "abxxC", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?<=^.{4})(?:bar|cat)", perl, "fooocat", match_default, make_array(4, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?<=^.{4})(?:bar|cat)", perl, "foocat", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?<=^a{4})(?:bar|cat)", perl, "aaaacat", match_default, make_array(4, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?<=^a{4})(?:bar|cat)", perl, "aaacat", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?<=^[[:alpha:]]{4})(?:bar|cat)", perl, "aaaacat", match_default, make_array(4, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?<=^[[:alpha:]]{4})(?:bar|cat)", perl, "aaacat", match_default, make_array(-2, -2));
+
+ //TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abxyZZ", match_default, make_array(4, 6, -2, -2));
+ //TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abXyZZ", match_default, make_array(4, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "ZZZ", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "zZZ", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "bZZ", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "BZZ", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "ZZ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abXYZZ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "zzz", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "bzz", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("((?-i)[[:lower:]])[[:lower:]]", perl|icase, "ab", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("((?-i)[[:lower:]])[[:lower:]]", perl|icase, "aB", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("((?-i)[[:lower:]])[[:lower:]]", perl|icase, "Ab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("((?-i)[[:lower:]])[[:lower:]]", perl|icase, "AB", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("a(?-i)b", perl|icase, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(?-i)b", perl|icase, "Ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(?-i)b", perl|icase, "aB", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(?-i)b", perl|icase, "AB", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?:(?-i)a)b", perl|icase, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("((?-i)a)b", perl|icase, "ab", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?-i)a)b", perl|icase, "aB", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("((?-i)a)b", perl|icase, "aB", match_default, make_array(0, 2, 0, 1, -2, -2));
+
+ TEST_REGEX_SEARCH("(?:(?-i)a)b", perl|icase, "Ab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:(?-i)a)b", perl|icase, "aB", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("((?-i)a)b", perl|icase, "aB", match_default, make_array(0, 2, 0, 1, -2, -2));
+
+ TEST_REGEX_SEARCH("(?:(?-i)a)b", perl|icase, "Ab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:(?-i)a)b", perl|icase, "AB", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?-i:a)b", perl|icase, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("((?-i:a))b", perl|icase, "ab", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?-i:a)b", perl|icase, "aB", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("((?-i:a))b", perl|icase, "aB", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?-i:a)b", perl|icase, "AB", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?-i:a)b", perl|icase, "Ab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?-i:a)b", perl|icase, "aB", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("((?-i:a))b", perl|icase, "aB", match_default, make_array(0, 2, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?-i:a)b", perl|icase, "Ab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?-i:a)b", perl|icase, "AB", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("((?-i:a.))b", perl|icase, "AB", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("((?-i:a.))b", perl|icase, "A\nB", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("((?s-i:a.))b", perl|icase, "a\nB", match_default, make_array(0, 3, 0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH(".", perl, "\n", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", perl, "\n", match_default|match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", perl|mod_s, "\n", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", perl|mod_s, "\n", match_default|match_not_dot_newline, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(".", perl|no_mod_s, "\n", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".", perl|no_mod_s, "\n", match_default|match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?s).", perl, "\n", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?s).", perl, "\n", match_default|match_not_dot_newline, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?-s).", perl, "\n", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?-s).", perl, "\n", match_default|match_not_dot_newline, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?-xism)d", perl, "d", match_default, make_array(0, 1, -2, -2));
+ test_options3();
+}
+
+void test_options3()
+{
+ using namespace boost::regex_constants;
+
+ TEST_REGEX_SEARCH(".+", perl, " \n ", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH(".+", perl, " \n ", match_default|match_not_dot_newline, make_array(0, 2, -2, 3, 5, -2, -2));
+ TEST_REGEX_SEARCH(".+", perl|mod_s, " \n ", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH(".+", perl|mod_s, " \n ", match_default|match_not_dot_newline, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH(".+", perl|no_mod_s, " \n ", match_default, make_array(0, 2, -2, 3, 5, -2, -2));
+ TEST_REGEX_SEARCH(".+", perl|no_mod_s, " \n ", match_default|match_not_dot_newline, make_array(0, 2, -2, 3, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?s).+", perl, " \n ", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?s).+", perl, " \n ", match_default|match_not_dot_newline, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?-s).+", perl, " \n ", match_default, make_array(0, 2, -2, 3, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?-s).+", perl, " \n ", match_default|match_not_dot_newline, make_array(0, 2, -2, 3, 5, -2, -2));
+
+ const char* big_expression =
+" (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* # optional leading comment\n"
+"(?: (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"|\n"
+"\" (?: # opening quote...\n"
+"[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n"
+"| # or\n"
+"\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n"
+")* \" # closing quote\n"
+") # initial word\n"
+"(?: (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* \\. (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"|\n"
+"\" (?: # opening quote...\n"
+"[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n"
+"| # or\n"
+"\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n"
+")* \" # closing quote\n"
+") )* # further okay, if led by a period\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* @ (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"| \\[ # [\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n"
+"\\] # ]\n"
+") # initial subdomain\n"
+"(?: #\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* \\. # if led by a period...\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"| \\[ # [\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n"
+"\\] # ]\n"
+") # ...further okay\n"
+")*\n"
+"# address\n"
+"| # or\n"
+"(?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"|\n"
+"\" (?: # opening quote...\n"
+"[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n"
+"| # or\n"
+"\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n"
+")* \" # closing quote\n"
+") # one word, optionally followed by....\n"
+"(?:\n"
+"[^()<>@,;:\".\\\\\\[\\]\\x80-\\xff\\000-\\010\\012-\\037] | # atom and space parts, or...\n"
+"\\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) | # comments, or...\n"
+"\" (?: # opening quote...\n"
+"[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n"
+"| # or\n"
+"\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n"
+")* \" # closing quote\n"
+"# quoted strings\n"
+")*\n"
+"< (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* # leading <\n"
+"(?: @ (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"| \\[ # [\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n"
+"\\] # ]\n"
+") # initial subdomain\n"
+"(?: #\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* \\. # if led by a period...\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"| \\[ # [\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n"
+"\\] # ]\n"
+") # ...further okay\n"
+")*\n"
+"(?: (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* , (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* @ (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"| \\[ # [\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n"
+"\\] # ]\n"
+") # initial subdomain\n"
+"(?: #\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* \\. # if led by a period...\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"| \\[ # [\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n"
+"\\] # ]\n"
+") # ...further okay\n"
+")*\n"
+")* # further okay, if led by comma\n"
+": # closing colon\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* )? # optional route\n"
+"(?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"|\n"
+"\" (?: # opening quote...\n"
+"[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n"
+"| # or\n"
+"\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n"
+")* \" # closing quote\n"
+") # initial word\n"
+"(?: (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* \\. (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"|\n"
+"\" (?: # opening quote...\n"
+"[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n"
+"| # or\n"
+"\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n"
+")* \" # closing quote\n"
+") )* # further okay, if led by a period\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* @ (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"| \\[ # [\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n"
+"\\] # ]\n"
+") # initial subdomain\n"
+"(?: #\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* \\. # if led by a period...\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* (?:\n"
+"[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n"
+"(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n"
+"| \\[ # [\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n"
+"\\] # ]\n"
+") # ...further okay\n"
+")*\n"
+"# address spec\n"
+"(?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* > # trailing >\n"
+"# name and address\n"
+") (?: [\\040\\t] | \\(\n"
+"(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n"
+"\\) )* # optional trailing comment\n"
+"\n";
+
+ do{
+ test_info<char>::set_info(__FILE__, __LINE__,
+ big_expression,
+ perl|mod_x, "Alan Other <user@dom.ain>", match_default,
+ make_array(0, 25, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ do{
+ std::string st(big_expression);
+ test_info<wchar_t>::set_info(__FILE__, __LINE__,
+ std::wstring(st.begin(), st.end()),
+ perl|mod_x, L"Alan Other <user@dom.ain>", match_default,
+ make_array(0, 25, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#endif
+ do{
+ test_info<char>::set_info(__FILE__, __LINE__,
+ big_expression,
+ perl|mod_x, "<user@dom.ain>", match_default,
+ make_array(1, 13, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ do{
+ std::string st(big_expression);
+ test_info<wchar_t>::set_info(__FILE__, __LINE__,
+ std::wstring(st.begin(), st.end()),
+ perl|mod_x, L"<user@dom.ain>", match_default,
+ make_array(1, 13, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#endif
+ do{
+ test_info<char>::set_info(__FILE__, __LINE__,
+ big_expression,
+ perl|mod_x, "\"A. Other\" <user.1234@dom.ain> (a comment)", match_default,
+ make_array(0, 42, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ do{
+ std::string st(big_expression);
+ test_info<wchar_t>::set_info(__FILE__, __LINE__,
+ std::wstring(st.begin(), st.end()),
+ perl|mod_x, L"\"A. Other\" <user.1234@dom.ain> (a comment)", match_default,
+ make_array(0, 42, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#endif
+ do{
+ test_info<char>::set_info(__FILE__, __LINE__,
+ big_expression,
+ perl|mod_x, "A. Other <user.1234@dom.ain> (a comment)", match_default,
+ make_array(2, 40, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ do{
+ std::string st(big_expression);
+ test_info<wchar_t>::set_info(__FILE__, __LINE__,
+ std::wstring(st.begin(), st.end()),
+ perl|mod_x, L"A. Other <user.1234@dom.ain> (a comment)", match_default,
+ make_array(2, 40, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#endif
+ do{
+ test_info<char>::set_info(__FILE__, __LINE__,
+ big_expression,
+ perl|mod_x, "\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay", match_default,
+ make_array(0, 61, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ do{
+ std::string st(big_expression);
+ test_info<wchar_t>::set_info(__FILE__, __LINE__,
+ std::wstring(st.begin(), st.end()),
+ perl|mod_x, L"\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay", match_default,
+ make_array(0, 61, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#endif
+ do{
+ test_info<char>::set_info(__FILE__, __LINE__,
+ big_expression,
+ perl|mod_x, "A missing angle <user@some.where", match_default,
+ make_array(17, 32, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ do{
+ std::string st(big_expression);
+ test_info<wchar_t>::set_info(__FILE__, __LINE__,
+ std::wstring(st.begin(), st.end()),
+ perl|mod_x, L"A missing angle <user@some.where", match_default,
+ make_array(17, 32, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#endif
+}
+
+void test_mark_resets()
+{
+ using namespace boost::regex_constants;
+
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))", perl, "abc", match_default, make_array(0, 3, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))", perl, "xyz", match_default, make_array(0, 3, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(x)(?|(abc)|(xyz))(x)", perl, "xabcx", match_default, make_array(0, 5, 0, 1, 1, 4, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("(x)(?|(abc)|(xyz))(x)", perl, "xxyzx", match_default, make_array(0, 5, 0, 1, 1, 4, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("(x)(?|(abc)(pqr)|(xyz))(x)", perl, "xabcpqrx", match_default, make_array(0, 8, 0, 1, 1, 4, 4, 7, 7, 8, -2, -2));
+ TEST_REGEX_SEARCH("(x)(?|(abc)(pqr)|(xyz))(x)", perl, "xxyzx", match_default, make_array(0, 5, 0, 1, 1, 4, -1, -1, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))\\1", perl, "abcabc", match_default, make_array(0, 6, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))\\1", perl, "xyzxyz", match_default, make_array(0, 6, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))\\1", perl, "abcxyz", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))\\1", perl, "xyzabc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))(?1)", perl, "abcabc", match_default, make_array(0, 6, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))(?1)", perl, "xyzabc", match_default, make_array(0, 6, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))(?1)", perl, "xyzxyz", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^X(?5)(a)(?|(b)|(q))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, -2, -2));
+ TEST_INVALID_REGEX("^X(?5)(a)(?|(b)|(q))(c)(d)Y", perl);
+ TEST_REGEX_SEARCH("^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, -2, -2));
+ TEST_REGEX_SEARCH("^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, -1, -1, -1, -1, 4, 5, 5, 6, 6, 7, -2, -2));
+ TEST_REGEX_SEARCH("^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, -1, -1, -1, -1, 4, 5, 5, 6, 6, 7, -2, -2));
+ TEST_REGEX_SEARCH("^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, -1, -1, -1, -1, 4, 5, 5, 6, 6, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(?:((?:xyz)))|(123))", perl, "abc", match_default, make_array(0, 3, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(?:)((?:)xyz)|(123))", perl, "xyz", match_default, make_array(0, 3, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|((?:(x)|(y)|(z)))|(123))", perl, "y", match_default, make_array(0, 1, 0, 1, -1, -1, 0, 1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|((?|(x)|(y)|(z)))|(123))", perl, "y", match_default, make_array(0, 1, 0, 1, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|((?|(x)|(y)|(z)))|(123))", perl, "abc", match_default, make_array(0, 3, 0, 3, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|((?|(x)|(y)|(z)))|(123))", perl, "123", match_default, make_array(0, 3, 0, 3, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|((x)|(y)|(z))|(123))", perl, "z", match_default, make_array(0, 1, 0, 1, -1, -1, -1, -1, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|((x)|(y)|(z))|(123))", perl, "abc", match_default, make_array(0, 3, 0, 3, -1, -1, -1, -1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|((x)|(y)|(z))|(123))", perl, "123", match_default, make_array(0, 3, 0, 3, -1, -1, -1, -1, -1, -1, -2, -2));
+}
+
+void test_recursion()
+{
+ using namespace boost::regex_constants;
+
+ TEST_INVALID_REGEX("(a(?2)b)", perl);
+ TEST_INVALID_REGEX("(a(?1b))", perl);
+ TEST_REGEX_SEARCH("(a(?1)b)", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(a(?1)+b)", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^([^()]|\\((?1)*\\))*$", perl, "abc", match_default, make_array(0, 3, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("^([^()]|\\((?1)*\\))*$", perl, "a(b)c", match_default, make_array(0, 5, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("^([^()]|\\((?1)*\\))*$", perl, "a(b(c))d", match_default, make_array(0, 8, 7, 8, -2, -2));
+ TEST_REGEX_SEARCH("^([^()]|\\((?1)*\\))*$", perl, "a(b(c)d", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^>abc>([^()]|\\((?1)*\\))*<xyz<$", perl, ">abc>123<xyz<", match_default, make_array(0, 13, 7, 8, -2, -2));
+ TEST_REGEX_SEARCH("^>abc>([^()]|\\((?1)*\\))*<xyz<$", perl, ">abc>1(2)3<xyz<", match_default, make_array(0, 15, 9, 10, -2, -2));
+ TEST_REGEX_SEARCH("^>abc>([^()]|\\((?1)*\\))*<xyz<$", perl, ">abc>(1(2)3)<xyz<", match_default, make_array(0, 17, 5, 12, -2, -2));
+ //TEST_REGEX_SEARCH("^\\W*(?:((.)\\W*(?1)\\W*\\2|)|((.)\\W*(?3)\\W*\\4|\\W*.\\W*))\\W*$", perl|icase, "1221", match_default, make_array(0, 4, 0, 4, 0, 1, -1, -1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("^\\W*(?:((.)\\W*(?1)\\W*\\2|)|((.)\\W*(?3)\\W*\\4|\\W*.\\W*))\\W*$", perl|icase, "Satan, oscillate my metallic sonatas!", match_default, make_array(0, 37, -1, -1, -1, -1, 0, 36, 0, 1, -2, -2));
+ //TEST_REGEX_SEARCH("^\\W*(?:((.)\\W*(?1)\\W*\\2|)|((.)\\W*(?3)\\W*\\4|\\W*.\\W*))\\W*$", perl|icase, "A man, a plan, a canal: Panama!", match_default, make_array(0, 31, -1, -1, -1, -1, 0, 30, 0, 1, -2, -2));
+ //TEST_REGEX_SEARCH("^\\W*(?:((.)\\W*(?1)\\W*\\2|)|((.)\\W*(?3)\\W*\\4|\\W*.\\W*))\\W*$", perl|icase, "Able was I ere I saw Elba.", match_default, make_array(0, 26, -1, -1, -1, -1, 0, 25, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("^\\W*(?:((.)\\W*(?1)\\W*\\2|)|((.)\\W*(?3)\\W*\\4|\\W*.\\W*))\\W*$", perl|icase, "The quick brown fox", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(\\d+|\\((?1)([+*-])(?1)\\)|-(?1))$", perl|icase, "12", match_default, make_array(0, 2, 0, 2, -1, -1, -2, -2));
+ //TEST_REGEX_SEARCH("^(\\d+|\\((?1)([+*-])(?1)\\)|-(?1))$", perl|icase, "(((2+2)*-3)-7)", match_default, make_array(0, 14, 0, 14, 11, 12, -2, -2));
+ TEST_REGEX_SEARCH("^(\\d+|\\((?1)([+*-])(?1)\\)|-(?1))$", perl|icase, "-12", match_default, make_array(0, 3, 0, 3, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("^(\\d+|\\((?1)([+*-])(?1)\\)|-(?1))$", perl|icase, "((2+2)*-3)-7)", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(x(y|(?1){2})z)", perl|icase, "xyz", match_default, make_array(0, 3, 0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("^(x(y|(?1){2})z)", perl|icase, "xxyzxyzz", match_default, make_array(0, 8, 0, 8, 1, 7, -2, -2));
+ TEST_REGEX_SEARCH("^(x(y|(?1){2})z)", perl|icase, "xxyzz", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(x(y|(?1){2})z)", perl|icase, "xxyzxyzxyzz", match_default, make_array(-2, -2));
+ TEST_INVALID_REGEX("(?1)", perl);
+ TEST_INVALID_REGEX("((?2)(abc)", perl);
+ TEST_REGEX_SEARCH("^(a|b|c)=(?1)+", perl|icase, "a=a", match_default, make_array(0, 3, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("^(a|b|c)=(?1)+", perl|icase, "a=b", match_default, make_array(0, 3, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("^(a|b|c)=(?1)+", perl|icase, "a=bc", match_default, make_array(0, 4, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("^(a|b|c)=((?1))+", perl|icase, "a=a", match_default, make_array(0, 3, 0, 1, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("^(a|b|c)=((?1))+", perl|icase, "a=b", match_default, make_array(0, 3, 0, 1, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("^(a|b|c)=((?1))+", perl|icase, "a=bc", match_default, make_array(0, 4, 0, 1, 3, 4, -2, -2));
+ TEST_REGEX_SEARCH("^(?1)(abc)", perl|icase, "abcabc", match_default, make_array(0, 6, 3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?1)X(?<abc>P)", perl|icase, "abcPXP123", match_default, make_array(3, 6, 5, 6, -2, -2));
+ TEST_REGEX_SEARCH("(abc)(?i:(?1))", perl|icase, "defabcabcxyz", match_default, make_array(3, 9, 3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(abc)(?i:(?1))", perl, "DEFabcABCXYZ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(abc)(?i:(?1)abc)", perl, "DEFabcABCABCXYZ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(abc)(?:(?i)(?1))", perl, "defabcabcxyz", match_default, make_array(3, 9, 3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(abc)(?:(?i)(?1))", perl, "DEFabcABCXYZ", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))(?1)", perl, "abcabc", match_default, make_array(0, 6, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))(?1)", perl, "xyzabc", match_default, make_array(0, 6, 0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?|(abc)|(xyz))(?1)", perl, "xyzxyz", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?1)[]a()b](abc)", perl, "abcbabc", match_default, make_array(0, 7, 4, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?1)[]a()b](abc)", perl, "abcXabc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?1)[^]a()b](abc)", perl, "abcXabc", match_default, make_array(0, 7, 4, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?1)[^]a()b](abc)", perl, "abcbabc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?2)[]a()b](abc)(xyz)", perl, "xyzbabcxyz", match_default, make_array(0, 10, 4, 7, 7, 10, -2, -2));
+ TEST_REGEX_SEARCH("^X(?5)(a)(?|(b)|(q))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, -2, -2));
+ TEST_INVALID_REGEX("^X(?5)(a)(?|(b)|(q))(c)(d)Y", perl);
+ TEST_REGEX_SEARCH("^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, -1, -1, -1, -1, 4, 5, 5, 6, 6, 7, -2, -2));
+ TEST_REGEX_SEARCH("^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, -1, -1, -1, -1, 4, 5, 5, 6, 6, 7, -2, -2));
+ TEST_REGEX_SEARCH("^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, -1, -1, -1, -1, 4, 5, 5, 6, 6, 7, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\x{100}*(\\d+|\"(?1)\")", perl, L"1234", match_default, make_array(0, 4, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\x{100}*(\\d+|\"(?1)\")", perl, L"\"1234\"", match_default, make_array(0, 6, 0, 6, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\x{100}*(\\d+|\"(?1)\")", perl, L"\x100" L"1234", match_default, make_array(0, 5, 1, 5, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\x{100}*(\\d+|\"(?1)\")", perl, L"\"\x100" L"1234\"", match_default, make_array(1, 6, 2, 6, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\x{100}*(\\d+|\"(?1)\")", perl, L"\x100\x100" L"12ab", match_default, make_array(0, 4, 2, 4, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\x{100}*(\\d+|\"(?1)\")", perl, L"\x100\x100" L"\"12\"", match_default, make_array(0, 6, 2, 6, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\x{100}*(\\d+|\"(?1)\")", perl, L"\x100\x100" L"abcd", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(ab|c)(?-1)", perl, "abc", match_default, make_array(0, 3, 0, 2, -2, -2));
+ TEST_REGEX_SEARCH("xy(?+1)(abc)", perl, "xyabcabc", match_default, make_array(0, 8, 5, 8, -2, -2));
+ TEST_REGEX_SEARCH("xy(?+1)(abc)", perl, "xyabc", match_default, make_array(-2, -2));
+ TEST_INVALID_REGEX("x(?-0)y", perl);
+ TEST_INVALID_REGEX("x(?-1)y", perl);
+ TEST_INVALID_REGEX("x(?+0)y", perl);
+ TEST_INVALID_REGEX("x(?+1)y", perl);
+ TEST_REGEX_SEARCH("^(?+1)(?<a>x|y){0}z", perl, "xzxx", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("^(?+1)(?<a>x|y){0}z", perl, "yzyy", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("^(?+1)(?<a>x|y){0}z", perl, "xxz", match_default, make_array(-2, -2));
+
+ // Now recurse to sub-expression zero:
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "(abcd)", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "(abcd)xyz", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "xyz(abcd)", match_default, make_array(3, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "(ab(xy)cd)pqr", match_default, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "(ab(xycd)pqr", match_default, make_array(3, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "() abc ()", match_default, make_array(0, 2, -2, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "12(abcde(fsh)xyz(foo(bar))lmno)89", match_default, make_array(2, 31, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "abcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "abcd)", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?0))*\\)", perl, "(abcd", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("\\( ( (?>[^()]+) | (?0) )* \\) ", perl|mod_x, "(ab(xy)cd)pqr", match_default, make_array(0, 10, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( (?>[^()]+) | (?0) )* \\) ", perl|mod_x, "1(abcd)(x(y)z)pqr", match_default, make_array(1, 7, 2, 6, -2, 7, 14, 12, 13, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?0) ) \\) ", perl|mod_x, "(abcd)", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?0) ) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(3, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?0) ) \\) ", perl|mod_x, "(a(b(c)d)e)", match_default, make_array(4, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?0) ) \\) ", perl|mod_x, "((ab))", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?0) ) \\) ", perl|mod_x, "()", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?0) )? \\) ", perl|mod_x, "()", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?0) )? \\) ", perl|mod_x, "12(abcde(fsh)xyz(foo(bar))lmno)89", match_default, make_array(8, 13, -2, 20, 25, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( (?>[^()]+) | (?0) )* \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( ( (?>[^()]+) | (?0) )* ) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, 1, 9, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( (123)? ( ( (?>[^()]+) | (?0) )* ) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, -1, -1, 1, 9, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( (123)? ( ( (?>[^()]+) | (?0) )* ) \\) ", perl|mod_x, "(123ab(xy)cd)", match_default, make_array(0, 13, 1, 4, 4, 12, 10, 12, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( (123)? ( (?>[^()]+) | (?0) )* ) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, 1, 9, -1, -1, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( (123)? ( (?>[^()]+) | (?0) )* ) \\) ", perl|mod_x, "(123ab(xy)cd)", match_default, make_array(0, 13, 1, 12, 1, 4, 10, 12, -2, -2));
+ TEST_REGEX_SEARCH("\\( (((((((((( ( (?>[^()]+) | (?0) )* )))))))))) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?0) )* ) \\) ", perl|mod_x, "(abcd(xyz<p>qrs)123)", match_default, make_array(0, 20, 1, 19, 16, 19, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( ( (?>[^()]+) | ((?0)) )* ) \\) ", perl|mod_x, "(ab(cd)ef)", match_default, make_array(0, 10, 1, 9, 7, 9, 3, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( ( (?>[^()]+) | ((?0)) )* ) \\) ", perl|mod_x, "(ab(cd(ef)gh)ij)", match_default, make_array(0, 16, 1, 15, 13, 15, 3, 13, -2, -2));
+ // Again with (?R):
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "(abcd)", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "(abcd)xyz", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "xyz(abcd)", match_default, make_array(3, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "(ab(xy)cd)pqr", match_default, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "(ab(xycd)pqr", match_default, make_array(3, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "() abc ()", match_default, make_array(0, 2, -2, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "12(abcde(fsh)xyz(foo(bar))lmno)89", match_default, make_array(2, 31, -2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "abcd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "abcd)", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\((?:(?>[^()]+)|(?R))*\\)", perl, "(abcd", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("\\( ( (?>[^()]+) | (?R) )* \\) ", perl|mod_x, "(ab(xy)cd)pqr", match_default, make_array(0, 10, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( (?>[^()]+) | (?R) )* \\) ", perl|mod_x, "1(abcd)(x(y)z)pqr", match_default, make_array(1, 7, 2, 6, -2, 7, 14, 12, 13, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?R) ) \\) ", perl|mod_x, "(abcd)", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?R) ) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(3, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?R) ) \\) ", perl|mod_x, "(a(b(c)d)e)", match_default, make_array(4, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?R) ) \\) ", perl|mod_x, "((ab))", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?R) ) \\) ", perl|mod_x, "()", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?R) )? \\) ", perl|mod_x, "()", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\( (?: (?>[^()]+) | (?R) )? \\) ", perl|mod_x, "12(abcde(fsh)xyz(foo(bar))lmno)89", match_default, make_array(8, 13, -2, 20, 25, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( (?>[^()]+) | (?R) )* \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( ( (?>[^()]+) | (?R) )* ) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, 1, 9, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( (123)? ( ( (?>[^()]+) | (?R) )* ) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, -1, -1, 1, 9, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( (123)? ( ( (?>[^()]+) | (?R) )* ) \\) ", perl|mod_x, "(123ab(xy)cd)", match_default, make_array(0, 13, 1, 4, 4, 12, 10, 12, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( (123)? ( (?>[^()]+) | (?R) )* ) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, 1, 9, -1, -1, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( (123)? ( (?>[^()]+) | (?R) )* ) \\) ", perl|mod_x, "(123ab(xy)cd)", match_default, make_array(0, 13, 1, 12, 1, 4, 10, 12, -2, -2));
+ TEST_REGEX_SEARCH("\\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \\) ", perl|mod_x, "(ab(xy)cd)", match_default, make_array(0, 10, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 7, 9, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \\) ", perl|mod_x, "(abcd(xyz<p>qrs)123)", match_default, make_array(0, 20, 1, 19, 16, 19, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( ( (?>[^()]+) | ((?R)) )* ) \\) ", perl|mod_x, "(ab(cd)ef)", match_default, make_array(0, 10, 1, 9, 7, 9, 3, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\( ( ( (?>[^()]+) | ((?R)) )* ) \\) ", perl|mod_x, "(ab(cd(ef)gh)ij)", match_default, make_array(0, 16, 1, 15, 13, 15, 3, 13, -2, -2));
+ // And some extra cases:
+ TEST_REGEX_SEARCH("x(ab|(bc|(de|(?R))))", perl|mod_x, "xab", match_default, make_array(0, 3, 1, 3, -1, -1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("x(ab|(bc|(de|(?R))))", perl|mod_x, "xbc", match_default, make_array(0, 3, 1, 3, 1, 3, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("x(ab|(bc|(de|(?R))))", perl|mod_x, "xde", match_default, make_array(0, 3, 1, 3, 1, 3, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("x(ab|(bc|(de|(?R))))", perl|mod_x, "xxab", match_default, make_array(0, 4, 1, 4, 1, 4, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("x(ab|(bc|(de|(?R))))", perl|mod_x, "xxxab", match_default, make_array(0, 5, 1, 5, 1, 5, 1, 5, -2, -2));
+ TEST_REGEX_SEARCH("x(ab|(bc|(de|(?R))))", perl|mod_x, "xyab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[^()]*(?:\\((?R)\\)[^()]*)*", perl|mod_x, "(this(and)that)", match_default, make_array(0, 15, -2, 15, 15, -2, -2));
+ TEST_REGEX_SEARCH("[^()]*(?:\\((?R)\\)[^()]*)*", perl|mod_x, "(this(and)that)stuff", match_default, make_array(0, 20, -2, 20, 20, -2, -2));
+ TEST_REGEX_SEARCH("[^()]*(?:\\((?>(?R))\\)[^()]*)*", perl|mod_x, "(this(and)that)", match_default, make_array(0, 15, -2, 15, 15, -2, -2));
+
+ // More complex cases involving (?(R):
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<>", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abcd>", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc <123> hij>", match_default, make_array(0, 15, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc <def> hij>", match_default, make_array(5, 10, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc<>def>", match_default, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc<>", match_default, make_array(4, 6, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("((abc (?(R) (?(R1)1) (?(R2)2) X | (?1) (?2) (?R) ))) ", perl|mod_x, "abcabc1Xabc2XabcXabcabc", match_default, make_array(0, 17, 0, 17, 0, 17, -2, -2));
+
+ // Recursion to named sub-expressions:
+ //TEST_REGEX_SEARCH("^\\W*(?:(?<one>(?<two>.)\\W*(?&one)\\W*\\k<two>|)|(?<three>(?<four>.)\\W*(?&three)\\W*\\k'four'|\\W*.\\W*))\\W*$", perl|mod_x|icase, "Satan, oscillate my metallic sonatas!", match_default, make_array(0, 37, -1, -1, -1, -1, 0, 36, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?'abc'a|b)(?<doe>d|e)(?&abc){2}", perl|mod_x, "bdaa", match_default, make_array(0, 4, 0, 1, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?'abc'a|b)(?<doe>d|e)(?&abc){2}", perl|mod_x, "bdab", match_default, make_array(0, 4, 0, 1, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?'abc'a|b)(?<doe>d|e)(?&abc){2}", perl|mod_x, "bddd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?&abc)X(?<abc>P)", perl|mod_x, "abcPXP123", match_default, make_array(3, 6, 5, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?:a(?&abc)b)*(?<abc>x)", perl|mod_x, "123axbaxbaxbx456", match_default, make_array(3, 13, 12, 13 , -2, -2));
+ TEST_REGEX_SEARCH("(?:a(?&abc)b){1,5}(?<abc>x)", perl|mod_x, "123axbaxbaxbx456", match_default, make_array(3, 13, 12, 13 , -2, -2));
+ TEST_REGEX_SEARCH("(?:a(?&abc)b){2,5}(?<abc>x)", perl|mod_x, "123axbaxbaxbx456", match_default, make_array(3, 13, 12, 13 , -2, -2));
+ TEST_REGEX_SEARCH("(?:a(?&abc)b){2,}(?<abc>x)", perl|mod_x, "123axbaxbaxbx456", match_default, make_array(3, 13, 12, 13 , -2, -2));
+ TEST_INVALID_REGEX("(?<a>)(?&)", perl|mod_x);
+ TEST_INVALID_REGEX("(?<abc>)(?&a)", perl|mod_x);
+ TEST_INVALID_REGEX("(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)", perl|mod_x);
+ TEST_INVALID_REGEX("(?&N)[]a(?<N>)](?<M>abc)", perl|mod_x);
+ TEST_INVALID_REGEX("(?&N)[]a(?<N>)](abc)", perl|mod_x);
+ TEST_INVALID_REGEX("(?&N)[]a(?<N>)](abc)", perl|mod_x);
+ TEST_REGEX_SEARCH("^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)", perl|mod_x, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, -2, -2));
+ // And again with (?P> :
+ //TEST_REGEX_SEARCH("^\\W*(?:(?<one>(?<two>.)\\W*(?&one)\\W*\\k<two>|)|(?<three>(?<four>.)\\W*(?&three)\\W*\\k'four'|\\W*.\\W*))\\W*$", perl|mod_x|icase, "Satan, oscillate my metallic sonatas!", match_default, make_array(0, 37, -1, -1, -1, -1, 0, 36, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(?'abc'a|b)(?<doe>d|e)(?P>abc){2}", perl|mod_x, "bdaa", match_default, make_array(0, 4, 0, 1, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?'abc'a|b)(?<doe>d|e)(?P>abc){2}", perl|mod_x, "bdab", match_default, make_array(0, 4, 0, 1, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?'abc'a|b)(?<doe>d|e)(?P>abc){2}", perl|mod_x, "bddd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?P>abc)X(?<abc>P)", perl|mod_x, "abcPXP123", match_default, make_array(3, 6, 5, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?:a(?P>abc)b)*(?<abc>x)", perl|mod_x, "123axbaxbaxbx456", match_default, make_array(3, 13, 12, 13 , -2, -2));
+ TEST_REGEX_SEARCH("(?:a(?P>abc)b){1,5}(?<abc>x)", perl|mod_x, "123axbaxbaxbx456", match_default, make_array(3, 13, 12, 13 , -2, -2));
+ TEST_REGEX_SEARCH("(?:a(?P>abc)b){2,5}(?<abc>x)", perl|mod_x, "123axbaxbaxbx456", match_default, make_array(3, 13, 12, 13 , -2, -2));
+ TEST_REGEX_SEARCH("(?:a(?P>abc)b){2,}(?<abc>x)", perl|mod_x, "123axbaxbaxbx456", match_default, make_array(3, 13, 12, 13 , -2, -2));
+ TEST_INVALID_REGEX("(?<a>)(?P>)", perl|mod_x);
+ TEST_INVALID_REGEX("(?<abc>)(?P>a)", perl|mod_x);
+ TEST_INVALID_REGEX("(?<a>)(?P>aaaaaaaaaaaaaaaaaaaaaaa)", perl|mod_x);
+ TEST_INVALID_REGEX("(?P>N)[]a(?<N>)](?<M>abc)", perl|mod_x);
+ TEST_INVALID_REGEX("(?P>N)[]a(?<N>)](abc)", perl|mod_x);
+ TEST_INVALID_REGEX("(?P>N)[]a(?<N>)](abc)", perl|mod_x);
+ TEST_REGEX_SEARCH("^X(?P>N)(a)(?|(b)|(q))(c)(d)(?<N>Y)", perl|mod_x, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, -2, -2));
+ // Now check (?(R&NAME) :
+ TEST_REGEX_SEARCH("(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X | (?1) (?2) (?R) ))) ", perl|mod_x, "abcabc1Xabc2XabcXabcabc", match_default, make_array(0, 17, 0, 17, 0, 17, -2, -2));
+ TEST_INVALID_REGEX("(?<A> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) ", perl|mod_x);
+ TEST_REGEX_SEARCH("(?<1> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) ", perl|mod_x, "abcabc1Xabc2XabcXabcabc", match_default, make_array(0, 17, 0, 17, 0, 17, -2, -2));
+
+ // Now check for named conditionals:
+ TEST_REGEX_SEARCH("^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)", perl|mod_x, "abd", match_default, make_array(0, 3, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)", perl|mod_x, "ce", match_default, make_array(0, 2, -1, -1, -2, -2));
+
+ // Recursions in combination with (DEFINE):
+ TEST_REGEX_SEARCH("^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) ", perl|mod_x, "abcd", match_default, make_array(0, 2, -1, -1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(?<NAME>(?&NAME_PAT))\\s+(?<ADDR>(?&ADDRESS_PAT)) (?(DEFINE) (?<NAME_PAT>[a-z]+) (?<ADDRESS_PAT>\\d+))", perl|mod_x, "metcalfe 33", match_default, make_array(0, 11, 0, 8, 9, 11, -1, -1, -1, -1, -2, -2));
+ TEST_INVALID_REGEX("^(?(DEFINE) abc | xyz ) ", perl|mod_x);
+ //TEST_INVALID_REGEX("(?(DEFINE) abc){3} xyz", perl|mod_x);
+ TEST_REGEX_SEARCH("(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))\\b(?&byte)(\\.(?&byte)){3}", perl|mod_x, "1.2.3.4", match_default, make_array(0, 7, -1, -1, 5, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))\\b(?&byte)(\\.(?&byte)){3}", perl|mod_x, "131.111.10.206", match_default, make_array(0, 14, -1, -1, 10, 14, -2, -2));
+ TEST_REGEX_SEARCH("(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))\\b(?&byte)(\\.(?&byte)){3}", perl|mod_x, "10.0.0.0", match_default, make_array(0, 8, -1, -1, 6, 8, -2, -2));
+ TEST_REGEX_SEARCH("(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))\\b(?&byte)(\\.(?&byte)){3}", perl|mod_x, "10.6", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))\\b(?&byte)(\\.(?&byte)){3}", perl|mod_x, "455.3.4.5", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b(?&byte)(\\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))", perl|mod_x, "1.2.3.4", match_default, make_array(0, 7, 5, 7, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("\\b(?&byte)(\\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))", perl|mod_x, "131.111.10.206", match_default, make_array(0, 14, 10, 14, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("\\b(?&byte)(\\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))", perl|mod_x, "10.0.0.0", match_default, make_array(0, 8, 6, 8, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("\\b(?&byte)(\\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))", perl|mod_x, "10.6", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\b(?&byte)(\\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\\d|25[0-5]|1\\d\\d|[1-9]?\\d))", perl|mod_x, "455.3.4.5", match_default, make_array(-2, -2));
+
+ // Bugs:
+ TEST_REGEX_SEARCH("namespace\\s+(\\w+)\\s+(\\{(?:[^{}]*(?:(?2)[^{}]*)*)?\\})", perl, "namespace one { namespace two { int foo(); } }", match_default, make_array(0, 46, 10, 13, 14, 46, -2, -2));
+ TEST_REGEX_SEARCH("namespace\\s+(\\w+)\\s+(\\{(?:[^{}]*(?:(?2)[^{}]*)*)?\\})", perl, "namespace one { namespace two { int foo(){} } { {{{ } } } } {}}", match_default, make_array(0, 64, 10, 13, 14, 64, -2, -2));
+ TEST_INVALID_REGEX("((?1)|a)", perl);
+ TEST_REGEX_SEARCH("a(?0)?", perl, "aaaaa", match_default, make_array(0, 5, -2, -2));
+
+ // Recursion to a named sub with a name that is used multiple times:
+ TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+))\\.(?&A)", perl, "aaaa.aa", match_default, make_array(0, 7, 0, 4, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+))\\.(?&A)", perl, "bbbb.aa", match_default, make_array(0, 7, -1, -1, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+))\\.(?&A)", perl, "bbbb.bb", match_default, make_array(-2, -2));
+ // Back reference to a named sub with a name that is used multiple times:
+ TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+))\\.\\k<A>", perl, "aaaa.aaaa", match_default, make_array(0, 9, 0, 4, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+))\\.\\k<A>", perl, "bbbb.aaaa", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+))\\.\\k<A>", perl, "aaaa.bbbb", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+))\\.\\k<A>", perl, "bbbb.bbbb", match_default, make_array(0, 9, -1, -1, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+)|c+)\\.\\k<A>", perl, "cccc.cccc", match_default, make_array(-2, -2));
+}
+
+void test_verbs()
+{
+ using namespace boost::regex_constants;
+
+ TEST_INVALID_REGEX("a+(*", perl);
+ TEST_INVALID_REGEX("a+(*FX)", perl);
+ TEST_REGEX_SEARCH("a+(*FAIL)b", perl, "aaaab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(A(A|B(*ACCEPT)|C)D)(E)", perl, "AB", match_default, make_array(0, 2, 0, 2, 1, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(A(A|B(*ACCEPT)|C)D)(E)", perl, "ACDE", match_default, make_array(0, 4, 0, 3, 1, 2, 3, 4, -2, -2));
+
+ TEST_REGEX_SEARCH("^a+(*FAIL)", perl, "aaaaaa", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a+b?c+(*FAIL)", perl, "aaabccc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a+b?(*COMMIT)c+(*FAIL)", perl, "aaabccc", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(A(A|B(*ACCEPT)|C)D)(E)", perl, "AB", match_default, make_array(0, 2, 0, 2, 1, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(A(A|B(*ACCEPT)|C)D)(E)", perl, "ABX", match_default, make_array(0, 2, 0, 2, 1, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(A(A|B(*ACCEPT)|C)D)(E)", perl, "AADE", match_default, make_array(0, 4, 0, 3, 1, 2, 3, 4, -2, -2));
+ TEST_REGEX_SEARCH("(A(A|B(*ACCEPT)|C)D)(E)", perl, "ACDE", match_default, make_array(0, 4, 0, 3, 1, 2, 3, 4, -2, -2));
+ TEST_REGEX_SEARCH("(A(A|B(*ACCEPT)|C)D)(E)", perl, "AD", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(?:(?1)|B)(A(*ACCEPT)XX|C)D", perl, "AAD", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?1)|B)(A(*ACCEPT)XX|C)D", perl, "ACD", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?1)|B)(A(*ACCEPT)XX|C)D", perl, "BAD", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?1)|B)(A(*ACCEPT)XX|C)D", perl, "BCD", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?1)|B)(A(*ACCEPT)XX|C)D", perl, "BAX", match_default, make_array(0, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(?:(?1)|B)(A(*ACCEPT)XX|C)D", perl, "ACX", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:(?1)|B)(A(*ACCEPT)XX|C)D", perl, "ABC", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("^(?=a(*ACCEPT)b)", perl, "ac", match_default, make_array(0, 0, -2, -2));
+ TEST_REGEX_SEARCH("A(*COMMIT)(B|D)", perl, "ACABX", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(*COMMIT)(A|P)(B|P)(C|P)", perl, "ABCDEFG", match_default, make_array(0, 3, 0, 1, 1, 2, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("(*COMMIT)(A|P)(B|P)(C|P)", perl, "DEFGABC", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("(\\w+)(?>b(*COMMIT))\\w{2}", perl, "abbb", match_default, make_array(0, 4, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(\\w+)b(*COMMIT)\\w{2}", perl, "abbb", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("a+b?(*PRUNE)c+(*FAIL)", perl, "aaabccc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a+b?(*SKIP)c+(*FAIL)", perl, "aaabcccaaabccc", match_default, make_array(-2, -2));
+//
+ TEST_REGEX_SEARCH("^(?=a(*SKIP)b|ac)", perl, "ac", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?=a(*PRUNE)b)", perl, "ab", match_default, make_array(0, 0, -2, -2));
+ TEST_REGEX_SEARCH("^(?=a(*PRUNE)b)", perl, "ac", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("AA+(*PRUNE)(B|Z)|AC", perl, "AAAC", match_default, make_array(2, 4, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("AA+(*SKIP)(B|Z)|AC", perl, "AAAC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("AA+(*SKIP)(B|Z)|C", perl, "AAAC", match_default, make_array(3, 4, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("AA+(*SKIP)(B|Z)|AC", perl, "AAAC", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("AA+(*SKIP)B|C", perl, "AAAC", match_default, make_array(3, 4, -2, -2));
+
+ TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "aaaxxxxxx", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "aaa++++++", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "bbbxxxxx", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "bbb+++++", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "cccxxxx", match_default, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "ccc++++", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "dddddddd", match_default, make_array(0, 3, -2, -2));
+
+ TEST_REGEX_SEARCH("^(aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "aaaxxxxxx", match_default, make_array(0, 9, 0, 9, -2, -2));
+ TEST_REGEX_SEARCH("^(aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "aaa++++++", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "bbbxxxxx", match_default, make_array(0, 8, 0, 8, -2, -2));
+ TEST_REGEX_SEARCH("^(aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "bbb+++++", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "cccxxxx", match_default, make_array(0, 7, 0, 7, -2, -2));
+ TEST_REGEX_SEARCH("^(aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "ccc++++", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "dddddddd", match_default, make_array(0, 3, 0, 3, -2, -2));
+
+ TEST_REGEX_SEARCH("(?:a+(*THEN)\\w{6}|x\\w{3})", perl, "aaaxxxxx", match_default, make_array(3, 7, -2, -2));
+ TEST_REGEX_SEARCH("(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?", perl, "yes", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?>(*COMMIT)(yes|no)(*THEN)(*F))?", perl, "yes", match_default, make_array(-2, -2));
+}
diff --git a/src/boost/libs/regex/test/regress/test_regex_replace.hpp b/src/boost/libs/regex/test/regress/test_regex_replace.hpp
new file mode 100644
index 000000000..cc0297485
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_regex_replace.hpp
@@ -0,0 +1,80 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_regex_replace.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares tests for regex search and replace.
+ */
+
+#ifndef BOOST_REGEX_REGRESS_REGEX_REPLACE_HPP
+#define BOOST_REGEX_REGRESS_REGEX_REPLACE_HPP
+#include "info.hpp"
+
+template<class charT, class traits>
+void test_regex_replace(boost::basic_regex<charT, traits>& r)
+{
+ typedef std::basic_string<charT> string_type;
+ const string_type& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const string_type& format_string = test_info<charT>::format_string();
+ const string_type& result_string = test_info<charT>::result_string();
+
+ string_type result = boost::regex_replace(search_text, r, format_string, opts);
+ if(result != result_string)
+ {
+ BOOST_REGEX_TEST_ERROR("regex_replace generated an incorrect string result", charT);
+ }
+}
+
+
+struct test_regex_replace_tag{};
+
+template<class charT, class traits>
+void test(boost::basic_regex<charT, traits>& r, const test_regex_replace_tag&)
+{
+ const std::basic_string<charT>& expression = test_info<charT>::expression();
+ boost::regex_constants::syntax_option_type syntax_options = test_info<charT>::syntax_options();
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+ r.assign(expression, syntax_options);
+ if(r.status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), charT);
+ }
+ test_regex_replace(r);
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(const boost::bad_expression& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), charT);
+ }
+ catch(const std::runtime_error& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << e.what(), charT);
+ }
+ catch(const std::exception& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << e.what(), charT);
+ }
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", charT);
+ }
+#endif
+
+}
+
+#endif
+
diff --git a/src/boost/libs/regex/test/regress/test_regex_search.hpp b/src/boost/libs/regex/test/regress/test_regex_search.hpp
new file mode 100644
index 000000000..16b1bf91f
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_regex_search.hpp
@@ -0,0 +1,554 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_regex_search.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares tests for regex search and iteration.
+ */
+
+#ifndef BOOST_REGEX_REGRESS_REGEX_SEARCH_HPP
+#define BOOST_REGEX_REGRESS_REGEX_SEARCH_HPP
+#include "info.hpp"
+#ifdef TEST_ROPE
+#include <rope>
+#endif
+//
+// this file implements a test for a regular expression that should compile,
+// followed by a search for that expression:
+//
+struct test_regex_search_tag{};
+
+template <class BidirectionalIterator>
+void test_sub_match(const boost::sub_match<BidirectionalIterator>& sub, BidirectionalIterator base, const int* answer_table, int i, bool recurse = true)
+{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4244)
+#endif
+ if(recurse)
+ {
+ boost::sub_match<BidirectionalIterator> copy(sub);
+ test_sub_match(copy, base, answer_table, i, false);
+ }
+ typedef typename boost::sub_match<BidirectionalIterator>::value_type charT;
+ if((sub.matched == 0)
+ &&
+ !((i == 0)
+ && (test_info<charT>::match_options() & boost::match_partial)) )
+ {
+ if(answer_table[2*i] >= 0)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Sub-expression " << i
+ << " was not matched when it should have been.", charT);
+ }
+ }
+ else
+ {
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.first) != answer_table[2*i])
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in start location of sub-expression "
+ << i << ", found " << boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.first)
+ << ", expected " << answer_table[2*i] << ".", charT);
+ }
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.second) != answer_table[1+ 2*i])
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in end location of sub-expression "
+ << i << ", found " << boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.second)
+ << ", expected " << answer_table[1 + 2*i] << ".", charT);
+ }
+ }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+}
+
+template <class BidirectionalIterator, class Allocator>
+void test_result(const boost::match_results<BidirectionalIterator, Allocator>& what, BidirectionalIterator base, const int* answer_table, bool recurse = true)
+{
+ if(recurse)
+ {
+ boost::match_results<BidirectionalIterator, Allocator> copy(what);
+ test_result(copy, base, answer_table, false);
+ boost::match_results<BidirectionalIterator, Allocator> s;
+ s.swap(copy);
+ test_result(s, base, answer_table, false);
+ boost::match_results<BidirectionalIterator, Allocator> s2;
+ s2 = what;
+ test_result(s2, base, answer_table, false);
+ }
+ for(unsigned i = 0; i < what.size(); ++i)
+ {
+ test_sub_match(what[i], base, answer_table, i);
+ }
+}
+
+template<class charT, class traits>
+void test_simple_search(boost::basic_regex<charT, traits>& r)
+{
+ typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ boost::match_results<const_iterator> what;
+ if(boost::regex_search(
+ search_text.begin(),
+ search_text.end(),
+ what,
+ r,
+ opts))
+ {
+ test_result(what, search_text.begin(), answer_table);
+ // setting match_any should have no effect on the result returned:
+ if(!boost::regex_search(
+ search_text.begin(),
+ search_text.end(),
+ r,
+ opts|boost::regex_constants::match_any))
+ {
+ BOOST_REGEX_TEST_ERROR("Expected match was not found when using the match_any flag.", charT);
+ }
+ }
+ else
+ {
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+ // setting match_any should have no effect on the result returned:
+ else if(boost::regex_search(
+ search_text.begin(),
+ search_text.end(),
+ r,
+ opts|boost::regex_constants::match_any))
+ {
+ BOOST_REGEX_TEST_ERROR("Unexpected match was found when using the match_any flag.", charT);
+ }
+ }
+#ifdef TEST_ROPE
+ std::rope<charT> rsearch_text;
+ for(unsigned i = 0; i < search_text.size(); ++i)
+ {
+ std::rope<charT> c(search_text[i]);
+ if(++i != search_text.size())
+ {
+ c.append(search_text[i]);
+ if(++i != search_text.size())
+ {
+ c.append(search_text[i]);
+ }
+ }
+ rsearch_text.append(c);
+ }
+ boost::match_results<std::rope<charT>::const_iterator> rwhat;
+ if(boost::regex_search(
+ rsearch_text.begin(),
+ rsearch_text.end(),
+ rwhat,
+ r,
+ opts))
+ {
+ test_result(rwhat, rsearch_text.begin(), answer_table);
+ }
+ else
+ {
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+ }
+#endif
+}
+
+template<class charT, class traits>
+void test_regex_iterator(boost::basic_regex<charT, traits>& r)
+{
+ typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ typedef boost::regex_iterator<const_iterator, charT, traits> test_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ test_iterator start(search_text.begin(), search_text.end(), r, opts), end;
+ test_iterator copy(start);
+ const_iterator last_end = search_text.begin();
+ while(start != end)
+ {
+ if(start != copy)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", charT);
+ }
+ if(!(start == copy))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", charT);
+ }
+ test_result(*start, search_text.begin(), answer_table);
+ // test $` and $' :
+ if(start->prefix().first != last_end)
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for start of $`", charT);
+ }
+ if(start->prefix().second != (*start)[0].first)
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for end of $`", charT);
+ }
+ if(start->prefix().matched != (start->prefix().first != start->prefix().second))
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for matched member of $`", charT);
+ }
+ if(start->suffix().first != (*start)[0].second)
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for start of $'", charT);
+ }
+ if(start->suffix().second != search_text.end())
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for end of $'", charT);
+ }
+ if(start->suffix().matched != (start->suffix().first != start->suffix().second))
+ {
+ BOOST_REGEX_TEST_ERROR("Incorrect position for matched member of $'", charT);
+ }
+ last_end = (*start)[0].second;
+ ++start;
+ ++copy;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+}
+
+template<class charT, class traits>
+void test_regex_token_iterator(boost::basic_regex<charT, traits>& r)
+{
+ typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ typedef boost::regex_token_iterator<const_iterator, charT, traits> test_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ //
+ // we start by testing sub-expression 0:
+ //
+ test_iterator start(search_text.begin(), search_text.end(), r, 0, opts), end;
+ test_iterator copy(start);
+ while(start != end)
+ {
+ if(start != copy)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", charT);
+ }
+ if(!(start == copy))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", charT);
+ }
+ test_sub_match(*start, search_text.begin(), answer_table, 0);
+ ++start;
+ ++copy;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+ //
+ // and now field spitting:
+ //
+ test_iterator start2(search_text.begin(), search_text.end(), r, -1, opts), end2;
+ test_iterator copy2(start2);
+ int last_end2 = 0;
+ answer_table = test_info<charT>::answer_table();
+ while(start2 != end2)
+ {
+ if(start2 != copy2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", charT);
+ }
+ if(!(start2 == copy2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", charT);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4244)
+#endif
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first) != last_end2)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of start of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first)
+ << ", expected: "
+ << last_end2
+ << ".", charT);
+ }
+ int expected_end = static_cast<int>(answer_table[0] < 0 ? search_text.size() : answer_table[0]);
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second) != expected_end)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of end2 of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second)
+ << ", expected: "
+ << expected_end
+ << ".", charT);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+ last_end2 = answer_table[1];
+ ++start2;
+ ++copy2;
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ //
+ // and now both field splitting and $0:
+ //
+ std::vector<int> subs;
+ subs.push_back(-1);
+ subs.push_back(0);
+ start2 = test_iterator(search_text.begin(), search_text.end(), r, subs, opts);
+ copy2 = start2;
+ last_end2 = 0;
+ answer_table = test_info<charT>::answer_table();
+ while(start2 != end2)
+ {
+ if(start2 != copy2)
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator != comparison.", charT);
+ }
+ if(!(start2 == copy2))
+ {
+ BOOST_REGEX_TEST_ERROR("Failed iterator == comparison.", charT);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4244)
+#endif
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first) != last_end2)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of start of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first)
+ << ", expected: "
+ << last_end2
+ << ".", charT);
+ }
+ int expected_end = static_cast<int>(answer_table[0] < 0 ? search_text.size() : answer_table[0]);
+ if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second) != expected_end)
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Error in location of end2 of field split, found: "
+ << boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second)
+ << ", expected: "
+ << expected_end
+ << ".", charT);
+ }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+ last_end2 = answer_table[1];
+ ++start2;
+ ++copy2;
+ if((start2 == end2) && (answer_table[0] >= 0))
+ {
+ BOOST_REGEX_TEST_ERROR(
+ "Expected $0 match not found", charT);
+ }
+ if(start2 != end2)
+ {
+ test_sub_match(*start2, search_text.begin(), answer_table, 0);
+ ++start2;
+ ++copy2;
+ }
+ // move on the answer table to next set of answers;
+ if(*answer_table != -2)
+ while(*answer_table++ != -2){}
+ }
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+#endif
+}
+
+template <class charT, class traits>
+struct grep_test_predicate
+{
+ typedef typename std::basic_string<charT>::const_iterator test_iter;
+
+ grep_test_predicate(test_iter b, const int* a)
+ : m_base(b), m_table(a)
+ {}
+ bool operator()(const boost::match_results<test_iter>& what)
+ {
+ test_result(what, m_base, m_table);
+ // move on the answer table to next set of answers;
+ if(*m_table != -2)
+ while(*m_table++ != -2){}
+ return true;
+ }
+private:
+ test_iter m_base;
+ const int* m_table;
+};
+
+template<class charT, class traits>
+void test_regex_grep(boost::basic_regex<charT, traits>& r)
+{
+ //typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ grep_test_predicate<charT, traits> pred(search_text.begin(), answer_table);
+ boost::regex_grep(pred, search_text.begin(), search_text.end(), r, opts);
+}
+
+template<class charT, class traits>
+void test_regex_match(boost::basic_regex<charT, traits>& r)
+{
+ typedef typename std::basic_string<charT>::const_iterator const_iterator;
+ const std::basic_string<charT>& search_text = test_info<charT>::search_text();
+ boost::regex_constants::match_flag_type opts = test_info<charT>::match_options();
+ const int* answer_table = test_info<charT>::answer_table();
+ boost::match_results<const_iterator> what;
+ if(answer_table[0] < 0)
+ {
+ if(boost::regex_match(search_text, r, opts))
+ {
+ BOOST_REGEX_TEST_ERROR("boost::regex_match found a match when it should not have done so.", charT);
+ }
+ }
+ else
+ {
+ if((answer_table[0] > 0) && boost::regex_match(search_text, r, opts))
+ {
+ BOOST_REGEX_TEST_ERROR("boost::regex_match found a match when it should not have done so.", charT);
+ }
+ else if((answer_table[0] == 0) && (answer_table[1] == static_cast<int>(search_text.size())))
+ {
+ if(boost::regex_match(
+ search_text.begin(),
+ search_text.end(),
+ what,
+ r,
+ opts))
+ {
+ test_result(what, search_text.begin(), answer_table);
+ }
+ else if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+ }
+ }
+}
+
+template<class charT, class traits>
+void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
+{
+ const std::basic_string<charT>& expression = test_info<charT>::expression();
+ boost::regex_constants::syntax_option_type syntax_options = test_info<charT>::syntax_options();
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
+ r.assign(expression, syntax_options);
+ if(r.status())
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), charT);
+ }
+ if(expression != std::basic_string<charT>(r.begin(), r.end()))
+ {
+ BOOST_REGEX_TEST_ERROR("Stored expression string was incorrect", charT);
+ }
+ test_simple_search(r);
+ test_regex_iterator(r);
+ test_regex_token_iterator(r);
+ test_regex_grep(r);
+ test_regex_match(r);
+ //
+ // Verify sub-expression locations:
+ //
+#ifndef BOOST_NO_EXCEPTIONS
+ if((syntax_options & boost::regbase::save_subexpression_location) == 0)
+ {
+ bool have_except = false;
+ try
+ {
+ r.subexpression(1);
+ }
+ catch(const std::out_of_range&)
+ {
+ have_except = true;
+ }
+ if(!have_except)
+ {
+ BOOST_REGEX_TEST_ERROR("Expected std::out_of_range error was not found.", charT);
+ }
+ }
+#endif
+ r.assign(expression, syntax_options | boost::regbase::save_subexpression_location);
+ for(std::size_t i = 0; i < r.mark_count(); ++i)
+ {
+ std::pair<const charT*, const charT*> p = r.subexpression(i);
+ if(*p.first != '(')
+ {
+ BOOST_REGEX_TEST_ERROR("Starting location of sub-expression " << i << " iterator was invalid.", charT);
+ }
+ if(*p.second != ')')
+ {
+ BOOST_REGEX_TEST_ERROR("Ending location of sub-expression " << i << " iterator was invalid.", charT);
+ }
+ }
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(const boost::bad_expression& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), charT);
+ }
+ catch(const std::runtime_error& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << e.what(), charT);
+ }
+ catch(const std::exception& e)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << e.what(), charT);
+ }
+ catch(...)
+ {
+ BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", charT);
+ }
+#endif
+}
+
+
+
+#endif
diff --git a/src/boost/libs/regex/test/regress/test_replace.cpp b/src/boost/libs/regex/test/regress/test_replace.cpp
new file mode 100644
index 000000000..635e6e30c
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_replace.cpp
@@ -0,0 +1,198 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_replace()
+{
+ using namespace boost::regex_constants;
+ // start by testing subs:
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$`", "...");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$'", ",,,");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$&", "aaa");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$0", "aaa");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$1", "");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$15", "");
+ TEST_REGEX_REPLACE("(a+)b+", perl, "...aaabbb,,,", match_default|format_no_copy, "$1", "aaa");
+ TEST_REGEX_REPLACE("[[:digit:]]*", perl, "123ab", match_default|format_no_copy, "<$0>", "<123><><><>");
+ TEST_REGEX_REPLACE("[[:digit:]]*", perl, "123ab1", match_default|format_no_copy, "<$0>", "<123><><><1><>");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$`$", "...$");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "(?1x:y)", "(?1x:y)");
+ // and now escapes:
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$x", "$x");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\a", "\a");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\f", "\f");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\n", "\n");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\r", "\r");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\t", "\t");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\v", "\v");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\", "\\");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\x21", "!");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\xz", "xz");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\x", "x");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\x{z}", "x{z}");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\x{12b", "x{12b");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\x{21}", "!");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\c@", "\0");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\c", "c");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\e", "\x1B");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\0101", "A");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "\\u$1", "Aaa");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "\\U$1", "AAA");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "\\U$1\\E$1", "AAAaaa");
+ TEST_REGEX_REPLACE("(A+)", perl, "...AAA,,,", match_default|format_no_copy, "\\l$1", "aAA");
+ TEST_REGEX_REPLACE("(A+)", perl, "...AAA,,,", match_default|format_no_copy, "\\L$1", "aaa");
+ TEST_REGEX_REPLACE("(A+)", perl, "...AAA,,,", match_default|format_no_copy, "\\L$1\\E$1", "aaaAAA");
+ TEST_REGEX_REPLACE("\\w+", perl, "fee FOO FAR bAR", match_default|format_perl, "\\L\\u$0", "Fee Foo Far Bar");
+ // sed format sequences:
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "\\0", "aabb");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "\\1", "aa");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "\\2", "bb");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "&", "aabb");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "$", "$");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "$1", "$1");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "()?:", "()?:");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "\\\\", "\\");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "\\&", "&");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_sed|format_no_copy, "\\l\\u\\L\\U\\E", "luLUE");
+
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "$0", "aabb");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "$1", "aa");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "$2", "bb");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "$&", "aabb");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "$$", "$");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "&", "&");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "\\0", "\0");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "()?:", "()?:");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,", match_default|format_perl|format_no_copy, "\\0101", "A");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "\\1", "aa");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, " ...aabb,,", match_default|format_perl|format_no_copy, "\\2", "bb");
+
+ // move to copying unmatched data:
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_all, "bbb", "...bbb,,,");
+ TEST_REGEX_REPLACE("a+(b+)", perl, "...aaabb,,,", match_default|format_all, "$1", "...bb,,,");
+ TEST_REGEX_REPLACE("a+(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "$1", "...bb,,,b*bbb?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?1A)(?2B)", "...AB,,,AB*AB?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "?1A:B", "...AB,,,AB*AB?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?1A:B)C", "...ACBC,,,ACBC*ACBC?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "?1:B", "...B,,,B*B?");
+
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?{1}A)(?{2}B)", "...AB,,,AB*AB?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "?{1}A:B", "...AB,,,AB*AB?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?{1}A:B)C", "...ACBC,,,ACBC*ACBC?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "?{1}:B", "...B,,,B*B?");
+ TEST_REGEX_REPLACE("(?<one>a+)|(?<two>b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?{one}A)(?{two}B)", "...AB,,,AB*AB?");
+ TEST_REGEX_REPLACE("(?<one>a+)|(?<two>b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "?{one}A:B", "...AB,,,AB*AB?");
+ TEST_REGEX_REPLACE("(?<one>a+)|(?<two>b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?{one}A:B)C", "...ACBC,,,ACBC*ACBC?");
+ TEST_REGEX_REPLACE("(?<one>a+)|(?<two>b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "?{one}:B", "...B,,,B*B?");
+
+ // move to copying unmatched data, but replace first occurance only:
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_all|format_first_only, "bbb", "...bbb,,,");
+ TEST_REGEX_REPLACE("a+(b+)", perl, "...aaabb,,,", match_default|format_all|format_first_only, "$1", "...bb,,,");
+ TEST_REGEX_REPLACE("a+(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all|format_first_only, "$1", "...bb,,,ab*abbb?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all|format_first_only, "(?1A)(?2B)", "...Abb,,,ab*abbb?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "?1A", "...A,,,A*A?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "?1:B", "...B,,,B*B?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?1A:(?2B))", "...AB,,,AB*AB?");
+ TEST_REGEX_REPLACE("X", literal, "XX", match_default, "Y", "YY");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?", "...??,,,??*???");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?a", "...?a?a,,,?a?a*?a?a?");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?1A:(?2B))abc", "...AabcBabc,,,AabcBabc*AabcBabc?");
+ TEST_REGEX_REPLACE("a+(b+)", perl, "...aaabb,,,", match_default|format_all|format_no_copy, "(?2abc:def)", "def");
+ TEST_REGEX_REPLACE("a+(b+)", perl, "...aaabb,,,", match_default|format_all|format_no_copy, "(?1abc:def)", "abc");
+ TEST_REGEX_REPLACE("a+(b+)", perl, "...aaabb,,,", match_default|format_perl|format_no_copy, "(?1abc:def)", "(?1abc:def)");
+ TEST_REGEX_REPLACE("a+(b+)", perl, "...", match_default|format_perl, "(?1abc:def)", "...");
+ TEST_REGEX_REPLACE("a+(b+)", perl, "...", match_default|format_perl|format_no_copy, "(?1abc:def)", "");
+ // probe bug reports and other special cases:
+ TEST_REGEX_REPLACE("([^\\d]+).*", normal|icase, "tesd 999 test", match_default|format_all, "($1)replace", "tesd replace");
+ TEST_REGEX_REPLACE("(a)(b)", perl, "ab", match_default|format_all, "$1:$2", "a:b");
+ TEST_REGEX_REPLACE("(a(c)?)|(b)", perl, "acab", match_default|format_all, "(?1(?2(C:):A):B:)", "C:AB:");
+ TEST_REGEX_REPLACE("x", icase, "xx", match_default|format_all, "a", "aa");
+ TEST_REGEX_REPLACE("x", basic|icase, "xx", match_default|format_all, "a", "aa");
+ TEST_REGEX_REPLACE("x", boost::regex::extended|icase, "xx", match_default|format_all, "a", "aa");
+ TEST_REGEX_REPLACE("x", emacs|icase, "xx", match_default|format_all, "a", "aa");
+ TEST_REGEX_REPLACE("x", literal|icase, "xx", match_default|format_all, "a", "aa");
+ // literals:
+ TEST_REGEX_REPLACE("(a(c)?)|(b)", perl, "acab", match_default|format_literal, "\\&$", "\\&$\\&$\\&$");
+ // Bracketed sub expressions:
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default, "$", "...$,,,");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default, "${", "...${,,,");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default, "${2", "...${2,,,");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default, "${23", "...${23,,,");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default, "${d}", "...${d},,,");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default, "/${1}/", ".../aaa/,,,");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default, "/${10}/", "...//,,,");
+ TEST_REGEX_REPLACE("((((((((((a+))))))))))", perl, "...aaa,,,", match_default, "/${10}/", ".../aaa/,,,");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default, "/${1}0/", ".../aaa0/,,,");
+
+ // New Perl style operators:
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$MATCH", "aaa");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${MATCH}", "aaa");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${^MATCH}", "aaa");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$MATC", "$MATC");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${MATCH", "${MATCH");
+
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$PREMATCH", "...");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${PREMATCH}", "...");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${^PREMATCH}", "...");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$PREMATC", "$PREMATC");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${PREMATCH", "${PREMATCH");
+
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$POSTMATCH", ",,,");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${POSTMATCH}", ",,,");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${^POSTMATCH}", ",,,");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$POSTMATC", "$POSTMATC");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "${POSTMATCH", "${POSTMATCH");
+
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_PAREN_MATCH", "");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_PAREN_MATC", "$LAST_PAREN_MATC");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_PAREN_MATCH", "aaa");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$LAST_PAREN_MATCH", "bb");
+
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$+", "");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$+foo", "foo");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "$+", "aaa");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$+foo", "bbfoo");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$+{", "bb{");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$+{foo", "bb{foo");
+
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESULT", "");
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESUL", "$LAST_SUBMATCH_RESUL");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESULT", "aaa");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESULT", "bb");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaa,,,", match_default|format_no_copy, "$LAST_SUBMATCH_RESULT", "aaa");
+
+ TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$^N", "");
+ TEST_REGEX_REPLACE("(a+)", perl, "...aaa,,,", match_default|format_no_copy, "$^N", "aaa");
+ TEST_REGEX_REPLACE("(a+)(b+)", perl, "...aaabb,,,", match_default|format_no_copy, "$^N", "bb");
+ TEST_REGEX_REPLACE("(a+)|(b+)", perl, "...aaa,,,", match_default|format_no_copy, "$^N", "aaa");
+
+ TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "$&", "aabb");
+ TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "$1", "aa");
+ TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "$2", "bb");
+ TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "d$+{one}c", "daac");
+ TEST_REGEX_REPLACE("(?<one>a+)(?<two>b+)", perl, " ...aabb,,", match_default|format_no_copy, "c$+{two}d", "cbbd");
+
+ TEST_REGEX_REPLACE("(?<one>a)(?<one>b)(c)", perl, " ...abc,,", match_default, "$1.$2.$3.$+{one}", " ...a.b.c.a,,");
+ TEST_REGEX_REPLACE("(?:(?<one>a)|(?<one>b))", perl, " ...a,,", match_default, "$1.$2.$+{one}", " ...a..a,,");
+ TEST_REGEX_REPLACE("(?:(?<one>a)|(?<one>b))", perl, " ...b,,", match_default, "$1.$2.$+{one}", " ....b.b,,");
+ TEST_REGEX_REPLACE("(?:(?<one>a)(?<one>b))", perl, " ...ab,,", match_default, "$1.$2.$+{one}", " ...a.b.a,,");
+
+ // See https://svn.boost.org/trac/boost/ticket/589
+ TEST_REGEX_REPLACE("(a*)", perl, "aabb", match_default, "{$1}", "{aa}{}b{}b{}");
+ TEST_REGEX_REPLACE("(a*)", boost::regex::extended, "aabb", match_default, "{$1}", "{aa}{}b{}b{}");
+ TEST_REGEX_REPLACE("(a*)", boost::regex::extended, "aabb", match_default|match_posix, "{$1}", "{aa}b{}b{}");
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_sets.cpp b/src/boost/libs/regex/test/regress/test_sets.cpp
new file mode 100644
index 000000000..3cd7a520e
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_sets.cpp
@@ -0,0 +1,406 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_sets()
+{
+ using namespace boost::regex_constants;
+ // now test the set operator []
+ TEST_REGEX_SEARCH("[abc]", boost::regex::extended, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[abc]", boost::regex::extended, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[abc]", boost::regex::extended, "c", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[abc]", boost::regex::extended, "d", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[^bcd]", boost::regex::extended, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[^bcd]", boost::regex::extended, "b", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[^bcd]", boost::regex::extended, "d", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[^bcd]", boost::regex::extended, "e", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a[b]c", boost::regex::extended, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[ab]c", boost::regex::extended, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[a^b]*c", boost::regex::extended, "aba^c", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a[^ab]c", boost::regex::extended, "adc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[]b]c", boost::regex::extended, "a]c", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[[b]c", boost::regex::extended, "a[c", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[-b]c", boost::regex::extended, "a-c", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[^]b]c", boost::regex::extended, "adc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[^-b]c", boost::regex::extended, "adc", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[b-]c", boost::regex::extended, "a-c", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[a-z-]c", boost::regex::extended, "a-c", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[a-z-]+c", boost::regex::extended, "aaz-c", match_default, make_array(0, 5, -2, -2));
+ TEST_INVALID_REGEX("a[b", boost::regex::extended);
+ TEST_INVALID_REGEX("a[", boost::regex::extended);
+ TEST_INVALID_REGEX("a[]", boost::regex::extended);
+
+ // now some ranges:
+ TEST_REGEX_SEARCH("[b-e]", boost::regex::extended, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[b-e]", boost::regex::extended, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[b-e]", boost::regex::extended, "e", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[b-e]", boost::regex::extended, "f", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[^b-e]", boost::regex::extended, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[^b-e]", boost::regex::extended, "b", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[^b-e]", boost::regex::extended, "e", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[^b-e]", boost::regex::extended, "f", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a[1-3]c", boost::regex::extended, "a2c", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[-3]c", boost::regex::extended, "a-c", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[-3]c", boost::regex::extended, "a3c", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a[^-3]c", boost::regex::extended, "a-c", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a[^-3]c", boost::regex::extended, "a3c", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a[^-3]c", boost::regex::extended, "axc", match_default, make_array(0, 3, -2, -2));
+ TEST_INVALID_REGEX("a[3-1]c", boost::regex::extended & ~::boost::regex_constants::collate);
+ TEST_INVALID_REGEX("a[1-3-5]c", boost::regex::extended);
+ TEST_INVALID_REGEX("a[1-", boost::regex::extended);
+ TEST_INVALID_REGEX("a[\\9]", perl);
+
+ // and some classes
+ TEST_REGEX_SEARCH("a[[:alpha:]]c", boost::regex::extended, "abc", match_default, make_array(0, 3, -2, -2));
+ TEST_INVALID_REGEX("a[[:unknown:]]c", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:a", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:alpha", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:alpha:", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:alpha:]", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:alpha:!", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:alpha,:]", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:]:]]b", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:-:]]b", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:alph:]]", boost::regex::extended);
+ TEST_INVALID_REGEX("a[[:alphabet:]]", boost::regex::extended);
+ TEST_REGEX_SEARCH("[[:alnum:]]+", boost::regex::extended, "-%@a0X_-", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("[[:alpha:]]+", boost::regex::extended, " -%@aX_0-", match_default, make_array(4, 6, -2, -2));
+ TEST_REGEX_SEARCH("[[:blank:]]+", boost::regex::extended, "a \tb", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("[[:cntrl:]]+", boost::regex::extended, " a\n\tb", match_default, make_array(2, 4, -2, -2));
+ TEST_REGEX_SEARCH("[[:digit:]]+", boost::regex::extended, "a019b", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("[[:graph:]]+", boost::regex::extended, " a%b ", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("[[:lower:]]+", boost::regex::extended, "AabC", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("[[:print:]]+", boost::regex::extended, "AabC", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("[[:punct:]]+", boost::regex::extended, " %-&\t", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("[[:space:]]+", boost::regex::extended, "a \n\t\rb", match_default, make_array(1, 5, -2, -2));
+ TEST_REGEX_SEARCH("[[:upper:]]+", boost::regex::extended, "aBCd", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("[[:xdigit:]]+", boost::regex::extended, "p0f3Cx", match_default, make_array(1, 5, -2, -2));
+ TEST_REGEX_SEARCH("[\\d]+", perl, "a019b", match_default, make_array(1, 4, -2, -2));
+
+ //
+ // escapes are supported in character classes if we have either
+ // perl or awk regular expressions:
+ //
+ TEST_REGEX_SEARCH("[\\n]", perl, "\n", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[\\b]", perl, "\b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[\\n]", basic, "\n", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[\\n]", basic, "\\", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:class:]", basic|no_char_classes, ":", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:class:]", basic|no_char_classes, "[", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:class:]", basic|no_char_classes, "c", match_default, make_array(0, 1, -2, -2));
+ //
+ // test single character escapes:
+ //
+ TEST_REGEX_SEARCH("\\w", perl, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\w", perl, "Z", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\w", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\w", perl, "z", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\w", perl, "_", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\w", perl, "}", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\w", perl, "`", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\w", perl, "[", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\w", perl, "@", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\W", perl, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\W", perl, "z", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\W", perl, "A", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\W", perl, "Z", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\W", perl, "_", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\W", perl, "}", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\W", perl, "`", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\W", perl, "[", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\W", perl, "@", match_default, make_array(0, 1, -2, -2));
+
+ TEST_REGEX_SEARCH("[[:lower:]]", perl|icase, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:upper:]]", perl|icase, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:alpha:]]", perl|icase, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:alnum:]]", perl|icase, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:lower:]]", perl|icase, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:upper:]]", perl|icase, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:alpha:]]", perl|icase, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:alnum:]]", perl|icase, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:lower:][:upper:]]", perl, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:lower:][:upper:]]", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:lower:][:alpha:]]", perl, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[:lower:][:alpha:]]", perl, "a", match_default, make_array(0, 1, -2, -2));
+}
+
+void test_sets2b();
+void test_sets2c();
+
+void test_sets2()
+{
+ using namespace boost::regex_constants;
+ // collating elements
+ TEST_REGEX_SEARCH("[[.zero.]]", perl, "0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.one.]]", perl, "1", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.two.]]", perl, "2", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.three.]]", perl, "3", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.a.]]", perl, "bac", match_default, make_array(1, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.\xf0.]]", perl, "b\xf0x", match_default, make_array(1, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.right-curly-bracket.]]", perl, "}", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.NUL.]]", perl, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.NUL.][.ae.]]", perl, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.NUL.]-a]", boost::regex::extended, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.NUL.]-a]", perl, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.NUL.]-a]", boost::regex::extended, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.NUL.]-a]", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.NUL.]-[.NUL.]a]", boost::regex::extended, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.NUL.]-[.NUL.]a]", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_INVALID_REGEX("[[..]]", perl);
+ TEST_INVALID_REGEX("[[.not-a-collating-element.]]", perl);
+ TEST_INVALID_REGEX("[[.", perl);
+ TEST_INVALID_REGEX("[[.N", perl);
+ TEST_INVALID_REGEX("[[.NUL", perl);
+ TEST_INVALID_REGEX("[[.NUL.", perl);
+ TEST_INVALID_REGEX("[[.NUL.]", perl);
+ TEST_INVALID_REGEX("[[:<:]z]", perl);
+ TEST_INVALID_REGEX("[a[:>:]]", perl);
+ TEST_REGEX_SEARCH("[[.A.]]", boost::regex::extended|icase, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.A.]]", boost::regex::extended|icase, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.A.]-b]+", boost::regex::extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("[A-[.b.]]+", boost::regex::extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("[[.a.]-B]+", boost::regex::extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("[a-[.B.]]+", boost::regex::extended|icase, "AaBb", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("[\x61]", boost::regex::extended, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[\x61-c]+", boost::regex::extended, "abcd", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("[a-\x63]+", boost::regex::extended, "abcd", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("[[.a.]-c]+", boost::regex::extended, "abcd", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("[a-[.c.]]+", boost::regex::extended, "abcd", match_default, make_array(0, 3, -2, -2));
+ TEST_INVALID_REGEX("[[:alpha:]-a]", boost::regex::extended);
+ TEST_INVALID_REGEX("[a-[:alpha:]]", boost::regex::extended);
+ TEST_REGEX_SEARCH("[[.ae.]]", basic, "ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]]", basic, "aE", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[[.AE.]]", basic, "AE", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.Ae.]]", basic, "Ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]-b]", basic, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]-b]", basic, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]-b]", basic, "ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[a-[.ae.]]", basic, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[a-[.ae.]]", basic, "b", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[a-[.ae.]]", basic, "ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]]", basic|icase, "AE", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]]", basic|icase, "Ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.AE.]]", basic|icase, "Ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.Ae.]]", basic|icase, "aE", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.AE.]-B]", basic|icase, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[[.Ae.]-b]", basic|icase, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.Ae.]-b]", basic|icase, "B", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]-b]", basic|icase, "AE", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]]", perl, "ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]]", perl, "aE", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[[.AE.]]", perl, "AE", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.Ae.]]", perl, "Ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]-b]", perl, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]-b]", perl, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]-b]", perl, "ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[a-[.ae.]]", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[a-[.ae.]]", perl, "b", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[a-[.ae.]]", perl, "ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]]", perl|icase, "AE", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]]", perl|icase, "Ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.AE.]]", perl|icase, "Ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.Ae.]]", perl|icase, "aE", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.AE.]-B]", perl|icase, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("[[.Ae.]-b]", perl|icase, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.Ae.]-b]", perl|icase, "B", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.]-b]", perl|icase, "AE", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.][:lower:]]", perl|icase, "AE", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.][:lower:]]", perl|icase, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[.ae.][=a=]]+", perl, "zzaA", match_default, make_array(2, 4, -2, -2));
+ TEST_INVALID_REGEX("[d-[.ae.]]", perl);
+ //
+ // try some equivalence classes:
+ //
+ TEST_REGEX_SEARCH("[[=a=]]", basic, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[=a=]]", basic, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[=ae=]]", basic, "ae", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("[[=right-curly-bracket=]]", basic, "}", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[=NUL=]]", basic, "\x0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[[=NUL=]]", perl, "\x0", match_default, make_array(0, 1, -2, -2));
+ TEST_INVALID_REGEX("[[=", perl);
+ TEST_INVALID_REGEX("[[=a", perl);
+ TEST_INVALID_REGEX("[[=ae", perl);
+ TEST_INVALID_REGEX("[[=ae=", perl);
+ TEST_INVALID_REGEX("[[=ae=]", perl);
+ //
+ // now some perl style single character classes:
+ //
+ TEST_REGEX_SEARCH("\\l+", perl, "ABabcAB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[\\l]+", perl, "ABabcAB", match_default, make_array(2, 5, -2, -2));
+ TEST_INVALID_REGEX("[\\l-a]", perl);
+ TEST_REGEX_SEARCH("[\\L]+", perl, "abABCab", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[[:^lower:]]+", perl, "abABCab", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\L+", perl, "abABCab", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\u+", perl, "abABCab", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[\\u]+", perl, "abABCab", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[\\U]+", perl, "ABabcAB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[[:^upper:]]+", perl, "ABabcAB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\U+", perl, "ABabcAB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\d+", perl, "AB012AB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[\\d]+", perl, "AB012AB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[\\D]+", perl, "01abc01", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[[:^digit:]]+", perl, "01abc01", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\D+", perl, "01abc01", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\s+", perl, "AB AB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[\\s]+", perl, "AB AB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[\\S]+", perl, " abc ", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[[:^space:]]+", perl, " abc ", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\S+", perl, " abc ", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\s+", perl, "AB AB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("[\\w]+", perl, "AB_ AB", match_default, make_array(0, 3, -2, 6, 8, -2, -2));
+ TEST_REGEX_SEARCH("[\\W]+", perl, "AB_ AB", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("[[:^word:]]+", perl, "AB_ AB", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\W+", perl, "AB_ AB", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\h+", perl, "\v\f\r\n \t\n", match_default, make_array(4, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\V+", perl, "\v\f\r\n \t\n", match_default, make_array(4, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\H+", perl, " \t\v\f\r\n ", match_default, make_array(2, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\v+", perl, " \t\v\f\r\n ", match_default, make_array(2, 6, -2, -2));
+ test_sets2c();
+}
+
+void test_sets2c()
+{
+ using namespace boost::regex_constants;
+ // and some Perl style properties:
+ TEST_REGEX_SEARCH("\\pl+", perl, "ABabcAB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\Pl+", perl, "abABCab", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\pu+", perl, "abABCab", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\Pu+", perl, "ABabcAB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\pd+", perl, "AB012AB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\PD+", perl, "01abc01", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\ps+", perl, "AB AB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\PS+", perl, " abc ", match_default, make_array(2, 5, -2, -2));
+
+ TEST_REGEX_SEARCH("\\p{alnum}+", perl, "-%@a0X_-", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\p{alpha}+", perl, " -%@aX_0-", match_default, make_array(4, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\p{blank}+", perl, "a \tb", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{cntrl}+", perl, " a\n\tb", match_default, make_array(2, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{digit}+", perl, "a019b", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{graph}+", perl, " a%b ", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{lower}+", perl, "AabC", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\p{print}+", perl, "AabC", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{punct}+", perl, " %-&\t", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{space}+", perl, "a \n\t\rb", match_default, make_array(1, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\p{upper}+", perl, "aBCd", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\p{xdigit}+", perl, "p0f3Cx", match_default, make_array(1, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\P{alnum}+", perl, "-%@a", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\P{alpha}+", perl, " -%@a", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\P{blank}+", perl, "a ", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{cntrl}+", perl, " a\n", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\P{digit}+", perl, "a0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{graph}+", perl, " a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{lower}+", perl, "Aa", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{print}+", perl, "Absc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\P{punct}+", perl, " %", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{space}+", perl, "a ", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{upper}+", perl, "aB", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{xdigit}+", perl, "pf", match_default, make_array(0, 1, -2, -2));
+
+ TEST_INVALID_REGEX("\\p{invalid class}", perl);
+ TEST_INVALID_REGEX("\\p{upper", perl);
+ TEST_INVALID_REGEX("\\p{", perl);
+ TEST_INVALID_REGEX("\\p", perl);
+ TEST_INVALID_REGEX("\\P{invalid class}", perl);
+ TEST_INVALID_REGEX("\\P{upper", perl);
+ TEST_INVALID_REGEX("\\P{", perl);
+ TEST_INVALID_REGEX("\\P", perl);
+
+ // try named characters:
+ TEST_REGEX_SEARCH("\\N{zero}", perl, "0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{one}", perl, "1", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{two}", perl, "2", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{three}", perl, "3", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{a}", perl, "bac", match_default, make_array(1, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\N{\xf0}", perl, "b\xf0x", match_default, make_array(1, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\N{right-curly-bracket}", perl, "}", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{NUL}", perl, "\0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[\\N{zero}-\\N{nine}]+", perl, " 0123456789 ", match_default, make_array(1, 11, -2, -2));
+
+ TEST_INVALID_REGEX("\\N", perl);
+ TEST_INVALID_REGEX("\\N{", perl);
+ TEST_INVALID_REGEX("\\N{}", perl);
+ TEST_INVALID_REGEX("\\N{invalid-name}", perl);
+ TEST_INVALID_REGEX("\\N{zero", perl);
+ test_sets2b();
+}
+
+void test_sets2b()
+{
+ using namespace boost::regex_constants;
+
+ // and repeat with POSIX-boost::regex::extended syntax:
+ TEST_REGEX_SEARCH("\\pl+", boost::regex::extended, "ABabcAB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\Pl+", boost::regex::extended, "abABCab", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\pu+", boost::regex::extended, "abABCab", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\Pu+", boost::regex::extended, "ABabcAB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\pd+", boost::regex::extended, "AB012AB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\PD+", boost::regex::extended, "01abc01", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\ps+", boost::regex::extended, "AB AB", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\PS+", boost::regex::extended, " abc ", match_default, make_array(2, 5, -2, -2));
+
+ TEST_REGEX_SEARCH("\\p{alnum}+", boost::regex::extended, "-%@a0X_-", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\p{alpha}+", boost::regex::extended, " -%@aX_0-", match_default, make_array(4, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\p{blank}+", boost::regex::extended, "a \tb", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{cntrl}+", boost::regex::extended, " a\n\tb", match_default, make_array(2, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{digit}+", boost::regex::extended, "a019b", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{graph}+", boost::regex::extended, " a%b ", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{lower}+", boost::regex::extended, "AabC", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\p{print}+", boost::regex::extended, "AabC", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{punct}+", boost::regex::extended, " %-&\t", match_default, make_array(1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\p{space}+", boost::regex::extended, "a \n\t\rb", match_default, make_array(1, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\p{upper}+", boost::regex::extended, "aBCd", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\p{xdigit}+", boost::regex::extended, "p0f3Cx", match_default, make_array(1, 5, -2, -2));
+ TEST_REGEX_SEARCH("\\P{alnum}+", boost::regex::extended, "-%@a", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("\\P{alpha}+", boost::regex::extended, " -%@a", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\P{blank}+", boost::regex::extended, "a ", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{cntrl}+", boost::regex::extended, " a\n", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\P{digit}+", boost::regex::extended, "a0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{graph}+", boost::regex::extended, " a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{lower}+", boost::regex::extended, "Aa", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{print}+", boost::regex::extended, "Absc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("\\P{punct}+", boost::regex::extended, " %", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{space}+", boost::regex::extended, "a ", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{upper}+", boost::regex::extended, "aB", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\P{xdigit}+", boost::regex::extended, "pf", match_default, make_array(0, 1, -2, -2));
+
+ TEST_INVALID_REGEX("\\p{invalid class}", boost::regex::extended);
+ TEST_INVALID_REGEX("\\p{upper", boost::regex::extended);
+ TEST_INVALID_REGEX("\\p{", boost::regex::extended);
+ TEST_INVALID_REGEX("\\p", boost::regex::extended);
+ TEST_INVALID_REGEX("\\P{invalid class}", boost::regex::extended);
+ TEST_INVALID_REGEX("\\P{upper", boost::regex::extended);
+ TEST_INVALID_REGEX("\\P{", boost::regex::extended);
+ TEST_INVALID_REGEX("\\P", boost::regex::extended);
+
+ // try named characters:
+ TEST_REGEX_SEARCH("\\N{zero}", boost::regex::extended, "0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{one}", boost::regex::extended, "1", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{two}", boost::regex::extended, "2", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{three}", boost::regex::extended, "3", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{a}", boost::regex::extended, "bac", match_default, make_array(1, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\N{\xf0}", boost::regex::extended, "b\xf0x", match_default, make_array(1, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\N{right-curly-bracket}", boost::regex::extended, "}", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\N{NUL}", boost::regex::extended, "\0", match_default, make_array(0, 1, -2, -2));
+
+ TEST_INVALID_REGEX("\\N", boost::regex::extended);
+ TEST_INVALID_REGEX("\\N{", boost::regex::extended);
+ TEST_INVALID_REGEX("\\N{}", boost::regex::extended);
+ TEST_INVALID_REGEX("\\N{invalid-name}", boost::regex::extended);
+ TEST_INVALID_REGEX("\\N{zero", boost::regex::extended);
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_simple_repeats.cpp b/src/boost/libs/regex/test/regress/test_simple_repeats.cpp
new file mode 100644
index 000000000..1a73fde6e
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_simple_repeats.cpp
@@ -0,0 +1,500 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_simple_repeats2();
+
+void test_simple_repeats()
+{
+ using namespace boost::regex_constants;
+ // simple repeats:
+ TEST_REGEX_SEARCH("a*", perl, "b", match_default, make_array(0, 0, -2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("ab*", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab*", basic, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab*", perl, "sssabbbbbbsss", match_default, make_array(3, 10, -2, -2));
+ TEST_REGEX_SEARCH("ab*c*", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("ab*c*", perl, "abbb", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab*c*", perl, "accc", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab*c*", perl, "abbcc", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("*a", basic, "*a", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("^*a", basic, "*a", match_default, make_array(0, 2, -2, -2));
+ TEST_INVALID_REGEX("*a", perl);
+ TEST_INVALID_REGEX("\\<*", perl);
+ TEST_INVALID_REGEX("\\>*", perl);
+ TEST_REGEX_SEARCH("\n*", perl, "\n\n", match_default, make_array(0, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\**", perl, "**", match_default, make_array(0, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\*", perl, "*", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(ab)*", perl, "abab", match_default, make_array(0, 4, 2, 4, -2, 4, 4, -2, -2));
+
+ TEST_INVALID_REGEX("(*)", perl);
+ TEST_INVALID_REGEX("(*)", boost::regex::extended);
+ TEST_INVALID_REGEX("\\(*\\)", basic);
+ TEST_INVALID_REGEX("^*", perl);
+ TEST_INVALID_REGEX("^*", boost::regex::extended);
+ TEST_INVALID_REGEX("$*", perl);
+ TEST_INVALID_REGEX("$*", boost::regex::extended);
+ TEST_INVALID_REGEX("$*", basic);
+ TEST_INVALID_REGEX("\\b*", perl);
+ TEST_INVALID_REGEX("\\B*", perl);
+ TEST_INVALID_REGEX("\\A*", perl);
+ TEST_INVALID_REGEX("\\z*", perl);
+ TEST_INVALID_REGEX("\\Z*", perl);
+ TEST_INVALID_REGEX("\\A*", perl);
+ TEST_INVALID_REGEX("a|*", perl);
+ TEST_INVALID_REGEX("a|*", boost::regex::extended);
+ TEST_INVALID_REGEX("(+)", perl);
+ TEST_INVALID_REGEX("(+)", boost::regex::extended);
+ TEST_INVALID_REGEX("^+", perl);
+ TEST_INVALID_REGEX("^+", boost::regex::extended);
+ TEST_INVALID_REGEX("$+", perl);
+ TEST_INVALID_REGEX("$+", boost::regex::extended);
+ TEST_INVALID_REGEX("\\b+", perl);
+ TEST_INVALID_REGEX("\\B+", perl);
+ TEST_INVALID_REGEX("\\A+", perl);
+ TEST_INVALID_REGEX("\\z+", perl);
+ TEST_INVALID_REGEX("\\Z+", perl);
+ TEST_INVALID_REGEX("\\A+", perl);
+ TEST_INVALID_REGEX("a|+", perl);
+ TEST_INVALID_REGEX("a|+", boost::regex::extended);
+ TEST_INVALID_REGEX("(?)", perl);
+ TEST_INVALID_REGEX("(?)", boost::regex::extended);
+ TEST_INVALID_REGEX("^?", perl);
+ TEST_INVALID_REGEX("^?", boost::regex::extended);
+ TEST_INVALID_REGEX("$?", perl);
+ TEST_INVALID_REGEX("$?", boost::regex::extended);
+ TEST_INVALID_REGEX("\\b?", perl);
+ TEST_INVALID_REGEX("\\B?", perl);
+ TEST_INVALID_REGEX("\\A?", perl);
+ TEST_INVALID_REGEX("\\z?", perl);
+ TEST_INVALID_REGEX("\\Z?", perl);
+ TEST_INVALID_REGEX("\\A?", perl);
+ TEST_INVALID_REGEX("a|?", perl);
+ TEST_INVALID_REGEX("a|?", boost::regex::extended);
+ TEST_INVALID_REGEX("({1,2})", perl);
+ TEST_INVALID_REGEX("({1,2})", boost::regex::extended);
+ TEST_INVALID_REGEX("^{1,2}", perl);
+ TEST_INVALID_REGEX("^{1,2}", boost::regex::extended);
+ TEST_INVALID_REGEX("${1,2}", perl);
+ TEST_INVALID_REGEX("${1,2}", boost::regex::extended);
+ TEST_INVALID_REGEX("\\b{1,2}", perl);
+ TEST_INVALID_REGEX("\\B{1,2}", perl);
+ TEST_INVALID_REGEX("\\A{1,2}", perl);
+ TEST_INVALID_REGEX("\\z{1,2}", perl);
+ TEST_INVALID_REGEX("\\Z{1,2}", perl);
+ TEST_INVALID_REGEX("\\A{1,2}", perl);
+ TEST_INVALID_REGEX("a|{1,2}", perl);
+ TEST_INVALID_REGEX("a|{1,2}", boost::regex::extended);
+
+ // now try operator + :
+ TEST_REGEX_SEARCH("ab+", perl, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab+", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab+", perl, "sssabbbbbbsss", match_default, make_array(3, 10, -2, -2));
+ TEST_REGEX_SEARCH("ab+c+", perl, "abbb", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab+c+", perl, "accc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab+c+", perl, "abbcc", match_default, make_array(0, 5, -2, -2));
+ TEST_INVALID_REGEX("+a", perl);
+ TEST_INVALID_REGEX("\\<+", perl);
+ TEST_INVALID_REGEX("\\>+", perl);
+ TEST_REGEX_SEARCH("\n+", perl, "\n\n", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\+", perl, "+", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\+", perl, "++", match_default, make_array(0, 1, -2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\++", perl, "++", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("+", basic|bk_plus_qm, "+", match_default, make_array(0, 1, -2, -2));
+ TEST_INVALID_REGEX("\\+", basic|bk_plus_qm);
+ TEST_REGEX_SEARCH("a\\+", basic|bk_plus_qm, "aa", match_default, make_array(0, 2, -2, -2));
+
+ // now try operator ?
+ TEST_REGEX_SEARCH("a?", perl, "b", match_default, make_array(0, 0, -2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("ab?", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("ab?", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab?", perl, "sssabbbbbbsss", match_default, make_array(3, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab?c?", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("ab?c?", perl, "abbb", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab?c?", perl, "accc", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab?c?", perl, "abcc", match_default, make_array(0, 3, -2, -2));
+ TEST_INVALID_REGEX("?a", perl);
+ TEST_INVALID_REGEX("\\<?", perl);
+ TEST_INVALID_REGEX("\\>?", perl);
+ TEST_REGEX_SEARCH("\n?", perl, "\n\n", match_default, make_array(0, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\?", perl, "?", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\?", perl, "?", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\??", perl, "??", match_default, make_array(0, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("?", basic|bk_plus_qm, "?", match_default, make_array(0, 1, -2, -2));
+ TEST_INVALID_REGEX("\\?", basic|bk_plus_qm);
+ TEST_REGEX_SEARCH("a\\?", basic|bk_plus_qm, "aa", match_default, make_array(0, 1, -2, 1, 2, -2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\?", basic|bk_plus_qm, "b", match_default, make_array(0, 0, -2, 1, 1, -2, -2));
+
+ TEST_REGEX_SEARCH("a?", basic, "a?", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a+", basic, "a+", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\?", basic, "a?", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\+", basic, "a+", match_default, make_array(0, 2, -2, -2));
+
+ // now try operator {}
+ TEST_REGEX_SEARCH("a{2}", perl, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a{2}", perl, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{2}", perl, "aaa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{2,}", perl, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a{2,}", perl, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{2,}", perl, "aaaaa", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}", perl, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a{2,4}", perl, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}", perl, "aaa", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}", perl, "aaaa", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}", perl, "aaaaa", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a{ 2 , 4 }", perl, "aaaaa", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a{ 2 , }", perl, "aaaaa", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a{ 2 }", perl, "aaa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\{\\}", perl, "a{}", match_default, make_array(0, 3, -2, -2));
+
+ TEST_REGEX_SEARCH("a{2,4}?", perl, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a{2,4}?", perl, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}?", perl, "aaa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}?", perl, "aaaa", match_default, make_array(0, 2, -2, 2, 4, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}?", perl, "aaaaa", match_default, make_array(0, 2, -2, 2, 4, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}?$", perl, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}?$", perl, "aaa", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}?$", perl, "aaaa", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a{2,4}?$", perl, "aaaaa", match_default, make_array(1, 5, -2, -2));
+ TEST_REGEX_SEARCH("^a{0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(?:a){0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^a(?:bc)?", perl, "abcbc", match_any|match_all, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a}", perl, "a}", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{12b", perl, "a{12bc", match_default, make_array(0, 5, -2, -2));
+ TEST_INVALID_REGEX("a{b", boost::regex::extended);
+ TEST_INVALID_REGEX("a}b", boost::regex::extended);
+ test_simple_repeats2();
+}
+
+void test_simple_repeats2()
+{
+ using namespace boost::regex_constants;
+
+ TEST_REGEX_SEARCH("a{}", basic, "a{}", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a{", basic, "a{", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{1", basic, "a{1", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a{1,", basic, "a{1,", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a{1,2", basic, "a{1,2", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a{ 1 , 2", basic, "a{ 1 , 2", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("a{ }", basic, "a{ }", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a}", basic, "a}", match_default, make_array(0, 2, -2, -2));
+ TEST_INVALID_REGEX("{1}", perl);
+ TEST_REGEX_SEARCH("a{b}", basic, "a{b}", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a{1b", basic, "a{1b", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a{1,b}", basic, "a{1,b}", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("a{1,2v}", basic, "a{1,2v}", match_default, make_array(0, 7, -2, -2));
+ TEST_INVALID_REGEX("a{2,1}", perl);
+ // now try operator \\{\\} for POSIX basic regexes
+ TEST_REGEX_SEARCH("a\\{2\\}", basic, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\{2\\}", basic|no_intervals, "a{2}", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a\\{2\\}", basic, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\{2\\}", basic, "aaa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\{2,\\}", basic, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\{2,\\}", basic, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\{2,\\}", basic, "aaaaa", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a\\{2,4\\}", basic, "a", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a\\{2,4\\}", basic, "aa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a\\{2,4\\}", basic, "aaa", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a\\{2,4\\}", basic, "aaaa", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a\\{2,4\\}", basic, "aaaaa", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a\\{ 2 , 4 \\}", basic, "aaaaa", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("a\\{ 2 , \\}", basic, "aaaaa", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("a\\{ 2 \\}", basic, "aaa", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("a{}", basic, "a{}", match_default, make_array(0, 3, -2, -2));
+ TEST_INVALID_REGEX("a\\{\\}", basic);
+ TEST_INVALID_REGEX("a\\{", basic);
+ TEST_INVALID_REGEX("a\\{1", basic);
+ TEST_INVALID_REGEX("a\\{1,", basic);
+ TEST_INVALID_REGEX("a\\{1,\\", basic);
+ TEST_INVALID_REGEX("a\\{ \\}", basic);
+ TEST_INVALID_REGEX("a\\}", basic);
+ TEST_INVALID_REGEX("\\{1\\}", basic);
+ TEST_INVALID_REGEX("a\\{b\\}", basic);
+ TEST_INVALID_REGEX("a\\{1b\\}", basic);
+ TEST_INVALID_REGEX("a\\{1,b\\}", basic);
+ TEST_INVALID_REGEX("a\\{1,2v\\}", basic);
+ TEST_INVALID_REGEX("a\\{3,1\\}", basic);
+
+}
+
+void test_fast_repeats()
+{
+ using namespace boost::regex_constants;
+ // boost::regex::extended repeat checking to exercise new algorithms:
+ TEST_REGEX_SEARCH("ab.*xy", perl, "abxy_", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.*xy", perl, "ab_xy_", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab.*xy", perl, "abxy", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.*xy", perl, "ab_xy", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab.*", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab.*", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH(".*xy", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".*?xy", perl, "abc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a+?xy", perl, "abc", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab__xy_", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab____xy_", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab_____xy_", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab__xy", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab_____xy", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}", perl, "ab_______", match_default, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab______xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab_xy", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("ab.*?xy", perl, "abxy_", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?xy", perl, "ab_xy_", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?xy", perl, "abxy", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?xy", perl, "ab_xy", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?", perl, "ab__", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab__xy_", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab____xy_", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab_____xy_", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab__xy", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab_____xy", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?", perl, "ab_______", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab______xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab_xy", match_default, make_array(-2, -2));
+
+ // again but with slower algorithm variant:
+ TEST_REGEX_SEARCH("ab.*xy", perl, "abxy_", match_not_dot_newline|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.*xy", perl, "ab_xy_", match_not_dot_newline|match_not_dot_null, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab.*xy", perl, "abxy", match_not_dot_newline|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.*xy", perl, "ab_xy", match_not_dot_newline|match_not_dot_null, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab.*", perl, "ab", match_not_dot_newline|match_not_dot_null, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab.*", perl, "ab__", match_not_dot_newline|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH(".*xy", perl, "abc", match_not_dot_newline|match_not_dot_null, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".*?xy", perl, "abc", match_not_dot_newline|match_not_dot_null, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".*xy", perl, "ab\nbc", match_not_dot_newline|match_not_dot_null, make_array(-2, -2));
+ TEST_REGEX_SEARCH(".*?xy", perl, "ax\nbc", match_not_dot_newline|match_not_dot_null, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab__xy_", match_not_dot_newline|match_not_dot_null, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab____xy_", match_not_dot_newline|match_not_dot_null, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab_____xy_", match_not_dot_newline|match_not_dot_null, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab__xy", match_not_dot_newline|match_not_dot_null, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab_____xy", match_not_dot_newline|match_not_dot_null, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}", perl, "ab__", match_not_dot_newline|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}", perl, "ab_______", match_not_dot_newline|match_not_dot_null, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab______xy", match_not_dot_newline|match_not_dot_null, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab_xy", match_not_dot_newline|match_not_dot_null, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("ab.*?xy", perl, "abxy_", match_not_dot_newline|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?xy", perl, "ab_xy_", match_not_dot_newline|match_not_dot_null, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?xy", perl, "abxy", match_not_dot_newline|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?xy", perl, "ab_xy", match_not_dot_newline|match_not_dot_null, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?", perl, "ab", match_not_dot_newline|match_not_dot_null, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab.*?", perl, "ab__", match_not_dot_newline|match_not_dot_null, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab__xy_", match_not_dot_newline|match_not_dot_null, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab____xy_", match_not_dot_newline|match_not_dot_null, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab_____xy_", match_not_dot_newline|match_not_dot_null, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab__xy", match_not_dot_newline|match_not_dot_null, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab_____xy", match_not_dot_newline|match_not_dot_null, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?", perl, "ab__", match_not_dot_newline|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?", perl, "ab_______", match_not_dot_newline|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}?xy", perl, "ab______xy", match_not_dot_newline|match_not_dot_null, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab.{2,5}xy", perl, "ab_xy", match_not_dot_newline|match_not_dot_null, make_array(-2, -2));
+
+ // now again for single character repeats:
+ TEST_REGEX_SEARCH("ab_*xy", perl, "abxy_", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab_*xy", perl, "ab_xy_", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab_*xy", perl, "abxy", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab_*xy", perl, "ab_xy", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab_*", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab_*", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab_*?z", perl, "ab__", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("ab_{2,5}xy", perl, "ab__xy_", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}xy", perl, "ab____xy_", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}xy", perl, "ab_____xy_", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}xy", perl, "ab__xy", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}xy", perl, "ab_____xy", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}", perl, "ab_______", match_default, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}xy", perl, "ab______xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}xy", perl, "ab_xy", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("ab_*?xy", perl, "abxy_", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab_*?xy", perl, "ab_xy_", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab_*?xy", perl, "abxy", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab_*?xy", perl, "ab_xy", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab_*?", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab_*?", perl, "ab__", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("ab_{2,5}?xy", perl, "ab__xy_", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}?xy", perl, "ab____xy_", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}?xy", perl, "ab_____xy_", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}?xy", perl, "ab__xy", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}?xy", perl, "ab_____xy", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}?", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}?", perl, "ab_______", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}?xy", perl, "ab______xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab_{2,5}xy", perl, "ab_xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(5*?).somesite", perl, "//555.somesite", match_default, make_array(2, 14, 2, 5, -2, -2));
+}
+
+void test_fast_repeats2()
+{
+ using namespace boost::regex_constants;
+ // and again for sets:
+ TEST_REGEX_SEARCH("ab[_,;]*xy", perl, "abxy_", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*xy", perl, "ab_xy_", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*xy", perl, "abxy", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*xy", perl, "ab_xy", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*?xy", perl, "ab__z", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*?z", perl, "ab__", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*?.z", perl, "ab__,;,__z", match_default, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*?.z", perl, "ab__,;,__y", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}xy", perl, "ab__xy_", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}xy", perl, "ab____xy_", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}xy", perl, "ab_____xy_", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}xy", perl, "ab__xy", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}xy", perl, "ab_____xy", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}", perl, "ab_______", match_default, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}xy", perl, "ab______xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}xy", perl, "ab_xy", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("ab[_,;]*?xy", perl, "abxy_", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*?xy", perl, "ab_xy_", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*?xy", perl, "abxy", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*?xy", perl, "ab_xy", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*?", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]*?", perl, "ab__", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}?xy", perl, "ab__xy_", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}?xy", perl, "ab____xy_", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}?xy", perl, "ab_____xy_", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}?xy", perl, "ab__xy", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}?xy", perl, "ab_____xy", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}?", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}?", perl, "ab_______", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}?xy", perl, "ab______xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab[_,;]{2,5}xy", perl, "ab_xy", match_default, make_array(-2, -2));
+
+ // and again for tricky sets with digraphs:
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*xy", perl, "abxy_", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*xy", perl, "ab_xy_", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*xy", perl, "abxy", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*xy", perl, "ab_xy", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}xy", perl, "ab__xy_", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}xy", perl, "ab____xy_", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}xy", perl, "ab_____xy_", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}xy", perl, "ab__xy", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}xy", perl, "ab_____xy", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}", perl, "ab_______", match_default, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}xy", perl, "ab______xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}xy", perl, "ab_xy", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*?xy", perl, "abxy_", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*?xy", perl, "ab_xy_", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*?xy", perl, "abxy", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*?xy", perl, "ab_xy", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*?", perl, "ab", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]*?", perl, "ab__", match_default, make_array(0, 2, -2, -2));
+
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}?xy", perl, "ab__xy_", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}?xy", perl, "ab____xy_", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}?xy", perl, "ab_____xy_", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}?xy", perl, "ab__xy", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}?xy", perl, "ab_____xy", match_default, make_array(0, 9, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}?", perl, "ab__", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}?", perl, "ab_______", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}?xy", perl, "ab______xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("ab[_[.ae.]]{2,5}xy", perl, "ab_xy", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("([5[.ae.]]*?).somesite", perl, "//555.somesite", match_default, make_array(2, 14, 2, 5, -2, -2));
+
+ TEST_REGEX_SEARCH("A[^B]*?B.*?C", perl, "AxBxxxx", match_default|match_partial, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("A[^B]*?B.*?C", perl, "AxBx", match_default|match_partial, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("A[^B]*?B.*?C", perl, "AxBxxxx", match_default|match_partial|match_not_dot_null, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("A[^B]*?B.*?C", perl, "AxBx", match_default|match_partial|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("A[^B]*?Bx*?C", perl, "AxBxxxx", match_default|match_partial|match_not_dot_null, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("A[^B]*?Bx*?C", perl, "AxBx", match_default|match_partial|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("A[^B]*?B[xac]*?C", perl, "AxBxxxx", match_default|match_partial|match_not_dot_null, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("A[^B]*?B[xac]*?C", perl, "AxBx", match_default|match_partial|match_not_dot_null, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("A[^B]*?B[xac[.ae.]]*?C", perl, "AxBxxxx", match_default|match_partial|match_not_dot_null, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("A[^B]*?B[xac[.ae.]]*?C", perl, "AxBx", match_default|match_partial|match_not_dot_null, make_array(0, 4, -2, -2));
+
+
+}
+
+void test_pocessive_repeats()
+{
+ using namespace boost::regex_constants;
+ // and again for sets:
+ TEST_REGEX_SEARCH("^(\\w++|\\s++)*$", perl, "now is the time for all good men to come to the aid of the party", match_default, make_array(0, 64, 59, 64, -2, -2));
+ TEST_REGEX_SEARCH("^(\\w++|\\s++)*$", perl, "this is not a line with only words and spaces!", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(\\d++)(\\w)", perl, "12345a", match_default, make_array(0, 6, 0, 5, 5, 6, -2, -2));
+ TEST_REGEX_SEARCH("(\\d++)(\\w)", perl, "12345+", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(\\d++)(\\w)", perl, "12345", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a++b", perl, "aaab", match_default, make_array(0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(a++b)", perl, "aaab", match_default, make_array(0, 4, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH("([^()]++|\\([^()]*\\))+", perl, "((abc(ade)ufh()()x", match_default, make_array(2, 18, 17, 18, -2, -2));
+ TEST_REGEX_SEARCH("\\(([^()]++|\\([^()]+\\))+\\)", perl, "(abc)", match_default, make_array(0, 5, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("\\(([^()]++|\\([^()]+\\))+\\)", perl, "(abc(def)xyz)", match_default, make_array(0, 13, 9, 12, -2, -2));
+ TEST_REGEX_SEARCH("\\(([^()]++|\\([^()]+\\))+\\)", perl, "((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", match_default, make_array(-2, -2));
+ /*
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<>", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abcd>", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc <123> hij>", match_default, make_array(0, 15, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc <def> hij>", match_default, make_array(5, 10, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc<>def>", match_default, make_array(0, 10, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc<>", match_default, make_array(4, 6, -2, -2));
+ TEST_REGEX_SEARCH("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", perl|mod_x, "<abc", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH("((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))", perl|mod_x, "<>", match_default, make_array(0, 2, 0, 2, 0, 2, -2, -2));
+ TEST_REGEX_SEARCH("((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))", perl|mod_x, "<abcd>", match_default, make_array(0, 6, 0, 6, 0, 6, -2, -2));
+ TEST_REGEX_SEARCH("((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))", perl|mod_x, "<abc <123> hij>", match_default, make_array(0, 15, 0, 15, 0, 15, -2, -2));
+ TEST_REGEX_SEARCH("((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))", perl|mod_x, "<abc <def> hij>", match_default, make_array(5, 10, 5, 10, 5, 10, -2, -2));
+ TEST_REGEX_SEARCH("((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))", perl|mod_x, "<abc<>def>", match_default, make_array(0, 10, 0, 10, 0, 10, -2, -2));
+ TEST_REGEX_SEARCH("((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))", perl|mod_x, "<abc<>", match_default, make_array(4, 6, 4, 6, 4, 6, -2, -2));
+ TEST_REGEX_SEARCH("((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))", perl|mod_x, "<abc", match_default, make_array(-2, -2));
+ */
+ TEST_REGEX_SEARCH("x*+\\w", perl, "xxxxx", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("x*+\\w", perl, "xxxxxa", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("x{1,6}+\\w", perl, "xxxxx", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("x{1,6}+\\w", perl, "xxxxxa", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("x{1,5}+\\w", perl, "xxxxxa", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("x{1,4}+\\w", perl, "xxxxxa", match_default, make_array(0, 5, -2, -2));
+ TEST_REGEX_SEARCH("x{1,3}+\\w", perl, "xxxxxa", match_default, make_array(0, 4, -2, 4, 6, -2, -2));
+ TEST_INVALID_REGEX("\\d+++", perl);
+ TEST_INVALID_REGEX("\\d++*", perl);
+ TEST_INVALID_REGEX("\\d++?", perl);
+ TEST_INVALID_REGEX("\\d++{3}", perl);
+ TEST_INVALID_REGEX("\\d*++", perl);
+ TEST_INVALID_REGEX("\\d?++", perl);
+ TEST_INVALID_REGEX("\\d{1,2}++", perl);
+
+ TEST_REGEX_SEARCH("(ab +)", perl|mod_x, "abbb", match_default, make_array(0, 4, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(ab +?)", perl | mod_x, "abbb", match_default, make_array(0, 2, 0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(ab + ?)", perl | mod_x, "abbb", match_default, make_array(0, 2, 0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(ab ++)", perl | mod_x, "abbb", match_default, make_array(0, 4, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH("(ab + +)", perl | mod_x, "abbb", match_default, make_array(0, 4, 0, 4, -2, -2));
+ TEST_INVALID_REGEX("(ab + ++)", perl | mod_x);
+ TEST_INVALID_REGEX("(ab + + +)", perl | mod_x);
+ TEST_INVALID_REGEX("(ab + + ?)", perl | mod_x);
+
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_tricky_cases.cpp b/src/boost/libs/regex/test/regress/test_tricky_cases.cpp
new file mode 100644
index 000000000..f9cc25d1e
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_tricky_cases.cpp
@@ -0,0 +1,450 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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 "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+void test_tricky_cases2();
+void test_tricky_cases3();
+
+void test_tricky_cases()
+{
+ using namespace boost::regex_constants;
+ //
+ // now follows various complex expressions designed to try and bust the matcher:
+ //
+ TEST_REGEX_SEARCH("a(((b)))c", perl, "abc", match_default, make_array(0, 3, 1, 2, 1, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", perl, "abd", match_default, make_array(0, 3, 1, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", perl, "acd", match_default, make_array(0, 3, 1, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c)d", perl, "abbd", match_default, make_array(0, 4, 1, 3, -2, -2));
+ // just gotta have one DFA-buster, of course
+ TEST_REGEX_SEARCH("a[ab]{20}", perl, "aaaaabaaaabaaaabaaaab", match_default, make_array(0, 21, -2, -2));
+ // and an inline expansion in case somebody gets tricky
+ TEST_REGEX_SEARCH("a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]", perl, "aaaaabaaaabaaaabaaaab", match_default, make_array(0, 21, -2, -2));
+ // and in case somebody just slips in an NFA...
+ TEST_REGEX_SEARCH("a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)", perl, "aaaaabaaaabaaaabaaaabweeknights", match_default, make_array(0, 31, 21, 24, 24, 31, -2, -2));
+ // one really big one
+ TEST_REGEX_SEARCH("1234567890123456789012345678901234567890123456789012345678901234567890", perl, "a1234567890123456789012345678901234567890123456789012345678901234567890b", match_default, make_array(1, 71, -2, -2));
+ // fish for problems as brackets go past 8
+ TEST_REGEX_SEARCH("[ab][cd][ef][gh][ij][kl][mn]", perl, "xacegikmoq", match_default, make_array(1, 8, -2, -2));
+ TEST_REGEX_SEARCH("[ab][cd][ef][gh][ij][kl][mn][op]", perl, "xacegikmoq", match_default, make_array(1, 9, -2, -2));
+ TEST_REGEX_SEARCH("[ab][cd][ef][gh][ij][kl][mn][op][qr]", perl, "xacegikmoqy", match_default, make_array(1, 10, -2, -2));
+ TEST_REGEX_SEARCH("[ab][cd][ef][gh][ij][kl][mn][op][q]", perl, "xacegikmoqy", match_default, make_array(1, 10, -2, -2));
+ // and as parenthesis go past 9:
+ TEST_REGEX_SEARCH("(a)(b)(c)(d)(e)(f)(g)(h)", perl, "zabcdefghi", match_default, make_array(1, 9, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, -2, -2));
+ TEST_REGEX_SEARCH("(a)(b)(c)(d)(e)(f)(g)(h)(i)", perl, "zabcdefghij", match_default, make_array(1, 10, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, -2, -2));
+ TEST_REGEX_SEARCH("(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)", perl, "zabcdefghijk", match_default, make_array(1, 11, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, -2, -2));
+ TEST_REGEX_SEARCH("(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)", perl, "zabcdefghijkl", match_default, make_array(1, 12, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, -2, -2));
+ TEST_REGEX_SEARCH("(a)d|(b)c", perl, "abc", match_default, make_array(1, 3, -1, -1, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("_+((www)|(ftp)|(mailto)):_*", perl, "_wwwnocolon _mailto:", match_default, make_array(12, 20, 13, 19, -1, -1, -1, -1, 13, 19, -2, -2));
+ // subtleties of matching
+ TEST_REGEX_SEARCH("a(b)?c\\1d", perl, "acd", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("a(b?c)+d", perl, "accd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("(wee|week)(knights|night)", perl, "weeknights", match_default, make_array(0, 10, 0, 3, 3, 10, -2, -2));
+ TEST_REGEX_SEARCH(".*", perl, "abc", match_default, make_array(0, 3, -2, 3, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", perl, "abd", match_default, make_array(0, 3, 1, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", perl, "acd", match_default, make_array(0, 3, 1, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl, "abbd", match_default, make_array(0, 4, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl, "acd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", perl, "ad", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a(b?)c", perl, "abc", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b?)c", perl, "ac", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a(b+)c", perl, "abc", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b+)c", perl, "abbbc", match_default, make_array(0, 5, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(b*)c", perl, "ac", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a|ab)(bc([de]+)f|cde)", perl, "abcdef", match_default, make_array(0, 6, 0, 1, 1, 6, 3, 5, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]?)c", perl, "abc", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]?)c", perl, "ac", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)c", perl, "abc", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)c", perl, "abcc", match_default, make_array(0, 4, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)bc", perl, "abcbc", match_default, make_array(0, 5, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(bb+|b)b", perl, "abb", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)b", perl, "abb", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)b", perl, "abbb", match_default, make_array(0, 4, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)bb", perl, "abbb", match_default, make_array(0, 4, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(.*).*", perl, "abcdef", match_default, make_array(0, 6, 0, 6, -2, 6, 6, 6, 6, -2, -2));
+ TEST_REGEX_SEARCH("(a*)*", perl, "bc", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("Z(((((((a+)+)+)+)+)+)+)+|Y(((((((a+)+)+)+)+)+)+)+|X(((((((a+)+)+)+)+)+)+)+|W(((((((a+)+)+)+)+)+)+)+|V(((((((a+)+)+)+)+)+)+)+|CZ(((((((a+)+)+)+)+)+)+)+|CY(((((((a+)+)+)+)+)+)+)+|CX(((((((a+)+)+)+)+)+)+)+|CW(((((((a+)+)+)+)+)+)+)+|CV(((((((a+)+)+)+)+)+)+)+|(a+)+", perl, "bc", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("Z(((((((a+)+)+)+)+)+)+)+|Y(((((((a+)+)+)+)+)+)+)+|X(((((((a+)+)+)+)+)+)+)+|W(((((((a+)+)+)+)+)+)+)+|V(((((((a+)+)+)+)+)+)+)+|CZ(((((((a+)+)+)+)+)+)+)+|CY(((((((a+)+)+)+)+)+)+)+|CX(((((((a+)+)+)+)+)+)+)+|CW(((((((a+)+)+)+)+)+)+)+|CV(((((((a+)+)+)+)+)+)+)+|(a+)+", perl, "aaa", match_default,
+ make_array(0, 3,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 0, 3,
+ -2, -2));
+ TEST_REGEX_SEARCH("Z(((((((a+)+)+)+)+)+)+)+|Y(((((((a+)+)+)+)+)+)+)+|X(((((((a+)+)+)+)+)+)+)+|W(((((((a+)+)+)+)+)+)+)+|V(((((((a+)+)+)+)+)+)+)+|CZ(((((((a+)+)+)+)+)+)+)+|CY(((((((a+)+)+)+)+)+)+)+|CX(((((((a+)+)+)+)+)+)+)+|CW(((((((a+)+)+)+)+)+)+)+|CV(((((((a+)+)+)+)+)+)+)+|(a+)+",
+ perl, "Zaaa", match_default,
+ make_array(0, 4,
+ 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1,
+ -2, -2));
+ TEST_REGEX_SEARCH("xyx*xz", perl, "xyxxxxyxxxz", match_default, make_array(5, 11, -2, -2));
+ // do we get the right subexpression when it is used more than once?
+ TEST_REGEX_SEARCH("a(b|c)*d", perl, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c)*d", perl, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c)+d", perl, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c)+d", perl, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c?)+d", perl, "ad", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,0}d", perl, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,1}d", perl, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,1}d", perl, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,2}d", perl, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,2}d", perl, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,}d", perl, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,}d", perl, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,1}d", perl, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,2}d", perl, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,2}d", perl, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,}d", perl, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,}d", perl, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,2}d", perl, "acbd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,2}d", perl, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,4}d", perl, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,4}d", perl, "abcbd", match_default, make_array(0, 5, 3, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,4}d", perl, "abcbcd", match_default, make_array(0, 6, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,}d", perl, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,}d", perl, "abcbd", match_default, make_array(0, 5, 3, 4, -2, -2));
+
+ test_tricky_cases2();
+ test_tricky_cases3();
+}
+
+void test_tricky_cases2()
+{
+ using namespace boost::regex_constants;
+
+ TEST_REGEX_SEARCH("a(((b)))c", boost::regex::extended, "abc", match_default, make_array(0, 3, 1, 2, 1, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", boost::regex::extended, "abd", match_default, make_array(0, 3, 1, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", boost::regex::extended, "acd", match_default, make_array(0, 3, 1, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c)d", boost::regex::extended, "abbd", match_default, make_array(0, 4, 1, 3, -2, -2));
+ // just gotta have one DFA-buster, of course
+ TEST_REGEX_SEARCH("a[ab]{20}", boost::regex::extended, "aaaaabaaaabaaaabaaaab", match_default, make_array(0, 21, -2, -2));
+ // and an inline expansion in case somebody gets tricky
+ TEST_REGEX_SEARCH("a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]", boost::regex::extended, "aaaaabaaaabaaaabaaaab", match_default, make_array(0, 21, -2, -2));
+ // and in case somebody just slips in an NFA...
+ TEST_REGEX_SEARCH("a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)", boost::regex::extended, "aaaaabaaaabaaaabaaaabweeknights", match_default, make_array(0, 31, 21, 24, 24, 31, -2, -2));
+ // one really big one
+ TEST_REGEX_SEARCH("1234567890123456789012345678901234567890123456789012345678901234567890", boost::regex::extended, "a1234567890123456789012345678901234567890123456789012345678901234567890b", match_default, make_array(1, 71, -2, -2));
+ // fish for problems as brackets go past 8
+ TEST_REGEX_SEARCH("[ab][cd][ef][gh][ij][kl][mn]", boost::regex::extended, "xacegikmoq", match_default, make_array(1, 8, -2, -2));
+ TEST_REGEX_SEARCH("[ab][cd][ef][gh][ij][kl][mn][op]", boost::regex::extended, "xacegikmoq", match_default, make_array(1, 9, -2, -2));
+ TEST_REGEX_SEARCH("[ab][cd][ef][gh][ij][kl][mn][op][qr]", boost::regex::extended, "xacegikmoqy", match_default, make_array(1, 10, -2, -2));
+ TEST_REGEX_SEARCH("[ab][cd][ef][gh][ij][kl][mn][op][q]", boost::regex::extended, "xacegikmoqy", match_default, make_array(1, 10, -2, -2));
+ // and as parenthesis go past 9:
+ TEST_REGEX_SEARCH("(a)(b)(c)(d)(e)(f)(g)(h)", boost::regex::extended, "zabcdefghi", match_default, make_array(1, 9, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, -2, -2));
+ TEST_REGEX_SEARCH("(a)(b)(c)(d)(e)(f)(g)(h)(i)", boost::regex::extended, "zabcdefghij", match_default, make_array(1, 10, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, -2, -2));
+ TEST_REGEX_SEARCH("(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)", boost::regex::extended, "zabcdefghijk", match_default, make_array(1, 11, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, -2, -2));
+ TEST_REGEX_SEARCH("(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)", boost::regex::extended, "zabcdefghijkl", match_default, make_array(1, 12, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, -2, -2));
+ TEST_REGEX_SEARCH("(a)d|(b)c", boost::regex::extended, "abc", match_default, make_array(1, 3, -1, -1, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("_+((www)|(ftp)|(mailto)):_*", boost::regex::extended, "_wwwnocolon _mailto:", match_default, make_array(12, 20, 13, 19, -1, -1, -1, -1, 13, 19, -2, -2));
+ // subtleties of matching
+ TEST_REGEX_SEARCH("a\\(b\\)\\?c\\1d", basic|bk_plus_qm, "acd", match_default, make_array(0, 3, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b?c)+d", boost::regex::extended, "accd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("(wee|week)(knights|night)", boost::regex::extended, "weeknights", match_default, make_array(0, 10, 0, 3, 3, 10, -2, -2));
+ TEST_REGEX_SEARCH(".*", boost::regex::extended, "abc", match_default, make_array(0, 3, -2, 3, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", boost::regex::extended, "abd", match_default, make_array(0, 3, 1, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|(c))d", boost::regex::extended, "acd", match_default, make_array(0, 3, 1, 2, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", boost::regex::extended, "abbd", match_default, make_array(0, 4, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", boost::regex::extended, "acd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b*|c|e)d", boost::regex::extended, "ad", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a(b?)c", boost::regex::extended, "abc", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b?)c", boost::regex::extended, "ac", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a(b+)c", boost::regex::extended, "abc", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b+)c", boost::regex::extended, "abbbc", match_default, make_array(0, 5, 1, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(b*)c", boost::regex::extended, "ac", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("(a|ab)(bc([de]+)f|cde)", boost::regex::extended, "abcdef", match_default, make_array(0, 6, 0, 1, 1, 6, 3, 5, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]?)c", boost::regex::extended, "abc", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]?)c", boost::regex::extended, "ac", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)c", boost::regex::extended, "abc", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)c", boost::regex::extended, "abcc", match_default, make_array(0, 4, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a([bc]+)bc", boost::regex::extended, "abcbc", match_default, make_array(0, 5, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(bb+|b)b", boost::regex::extended, "abb", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)b", boost::regex::extended, "abb", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)b", boost::regex::extended, "abbb", match_default, make_array(0, 4, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(bbb+|bb+|b)bb", boost::regex::extended, "abbb", match_default, make_array(0, 4, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("(.*).*", boost::regex::extended, "abcdef", match_default, make_array(0, 6, 0, 6, -2, 6, 6, 6, 6, -2, -2));
+ TEST_REGEX_SEARCH("(a*)*", boost::regex::extended, "bc", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, -2));
+ TEST_REGEX_SEARCH("xyx*xz", boost::regex::extended, "xyxxxxyxxxz", match_default, make_array(5, 11, -2, -2));
+ // do we get the right subexpression when it is used more than once?
+ TEST_REGEX_SEARCH("a(b|c)*d", boost::regex::extended, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c)*d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c)+d", boost::regex::extended, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c)+d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c?)+d", boost::regex::extended, "ad", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,0}d", boost::regex::extended, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,1}d", boost::regex::extended, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,1}d", boost::regex::extended, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,2}d", boost::regex::extended, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,2}d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,}d", boost::regex::extended, "ad", match_default, make_array(0, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){0,}d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,1}d", boost::regex::extended, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,2}d", boost::regex::extended, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,2}d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,}d", boost::regex::extended, "abd", match_default, make_array(0, 3, 1, 2, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){1,}d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,2}d", boost::regex::extended, "acbd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,2}d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,4}d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,4}d", boost::regex::extended, "abcbd", match_default, make_array(0, 5, 3, 4, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,4}d", boost::regex::extended, "abcbcd", match_default, make_array(0, 6, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,}d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|c){2,}d", boost::regex::extended, "abcbd", match_default, make_array(0, 5, 3, 4, -2, -2));
+ // perl only:
+ TEST_REGEX_SEARCH("a(b|c?)+d", perl, "abcd", match_default, make_array(0, 4, 3, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b+|((c)*))+d", perl, "abd", match_default, make_array(0, 3, 2, 2, 2, 2, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b+|((c)*))+d", perl, "abcd", match_default, make_array(0, 4, 3, 3, 3, 3, 2, 3, -2, -2));
+ // posix only:
+ TEST_REGEX_SEARCH("a(b|c?)+d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b|((c)*))+d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, 2, 3, 2, 3, -2, -2));
+ TEST_REGEX_SEARCH("a(b+|((c)*))+d", boost::regex::extended, "abd", match_default, make_array(0, 3, 1, 2, -1, -1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("a(b+|((c)*))+d", boost::regex::extended, "abcd", match_default, make_array(0, 4, 2, 3, 2, 3, 2, 3, -2, -2));
+ // literals:
+ TEST_REGEX_SEARCH("\\**?/{}", literal, "\\**?/{}", match_default, make_array(0, 7, -2, -2));
+ TEST_REGEX_SEARCH("\\**?/{}", literal, "\\**?/{", match_default, make_array(-2, -2));
+ // try to match C++ syntax elements:
+ // line comment:
+ TEST_REGEX_SEARCH("//[^\\n]*", perl, "++i //here is a line comment\n", match_default, make_array(4, 28, -2, -2));
+ // block comment:
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", perl, "/* here is a block comment */", match_default, make_array(0, 29, 26, 27, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", perl, "/**/", match_default, make_array(0, 4, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", perl, "/***/", match_default, make_array(0, 5, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", perl, "/****/", match_default, make_array(0, 6, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", perl, "/*****/", match_default, make_array(0, 7, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", perl, "/*****/*/", match_default, make_array(0, 7, -1, -1, -2, -2));
+ // preprossor directives:
+ TEST_REGEX_SEARCH("^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*", perl, "#define some_symbol", match_default, make_array(0, 19, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*", perl, "#define some_symbol(x) #x", match_default, make_array(0, 25, -1, -1, -2, -2));
+ // try to match C++ syntax elements:
+ // line comment:
+ TEST_REGEX_SEARCH("//[^\\n]*", boost::regex::extended&~no_escape_in_lists, "++i //here is a line comment\n", match_default, make_array(4, 28, -2, -2));
+ // block comment:
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", boost::regex::extended&~no_escape_in_lists, "/* here is a block comment */", match_default, make_array(0, 29, 26, 27, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", boost::regex::extended&~no_escape_in_lists, "/**/", match_default, make_array(0, 4, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", boost::regex::extended&~no_escape_in_lists, "/***/", match_default, make_array(0, 5, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", boost::regex::extended&~no_escape_in_lists, "/****/", match_default, make_array(0, 6, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", boost::regex::extended&~no_escape_in_lists, "/*****/", match_default, make_array(0, 7, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("/\\*([^*]|\\*+[^*/])*\\*+/", boost::regex::extended&~no_escape_in_lists, "/*****/*/", match_default, make_array(0, 7, -1, -1, -2, -2));
+ // preprossor directives:
+ TEST_REGEX_SEARCH("^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*", boost::regex::extended&~no_escape_in_lists, "#define some_symbol", match_default, make_array(0, 19, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*", boost::regex::extended&~no_escape_in_lists, "#define some_symbol(x) #x", match_default, make_array(0, 25, -1, -1, -2, -2));
+ // perl only:
+ TEST_REGEX_SEARCH("^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*", perl, "#define some_symbol(x) \\ \r\n foo();\\\r\n printf(#x);", match_default, make_array(0, 53, 30, 42, -2, -2));
+ // POSIX leftmost longest checks:
+ TEST_REGEX_SEARCH("(aaa)|(\\w+)", boost::regex::extended&~no_escape_in_lists, "a", match_default, make_array(0, 1, -1, -1, 0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(aaa)|(\\w+)", boost::regex::extended&~no_escape_in_lists, "aa", match_default, make_array(0, 2, -1, -1, 0, 2, -2, -2));
+ TEST_REGEX_SEARCH("(aaa)|(\\w+)", boost::regex::extended&~no_escape_in_lists, "aaa", match_default, make_array(0, 3, 0, 3, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("(aaa)|(\\w+)", boost::regex::extended&~no_escape_in_lists, "aaaa", match_default, make_array(0, 4, -1, -1, 0, 4, -2, -2));
+ TEST_REGEX_SEARCH("($)|(\\>)", boost::regex::extended&~no_escape_in_lists, "aaaa", match_default, make_array(4, 4, 4, 4, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("($)|(\\>)", boost::regex::extended&~no_escape_in_lists, "aaaa", match_default|match_not_eol, make_array(4, 4, -1, -1, 4, 4, -2, -2));
+ TEST_REGEX_SEARCH("(aaa)(ab)*", boost::regex::extended, "aaaabab", match_default, make_array(0, 7, 0, 3, 5, 7, -2, -2));
+}
+
+void test_tricky_cases3()
+{
+ using namespace boost::regex_constants;
+ TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFF", match_default, make_array(0, 4, 0, 4, 0, 4, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "35", match_default, make_array(0, 2, 0, 2, -1, -1, 0, 2, -1, -1, -1, -1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFFu", match_default, make_array(0, 5, 0, 4, 0, 4, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFFL", match_default, make_array(0, 5, 0, 4, 0, 4, -1, -1, 4, 5, -1, -1, -1, -1, -2, -2));
+ TEST_REGEX_SEARCH("((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?", perl, "0xFFFFFFFFFFFFFFFFuint64", match_default, make_array(0, 24, 0, 18, 0, 18, -1, -1, 19, 24, 19, 24, 22, 24, -2, -2));
+ // strings:
+ TEST_REGEX_SEARCH("'([^\\\\']|\\\\.)*'", perl, "'\\x3A'", match_default, make_array(0, 6, 4, 5, -2, -2));
+ TEST_REGEX_SEARCH("'([^\\\\']|\\\\.)*'", perl, "'\\''", match_default, make_array(0, 4, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH("'([^\\\\']|\\\\.)*'", perl, "'\\n'", match_default, make_array(0, 4, 1, 3, -2, -2));
+ // posix only:
+ TEST_REGEX_SEARCH("^[[:blank:]]*#([^\\n]*\\\\[[:space:]]+)*[^\\n]*", awk, "#define some_symbol(x) \\ \r\n foo();\\\r\n printf(#x);", match_default, make_array(0, 53, 28, 42, -2, -2));
+ // now try and test some unicode specific characters:
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+ TEST_REGEX_SEARCH_W(L"[[:unicode:]]+", perl, L"a\x0300\x0400z", match_default, make_array(1, 3, -2, -2));
+ TEST_REGEX_SEARCH_W(L"[\x10-\xff]", perl, L"\x0300\x0400", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH_W(L"[\01-\05]{5}", perl, L"\x0300\x0400\x0300\x0400\x0300\x0400", match_default, make_array(-2, -2));
+#if !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
+ TEST_REGEX_SEARCH_W(L"[\x300-\x400]+", perl, L"\x0300\x0400\x0300\x0400\x0300\x0400", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH_W(L"[\\x{300}-\\x{400}]+", perl, L"\x0300\x0400\x0300\x0400\x0300\x0400", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH_W(L"\\x{300}\\x{400}+", perl, L"\x0300\x0400\x0400\x0400\x0400\x0400", match_default, make_array(0, 6, -2, -2));
+#endif
+#endif
+ // finally try some case insensitive matches:
+ TEST_REGEX_SEARCH("0123456789@abcdefghijklmnopqrstuvwxyz\\[\\\\\\]\\^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ\\{\\|\\}", perl|icase, "0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}", match_default, make_array(0, 72, -2, -2));
+ TEST_REGEX_SEARCH("a", perl|icase, "A", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("A", perl|icase, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("[abc]+", perl|icase, "abcABC", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("[ABC]+", perl|icase, "abcABC", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("[a-z]+", perl|icase, "abcABC", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("[A-Z]+", perl|icase, "abzANZ", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("[a-Z]+", perl|icase, "abzABZ", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("[A-z]+", perl|icase, "abzABZ", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("[[:lower:]]+", perl|icase, "abyzABYZ", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("[[:upper:]]+", perl|icase, "abzABZ", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("[[:word:]]+", perl|icase, "abcZZZ", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("[[:alpha:]]+", perl|icase, "abyzABYZ", match_default, make_array(0, 8, -2, -2));
+ TEST_REGEX_SEARCH("[[:alnum:]]+", perl|icase, "09abyzABYZ", match_default, make_array(0, 10, -2, -2));
+
+ // known and suspected bugs:
+ TEST_REGEX_SEARCH("\\(", perl, "(", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\)", perl, ")", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\$", perl, "$", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\^", perl, "^", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\.", perl, ".", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\*", perl, "*", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\+", perl, "+", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\?", perl, "?", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\[", perl, "[", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\]", perl, "]", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\|", perl, "|", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\\\", perl, "\\", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("#", perl, "#", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\#", perl, "#", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a-", perl, "a-", match_default, make_array(0, 2, -2, -2));
+ TEST_REGEX_SEARCH("\\-", perl, "-", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\{", perl, "{", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\}", perl, "}", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("0", perl, "0", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("1", perl, "1", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("9", perl, "9", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("b", perl, "b", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("B", perl, "B", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("<", perl, "<", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(">", perl, ">", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("w", perl, "w", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("W", perl, "W", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("`", perl, "`", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(" ", perl, " ", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("\\n", perl, "\n", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(",", perl, ",", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("a", perl, "a", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("f", perl, "f", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("n", perl, "n", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("r", perl, "r", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("t", perl, "t", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("v", perl, "v", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("c", perl, "c", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("x", perl, "x", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH(":", perl, ":", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH("(\\.[[:alnum:]]+){2}", perl, "w.a.b ", match_default, make_array(1, 5, 3, 5, -2, -2));
+
+ // new bugs detected in spring 2003:
+ TEST_REGEX_SEARCH("b", perl, "abc", match_default|match_continuous, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?!foo)bar", perl, "foobar", match_default, make_array(3, 6, -2, -2));
+ TEST_REGEX_SEARCH("(?!foo)bar", perl, "??bar", match_default, make_array(2, 5, -2, -2));
+ TEST_REGEX_SEARCH("(?!foo)bar", perl, "barfoo", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?!foo)bar", perl, "bar??", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("(?!foo)bar", perl, "bar", match_default, make_array(0, 3, -2, -2));
+ TEST_REGEX_SEARCH("a\\Z", perl, "a\nb", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("()", perl, "abc", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, 3, 3, 3, 3, -2, -2));
+ TEST_REGEX_SEARCH("^()", perl, "abc", match_default, make_array(0, 0, 0, 0, -2, -2));
+ TEST_REGEX_SEARCH("^()+", perl, "abc", match_default, make_array(0, 0, 0, 0, -2, -2));
+ TEST_REGEX_SEARCH("^(){1}", perl, "abc", match_default, make_array(0, 0, 0, 0, -2, -2));
+ TEST_REGEX_SEARCH("^(){2}", perl, "abc", match_default, make_array(0, 0, 0, 0, -2, -2));
+ TEST_REGEX_SEARCH("^((){2})", perl, "abc", match_default, make_array(0, 0, 0, 0, 0, 0, -2, -2));
+ TEST_REGEX_SEARCH("()", perl, "", match_default, make_array(0, 0, 0, 0, -2, -2));
+ TEST_REGEX_SEARCH("()\\1", perl, "", match_default, make_array(0, 0, 0, 0, -2, -2));
+ TEST_REGEX_SEARCH("()\\1", perl, "a", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a()\\1b", perl, "ab", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("a()b\\1", perl, "ab", match_default, make_array(0, 2, 1, 1, -2, -2));
+ TEST_REGEX_SEARCH("([a-c]+)\\1", perl, "abcbc", match_default, make_array(1, 5, 1, 3, -2, -2));
+ TEST_REGEX_SEARCH(".+abc", perl, "xxxxxxxxyyyyyyyyab", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(.+)\\1", perl, "abcdxxxyyyxxxyyy", match_default, make_array(4, 16, 4, 10, -2, -2));
+ // this should not throw:
+ TEST_REGEX_SEARCH("[_]+$", perl, "___________________________________________x", match_default, make_array(-2, -2));
+ // bug in V4 code detected 2004/05/12:
+ TEST_REGEX_SEARCH("\\l+", perl|icase, "abcXYZ", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("\\u+", perl|icase, "abcXYZ", match_default, make_array(0, 6, -2, -2));
+ TEST_REGEX_SEARCH("(a)(?:b)", perl|nosubs, "ab", match_default, make_array(0, 2, -2, -2));
+ // bug reported 2006-09-20:
+ TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds123456789b", match_default, make_array(0, 34, -2, -2));
+ TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds12345678", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])){3}$", perl, "1.2.03", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])){3,4}$", perl, "1.2.03", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH("^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])){3,4}?$", perl, "1.2.03", match_default, make_array(-2, -2));
+
+
+ //
+ // the strings in the next test case are too long for most compilers to cope with,
+ // we have to break them up and call the testing procs directly rather than rely on the macros:
+ //
+ static const char* big_text = "00001 01 \r\n00002 02 1 2 3 4 5 6"
+ "7 8 9 0\r\n00003 03 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\r\n"
+ "00004 04 \r\n00005 05 \r\n00006 06 "
+ "Seite: 0001\r\n00007 07 "
+ "StartSeitEEnde: 0001\r\n00008 08 "
+ "StartSeiTe Ende: 0001\r\n00009 09 "
+ "Start seiteEnde: 0001\r\n00010 10 "
+ "28.2.03\r\n00011 11 "
+ "Page: 0001\r\n00012 12 "
+ "Juhu die Erste: 0001\r\n00013 13 "
+ "Es war einmal! 0001\r\n00014 14 ABCDEFGHIJKLMNOPQRSTUVWXYZ0001\r\n"
+ "00015 15 abcdefghijklmnopqrstuvwxyz0001\r\n"
+ "00016 16 lars.schmeiser@gft.com\r\n00017 17 \r\n"
+ "00018 18 \r\n00019 19 \r\n00020 20 \r\n00021 21 1 2 3 4 5 "
+ "6 7 8 9 0\r\n"
+ "00022 22 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\r\n"
+ "00023 01 \r\n00024 02 1 2 3 4 5 6 7 8 9 0\r\n"
+ "00025 03 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\r\n"
+ "00026 04 \r\n00027 05 \r\n00028 06 "
+ "Seite: 0002\r\n00029 07 StartSeitEEnde: 0002\r\n"
+ "00030 08 "
+ "StartSeiTe Ende: 0002\r\n00031 09 "
+ "Start seiteEnde: 0002\r\n00032 10 "
+ "28.02.2003\r\n00033 11 "
+ "Page: 0002\r\n00034 12 "
+ "Juhu die Erste: 0002\r\n00035 13 "
+ "Es war einmal! 0002\r\n00036 14 ABCDEFGHIJKLMNOPQRSTUVWXYZ0002\r\n00037 "
+ "15 abcdefghijklmnopqrstuvwxyz0002\r\n00038 16 "
+ "lars.schmeiser@194.1.12.111\r\n00039 17 \r\n00040 18 \r\n00041 19 \r\n"
+ "00042 20 \r\n00043 21 1 2 3 4 5 6 7 8 9 0\r\n";
+
+ do{
+ test_info<char>::set_info(__FILE__, __LINE__,
+ "(.*\\r\\n){3}.* abcdefghijklmnopqrstuvwxyz.*\\r\\n",
+ perl, big_text, match_default|match_not_dot_newline,
+ make_array(753, 1076, 934, 1005, -2, 2143, 2466, 2324, 2395, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ do{
+ std::string st(big_text);
+ test_info<wchar_t>::set_info(__FILE__, __LINE__,
+ L"(.*\\r\\n){3}.* abcdefghijklmnopqrstuvwxyz.*\\r\\n",
+ perl, std::wstring(st.begin(), st.end()), match_default|match_not_dot_newline,
+ make_array(753, 1076, 934, 1005, -2, 2143, 2466, 2324, 2395, -2, -2));
+ test(char(0), test_regex_search_tag());
+ }while(0);
+#endif
+
+ do {
+ const unsigned char bytes[] = { 0x15,0x0,0x28,0x28,0x85,0x7c,0xb5,0x7c,0x7c,0x7c,0x7c,0x0,0x7c,0x7c,0x16,0x7c,0x7c,0x7c,0x67,0x85,0x0,0xb5,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x3d,0x0,0x7c,0x7c,0x29,0x3f,0x28,0x3f,0x31,0x29,0xb5,0x2a,0xb5,0xff,0xb5,0xb5,0x85,0xb5,0x67,0xa,0x2a,0xf7,0x2a,0x7c,0x7c,0x32,0x29,0x5c,0x5a,0x3a,0x6b };
+ std::string str((char*)bytes, sizeof(bytes));
+ test_info<char>::set_info(__FILE__, __LINE__,
+ str.c_str(),
+ perl, str.c_str(), match_default | match_not_dot_newline,
+ make_array(0, 1, -2, -2));
+ test(char(0), test_regex_search_tag());
+ } while(0);
+
+
+}
+
diff --git a/src/boost/libs/regex/test/regress/test_unicode.cpp b/src/boost/libs/regex/test/regress/test_unicode.cpp
new file mode 100644
index 000000000..eed5b4563
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/test_unicode.cpp
@@ -0,0 +1,170 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE test_unicode.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Unicode specific tests (requires ICU).
+ */
+
+#include <boost/regex/config.hpp>
+#ifdef BOOST_HAS_ICU
+#include "test.hpp"
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127)
+#endif
+
+#ifndef BOOST_NO_STD_WSTRING
+
+#define TEST_REGEX_SEARCH_U(s, f, t, m, a)\
+ do{\
+ const wchar_t e[] = { s };\
+ std::wstring se(e, (sizeof(e) / sizeof(wchar_t)) - 1);\
+ const wchar_t st[] = { t };\
+ std::wstring sst(st, (sizeof(st) / sizeof(wchar_t)) - 1);\
+ test_info<wchar_t>::set_info(__FILE__, __LINE__, se, f, sst, m, a);\
+ test_icu(wchar_t(0), test_regex_search_tag());\
+ }while(0)
+
+#define TEST_REGEX_CLASS_U(classname, character)\
+ TEST_REGEX_SEARCH_U(\
+ L"[[:" BOOST_JOIN(L, BOOST_STRINGIZE(classname)) L":]]",\
+ perl, \
+ BOOST_JOIN(L, \
+ BOOST_STRINGIZE(\
+ BOOST_JOIN(\x, character))), \
+ match_default, \
+ make_array(0, 1, -2, -2))
+
+#else
+
+#define TEST_REGEX_SEARCH_U(s, f, t, m, a)
+#define TEST_REGEX_CLASS_U(classname, character)
+
+#endif
+
+void test_unicode()
+{
+ using namespace boost::regex_constants;
+
+ TEST_REGEX_CLASS_U(L*, 3108);
+ TEST_REGEX_CLASS_U(Letter, 3108);
+ TEST_REGEX_CLASS_U(Lu, 2145);
+ TEST_REGEX_CLASS_U(Uppercase Letter, 2145);
+ TEST_REGEX_CLASS_U(Ll, 2146);
+ TEST_REGEX_CLASS_U(Lowercase Letter, 2146);
+ TEST_REGEX_CLASS_U(Lt, 1FFC);
+ TEST_REGEX_CLASS_U(Titlecase Letter, 1FFC);
+ TEST_REGEX_CLASS_U(Lm, 1D61);
+ TEST_REGEX_CLASS_U(Modifier Letter, 1D61);
+ TEST_REGEX_CLASS_U(Lo, 1974);
+ TEST_REGEX_CLASS_U(Other Letter, 1974);
+ TEST_REGEX_CLASS_U(M*, 20EA);
+ TEST_REGEX_CLASS_U(Mark, 20EA);
+ TEST_REGEX_CLASS_U(Mn, 20EA);
+ TEST_REGEX_CLASS_U(Non-Spacing Mark, 20EA);
+ TEST_REGEX_CLASS_U(Mc, 1938);
+ TEST_REGEX_CLASS_U(Spacing Combining Mark, 1938);
+ TEST_REGEX_CLASS_U(Me, 0488);
+ TEST_REGEX_CLASS_U(Enclosing Mark, 0488);
+ TEST_REGEX_CLASS_U(N*, 0669);
+ TEST_REGEX_CLASS_U(Number, 0669);
+ TEST_REGEX_CLASS_U(Nd, 0669);
+ TEST_REGEX_CLASS_U(Decimal Digit Number, 0669);
+ TEST_REGEX_CLASS_U(Nl, 303A);
+ TEST_REGEX_CLASS_U(Letter Number, 303A);
+ TEST_REGEX_CLASS_U(No, 2793);
+ TEST_REGEX_CLASS_U(Other Number, 2793);
+
+ TEST_REGEX_CLASS_U(S*, 2144);
+ TEST_REGEX_CLASS_U(Symbol, 2144);
+ TEST_REGEX_CLASS_U(Sm, 2144);
+ TEST_REGEX_CLASS_U(Math Symbol, 2144);
+ TEST_REGEX_CLASS_U(Sc, 20B1);
+ TEST_REGEX_CLASS_U(Currency Symbol, 20B1);
+ TEST_REGEX_CLASS_U(Sk, 1FFE);
+ TEST_REGEX_CLASS_U(Modifier Symbol, 1FFE);
+ TEST_REGEX_CLASS_U(So, 19FF);
+ TEST_REGEX_CLASS_U(Other Symbol, 19FF);
+
+ TEST_REGEX_CLASS_U(P*, 005F);
+ TEST_REGEX_CLASS_U(Punctuation, 005F);
+ TEST_REGEX_CLASS_U(Pc, 005F);
+ TEST_REGEX_CLASS_U(Connector Punctuation, 005F);
+ TEST_REGEX_CLASS_U(Pd, 002D);
+ TEST_REGEX_CLASS_U(Dash Punctuation, 002D);
+ TEST_REGEX_CLASS_U(Ps, 0028);
+ TEST_REGEX_CLASS_U(Open Punctuation, 0028);
+ TEST_REGEX_CLASS_U(Pe, FF63);
+ TEST_REGEX_CLASS_U(Close Punctuation, FF63);
+ TEST_REGEX_CLASS_U(Pi, 2039);
+ TEST_REGEX_CLASS_U(Initial Punctuation, 2039);
+ TEST_REGEX_CLASS_U(Pf, 203A);
+ TEST_REGEX_CLASS_U(Final Punctuation, 203A);
+ TEST_REGEX_CLASS_U(Po, 2038);
+ TEST_REGEX_CLASS_U(Other Punctuation, 2038);
+
+ TEST_REGEX_CLASS_U(Z*, 202F);
+ TEST_REGEX_CLASS_U(Separator, 202F);
+ TEST_REGEX_CLASS_U(Zs, 202F);
+ TEST_REGEX_CLASS_U(Space Separator, 202F);
+ TEST_REGEX_CLASS_U(Zl, 2028);
+ TEST_REGEX_CLASS_U(Line Separator, 2028);
+ TEST_REGEX_CLASS_U(Zp, 2029);
+ TEST_REGEX_CLASS_U(Paragraph Separator, 2029);
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ // Some tests have to be disabled for VC6 because the compiler
+ // mangles the string literals...
+ TEST_REGEX_CLASS_U(C*, 009F);
+ TEST_REGEX_CLASS_U(Other, 009F);
+ TEST_REGEX_CLASS_U(Cc, 009F);
+ TEST_REGEX_CLASS_U(Control, 009F);
+#endif
+ TEST_REGEX_CLASS_U(Cf, FFFB);
+ TEST_REGEX_CLASS_U(Format, FFFB);
+ //TEST_REGEX_CLASS_U(Cs, DC00);
+ //TEST_REGEX_CLASS_U(Surrogate, DC00);
+ TEST_REGEX_CLASS_U(Co, F8FF);
+ TEST_REGEX_CLASS_U(Private Use, F8FF);
+ TEST_REGEX_CLASS_U(Cn, FFFF);
+ TEST_REGEX_CLASS_U(Not Assigned, FFFF);
+ TEST_REGEX_CLASS_U(Any, 2038);
+ TEST_REGEX_CLASS_U(Assigned, 2038);
+ TEST_REGEX_CLASS_U(ASCII, 7f);
+ TEST_REGEX_SEARCH_U(L"[[:Assigned:]]", perl, L"\xffff", match_default, make_array(-2, -2));
+ TEST_REGEX_SEARCH_U(L"[[:ASCII:]]", perl, L"\x80", match_default, make_array(-2, -2));
+
+ TEST_REGEX_SEARCH_U(L"\\N{KHMER DIGIT SIX}", perl, L"\x17E6", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH_U(L"\\N{MODIFIER LETTER LOW ACUTE ACCENT}", perl, L"\x02CF", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH_U(L"\\N{SUPERSCRIPT ONE}", perl, L"\x00B9", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH_U(L"[\\N{KHMER DIGIT SIX}]", perl, L"\x17E6", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH_U(L"[\\N{MODIFIER LETTER LOW ACUTE ACCENT}]", perl, L"\x02CF", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH_U(L"[\\N{SUPERSCRIPT ONE}]", perl, L"\x00B9", match_default, make_array(0, 1, -2, -2));
+ TEST_REGEX_SEARCH_U(L"\\N{CJK UNIFIED IDEOGRAPH-7FED}", perl, L"\x7FED", match_default, make_array(0, 1, -2, -2));
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ // Some tests have to be disabled for VC6 because the compiler
+ // mangles the string literals...
+ TEST_REGEX_SEARCH_U(L"\\w+", perl, L" e\x301" L"coute ", match_default, make_array(1, 8, -2, -2));
+
+ TEST_REGEX_SEARCH_U(L"^", perl, L" \x2028 \x2029 \x000D\x000A \x000A \x000C \x000D \x0085 ",
+ match_default | match_not_bol, make_array(2, 2, -2, 4, 4, -2, 7, 7, -2, 9, 9, -2, 11, 11, -2, 13, 13, -2, 15, 15, -2, -2));
+ TEST_REGEX_SEARCH_U(L"$", perl, L" \x2028 \x2029 \x000D\x000A \x000A \x000C \x000D \x0085 ",
+ match_default | match_not_eol, make_array(1, 1, -2, 3, 3, -2, 5, 5, -2, 8, 8, -2, 10, 10, -2, 12, 12, -2, 14, 14, -2, -2));
+ TEST_REGEX_SEARCH_U(L".", perl, L" \x2028\x2029\x000D\x000A\x000A\x000C\x000D\x0085 ",
+ match_default | match_not_dot_newline, make_array(0, 1, -2, 9, 10, -2, -2));
+#endif
+}
+
+#else
+void test_unicode(){}
+#endif
diff --git a/src/boost/libs/regex/test/regress/vc6-stlport.mak b/src/boost/libs/regex/test/regress/vc6-stlport.mak
new file mode 100644
index 000000000..4e1acff08
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/vc6-stlport.mak
@@ -0,0 +1,77 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for regression tests
+#
+# Visual C++ 6 + full stlport 4.x
+#
+# we don't test single threaded builds as stlport doesn't support these...
+#
+#
+# Add additional compiler options here:
+#
+CXXFLAGS=
+#
+# Add additional debugging options here:
+#
+CXXDEBUG=/D_STLP_DEBUG=1
+#
+# Add additional include directories here:
+#
+INCLUDES=
+#
+# add additional linker flags here:
+#
+XLFLAGS=
+#
+# sources to compile for each test:
+#
+SOURCES=*.cpp
+
+!IF "$(MSVCDIR)" == ""
+!ERROR Variable MSVCDIR not set.
+!ENDIF
+
+!IF "$(STLPORT_PATH)" == ""
+!ERROR Variable STLPORT_PATH not set.
+!ENDIF
+
+
+CFLAGS= $(INCLUDES) /I$(STLPORT_PATH)\stlport /Zm400 /GF /Gy -GX -GR -I..\..\..\..\ $(CXXFLAGS) /DBOOST_LIB_DIAGNOSTIC=1
+
+LFLAGS= -link /LIBPATH:..\..\..\..\stage\lib /LIBPATH:..\..\build\vc6-stlport /LIBPATH:$(STLPORT_PATH)\lib user32.lib $(XLFLAGS)
+
+all :: r3-vc6-stlport.exe r4-vc6-stlport.exe r5-vc6-stlport.exe r6-vc6-stlport.exe r7-vc6-stlport.exe r8-vc6-stlport.exe
+ r1-vc6-stlport
+ r2-vc6-stlport
+ r3-vc6-stlport
+ r4-vc6-stlport
+ r5-vc6-stlport
+ r6-vc6-stlport
+ -copy ..\..\build\vc6\boost_regex*.dll
+ -copy ..\..\..\..\stage\lib\boost_regex*.dll
+ r7-vc6-stlport
+ r8-vc6-stlport
+
+r3-vc6-stlport.exe :
+ cl /MT $(CFLAGS) /O2 -o r3-vc6-stlport.exe $(SOURCES) $(LFLAGS)
+
+r4-vc6-stlport.exe :
+ cl /MTd $(CFLAGS) -o r4-vc6-stlport.exe $(SOURCES) $(LFLAGS)
+
+r5-vc6-stlport.exe :
+ cl /MD $(CFLAGS) /O2 -o r5-vc6-stlport.exe $(SOURCES) $(LFLAGS)
+
+r6-vc6-stlport.exe :
+ cl /MDd $(CFLAGS) -o r6-vc6-stlport.exe $(SOURCES) $(LFLAGS)
+
+r7-vc6-stlport.exe :
+ cl /MD $(CFLAGS) /O2 /DBOOST_ALL_DYN_LINK -o r7-vc6-stlport.exe $(SOURCES) $(LFLAGS)
+
+r8-vc6-stlport.exe :
+ cl /MDd $(CFLAGS) /DBOOST_ALL_DYN_LINK -o r8-vc6-stlport.exe $(SOURCES) $(LFLAGS)
+
+
+
diff --git a/src/boost/libs/regex/test/regress/vc6.mak b/src/boost/libs/regex/test/regress/vc6.mak
new file mode 100644
index 000000000..019fcf626
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/vc6.mak
@@ -0,0 +1,68 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for regression tests
+#
+# Visual C++ 6
+#
+#
+# Add additional compiler options here:
+#
+CXXFLAGS=
+#
+# Add additional include directories here:
+#
+INCLUDES=
+#
+# add additional linker flags here:
+#
+XLFLAGS=
+#
+# sources to compile for each test:
+#
+SOURCES=*.cpp
+
+CFLAGS= $(INCLUDES) /Zm400 /GF /Gy -GX -GR -I..\..\..\..\ /DBOOST_LIB_DIAGNOSTIC=1 $(CXXFLAGS)
+
+LFLAGS= -link /LIBPATH:..\..\..\..\stage\lib /LIBPATH:..\..\build\vc6 user32.lib $(XLFLAGS)
+
+all :: r1-vc6.exe r2-vc6.exe r3-vc6.exe r4-vc6.exe r5-vc6.exe r6-vc6.exe r7-vc6.exe r8-vc6.exe
+ r1-vc6
+ r2-vc6
+ r3-vc6
+ r4-vc6
+ r5-vc6
+ r6-vc6
+ -copy ..\..\build\vc6\boost_regex*.dll
+ -copy ..\..\..\..\stage\lib\boost_regex*.dll
+ r7-vc6
+ r8-vc6
+
+r1-vc6.exe :
+ cl /ML $(CFLAGS) /O2 -o r1-vc6.exe $(SOURCES) $(LFLAGS)
+
+r2-vc6.exe :
+ cl /MLd $(CFLAGS) -o r2-vc6.exe $(SOURCES) $(LFLAGS)
+
+r3-vc6.exe :
+ cl /MT $(CFLAGS) /O2 -o r3-vc6.exe $(SOURCES) $(LFLAGS)
+
+r4-vc6.exe :
+ cl /MTd $(CFLAGS) -o r4-vc6.exe $(SOURCES) $(LFLAGS)
+
+r5-vc6.exe :
+ cl /MD $(CFLAGS) /O2 -o r5-vc6.exe $(SOURCES) $(LFLAGS)
+
+r6-vc6.exe :
+ cl /MDd $(CFLAGS) -o r6-vc6.exe $(SOURCES) $(LFLAGS)
+
+r7-vc6.exe :
+ cl /MD $(CFLAGS) /O2 /DBOOST_ALL_DYN_LINK -o r7-vc6.exe $(SOURCES) $(LFLAGS)
+
+r8-vc6.exe :
+ cl /MDd $(CFLAGS) /DBOOST_ALL_DYN_LINK -o r8-vc6.exe $(SOURCES) $(LFLAGS)
+
+
+
diff --git a/src/boost/libs/regex/test/regress/vc7.mak b/src/boost/libs/regex/test/regress/vc7.mak
new file mode 100644
index 000000000..d4ea3bc15
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/vc7.mak
@@ -0,0 +1,68 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for regression tests
+#
+# Visual C++ 6
+#
+#
+# Add additional compiler options here:
+#
+CXXFLAGS=
+#
+# Add additional include directories here:
+#
+INCLUDES=
+#
+# add additional linker flags here:
+#
+XLFLAGS=
+#
+# sources to compile for each test:
+#
+SOURCES=*.cpp
+
+CFLAGS= $(INCLUDES) /Zm400 /O2 /GB /GF /Gy -GX -GR -I..\..\..\..\ $(CXXFLAGS) /DBOOST_LIB_DIAGNOSTIC=1 /Zc:wchar_t
+
+LFLAGS= -link /LIBPATH:..\..\..\..\stage\lib /LIBPATH:..\..\build\vc7 $(XLFLAGS)
+
+all :: r1-vc7.exe r2-vc7.exe r3-vc7.exe r4-vc7.exe r5-vc7.exe r6-vc7.exe r7-vc7.exe r8-vc7.exe
+ r1-vc7
+ r2-vc7
+ r3-vc7
+ r4-vc7
+ r5-vc7
+ r6-vc7
+ -copy ..\..\build\vc7\boost_regex*.dll
+ -copy ..\..\..\..\stage\lib\boost_regex*.dll
+ r7-vc7
+ r8-vc7
+
+r1-vc7.exe :
+ cl /ML $(CFLAGS) /O2 -o r1-vc7.exe $(SOURCES) $(LFLAGS)
+
+r2-vc7.exe :
+ cl /MLd $(CFLAGS) -o r2-vc7.exe $(SOURCES) $(LFLAGS)
+
+r3-vc7.exe :
+ cl /MT $(CFLAGS) /O2 -o r3-vc7.exe $(SOURCES) $(LFLAGS)
+
+r4-vc7.exe :
+ cl /MTd $(CFLAGS) -o r4-vc7.exe $(SOURCES) $(LFLAGS)
+
+r5-vc7.exe :
+ cl /MD $(CFLAGS) /O2 -o r5-vc7.exe $(SOURCES) $(LFLAGS)
+
+r6-vc7.exe :
+ cl /MDd $(CFLAGS) -o r6-vc7.exe $(SOURCES) $(LFLAGS)
+
+r7-vc7.exe :
+ cl /MD $(CFLAGS) /O2 /DBOOST_ALL_DYN_LINK -o r7-vc7.exe $(SOURCES) $(LFLAGS)
+
+r8-vc7.exe :
+ cl /MDd $(CFLAGS) /DBOOST_ALL_DYN_LINK -o r8-vc7.exe $(SOURCES) $(LFLAGS)
+
+
+
diff --git a/src/boost/libs/regex/test/regress/vc71.mak b/src/boost/libs/regex/test/regress/vc71.mak
new file mode 100644
index 000000000..831b25235
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/vc71.mak
@@ -0,0 +1,68 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for regression tests
+#
+# Visual C++ 7.1
+#
+#
+# Add additional compiler options here:
+#
+CXXFLAGS=
+#
+# Add additional include directories here:
+#
+INCLUDES=
+#
+# add additional linker flags here:
+#
+XLFLAGS=
+#
+# sources to compile for each test:
+#
+SOURCES=*.cpp
+
+CFLAGS= $(INCLUDES) /Zm400 /GB /GF /Gy -GX -GR -I..\..\..\..\ $(CXXFLAGS) /DBOOST_LIB_DIAGNOSTIC=1 /Zc:wchar_t
+
+LFLAGS= -link /LIBPATH:..\..\..\..\stage\lib /LIBPATH:..\..\build\vc71 $(XLFLAGS)
+
+all :: r1-vc71.exe r2-vc71.exe r3-vc71.exe r4-vc71.exe r5-vc71.exe r6-vc71.exe r7-vc71.exe r8-vc71.exe
+ r1-vc71
+ r2-vc71
+ r3-vc71
+ r4-vc71
+ r5-vc71
+ r6-vc71
+ -copy ..\..\build\vc71\boost_regex*.dll
+ -copy ..\..\..\..\stage\lib\boost_regex*.dll
+ r7-vc71
+ r8-vc71
+
+r1-vc71.exe :
+ cl /ML $(CFLAGS) /O2 -o r1-vc71.exe $(SOURCES) $(LFLAGS)
+
+r2-vc71.exe :
+ cl /MLd $(CFLAGS) -o r2-vc71.exe $(SOURCES) $(LFLAGS)
+
+r3-vc71.exe :
+ cl /MT $(CFLAGS) /O2 -o r3-vc71.exe $(SOURCES) $(LFLAGS)
+
+r4-vc71.exe :
+ cl /MTd $(CFLAGS) -o r4-vc71.exe $(SOURCES) $(LFLAGS)
+
+r5-vc71.exe :
+ cl /MD $(CFLAGS) /O2 -o r5-vc71.exe $(SOURCES) $(LFLAGS)
+
+r6-vc71.exe :
+ cl /MDd $(CFLAGS) -o r6-vc71.exe $(SOURCES) $(LFLAGS)
+
+r7-vc71.exe :
+ cl /MD $(CFLAGS) /O2 /DBOOST_ALL_DYN_LINK -o r7-vc71.exe $(SOURCES) $(LFLAGS)
+
+r8-vc71.exe :
+ cl /MDd $(CFLAGS) /DBOOST_ALL_DYN_LINK -o r8-vc71.exe $(SOURCES) $(LFLAGS)
+
+
+
diff --git a/src/boost/libs/regex/test/regress/vc8.mak b/src/boost/libs/regex/test/regress/vc8.mak
new file mode 100644
index 000000000..68c4a8fe4
--- /dev/null
+++ b/src/boost/libs/regex/test/regress/vc8.mak
@@ -0,0 +1,68 @@
+# copyright John Maddock 2003
+# 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.
+
+# very basic makefile for regression tests
+#
+# Visual C++ 8.0
+#
+#
+# Add additional compiler options here:
+#
+CXXFLAGS=
+#
+# Add additional include directories here:
+#
+INCLUDES=
+#
+# add additional linker flags here:
+#
+XLFLAGS=
+#
+# sources to compile for each test:
+#
+SOURCES=*.cpp
+
+CFLAGS= $(INCLUDES) /Zm400 /GB /GF /Gy -GX -GR -I..\..\..\..\ $(CXXFLAGS) /DBOOST_LIB_DIAGNOSTIC=1 /Zc:wchar_t
+
+LFLAGS= -link /LIBPATH:..\..\..\..\stage\lib /LIBPATH:..\..\build\vc80 $(XLFLAGS)
+
+all :: r1-vc8.exe r2-vc8.exe r3-vc8.exe r4-vc8.exe r5-vc8.exe r6-vc8.exe r7-vc8.exe r8-vc8.exe
+ r1-vc8
+ r2-vc8
+ r3-vc8
+ r4-vc8
+ r5-vc8
+ r6-vc8
+ -copy ..\..\build\vc80\boost_regex*.dll
+ -copy ..\..\..\..\stage\lib\boost_regex*.dll
+ r7-vc8
+ r8-vc8
+
+r1-vc8.exe :
+ cl /ML $(CFLAGS) /O2 -o r1-vc8.exe $(SOURCES) $(LFLAGS)
+
+r2-vc8.exe :
+ cl /MLd $(CFLAGS) -o r2-vc8.exe $(SOURCES) $(LFLAGS)
+
+r3-vc8.exe :
+ cl /MT $(CFLAGS) /O2 -o r3-vc8.exe $(SOURCES) $(LFLAGS)
+
+r4-vc8.exe :
+ cl /MTd $(CFLAGS) -o r4-vc8.exe $(SOURCES) $(LFLAGS)
+
+r5-vc8.exe :
+ cl /MD $(CFLAGS) /O2 -o r5-vc8.exe $(SOURCES) $(LFLAGS)
+
+r6-vc8.exe :
+ cl /MDd $(CFLAGS) -o r6-vc8.exe $(SOURCES) $(LFLAGS)
+
+r7-vc8.exe :
+ cl /MD $(CFLAGS) /O2 /DBOOST_ALL_DYN_LINK -o r7-vc8.exe $(SOURCES) $(LFLAGS)
+
+r8-vc8.exe :
+ cl /MDd $(CFLAGS) /DBOOST_ALL_DYN_LINK -o r8-vc8.exe $(SOURCES) $(LFLAGS)
+
+
+
diff --git a/src/boost/libs/regex/test/static_mutex/static_mutex_test.cpp b/src/boost/libs/regex/test/static_mutex/static_mutex_test.cpp
new file mode 100644
index 000000000..f029a4bee
--- /dev/null
+++ b/src/boost/libs/regex/test/static_mutex/static_mutex_test.cpp
@@ -0,0 +1,207 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE static_mutex_test.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: test program for boost::static_mutex.
+ */
+
+#include <boost/regex/pending/static_mutex.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/timer.hpp>
+#include <iostream>
+#include <iomanip>
+
+//
+// we cannot use the regular Boost.Test in here: it is not thread safe
+// and calls to BOOST_CHECK will eventually crash on some compilers
+// (Borland certainly) due to race conditions inside the Boost.Test lib.
+//
+#define BOOST_CHECK(pred) if(!(pred)) failed_test(__FILE__, __LINE__, BOOST_STRINGIZE(pred));
+
+int total_failures = 0;
+void failed_test(const char* file, int line, const char* pred)
+{
+ static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ;
+ boost::static_mutex::scoped_lock guard(mut);
+ ++total_failures;
+ std::cout << "Failed test in \"" << file << "\" at line " << line << ": " << pred << std::endl;
+}
+
+void print_cycles(int c)
+{
+ static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ;
+ boost::static_mutex::scoped_lock guard(mut);
+ std::cout << "Thread exited after " << c << " cycles." << std::endl;
+}
+
+bool sufficient_time()
+{
+ // return true if enough time has passed since the tests began:
+ static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ;
+ boost::static_mutex::scoped_lock guard(mut);
+ static boost::timer t;
+ // is 10 seconds enough?
+ return t.elapsed() >= 10.0;
+}
+
+// define three trivial test proceedures:
+bool t1()
+{
+ static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ;
+ static int has_lock = 0;
+ static int data = 10000;
+
+ boost::static_mutex::scoped_lock guard(mut);
+ BOOST_CHECK(++has_lock == 1);
+ BOOST_CHECK(guard.locked());
+ BOOST_CHECK(guard);
+ bool result = (--data > 0) ? true : false;
+ BOOST_CHECK(--has_lock == 0);
+ return result;
+}
+
+bool t2()
+{
+ static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ;
+ static int has_lock = 0;
+ static int data = 10000;
+
+ boost::static_mutex::scoped_lock guard(mut, false);
+ BOOST_CHECK(0 == guard.locked());
+ BOOST_CHECK(!guard);
+ guard.lock();
+ BOOST_CHECK(++has_lock == 1);
+ BOOST_CHECK(guard.locked());
+ BOOST_CHECK(guard);
+ bool result = (--data > 0) ? true : false;
+ BOOST_CHECK(--has_lock == 0);
+ guard.unlock();
+ BOOST_CHECK(0 == guard.locked());
+ BOOST_CHECK(!guard);
+ return result;
+}
+
+bool t3()
+{
+ static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ;
+ static int has_lock = 0;
+ static int data = 10000;
+
+ boost::static_mutex::scoped_lock guard(mut);
+ BOOST_CHECK(++has_lock == 1);
+ BOOST_CHECK(guard.locked());
+ BOOST_CHECK(guard);
+ bool result = (--data > 0) ? true : false;
+ BOOST_CHECK(--has_lock == 0);
+ return result;
+}
+
+// define their thread procs:
+void thread1_proc()
+{
+ int cycles = 0;
+ while(!sufficient_time())
+ {
+ t1();
+ t2();
+ ++cycles;
+ }
+ print_cycles(cycles);
+}
+
+void thread2_proc()
+{
+ int cycles = 0;
+ while(!sufficient_time())
+ {
+ t2();
+ t3();
+ ++cycles;
+ }
+ print_cycles(cycles);
+}
+
+void thread3_proc()
+{
+ int cycles = 0;
+ while(!sufficient_time())
+ {
+ t1();
+ t3();
+ ++cycles;
+ }
+ print_cycles(cycles);
+}
+
+// make sure that at least one of our test proceedures
+// is called during program startup:
+struct startup1
+{
+ startup1()
+ {
+ t1();
+ }
+ ~startup1()
+ {
+ t1();
+ }
+};
+
+startup1 up1;
+
+int main()
+{
+ (void)up1;
+
+ std::list<boost::shared_ptr<boost::thread> > threads;
+ for(int i = 0; i < 2; ++i)
+ {
+ try{
+ threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&thread1_proc)));
+ }
+ catch(const std::exception& e)
+ {
+ std::cerr << "<note>Thread creation failed with message: " << e.what() << "</note>" << std::endl;
+ }
+ }
+ for(int i = 0; i < 2; ++i)
+ {
+ try{
+ threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&thread2_proc)));
+ }
+ catch(const std::exception& e)
+ {
+ std::cerr << "<note>Thread creation failed with message: " << e.what() << "</note>" << std::endl;
+ }
+ }
+ for(int i = 0; i < 2; ++i)
+ {
+ try{
+ threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&thread3_proc)));
+ }
+ catch(const std::exception& e)
+ {
+ std::cerr << "<note>Thread creation failed with message: " << e.what() << "</note>" << std::endl;
+ }
+ }
+
+ std::list<boost::shared_ptr<boost::thread> >::const_iterator a(threads.begin()), b(threads.end());
+ while(a != b)
+ {
+ (*a)->join();
+ ++a;
+ }
+
+ return total_failures;
+}
diff --git a/src/boost/libs/regex/test/test_consolidated.cpp b/src/boost/libs/regex/test/test_consolidated.cpp
new file mode 100644
index 000000000..188033f7f
--- /dev/null
+++ b/src/boost/libs/regex/test/test_consolidated.cpp
@@ -0,0 +1,29 @@
+/*
+ *
+ * Copyright (c) 2011
+ * 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 <libs/regex/src/c_regex_traits.cpp>
+#include <libs/regex/src/cpp_regex_traits.cpp>
+#include <libs/regex/src/cregex.cpp>
+#include <libs/regex/src/fileiter.cpp>
+#include <libs/regex/src/icu.cpp>
+#include <libs/regex/src/instances.cpp>
+#include <libs/regex/src/posix_api.cpp>
+#include <libs/regex/src/regex.cpp>
+#include <libs/regex/src/regex_debug.cpp>
+#include <libs/regex/src/regex_raw_buffer.cpp>
+#include <libs/regex/src/regex_traits_defaults.cpp>
+#include <libs/regex/src/static_mutex.cpp>
+#include <libs/regex/src/usinstances.cpp>
+#include <libs/regex/src/wc_regex_traits.cpp>
+#include <libs/regex/src/w32_regex_traits.cpp>
+#include <libs/regex/src/wide_posix_api.cpp>
+#include <libs/regex/src/winstances.cpp>
diff --git a/src/boost/libs/regex/test/test_macros.hpp b/src/boost/libs/regex/test/test_macros.hpp
new file mode 100644
index 000000000..ef28fe0ac
--- /dev/null
+++ b/src/boost/libs/regex/test/test_macros.hpp
@@ -0,0 +1,227 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. 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_
+//
+
+#ifndef BOOST_MULTIPRECISION_TEST_HPP
+#define BOOST_MULTIPRECISION_TEST_HPP
+
+#include <limits>
+#include <cmath>
+#include <typeinfo>
+#include <iostream>
+#include <iomanip>
+#include <stdlib.h>
+
+#include <boost/core/lightweight_test.hpp>
+#include <boost/current_function.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/utility/enable_if.hpp>
+
+enum
+{
+ warn_on_fail,
+ error_on_fail,
+ abort_on_fail
+};
+
+template <class T>
+inline int digits_of(const T&)
+{
+ return std::numeric_limits<T>::is_specialized ? std::numeric_limits<T>::digits : 18;
+}
+
+
+inline std::ostream& report_where(const char* file, int line, const char* function)
+{
+ if(function)
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << "In function: "<< function << std::endl;
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << file << ":" << line;
+ return BOOST_LIGHTWEIGHT_TEST_OSTREAM;
+}
+
+#define BOOST_MP_REPORT_WHERE report_where(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
+
+inline void report_severity(int severity)
+{
+ if(severity == error_on_fail)
+ ++boost::detail::test_errors();
+ else if(severity == abort_on_fail)
+ {
+ ++boost::detail::test_errors();
+ abort();
+ }
+}
+
+#define BOOST_MP_REPORT_SEVERITY(severity) report_severity(severity)
+
+template <class E>
+void report_unexpected_exception(const E& e, int severity, const char* file, int line, const char* function)
+{
+ report_where(file, line, function) << " Unexpected exception of type " << typeid(e).name() << std::endl;
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Errot message was: " << e.what() << std::endl;
+ BOOST_MP_REPORT_SEVERITY(severity);
+}
+
+#define BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity) \
+ catch(const std::exception& __e) \
+ { report_unexpected_exception(__e, severity, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); }\
+ catch(...)\
+ { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Exception of unknown type was thrown" << std::endl; report_severity(severity); }
+
+
+#define BOOST_CHECK_IMP(x, severity)\
+ try{ if(x){}else{\
+ BOOST_MP_REPORT_WHERE << " Failed predicate: " << BOOST_STRINGIZE(x) << std::endl;\
+ BOOST_MP_REPORT_SEVERITY(severity);\
+ }\
+ }BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity)
+
+#define BOOST_CHECK(x) BOOST_CHECK_IMP(x, error_on_fail)
+#define BOOST_WARN(x) BOOST_CHECK_IMP(x, warn_on_fail)
+#define BOOST_REQUIRE(x) BOOST_CHECK_IMP(x, abort_on_fail)
+
+#define BOOST_EQUAL_IMP(x, y, severity)\
+ try{ if(!((x) == (y))){\
+ BOOST_MP_REPORT_WHERE << " Failed check for equality: \n" \
+ << std::setprecision(digits_of(x)) << std::scientific\
+ << "Value of LHS was: " << (x) << "\n"\
+ << "Value of RHS was: " << (y) << "\n"\
+ << std::setprecision(3) << std::endl;\
+ BOOST_MP_REPORT_SEVERITY(severity);\
+ }\
+ }BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity)
+
+#define BOOST_NE_IMP(x, y, severity)\
+ try{ if(!(x != y)){\
+ BOOST_MP_REPORT_WHERE << " Failed check for non-equality: \n" \
+ << std::setprecision(digits_of(x)) << std::scientific\
+ << "Value of LHS was: " << x << "\n"\
+ << "Value of RHS was: " << y << "\n"\
+ << std::setprecision(3) << std::endl;\
+ BOOST_MP_REPORT_SEVERITY(severity);\
+ }\
+ }BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity)
+
+#define BOOST_LT_IMP(x, y, severity)\
+ try{ if(!(x < y)){\
+ BOOST_MP_REPORT_WHERE << " Failed check for less than: \n" \
+ << std::setprecision(digits_of(x)) << std::scientific\
+ << "Value of LHS was: " << x << "\n"\
+ << "Value of RHS was: " << y << "\n"\
+ << std::setprecision(3) << std::endl;\
+ BOOST_MP_REPORT_SEVERITY(severity);\
+ }\
+ }BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity)
+
+#define BOOST_GT_IMP(x, y, severity)\
+ try{ if(!(x > y)){\
+ BOOST_MP_REPORT_WHERE << " Failed check for greater than: \n" \
+ << std::setprecision(digits_of(x)) << std::scientific\
+ << "Value of LHS was: " << x << "\n"\
+ << "Value of RHS was: " << y << "\n"\
+ << std::setprecision(3) << std::endl;\
+ BOOST_MP_REPORT_SEVERITY(severity);\
+ }\
+ }BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity)
+
+#define BOOST_LE_IMP(x, y, severity)\
+ try{ if(!(x <= y)){\
+ BOOST_MP_REPORT_WHERE << " Failed check for less-than-equal-to: \n" \
+ << std::setprecision(digits_of(x)) << std::scientific\
+ << "Value of LHS was: " << x << "\n"\
+ << "Value of RHS was: " << y << "\n"\
+ << std::setprecision(3) << std::endl;\
+ BOOST_MP_REPORT_SEVERITY(severity);\
+ }\
+ }BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity)
+
+#define BOOST_GE_IMP(x, y, severity)\
+ try{ if(!(x >= y)){\
+ BOOST_MP_REPORT_WHERE << " Failed check for greater-than-equal-to \n" \
+ << std::setprecision(digits_of(x)) << std::scientific\
+ << "Value of LHS was: " << x << "\n"\
+ << "Value of RHS was: " << y << "\n"\
+ << std::setprecision(3) << std::endl;\
+ BOOST_MP_REPORT_SEVERITY(severity);\
+ }\
+ }BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity)
+
+#define BOOST_MT_CHECK_THROW_IMP(x, E, severity)\
+ try{ \
+ x;\
+ BOOST_MP_REPORT_WHERE << " Expected exception not thrown in expression " << BOOST_STRINGIZE(x) << std::endl;\
+ BOOST_MP_REPORT_SEVERITY(severity);\
+ }\
+ catch(const E&){}\
+ BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity)
+
+template <class I, class J>
+bool check_equal_collections(I a, I b, J x, J y)
+{
+ int i = 0;
+ while(a != b)
+ {
+ if(x == y)
+ {
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << " Unexpected end of second sequence" << std::endl;
+ return false;
+ }
+ if(*a != *x)
+ {
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Error occured in position " << i << " of the collection." << std::endl;
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << "First value was " << std::setprecision(digits_of(x)) << std::scientific << *a << std::endl;
+ BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Second value was " << std::setprecision(digits_of(x)) << std::scientific << *x << std::endl;
+ return false;
+ }
+ ++a;
+ ++x;
+ }
+ return true;
+}
+
+#define BOOST_MT_CHECK_EQ_COLLECTIONS(a, b, x, y, severity)\
+ try{ \
+ if(!check_equal_collections(a, b, x, y))\
+ {\
+ BOOST_MP_REPORT_WHERE << " Collections were not equal" << std::endl;\
+ BOOST_MP_REPORT_SEVERITY(severity);\
+ }\
+ }\
+ BOOST_MP_UNEXPECTED_EXCEPTION_CHECK(severity)
+
+
+#define BOOST_CHECK_EQUAL(x, y) BOOST_EQUAL_IMP(x, y, error_on_fail)
+#define BOOST_WARN_EQUAL(x, y) BOOST_EQUAL_IMP(x, y, warn_on_fail)
+#define BOOST_REQUIRE_EQUAL(x, y) BOOST_EQUAL_IMP(x, y, abort_on_fail)
+
+#define BOOST_CHECK_NE(x, y) BOOST_NE_IMP(x, y, error_on_fail)
+#define BOOST_WARN_NE(x, y) BOOST_NE_IMP(x, y, warn_on_fail)
+#define BOOST_REQUIRE_NE(x, y) BOOST_NE_IMP(x, y, abort_on_fail)
+
+#define BOOST_CHECK_LT(x, y) BOOST_LT_IMP(x, y, error_on_fail)
+#define BOOST_WARN_LT(x, y) BOOST_LT_IMP(x, y, warn_on_fail)
+#define BOOST_REQUIRE_LT(x, y) BOOST_LT_IMP(x, y, abort_on_fail)
+
+#define BOOST_CHECK_GT(x, y) BOOST_GT_IMP(x, y, error_on_fail)
+#define BOOST_WARN_GT(x, y) BOOST_GT_IMP(x, y, warn_on_fail)
+#define BOOST_REQUIRE_GT(x, y) BOOST_GT_IMP(x, y, abort_on_fail)
+
+#define BOOST_CHECK_LE(x, y) BOOST_LE_IMP(x, y, error_on_fail)
+#define BOOST_WARN_LE(x, y) BOOST_LE_IMP(x, y, warn_on_fail)
+#define BOOST_REQUIRE_LE(x, y) BOOST_LE_IMP(x, y, abort_on_fail)
+
+#define BOOST_CHECK_GE(x, y) BOOST_GE_IMP(x, y, error_on_fail)
+#define BOOST_WARN_GE(x, y) BOOST_GE_IMP(x, y, warn_on_fail)
+#define BOOST_REQUIRE_GE(x, y) BOOST_GE_IMP(x, y, abort_on_fail)
+
+#define BOOST_CHECK_THROW(x, E) BOOST_MT_CHECK_THROW_IMP(x, E, error_on_fail)
+#define BOOST_WARN_THROW(x, E) BOOST_MT_CHECK_THROW_IMP(x, E, warn_on_fail)
+#define BOOST_REQUIRE_THROW(x, E) BOOST_MT_CHECK_THROW_IMP(x, E, abort_on_fail)
+
+#define BOOST_CHECK_EQUAL_COLLECTIONS(a, b, x, y) BOOST_MT_CHECK_EQ_COLLECTIONS(a, b, x, y, error_on_fail)
+#define BOOST_WARN_EQUAL_COLLECTIONS(a, b, x, y) BOOST_MT_CHECK_EQ_COLLECTIONS(a, b, x, y, warn_on_fail)
+#define BOOST_REQUIRE_EQUAL_COLLECTIONS(a, b, x, y) BOOST_MT_CHECK_EQ_COLLECTIONS(a, b, x, y, abort_on_fail)
+
+#endif
diff --git a/src/boost/libs/regex/test/test_warnings.cpp b/src/boost/libs/regex/test/test_warnings.cpp
new file mode 100644
index 000000000..f85d437d2
--- /dev/null
+++ b/src/boost/libs/regex/test/test_warnings.cpp
@@ -0,0 +1,29 @@
+/*
+*
+* Copyright (c) 2018
+* 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)
+*
+*/
+
+
+#ifdef _MSC_VER
+#pragma warning(disable:4820 4668)
+#endif
+
+#ifdef __APPLE_CC__
+#pragma clang diagnostic ignored "-Wc++11-long-long"
+#endif
+
+#include <boost/regex.hpp>
+
+void test_proc()
+{
+ std::string text, re;
+ boost::regex exp(re);
+ regex_match(text, exp);
+}
+
diff --git a/src/boost/libs/regex/test/unicode/unicode_iterator_test.cpp b/src/boost/libs/regex/test/unicode/unicode_iterator_test.cpp
new file mode 100644
index 000000000..2e6bcec1e
--- /dev/null
+++ b/src/boost/libs/regex/test/unicode/unicode_iterator_test.cpp
@@ -0,0 +1,322 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE unicode_iterator_test.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Simple test suite for Unicode interconversions.
+ */
+
+#include <boost/regex/pending/unicode_iterator.hpp>
+#include <boost/detail/lightweight_main.hpp>
+#include "../test_macros.hpp"
+#include <vector>
+#include <iterator>
+#include <algorithm>
+#include <iostream>
+#include <iomanip>
+#include <cstring>
+
+#if !defined(TEST_UTF8) && !defined(TEST_UTF16)
+# define TEST_UTF8
+# define TEST_UTF16
+#endif
+
+template <class I>
+typename I::value_type iterate_over(I a, I b)
+{
+ typedef typename I::value_type value_type;
+ value_type v = 0;
+ while(a != b)
+ {
+ v ^= *a;
+ ++a;
+ }
+ return v;
+}
+
+void spot_checks()
+{
+ // test specific values ripped straight out of the Unicode standard
+ // to verify that our encoding is the same as theirs, as well as
+ // self-consistent:
+ ::boost::uint32_t spot16[] = { 0x10302u, };
+ typedef boost::u32_to_u16_iterator<const ::boost::uint32_t*> u32to16type;
+
+ u32to16type it(spot16);
+ BOOST_CHECK_EQUAL(*it++, 0xD800u);
+ BOOST_CHECK_EQUAL(*it++, 0xDF02u);
+ BOOST_CHECK_EQUAL(*--it, 0xDF02u);
+ BOOST_CHECK_EQUAL(*--it, 0xD800u);
+
+ ::boost::uint32_t spot8[] = { 0x004Du, 0x0430u, 0x4E8Cu, 0x10302u, };
+ typedef boost::u32_to_u8_iterator<const ::boost::uint32_t*> u32to8type;
+
+ u32to8type it8(spot8);
+ BOOST_CHECK_EQUAL(*it8++, 0x4Du);
+ BOOST_CHECK_EQUAL(*it8++, 0xD0u);
+ BOOST_CHECK_EQUAL(*it8++, 0xB0u);
+ BOOST_CHECK_EQUAL(*it8++, 0xE4u);
+ BOOST_CHECK_EQUAL(*it8++, 0xBAu);
+ BOOST_CHECK_EQUAL(*it8++, 0x8Cu);
+ BOOST_CHECK_EQUAL(*it8++, 0xF0u);
+ BOOST_CHECK_EQUAL(*it8++, 0x90u);
+ BOOST_CHECK_EQUAL(*it8++, 0x8Cu);
+ BOOST_CHECK_EQUAL(*it8++, 0x82u);
+
+ BOOST_CHECK_EQUAL(*--it8, 0x82u);
+ BOOST_CHECK_EQUAL(*--it8, 0x8Cu);
+ BOOST_CHECK_EQUAL(*--it8, 0x90u);
+ BOOST_CHECK_EQUAL(*--it8, 0xF0u);
+ BOOST_CHECK_EQUAL(*--it8, 0x8Cu);
+ BOOST_CHECK_EQUAL(*--it8, 0xBAu);
+ BOOST_CHECK_EQUAL(*--it8, 0xE4u);
+ BOOST_CHECK_EQUAL(*--it8, 0xB0u);
+ BOOST_CHECK_EQUAL(*--it8, 0xD0u);
+ BOOST_CHECK_EQUAL(*--it8, 0x4Du);
+ //
+ // Test some bad sequences and verify that our iterators will catch them:
+ //
+ boost::uint8_t bad_seq[10] = { 0x4Du, 0xD0u, 0xB0u, 0xE4u, 0xBAu, 0x8Cu, 0xF0u, 0x90u, 0x8Cu, 0x82u };
+ BOOST_CHECK_EQUAL(
+ iterate_over(
+ boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq, bad_seq, bad_seq + 10),
+ boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq+10, bad_seq, bad_seq + 10)),
+ 0x000149f3u);
+ BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq, bad_seq, bad_seq + 9), std::out_of_range);
+ BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq, bad_seq, bad_seq + 8), std::out_of_range);
+ BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq, bad_seq, bad_seq + 7), std::out_of_range);
+ BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq + 2, bad_seq, bad_seq + 10), std::out_of_range);
+ BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq + 2, bad_seq + 2, bad_seq + 10), std::out_of_range);
+
+ boost::uint16_t bad_seq2[6] = { 0xD800, 0xDF02, 0xD800, 0xDF02, 0xD800, 0xDF02 };
+ BOOST_CHECK_EQUAL(
+ iterate_over(
+ boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2, bad_seq2, bad_seq2 + 6),
+ boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2+6, bad_seq2, bad_seq2 + 6)),
+ 66306u);
+ BOOST_CHECK_THROW(boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2, bad_seq2, bad_seq2 + 5), std::out_of_range);
+ BOOST_CHECK_THROW(boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2 + 1, bad_seq2 + 1, bad_seq2 + 6), std::out_of_range);
+ BOOST_CHECK_THROW(boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2 + 1, bad_seq2, bad_seq2 + 6), std::out_of_range);
+
+ boost::uint8_t bad_seq3[5] = { '.', '*', 0xe4, '.', '*' };
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq3, bad_seq3, bad_seq3 + 5), boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq3 + 5, bad_seq3, bad_seq3 + 5)), std::out_of_range);
+ boost::uint8_t bad_seq4[5] = { '.', '*', 0xf6, '.', '*' };
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq4, bad_seq4, bad_seq4 + 5), boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq4 + 5, bad_seq4, bad_seq4 + 5)), std::out_of_range);
+
+ // Invalid sequences containing surrogate pairs:
+ const char* invalid_pseq = "\xed\xa0\x80"; // single lowest lead surrogate U+D800
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xed\xb0\x80"; // single lowest trail surrogate U+DC00
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xed\xb0\x80"; // single lowest trail surrogate U+DC00
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xed\xbf\xbf"; // single highest trail surrogate U+DFFF
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+
+ // overlong encodings (created by left-padding with zero bits)
+ invalid_pseq = "\xc0\x80"; // illegal 2-byte encoding of 1-byte character U+0000
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xe0\x80\x80"; // illegal 3-byte encoding of 1-byte character U+0000
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xf0\x80\x80\x80"; // illegal 4-byte encoding of 1-byte character U+0000
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+
+ invalid_pseq = "\xc1\xbf"; // illegal 2-byte encoding of 1-byte character U+007F
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xe0\x81\xbf"; // illegal 3-byte encoding of 1-byte character U+007F
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xf0\x80\x81\xbf"; // illegal 4-byte encoding of 1-byte character U+007F
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+
+ invalid_pseq = "\xe0\x82\x80"; // illegal 3-byte encoding of 2-byte character U+0080
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xf0\x80\x82\x80"; // illegal 4-byte encoding of 2-byte character U+0080
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+
+ invalid_pseq = "\xe0\x9f\xbf"; // illegal 3-byte encoding of 2-byte character U+07FF
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xf0\x80\x9f\xbf"; // illegal 4-byte encoding of 2-byte character U+07FF
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+
+ invalid_pseq = "\xf0\x80\xa0\x80"; // illegal 4-byte encoding of 3-byte character U+0800
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+ invalid_pseq = "\xf0\x8f\xbf\xbf"; // illegal 4-byte encoding of 3-byte character U+FFFF
+ BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
+}
+
+void test(const std::vector< ::boost::uint32_t>& v)
+{
+ typedef std::vector< ::boost::uint32_t> vector32_type;
+#ifdef TEST_UTF16
+ typedef std::vector< ::boost::uint16_t> vector16_type;
+#endif
+ typedef std::vector< ::boost::uint8_t> vector8_type;
+#ifdef TEST_UTF16
+ typedef boost::u32_to_u16_iterator<vector32_type::const_iterator, ::boost::uint16_t> u32to16type;
+ typedef boost::u16_to_u32_iterator<vector16_type::const_iterator, ::boost::uint32_t> u16to32type;
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
+ typedef std::reverse_iterator<u32to16type> ru32to16type;
+ typedef std::reverse_iterator<u16to32type> ru16to32type;
+#endif
+#endif // TEST_UTF16
+#ifdef TEST_UTF8
+ typedef boost::u32_to_u8_iterator<vector32_type::const_iterator, ::boost::uint8_t> u32to8type;
+ typedef boost::u8_to_u32_iterator<vector8_type::const_iterator, ::boost::uint32_t> u8to32type;
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
+ typedef std::reverse_iterator<u32to8type> ru32to8type;
+ typedef std::reverse_iterator<u8to32type> ru8to32type;
+#endif
+#endif // TEST_UTF8
+ vector8_type v8;
+#ifdef TEST_UTF16
+ vector16_type v16;
+#endif
+ vector32_type v32;
+ vector32_type::const_iterator i, j, k;
+
+#ifdef TEST_UTF16
+ //
+ // begin by testing forward iteration, of 32-16 bit interconversions:
+ //
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
+ v16.assign(u32to16type(v.begin()), u32to16type(v.end()));
+#else
+ v16.clear();
+ std::copy(u32to16type(v.begin()), u32to16type(v.end()), std::back_inserter(v16));
+#endif
+#ifndef BOOST_NO_STD_DISTANCE
+ BOOST_CHECK_EQUAL((std::size_t)std::distance(u32to16type(v.begin()), u32to16type(v.end())), v16.size());
+#endif
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
+ v32.assign(u16to32type(v16.begin(), v16.begin(), v16.end()), u16to32type(v16.end(), v16.begin(), v16.end()));
+#else
+ v32.clear();
+ std::copy(u16to32type(v16.begin(), v16.begin(), v16.end()), u16to32type(v16.end(), v16.begin(), v16.end()), std::back_inserter(v32));
+#endif
+#ifndef BOOST_NO_STD_DISTANCE
+ BOOST_CHECK_EQUAL((std::size_t)std::distance(u16to32type(v16.begin(), v16.begin(), v16.end()), u16to32type(v16.end(), v16.begin(), v16.end())), v32.size());
+#endif
+ BOOST_CHECK_EQUAL(v.size(), v32.size());
+ i = v.begin();
+ j = i;
+ std::advance(j, (std::min)(v.size(), v32.size()));
+ k = v32.begin();
+ BOOST_CHECK_EQUAL_COLLECTIONS(v.begin(), v.end(), v32.begin(), v32.end());
+ //
+ // test backward iteration, of 32-16 bit interconversions:
+ //
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
+ v16.assign(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin())));
+#ifndef BOOST_NO_STD_DISTANCE
+ BOOST_CHECK_EQUAL((std::size_t)std::distance(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin()))), v16.size());
+#endif
+ std::reverse(v16.begin(), v16.end());
+ v32.assign(ru16to32type(u16to32type(v16.end(), v16.begin(), v16.end())), ru16to32type(u16to32type(v16.begin(), v16.begin(), v16.end())));
+#ifndef BOOST_NO_STD_DISTANCE
+ BOOST_CHECK_EQUAL((std::size_t)std::distance(ru16to32type(u16to32type(v16.end(), v16.begin(), v16.end())), ru16to32type(u16to32type(v16.begin(), v16.begin(), v16.end()))), v32.size());
+#endif
+ BOOST_CHECK_EQUAL(v.size(), v32.size());
+ std::reverse(v32.begin(), v32.end());
+ i = v.begin();
+ j = i;
+ std::advance(j, (std::min)(v.size(), v32.size()));
+ k = v32.begin();
+ BOOST_CHECK_EQUAL_COLLECTIONS(v.begin(), v.end(), v32.begin(), v32.end());
+#endif
+#endif // TEST_UTF16
+
+#ifdef TEST_UTF8
+ //
+ // Test forward iteration, of 32-8 bit interconversions:
+ //
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
+ v8.assign(u32to8type(v.begin()), u32to8type(v.end()));
+#else
+ v8.clear();
+ std::copy(u32to8type(v.begin()), u32to8type(v.end()), std::back_inserter(v8));
+#endif
+#ifndef BOOST_NO_STD_DISTANCE
+ BOOST_CHECK_EQUAL((std::size_t)std::distance(u32to8type(v.begin()), u32to8type(v.end())), v8.size());
+#endif
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
+ v32.assign(u8to32type(v8.begin(), v8.begin(), v8.end()), u8to32type(v8.end(), v8.begin(), v8.end()));
+#else
+ v32.clear();
+ std::copy(u8to32type(v8.begin(), v8.begin(), v8.end()), u8to32type(v8.end(), v8.begin(), v8.end()), std::back_inserter(v32));
+#endif
+#ifndef BOOST_NO_STD_DISTANCE
+ BOOST_CHECK_EQUAL((std::size_t)std::distance(u8to32type(v8.begin(), v8.begin(), v8.end()), u8to32type(v8.end(), v8.begin(), v8.end())), v32.size());
+#endif
+ BOOST_CHECK_EQUAL(v.size(), v32.size());
+ i = v.begin();
+ j = i;
+ std::advance(j, (std::min)(v.size(), v32.size()));
+ k = v32.begin();
+ BOOST_CHECK_EQUAL_COLLECTIONS(v.begin(), v.end(), v32.begin(), v32.end());
+ //
+ // test backward iteration, of 32-8 bit interconversions:
+ //
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
+ v8.assign(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin())));
+#ifndef BOOST_NO_STD_DISTANCE
+ BOOST_CHECK_EQUAL((std::size_t)std::distance(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin()))), v8.size());
+#endif
+ std::reverse(v8.begin(), v8.end());
+ v32.assign(ru8to32type(u8to32type(v8.end(), v8.begin(), v8.end())), ru8to32type(u8to32type(v8.begin(), v8.begin(), v8.end())));
+#ifndef BOOST_NO_STD_DISTANCE
+ BOOST_CHECK_EQUAL((std::size_t)std::distance(ru8to32type(u8to32type(v8.end(), v8.begin(), v8.end())), ru8to32type(u8to32type(v8.begin(), v8.begin(), v8.end()))), v32.size());
+#endif
+ BOOST_CHECK_EQUAL(v.size(), v32.size());
+ std::reverse(v32.begin(), v32.end());
+ i = v.begin();
+ j = i;
+ std::advance(j, (std::min)(v.size(), v32.size()));
+ k = v32.begin();
+ BOOST_CHECK_EQUAL_COLLECTIONS(v.begin(), v.end(), v32.begin(), v32.end());
+#endif
+#endif // TEST_UTF8
+ //
+ // Test checked construction of UTF-8/16 iterators at each location in the sequences:
+ //
+#ifdef TEST_UTF8
+ for(u8to32type v8p(v8.begin(), v8.begin(), v8.end()), v8e(v8.end(), v8.begin(), v8.end()); v8p != v8e; ++v8p)
+ {
+ u8to32type pos(v8p.base(), v8p.base(), v8.end());
+ BOOST_CHECK(pos == v8p);
+ BOOST_CHECK(*pos == *v8p);
+ }
+#endif
+#ifdef TEST_UTF16
+ for(u16to32type v16p(v16.begin(), v16.begin(), v16.end()), v16e(v16.end(), v16.begin(), v16.end()); v16p != v16e; ++v16p)
+ {
+ u16to32type pos(v16p.base(), v16p.base(), v16.end());
+ BOOST_CHECK(pos == v16p);
+ BOOST_CHECK(*pos == *v16p);
+ }
+#endif
+}
+
+int cpp_main( int, char* [] )
+{
+ // test specific value points from the standard:
+ spot_checks();
+ // now test a bunch of values for self-consistency and round-tripping:
+ std::vector< ::boost::uint32_t> v;
+ for(unsigned i = 0; i < 0xD800; ++i)
+ v.push_back(i);
+ for(unsigned i = 0xDFFF + 1; i < 0x10FFFF; ++i)
+ v.push_back(i);
+ test(v);
+ return 0;
+}
+
diff --git a/src/boost/libs/regex/tools/generate/tables.cpp b/src/boost/libs/regex/tools/generate/tables.cpp
new file mode 100644
index 000000000..dae31de0c
--- /dev/null
+++ b/src/boost/libs/regex/tools/generate/tables.cpp
@@ -0,0 +1,217 @@
+/*
+ *
+ * Copyright (c) 2004
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE tables.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Generates code snippets programatically, for cut-and
+ * paste into regex source.
+ */
+
+#include <boost/config.hpp>
+#include <map>
+#include <vector>
+#include <string>
+#include <iostream>
+#include <algorithm>
+#include <cctype>
+
+std::string g_char_type;
+std::string g_data_type;
+std::map<std::string, std::string> g_table;
+std::map<std::string, std::pair<std::string, std::string> > g_help_table;
+
+void add(std::string key, std::string data)
+{
+ g_table[key] = data;
+ if(key.size() <= 2)
+ g_help_table[data].first = key;
+ else
+ g_help_table[data].second = key;
+
+ std::string::size_type i = 0;
+ while(i < key.size())
+ {
+ if(std::isspace(key[i]) || (key[i] == '-') || (key[i] == '_'))
+ key.erase(i, 1);
+ else
+ {
+ key[i] = std::tolower(key[i]);
+ ++i;
+ }
+ }
+}
+
+#define ADD(x, y) add(BOOST_STRINGIZE(x), BOOST_STRINGIZE(y))
+
+void generate_code()
+{
+ std::map<std::string, std::string>::const_iterator i, j;
+
+ // begin with the character tables:
+ std::cout << "static const " << g_char_type << " prop_name_table[] = {\n";
+ for(i = g_table.begin(), j = g_table.end(); i != j; ++i)
+ {
+ std::cout << " /* " << i->first << " */ ";
+ for(std::string::size_type n = 0; n < i->first.size(); ++n)
+ {
+ std::cout.put('\'');
+ std::cout.put((i->first)[n]);
+ std::cout.put('\'');
+ std::cout.put(',');
+ std::cout.put(' ');
+ }
+ std::cout << std::endl;;
+ }
+ std::cout << "};\n\n";
+
+ // now the iterator table:
+ std::cout << "static const BOOST_REGEX_DETAIL_NS::character_pointer_range<" << g_char_type << "> range_data[] = {\n";
+ std::size_t index = 0;
+ for(i = g_table.begin(), j = g_table.end(); i != j; ++i)
+ {
+ std::cout << " { prop_name_table+" << index << ", prop_name_table+";
+ index += i->first.size();
+ std::cout << index << ", }, // " << i->first << std::endl;
+ }
+ std::cout << "};\n\n";
+
+ // now the value table:
+ std::cout << "static const " << g_data_type << " icu_class_map[] = {\n";
+ for(i = g_table.begin(), j = g_table.end(); i != j; ++i)
+ {
+ std::cout << " " << i->second << ", // " << i->first << std::endl;
+ }
+ std::cout << "};\n\n" << std::flush;
+ g_table.clear();
+}
+
+void generate_html()
+{
+ // start by producing a sorted list:
+ std::vector<std::pair<std::string, std::string> > v;
+ std::map<std::string, std::pair<std::string, std::string> >::const_iterator i, j;
+ i = g_help_table.begin();
+ j = g_help_table.end();
+ while(i != j)
+ {
+ v.push_back(i->second);
+ ++i;
+ }
+ std::sort(v.begin(), v.end());
+
+ std::vector<std::pair<std::string, std::string> >::const_iterator h, k;
+ h = v.begin();
+ k = v.end();
+
+ std::cout << "<table width=\"100%\"><tr><td><b>Short Name</b></td><td><b>Long Name</b></td></tr>\n";
+ while(h != k)
+ {
+ std::cout << "<tr><td>" << (h->first.size() ? h->first : std::string(" ")) << "</td><td>" << h->second << "</td></tr>\n";
+ ++h;
+ }
+ std::cout << "</table>\n\n";
+}
+
+int main()
+{
+ g_char_type = "::UChar32";
+ g_data_type = "icu_regex_traits::char_class_type";
+ ADD(L*, U_GC_L_MASK);
+ ADD(Letter, U_GC_L_MASK);
+ ADD(Lu, U_GC_LU_MASK);
+ ADD(Ll, U_GC_LL_MASK);
+ ADD(Lt, U_GC_LT_MASK);
+ ADD(Lm, U_GC_LM_MASK);
+ ADD(Lo, U_GC_LO_MASK);
+ ADD(Uppercase Letter, U_GC_LU_MASK);
+ ADD(Lowercase Letter, U_GC_LL_MASK);
+ ADD(Titlecase Letter, U_GC_LT_MASK);
+ ADD(Modifier Letter, U_GC_LM_MASK);
+ ADD(Other Letter, U_GC_LO_MASK);
+
+ ADD(M*, U_GC_M_MASK);
+ ADD(Mn, U_GC_MN_MASK);
+ ADD(Mc, U_GC_MC_MASK);
+ ADD(Me, U_GC_ME_MASK);
+ ADD(Mark, U_GC_M_MASK);
+ ADD(Non-Spacing Mark, U_GC_MN_MASK);
+ ADD(Spacing Combining Mark, U_GC_MC_MASK);
+ ADD(Enclosing Mark, U_GC_ME_MASK);
+
+ ADD(N*, U_GC_N_MASK);
+ ADD(Nd, U_GC_ND_MASK);
+ ADD(Nl, U_GC_NL_MASK);
+ ADD(No, U_GC_NO_MASK);
+ ADD(Number, U_GC_N_MASK);
+ ADD(Decimal Digit Number, U_GC_ND_MASK);
+ ADD(Letter Number, U_GC_NL_MASK);
+ ADD(Other Number, U_GC_NO_MASK);
+
+ ADD(S*, U_GC_S_MASK);
+ ADD(Sm, U_GC_SM_MASK);
+ ADD(Sc, U_GC_SC_MASK);
+ ADD(Sk, U_GC_SK_MASK);
+ ADD(So, U_GC_SO_MASK);
+ ADD(Symbol, U_GC_S_MASK);
+ ADD(Math Symbol, U_GC_SM_MASK);
+ ADD(Currency Symbol, U_GC_SC_MASK);
+ ADD(Modifier Symbol, U_GC_SK_MASK);
+ ADD(Other Symbol, U_GC_SO_MASK);
+
+ ADD(P*, U_GC_P_MASK);
+ ADD(Pc, U_GC_PC_MASK);
+ ADD(Pd, U_GC_PD_MASK);
+ ADD(Ps, U_GC_PS_MASK);
+ ADD(Pe, U_GC_PE_MASK);
+ ADD(Pi, U_GC_PI_MASK);
+ ADD(Pf, U_GC_PF_MASK);
+ ADD(Po, U_GC_PO_MASK);
+ ADD(Punctuation, U_GC_P_MASK);
+ ADD(Connector Punctuation, U_GC_PC_MASK);
+ ADD(Dash Punctuation, U_GC_PD_MASK);
+ ADD(Open Punctuation, U_GC_PS_MASK);
+ ADD(Close Punctuation, U_GC_PE_MASK);
+ ADD(Initial Punctuation, U_GC_PI_MASK);
+ ADD(Final Punctuation, U_GC_PF_MASK);
+ ADD(Other Punctuation, U_GC_PO_MASK);
+
+ ADD(Z*, U_GC_Z_MASK);
+ ADD(Zs, U_GC_ZS_MASK);
+ ADD(Zl, U_GC_ZL_MASK);
+ ADD(Zp, U_GC_ZP_MASK);
+ ADD(Separator, U_GC_Z_MASK);
+ ADD(Space Separator, U_GC_ZS_MASK);
+ ADD(Line Separator, U_GC_ZL_MASK);
+ ADD(Paragraph Separator, U_GC_ZP_MASK);
+
+ ADD(C*, U_GC_C_MASK);
+ ADD(Cc, U_GC_CC_MASK);
+ ADD(Cf, U_GC_CF_MASK);
+ ADD(Cs, U_GC_CS_MASK);
+ ADD(Co, U_GC_CO_MASK);
+ ADD(Cn, U_GC_CN_MASK);
+ ADD(Other, U_GC_C_MASK);
+ ADD(Control, U_GC_CC_MASK);
+ ADD(Format, U_GC_CF_MASK);
+ ADD(Surrogate, U_GC_CS_MASK);
+ ADD(Private Use, U_GC_CO_MASK);
+ ADD(Not Assigned, U_GC_CN_MASK);
+ ADD(Any, icu_regex_traits::mask_any);
+ ADD(Assigned, (0x3FFFFFFFu) & ~(U_GC_CN_MASK));
+ ADD(ASCII, icu_regex_traits::mask_ascii);
+ ADD(Titlecase, U_GC_LT_MASK);
+
+ generate_code();
+ generate_html();
+ return 0;
+}