summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/xpressive
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/xpressive
parentInitial commit. (diff)
downloadceph-6d07fdb6bb33b1af39833b850bb6cf8af79fe293.tar.xz
ceph-6d07fdb6bb33b1af39833b850bb6cf8af79fe293.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/xpressive')
-rw-r--r--src/boost/libs/xpressive/example/Jamfile.v224
-rw-r--r--src/boost/libs/xpressive/example/example.vcproj738
-rw-r--r--src/boost/libs/xpressive/example/main.cpp257
-rw-r--r--src/boost/libs/xpressive/example/numbers.cpp167
-rw-r--r--src/boost/libs/xpressive/index.html15
-rw-r--r--src/boost/libs/xpressive/meta/libraries.json14
-rw-r--r--src/boost/libs/xpressive/perf/Jamfile.v244
-rw-r--r--src/boost/libs/xpressive/perf/command_line.cpp261
-rw-r--r--src/boost/libs/xpressive/perf/gcc/long_twain_search.xml37
-rw-r--r--src/boost/libs/xpressive/perf/gcc/short_matches.xml57
-rw-r--r--src/boost/libs/xpressive/perf/gcc/short_twain_search.xml7
-rw-r--r--src/boost/libs/xpressive/perf/main.cpp193
-rw-r--r--src/boost/libs/xpressive/perf/msvc/long_twain_search.xml37
-rw-r--r--src/boost/libs/xpressive/perf/msvc/short_matches.xml57
-rw-r--r--src/boost/libs/xpressive/perf/msvc/short_twain_search.xml7
-rw-r--r--src/boost/libs/xpressive/perf/regex_comparison.hpp139
-rw-r--r--src/boost/libs/xpressive/perf/time_boost.cpp105
-rw-r--r--src/boost/libs/xpressive/perf/time_dynamic_xpressive.cpp105
-rw-r--r--src/boost/libs/xpressive/perf/time_static_xpressive.cpp224
-rw-r--r--src/boost/libs/xpressive/test/Jamfile.v284
-rw-r--r--src/boost/libs/xpressive/test/c_traits.cpp16
-rw-r--r--src/boost/libs/xpressive/test/c_traits_u.cpp17
-rw-r--r--src/boost/libs/xpressive/test/misc1.cpp252
-rw-r--r--src/boost/libs/xpressive/test/misc2.cpp91
-rw-r--r--src/boost/libs/xpressive/test/multiple_defs1.cpp16
-rw-r--r--src/boost/libs/xpressive/test/multiple_defs2.cpp17
-rw-r--r--src/boost/libs/xpressive/test/regress.cpp14
-rw-r--r--src/boost/libs/xpressive/test/regress.ipp451
-rw-r--r--src/boost/libs/xpressive/test/regress.txt3756
-rw-r--r--src/boost/libs/xpressive/test/regress_u.cpp15
-rw-r--r--src/boost/libs/xpressive/test/test.hpp184
-rw-r--r--src/boost/libs/xpressive/test/test1.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test1.hpp139
-rw-r--r--src/boost/libs/xpressive/test/test10.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test10.hpp65
-rw-r--r--src/boost/libs/xpressive/test/test10u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test11.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test11.hpp83
-rw-r--r--src/boost/libs/xpressive/test/test11u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test1u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test2.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test2.hpp173
-rw-r--r--src/boost/libs/xpressive/test/test2u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test3.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test3.hpp196
-rw-r--r--src/boost/libs/xpressive/test/test3u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test4.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test4.hpp109
-rw-r--r--src/boost/libs/xpressive/test/test4u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test5.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test5.hpp159
-rw-r--r--src/boost/libs/xpressive/test/test5u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test6.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test6.hpp124
-rw-r--r--src/boost/libs/xpressive/test/test6u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test7.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test7.hpp124
-rw-r--r--src/boost/libs/xpressive/test/test7u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test8.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test8.hpp96
-rw-r--r--src/boost/libs/xpressive/test/test8u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test9.cpp29
-rw-r--r--src/boost/libs/xpressive/test/test9.hpp110
-rw-r--r--src/boost/libs/xpressive/test/test9u.cpp31
-rw-r--r--src/boost/libs/xpressive/test/test_actions.cpp287
-rw-r--r--src/boost/libs/xpressive/test/test_assert.cpp94
-rw-r--r--src/boost/libs/xpressive/test/test_assert_with_placeholder.cpp76
-rw-r--r--src/boost/libs/xpressive/test/test_basic_regex.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_cycles.cpp236
-rw-r--r--src/boost/libs/xpressive/test/test_dynamic.cpp38
-rw-r--r--src/boost/libs/xpressive/test/test_dynamic_grammar.cpp107
-rw-r--r--src/boost/libs/xpressive/test/test_format.cpp133
-rw-r--r--src/boost/libs/xpressive/test/test_match_results.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_non_char.cpp101
-rw-r--r--src/boost/libs/xpressive/test/test_partial_match.cpp21
-rw-r--r--src/boost/libs/xpressive/test/test_regex_algorithms.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_regex_compiler.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_regex_constants.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_regex_error.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_regex_iterator.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_regex_primitives.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_regex_token_iterator.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_regex_traits.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_skip.cpp96
-rw-r--r--src/boost/libs/xpressive/test/test_static.cpp38
-rw-r--r--src/boost/libs/xpressive/test/test_sub_match.cpp9
-rw-r--r--src/boost/libs/xpressive/test/test_symbols.cpp354
-rw-r--r--src/boost/libs/xpressive/test/test_typeof.cpp235
-rw-r--r--src/boost/libs/xpressive/test/test_typeof2.cpp178
-rw-r--r--src/boost/libs/xpressive/tools/Jamfile.v221
-rw-r--r--src/boost/libs/xpressive/tools/perl2xpr.cpp188
91 files changed, 11741 insertions, 0 deletions
diff --git a/src/boost/libs/xpressive/example/Jamfile.v2 b/src/boost/libs/xpressive/example/Jamfile.v2
new file mode 100644
index 000000000..ab9cd5d27
--- /dev/null
+++ b/src/boost/libs/xpressive/example/Jamfile.v2
@@ -0,0 +1,24 @@
+# (C) Copyright 2004: Eric Niebler
+# 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
+ <toolset>msvc-8.0:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>msvc-9.0:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>msvc,<stdlib>stlport:<define>_STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+ ;
+
+exe examples
+ :
+ main.cpp
+ :
+ <include>$(BOOST_ROOT)
+ ;
+
+exe numbers
+ :
+ numbers.cpp
+ :
+ <include>$(BOOST_ROOT)
+ ;
diff --git a/src/boost/libs/xpressive/example/example.vcproj b/src/boost/libs/xpressive/example/example.vcproj
new file mode 100644
index 000000000..0e54599d6
--- /dev/null
+++ b/src/boost/libs/xpressive/example/example.vcproj
@@ -0,0 +1,738 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="example-vc9"
+ ProjectGUID="{5B83CA94-A2A6-43A6-8363-E5F4731443F7}"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/EHa"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="false"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ DisableLanguageExtensions="false"
+ TreatWChar_tAsBuiltInType="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/example.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)/example.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/example.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\main.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd;ipp"
+ >
+ </Filter>
+ <Filter
+ Name="xpressive Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd;ipp"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\basic_regex.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\match_results.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\regex_actions.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\regex_algorithms.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\regex_compiler.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\regex_constants.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\regex_error.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\regex_iterator.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\regex_primitives.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\regex_token_iterator.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\regex_traits.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\sub_match.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\xpressive.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\xpressive_dynamic.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\xpressive_fwd.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\xpressive_static.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\xpressive_typeof.hpp"
+ >
+ </File>
+ <Filter
+ Name="detail"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\detail_fwd.hpp"
+ >
+ </File>
+ <Filter
+ Name="core"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\access.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\action.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\adaptor.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\finder.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\flow_control.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\icase.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\linker.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\list.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matchers.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\optimize.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\peeker.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\quant_style.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\regex_impl.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\results_cache.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\state.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\sub_match_impl.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\sub_match_vector.hpp"
+ >
+ </File>
+ <Filter
+ Name="matcher"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\action_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\alternate_end_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\alternate_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\any_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\assert_bol_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\assert_bos_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\assert_eol_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\assert_eos_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\assert_line_base.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\assert_word_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\attr_begin_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\attr_end_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\attr_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\charset_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\end_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\epsilon_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\keeper_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\literal_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\logical_newline_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\lookahead_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\lookbehind_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\mark_begin_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\mark_end_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\mark_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\optional_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\posix_charset_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\predicate_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\range_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\regex_byref_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\regex_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\repeat_begin_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\repeat_end_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\set_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\simple_repeat_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\string_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\core\matcher\true_matcher.hpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="static"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\compile.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\grammar.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\is_pure.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\modifier.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\placeholders.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\static.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transmogrify.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\type_traits.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\visitor.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\width_of.hpp"
+ >
+ </File>
+ <Filter
+ Name="transforms"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_action.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_alternate.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_independent.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_inverse.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_marker.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_matcher.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_modifier.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_quantifier.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_sequence.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\static\transforms\as_set.hpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="utility"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\algorithm.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\any.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\boyer_moore.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\cons.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\counted_base.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\dont_care.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\hash_peek_bitset.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\ignore_unused.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\literals.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\never_true.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\save_restore.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\sequence_stack.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\symbols.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\tracking_ptr.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\traits_utils.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\width.hpp"
+ >
+ </File>
+ <Filter
+ Name="chset"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\chset\basic_chset.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\chset\basic_chset.ipp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\chset\chset.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\chset\range_run.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\utility\chset\range_run.ipp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="dynamic"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\dynamic\dynamic.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\dynamic\matchable.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\dynamic\parse_charset.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\dynamic\parser.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\dynamic\parser_enum.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\dynamic\parser_traits.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\detail\dynamic\sequence.hpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="traits"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\traits\c_regex_traits.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\traits\cpp_regex_traits.hpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\boost\xpressive\traits\null_regex_traits.hpp"
+ >
+ </File>
+ <Filter
+ Name="detail"
+ >
+ <File
+ RelativePath="..\..\..\boost\xpressive\traits\detail\c_ctype.hpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/boost/libs/xpressive/example/main.cpp b/src/boost/libs/xpressive/example/main.cpp
new file mode 100644
index 000000000..8992f0fc2
--- /dev/null
+++ b/src/boost/libs/xpressive/example/main.cpp
@@ -0,0 +1,257 @@
+///////////////////////////////////////////////////////////////////////////////
+// main.hpp
+//
+// Copyright 2004 Eric Niebler. 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)
+
+#include <iostream>
+#include <iomanip>
+#include <boost/xpressive/xpressive.hpp>
+
+using namespace boost::xpressive;
+
+///////////////////////////////////////////////////////////////////////////////
+// Displays nested results to std::cout with indenting
+//
+// Display a tree of nested results
+//
+// Here is a helper class to demonstrate how you might display a tree of nested results:
+struct output_nested_results
+{
+ int tabs_;
+
+ output_nested_results(int tabs = 0)
+ : tabs_(tabs)
+ {
+ }
+
+ template< typename BidiIterT >
+ void operator ()( match_results< BidiIterT > const &what ) const
+ {
+ // first, do some indenting
+ typedef typename std::iterator_traits< BidiIterT >::value_type char_type;
+ char_type space_ch = char_type(' ');
+ std::fill_n( std::ostream_iterator<char_type>( std::cout ), tabs_ * 4, space_ch );
+
+ // output the match
+ std::cout << what[0] << '\n';
+
+ // output any nested matches
+ std::for_each(
+ what.nested_results().begin(),
+ what.nested_results().end(),
+ output_nested_results( tabs_ + 1 ) );
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// See if a whole string matches a regex
+//
+// This program outputs the following:
+//
+// hello world!
+// hello
+// world
+
+void example1()
+{
+ std::string hello( "hello world!" );
+
+ sregex rex = sregex::compile( "(\\w+) (\\w+)!" );
+ smatch what;
+
+ if( regex_match( hello, what, rex ) )
+ {
+ std::cout << what[0] << '\n'; // whole match
+ std::cout << what[1] << '\n'; // first capture
+ std::cout << what[2] << '\n'; // second capture
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// See if a string contains a sub-string that matches a regex
+//
+// Notice in this example how we use custom mark_tags to make the pattern
+// more readable. We can use the mark_tags later to index into the match_results<>.
+//
+// This program outputs the following:
+//
+// 5/30/1973
+// 30
+// 5
+// 1973
+// /
+
+void example2()
+{
+ char const *str = "I was born on 5/30/1973 at 7am.";
+
+ // define some custom mark_tags with names more meaningful than s1, s2, etc.
+ mark_tag day(1), month(2), year(3), delim(4);
+
+ // this regex finds a date
+ cregex date = (month= repeat<1,2>(_d)) // find the month ...
+ >> (delim= (set= '/','-')) // followed by a delimiter ...
+ >> (day= repeat<1,2>(_d)) >> delim // and a day followed by the same delimiter ...
+ >> (year= repeat<1,2>(_d >> _d)); // and the year.
+
+ cmatch what;
+
+ if( regex_search( str, what, date ) )
+ {
+ std::cout << what[0] << '\n'; // whole match
+ std::cout << what[day] << '\n'; // the day
+ std::cout << what[month] << '\n'; // the month
+ std::cout << what[year] << '\n'; // the year
+ std::cout << what[delim] << '\n'; // the delimiter
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Replace all sub-strings that match a regex
+//
+// The following program finds dates in a string and marks them up with pseudo-HTML.
+//
+// This program outputs the following:
+//
+// I was born on <date>5/30/1973</date> at 7am.
+
+void example3()
+{
+ std::string str( "I was born on 5/30/1973 at 7am." );
+
+ // essentially the same regex as in the previous example, but using a dynamic regex
+ sregex date = sregex::compile( "(\\d{1,2})([/-])(\\d{1,2})\\2((?:\\d{2}){1,2})" );
+
+ // As in Perl, $& is a reference to the sub-string that matched the regex
+ std::string format( "<date>$&</date>" );
+
+ str = regex_replace( str, date, format );
+ std::cout << str << '\n';
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Find all the sub-strings that match a regex and step through them one at a time
+//
+// The following program finds the words in a wide-character string. It uses wsregex_iterator.
+// Notice that dereferencing a wsregex_iterator yields a wsmatch object.
+//
+// This program outputs the following:
+//
+// This
+// is
+// his
+// face
+
+void example4()
+{
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ std::wstring str( L"This is his face." );
+
+ // find a whole word
+ wsregex token = +alnum;
+
+ wsregex_iterator cur( str.begin(), str.end(), token );
+ wsregex_iterator end;
+
+ for( ; cur != end; ++cur )
+ {
+ wsmatch const &what = *cur;
+ std::wcout << what[0] << L'\n';
+ }
+ #endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Split a string into tokens that each match a regex
+//
+// The following program finds race times in a string and displays first the minutes
+// and then the seconds. It uses regex_token_iterator<>.
+//
+// This program outputs the following:
+//
+// 4
+// 40
+// 3
+// 35
+// 2
+// 32
+
+void example5()
+{
+ std::string str( "Eric: 4:40, Karl: 3:35, Francesca: 2:32" );
+
+ // find a race time
+ sregex time = sregex::compile( "(\\d):(\\d\\d)" );
+
+ // for each match, the token iterator should first take the value of
+ // the first marked sub-expression followed by the value of the second
+ // marked sub-expression
+ int const subs[] = { 1, 2 };
+
+ sregex_token_iterator cur( str.begin(), str.end(), time, subs );
+ sregex_token_iterator end;
+
+ for( ; cur != end; ++cur )
+ {
+ std::cout << *cur << '\n';
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Split a string using a regex as a delimiter
+//
+// The following program takes some text that has been marked up with html and strips
+// out the mark-up. It uses a regex that matches an HTML tag and a regex_token_iterator<>
+// that returns the parts of the string that do not match the regex.
+//
+// This program outputs the following:
+//
+// {Now }{is the time }{for all good men}{ to come to the aid of their}{ country.}
+
+void example6()
+{
+ std::string str( "Now <bold>is the time <i>for all good men</i> to come to the aid of their</bold> country." );
+
+ // find an HTML tag
+ sregex html = '<' >> optional('/') >> +_w >> '>';
+
+ // the -1 below directs the token iterator to display the parts of
+ // the string that did NOT match the regular expression.
+ sregex_token_iterator cur( str.begin(), str.end(), html, -1 );
+ sregex_token_iterator end;
+
+ for( ; cur != end; ++cur )
+ {
+ std::cout << '{' << *cur << '}';
+ }
+ std::cout << '\n';
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// main
+int main()
+{
+ std::cout << "\n\nExample 1:\n\n";
+ example1();
+
+ std::cout << "\n\nExample 2:\n\n";
+ example2();
+
+ std::cout << "\n\nExample 3:\n\n";
+ example3();
+
+ std::cout << "\n\nExample 4:\n\n";
+ example4();
+
+ std::cout << "\n\nExample 5:\n\n";
+ example5();
+
+ std::cout << "\n\nExample 6:\n\n";
+ example6();
+
+ std::cout << "\n\n" << std::flush;
+
+ return 0;
+}
diff --git a/src/boost/libs/xpressive/example/numbers.cpp b/src/boost/libs/xpressive/example/numbers.cpp
new file mode 100644
index 000000000..4e591bbbe
--- /dev/null
+++ b/src/boost/libs/xpressive/example/numbers.cpp
@@ -0,0 +1,167 @@
+///////////////////////////////////////////////////////////////////////////////
+// numbers.cpp
+//
+// Copyright 2008 David Jenkins. 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)
+
+#if defined(_MSC_VER)
+//disbale warning C4996: 'std::xxx' was declared deprecated
+# pragma warning(disable:4996)
+#endif
+
+#include <iostream>
+#include <string>
+#include <map>
+#include <boost/assign/list_of.hpp> // for 'map_list_of()'
+#include <boost/xpressive/xpressive.hpp>
+#include <boost/xpressive/regex_actions.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// Match all named numbers in a string and return their integer values
+//
+// For example, given the input string:
+// "one two sixty three thousand ninety five eleven"
+// the program will output:
+// "one = 1"
+// "two = 2"
+// "sixty three thousand ninety five = 63095"
+// "eleven = 11"
+
+void example1()
+{
+ using namespace boost::xpressive;
+ using namespace boost::assign;
+
+ // initialize the maps for named numbers
+ std::map< std::string, int > ones_map =
+ map_list_of("one",1)("two",2)("three",3)("four",4)("five",5)
+ ("six",6)("seven",7)("eight",8)("nine",9);
+
+ std::map< std::string, int > teens_map =
+ map_list_of("ten",10)("eleven",11)("twelve",12)("thirteen",13)
+ ("fourteen",14)("fifteen",15)("sixteen",16)("seventeen",17)
+ ("eighteen",18)("nineteen",19);
+
+ std::map< std::string, int > tens_map =
+ map_list_of("twenty",20)("thirty",30)("fourty",40)
+ ("fifty",50)("sixty",60)("seventy",70)("eighty",80)("ninety",90);
+
+ std::map< std::string, int > specials_map =
+ map_list_of("zero",0)("dozen",12)("score",20);
+
+ // n is the integer result
+ local<long> n(0);
+ // temp stores intermediate values
+ local<long> temp(0);
+
+ // initialize the regular expressions for named numbers
+ sregex tens_rx =
+ // use skip directive to skip whitespace between words
+ skip(_s)
+ (
+ ( a3 = teens_map )
+ |
+ ( a2 = tens_map ) >> !( a1 = ones_map )
+ |
+ ( a1 = ones_map )
+ )
+ [ n += (a3|0) + (a2|0) + (a1|0) ];
+
+ sregex hundreds_rx =
+ skip(_s)
+ (
+ tens_rx >>
+ !(
+ as_xpr("hundred") [ n *= 100 ]
+ >> !tens_rx
+ )
+ )
+ ;
+
+ sregex specials_rx = // regex for special number names like dozen
+ skip(_s)
+ (
+ // Note: this uses two attribues, a1 and a2, and it uses
+ // a default attribute value of 1 for a1.
+ ( !( a1 = ones_map ) >> ( a2 = specials_map ) )
+ [ n = (a1|1) * a2 ]
+ >> !( "and" >> tens_rx )
+ )
+ ;
+
+ sregex number_rx =
+ bow
+ >>
+ skip(_s|punct)
+ (
+ specials_rx // special numbers
+ |
+ ( // normal numbers
+ !( hundreds_rx >> "million" ) [ temp += n * 1000000, n = 0 ]
+ >>
+ !( hundreds_rx >> "thousand" ) [ temp += n * 1000, n = 0 ]
+ >>
+ !hundreds_rx
+ )
+ [n += temp, temp = 0 ]
+ );
+
+ // this is the input string
+ std::string str( "one two three eighteen twenty two "
+ "nine hundred ninety nine twelve "
+ "eight hundred sixty three thousand ninety five "
+ "sixty five hundred ten "
+ "two million eight hundred sixty three thousand ninety five "
+ "zero sixty five hundred thousand "
+ "extra stuff "
+ "two dozen "
+ "four score and seven");
+
+ // the MATCHING results of iterating through the string are:
+ // one = 1
+ // two = 2
+ // three = 3
+ // eighteen = 18
+ // twenty two = 22
+ // nine hundred ninety nine = 999
+ // twelve = 12
+ // eight hundred sixty three thousand ninety five = 863095
+ // sixty five hundred ten = 6510
+ // two million eight hundred sixty three thousand ninety five = 2863095
+ // zero = 0
+ // sixty five hundred thousand = 6500000
+ // two dozen = 24
+ // four score and seven = 87
+ sregex_token_iterator cur( str.begin(), str.end(), number_rx );
+ sregex_token_iterator end;
+
+ for( ; cur != end; ++cur )
+ {
+ if ((*cur).length() > 0)
+ std::cout << *cur << " = " << n.get() << '\n';
+ n.get() = 0;
+ }
+ std::cout << '\n';
+ // the NON-MATCHING results of iterating through the string are:
+ // extra = unmatched
+ // stuff = unmatched
+ sregex_token_iterator cur2( str.begin(), str.end(), number_rx, -1 );
+ for( ; cur2 != end; ++cur2 )
+ {
+ if ((*cur2).length() > 0)
+ std::cout << *cur2 << " = unmatched" << '\n';
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// main
+int main()
+{
+ std::cout << "\n\nExample 1:\n\n";
+ example1();
+
+ std::cout << "\n\n" << std::flush;
+
+ return 0;
+}
diff --git a/src/boost/libs/xpressive/index.html b/src/boost/libs/xpressive/index.html
new file mode 100644
index 000000000..6409af22f
--- /dev/null
+++ b/src/boost/libs/xpressive/index.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+<meta http-equiv="refresh" content="0; URL=../../doc/html/xpressive.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="../../doc/html/xpressive.html">../../doc/html/xpressive.html</a>
+<p>Copyright&nbsp;Eric Niebler 2006</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/xpressive/meta/libraries.json b/src/boost/libs/xpressive/meta/libraries.json
new file mode 100644
index 000000000..fdc2b480c
--- /dev/null
+++ b/src/boost/libs/xpressive/meta/libraries.json
@@ -0,0 +1,14 @@
+{
+ "key": "xpressive",
+ "name": "Xpressive",
+ "authors": [
+ "Eric Niebler"
+ ],
+ "description": "Regular expressions that can be written as strings or as expression templates, and which can refer to each other and themselves recursively with the power of context-free grammars.",
+ "category": [
+ "String"
+ ],
+ "maintainers": [
+ "Eric Niebler <eric -at- boostpro.com>"
+ ]
+}
diff --git a/src/boost/libs/xpressive/perf/Jamfile.v2 b/src/boost/libs/xpressive/perf/Jamfile.v2
new file mode 100644
index 000000000..7769420e4
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/Jamfile.v2
@@ -0,0 +1,44 @@
+# Copyright Eric Niebler 2006
+
+# Use, modification, and distribution is 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)
+
+#project
+# : requirements <library>../../../../boost/libs/regex/build//boost_regex
+# ;
+
+BOOST_REGEX_SOURCES =
+ c_regex_traits
+ cpp_regex_traits
+ cregex
+ fileiter
+ icu
+ instances
+ posix_api
+ regex
+ regex_debug
+ regex_raw_buffer
+ regex_traits_defaults
+ static_mutex
+ w32_regex_traits
+ wc_regex_traits
+ wide_posix_api
+ winstances
+ usinstances ;
+
+exe xprperf
+ :
+ command_line.cpp
+ main.cpp
+ time_boost.cpp
+ time_dynamic_xpressive.cpp
+ time_static_xpressive.cpp
+ $(BOOST_ROOT)/libs/regex/src/$(BOOST_REGEX_SOURCES).cpp
+ :
+ <include>$(BOOST_ROOT)
+ <define>BOOST_REGEX_NO_LIB=1
+ <define>BOOST_REGEX_RECURSIVE
+ <define>BOOST_REGEX_USE_CPP_LOCALE
+ <define>BOOST_XPRESSIVE_USE_CPP_TRAITS
+ ;
diff --git a/src/boost/libs/xpressive/perf/command_line.cpp b/src/boost/libs/xpressive/perf/command_line.cpp
new file mode 100644
index 000000000..1c77805d3
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/command_line.cpp
@@ -0,0 +1,261 @@
+// (C) Copyright Eric Niebler 2006.
+// 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)
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <deque>
+#include <sstream>
+#include <stdexcept>
+#include <iterator>
+#include "./regex_comparison.hpp"
+
+//
+// globals:
+//
+bool time_boost = false;
+bool time_greta = false;
+bool time_safe_greta = false;
+bool time_dynamic_xpressive = false;
+bool time_static_xpressive = false;
+//bool time_posix = false;
+//bool time_pcre = false;
+
+bool test_matches = false;
+bool test_short_twain = false;
+bool test_long_twain = false;
+
+std::string xml_out_file;
+std::string xml_contents;
+std::list<results> result_list;
+
+int handle_argument(const std::string& what)
+{
+ if(what == "-b")
+ time_boost = true;
+ else if(what == "-g")
+ time_greta = true;
+ else if(what == "-gs")
+ time_safe_greta = true;
+ else if(what == "-dx")
+ time_dynamic_xpressive = true;
+ else if(what == "-sx")
+ time_static_xpressive = true;
+ //else if(what == "-posix")
+ // time_posix = true;
+ //else if(what == "-pcre")
+ // time_pcre = true;
+ else if(what == "-all")
+ {
+ time_boost = true;
+ time_greta = true;
+ time_safe_greta = true;
+ time_dynamic_xpressive = true;
+ time_static_xpressive = true;
+ //time_posix = true;
+ //time_pcre = true;
+ }
+ else if(what == "-test-matches")
+ test_matches = true;
+ else if(what == "-test-short-twain")
+ test_short_twain = true;
+ else if(what == "-test-long-twain")
+ test_long_twain = true;
+ else if(what == "-test-all")
+ {
+ test_matches = true;
+ test_short_twain = true;
+ test_long_twain = true;
+ }
+ else if((what == "-h") || (what == "--help"))
+ return show_usage();
+ else if((what[0] == '-') || (what[0] == '/'))
+ {
+ std::cerr << "Unknown argument: \"" << what << "\"" << std::endl;
+ return 1;
+ }
+ else if(xml_out_file.size() == 0)
+ {
+ xml_out_file = what;
+ }
+ else
+ {
+ std::cerr << "Unexpected argument: \"" << what << "\"" << std::endl;
+ return 1;
+ }
+ return 0;
+}
+
+int show_usage()
+{
+ std::cout <<
+ "Usage\n"
+ "xprperf [-h] [library options] [test options] [xml_output_file]\n"
+ " -h Show help\n\n"
+ " library options:\n"
+ " -b Apply tests to boost library\n"
+ //" -ba Apply tests to boost library with a custom allocator\n"
+ //" -be Apply tests to experimental boost library\n"
+ //" -g Apply tests to GRETA library\n"
+ //" -gs Apply tests to GRETA library (in non-recursive mode)\n"
+ " -dx Apply tests to dynamic xpressive library\n"
+ " -sx Apply tests to static xpressive library\n"
+ //" -posix Apply tests to POSIX library\n"
+ //" -pcre Apply tests to PCRE library\n"
+ " -all Apply tests to all libraries\n\n"
+ " test options:\n"
+ " -test-matches Test short matches\n"
+ " -test-short-twain Test short searches\n"
+ " -test-long-twain Test long searches\n"
+ " -test-all Test everthing\n";
+ return 1;
+}
+
+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);
+ }
+ std::istreambuf_iterator<char> it(is);
+ std::copy(it, std::istreambuf_iterator<char>(), std::back_inserter(temp_copy));
+ text.erase();
+ text.reserve(temp_copy.size());
+ text.append(temp_copy.begin(), temp_copy.end());
+}
+
+struct xml_double
+{
+ double d_;
+ xml_double( double d ) : d_(d) {}
+ friend std::ostream & operator<<( std::ostream & out, xml_double const & xd )
+ {
+ std::ostringstream tmp;
+ tmp << std::setprecision(out.precision()) << xd.d_;
+ std::string str = tmp.str();
+ std::string::size_type i = str.find( '-' );
+ if( i != std::string::npos )
+ str.replace( i, 1, "&#8209;" );
+ return out << str;
+ }
+};
+
+void print_result(std::ostream& os, double time, double best)
+{
+ static const char* suffixes[] = {"s", "ms", "us", "ns", "ps", };
+
+ if(time < 0)
+ {
+ os << "<entry>NA</entry>";
+ return;
+ }
+ double rel = time / best;
+ bool highlight = ((rel > 0) && (rel < 1.1));
+ unsigned suffix = 0;
+ while(time < 0)
+ {
+ time *= 1000;
+ ++suffix;
+ }
+ os << "<entry>";
+ if(highlight)
+ os << "<phrase role=\"highlight\">";
+ if(rel <= 1000)
+ os << std::setprecision(3) << xml_double(rel);
+ else
+ os << (int)rel;
+ os << "<para/>(";
+ if(time <= 1000)
+ os << std::setprecision(3) << xml_double(time);
+ else
+ os << (int)time;
+ os << suffixes[suffix] << ")";
+ if(highlight)
+ os << "</phrase>";
+ os << "</entry>";
+}
+
+void output_xml_results(bool show_description, const std::string& title, const std::string& filename)
+{
+ std::stringstream os;
+ // Generate the copyright and license on the output file
+ os << "<!--\n"
+ " Copyright 2004 Eric Niebler.\n"
+ "\n"
+ " Distributed under the Boost Software License, Version 1.0.\n"
+ " (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n"
+ "-->\n";
+
+ if(result_list.size())
+ {
+ // calculate the number of columns in this table
+ int num_cols = 1 + show_description + time_greta + time_safe_greta
+ + time_dynamic_xpressive + time_static_xpressive + time_boost;
+
+ //
+ // start by outputting the table header:
+ //
+ os << "<informaltable frame=\"all\">\n";
+ os << "<bridgehead renderas=\"sect4\">"
+ "<phrase role=\"table-title\">" << title << "</phrase>"
+ "</bridgehead>\n";
+ os << "<tgroup cols=\"" << num_cols << "\">\n";
+ os << "<thead>\n";
+ os << "<row>\n";
+
+ if(time_static_xpressive) os << "<entry>static xpressive</entry>";
+ if(time_dynamic_xpressive) os << "<entry>dynamic xpressive</entry>";
+ if(time_greta) os << "<entry>GRETA</entry>";
+ if(time_safe_greta) os << "<entry>GRETA<para/>(non-recursive mode)</entry>";
+ if(time_boost) os << "<entry>Boost</entry>";
+ //if(time_posix) os << "<entry>POSIX</entry>";
+ //if(time_pcre) os << "<entry>PCRE</entry>";
+ if(show_description) os << "<entry>Text</entry>";
+ os << "<entry>Expression</entry>";
+ os << "\n</row>\n";
+ os << "</thead>\n";
+ os << "<tbody>\n";
+
+ //
+ // Now enumerate through all the test results:
+ //
+ std::list<results>::const_iterator first, last;
+ first = result_list.begin();
+ last = result_list.end();
+ while(first != last)
+ {
+ os << "<row>\n";
+ if(time_static_xpressive) print_result(os, first->static_xpressive_time, first->factor);
+ if(time_dynamic_xpressive) print_result(os, first->dynamic_xpressive_time, first->factor);
+ if(time_greta) print_result(os, first->greta_time, first->factor);
+ if(time_safe_greta) print_result(os, first->safe_greta_time, first->factor);
+ if(time_boost) print_result(os, first->boost_time, first->factor);
+ //if(time_posix) print_result(os, first->posix_time, first->factor);
+ //if(time_pcre) print_result(os, first->pcre_time, first->factor);
+ if(show_description) os << "<entry>" << first->description << "</entry>";
+ os << "<entry><literal>" << first->expression << "</literal></entry>";
+ os << "\n</row>\n";
+ ++first;
+ }
+
+ os << "</tbody>\n"
+ "</tgroup>\n"
+ "</informaltable>\n";
+
+ result_list.clear();
+ }
+ else
+ {
+ os << "<para><emphasis>Results not available...</emphasis></para>\n";
+ }
+
+ std::ofstream file(filename.c_str());
+ file << os.str();
+}
diff --git a/src/boost/libs/xpressive/perf/gcc/long_twain_search.xml b/src/boost/libs/xpressive/perf/gcc/long_twain_search.xml
new file mode 100644
index 000000000..71efa3da9
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/gcc/long_twain_search.xml
@@ -0,0 +1,37 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ 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)
+-->
+<informaltable frame="all">
+<bridgehead renderas="sect4"><phrase role="table-title">Long Searches</phrase></bridgehead>
+<tgroup cols="4">
+<thead>
+<row>
+<entry>static xpressive</entry><entry>dynamic xpressive</entry><entry>Boost</entry><entry>Expression</entry>
+</row>
+</thead>
+<tbody>
+<row>
+<entry><phrase role="highlight">1<para/>(0.0263s)</phrase></entry><entry><phrase role="highlight">1<para/>(0.0263s)</phrase></entry><entry>1.78<para/>(0.0469s)</entry><entry><literal>Twain</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(0.0234s)</phrase></entry><entry><phrase role="highlight">1<para/>(0.0234s)</phrase></entry><entry>1.79<para/>(0.042s)</entry><entry><literal>Huck[[:alpha:]]+</literal></entry>
+</row>
+<row>
+<entry>1.84<para/>(1.26s)</entry><entry>2.21<para/>(1.51s)</entry><entry><phrase role="highlight">1<para/>(0.687s)</phrase></entry><entry><literal>[[:alpha:]]+ing</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.09<para/>(0.192s)</phrase></entry><entry>2<para/>(0.351s)</entry><entry><phrase role="highlight">1<para/>(0.176s)</phrase></entry><entry><literal>^[^
+]*?Twain</literal></entry>
+</row>
+<row>
+<entry>1.41<para/>(0.08s)</entry><entry>1.21<para/>(0.0684s)</entry><entry><phrase role="highlight">1<para/>(0.0566s)</phrase></entry><entry><literal>Tom|Sawyer|Huckleberry|Finn</literal></entry>
+</row>
+<row>
+<entry>1.56<para/>(0.195s)</entry><entry>1.12<para/>(0.141s)</entry><entry><phrase role="highlight">1<para/>(0.125s)</phrase></entry><entry><literal>(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)</literal></entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
diff --git a/src/boost/libs/xpressive/perf/gcc/short_matches.xml b/src/boost/libs/xpressive/perf/gcc/short_matches.xml
new file mode 100644
index 000000000..ee84e61a2
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/gcc/short_matches.xml
@@ -0,0 +1,57 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ 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)
+-->
+<informaltable frame="all">
+<bridgehead renderas="sect4"><phrase role="table-title">Short Matches</phrase></bridgehead>
+<tgroup cols="5">
+<thead>
+<row>
+<entry>static xpressive</entry><entry>dynamic xpressive</entry><entry>Boost</entry><entry>Text</entry><entry>Expression</entry>
+</row>
+</thead>
+<tbody>
+<row>
+<entry><phrase role="highlight">1<para/>(8.79e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1.08<para/>(9.54e&#8209;07s)</phrase></entry><entry>2.51<para/>(2.2e&#8209;06s)</entry><entry>100- this is a line of ftp response which contains a message string</entry><entry><literal>^([0-9]+)(\-| |$)(.*)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.06<para/>(1.07e&#8209;06s)</phrase></entry><entry><phrase role="highlight">1<para/>(1.01e&#8209;06s)</phrase></entry><entry>4.01<para/>(4.06e&#8209;06s)</entry><entry>1234-5678-1234-456</entry><entry><literal>([[:digit:]]{4}[- ]){3}[[:digit:]]{3,4}</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(1.4e&#8209;06s)</phrase></entry><entry>1.13<para/>(1.58e&#8209;06s)</entry><entry>2.89<para/>(4.05e&#8209;06s)</entry><entry>john_maddock@compuserve.com</entry><entry><literal>^([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})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(1.28e&#8209;06s)</phrase></entry><entry>1.16<para/>(1.49e&#8209;06s)</entry><entry>3.07<para/>(3.94e&#8209;06s)</entry><entry>foo12@foo.edu</entry><entry><literal>^([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})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(1.22e&#8209;06s)</phrase></entry><entry>1.2<para/>(1.46e&#8209;06s)</entry><entry>3.22<para/>(3.93e&#8209;06s)</entry><entry>bob.smith@foo.tv</entry><entry><literal>^([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})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.04<para/>(8.64e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1<para/>(8.34e&#8209;07s)</phrase></entry><entry>2.5<para/>(2.09e&#8209;06s)</entry><entry>EH10 2QQ</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry>1.11<para/>(9.09e&#8209;07s)</entry><entry><phrase role="highlight">1<para/>(8.19e&#8209;07s)</phrase></entry><entry>2.47<para/>(2.03e&#8209;06s)</entry><entry>G1 1AA</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry>1.12<para/>(9.38e&#8209;07s)</entry><entry><phrase role="highlight">1<para/>(8.34e&#8209;07s)</phrase></entry><entry>2.5<para/>(2.08e&#8209;06s)</entry><entry>SW1 1ZZ</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(7.9e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1.06<para/>(8.34e&#8209;07s)</phrase></entry><entry>2.49<para/>(1.96e&#8209;06s)</entry><entry>4/1/2001</entry><entry><literal>^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(8.19e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1.04<para/>(8.49e&#8209;07s)</phrase></entry><entry>2.4<para/>(1.97e&#8209;06s)</entry><entry>12/12/2001</entry><entry><literal>^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.09<para/>(8.95e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1<para/>(8.19e&#8209;07s)</phrase></entry><entry>2.4<para/>(1.96e&#8209;06s)</entry><entry>123</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+<row>
+<entry>1.11<para/>(8.79e&#8209;07s)</entry><entry><phrase role="highlight">1<para/>(7.9e&#8209;07s)</phrase></entry><entry>2.57<para/>(2.03e&#8209;06s)</entry><entry>+3.14159</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.09<para/>(8.94e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1<para/>(8.19e&#8209;07s)</phrase></entry><entry>2.47<para/>(2.03e&#8209;06s)</entry><entry>-3.14159</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
diff --git a/src/boost/libs/xpressive/perf/gcc/short_twain_search.xml b/src/boost/libs/xpressive/perf/gcc/short_twain_search.xml
new file mode 100644
index 000000000..52bc47898
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/gcc/short_twain_search.xml
@@ -0,0 +1,7 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ 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)
+-->
+<para><emphasis>Results not available...</emphasis></para>
diff --git a/src/boost/libs/xpressive/perf/main.cpp b/src/boost/libs/xpressive/perf/main.cpp
new file mode 100644
index 000000000..19ea02e65
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/main.cpp
@@ -0,0 +1,193 @@
+/*
+ *
+ * Copyright (c) 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)
+ *
+ */
+
+#include <iostream>
+#include <fstream>
+#include <iterator>
+#include <cassert>
+#include <boost/test/execution_monitor.hpp>
+#include "./regex_comparison.hpp"
+
+void test_match(const std::string& re, const std::string& text, const std::string& description)
+{
+ double time;
+ results r(re, description);
+
+ std::cout << "Testing: \"" << re << "\" against \"" << description << "\"" << std::endl;
+ if(time_greta == true)
+ {
+ // time = g::time_match(re, text);
+ // r.greta_time = time;
+ // std::cout << "\tGRETA regex: " << time << "s\n";
+ }
+ if(time_safe_greta == true)
+ {
+ // time = gs::time_match(re, text);
+ // r.safe_greta_time = time;
+ // std::cout << "\tSafe GRETA regex: " << time << "s\n";
+ }
+ if(time_dynamic_xpressive == true)
+ {
+ time = dxpr::time_match(re, text);
+ r.dynamic_xpressive_time = time;
+ std::cout << "\tdynamic xpressive regex: " << time << "s\n";
+ }
+ if(time_static_xpressive == true)
+ {
+ time = sxpr::time_match(re, text);
+ r.static_xpressive_time = time;
+ std::cout << "\tstatic xpressive regex: " << time << "s\n";
+ }
+ if(time_boost == true)
+ {
+ time = b::time_match(re, text);
+ r.boost_time = time;
+ std::cout << "\tBoost regex: " << time << "s\n";
+ }
+ //if(time_posix == true)
+ //{
+ // time = posix::time_match(re, text);
+ // r.posix_time = time;
+ // std::cout << "\tPOSIX regex: " << time << "s\n";
+ //}
+ //if(time_pcre == true)
+ //{
+ // time = pcr::time_match(re, text);
+ // r.pcre_time = time;
+ // std::cout << "\tPCRE regex: " << time << "s\n";
+ //}
+ r.finalise();
+ result_list.push_back(r);
+}
+
+void test_find_all(const std::string& re, const std::string& text, const std::string& description)
+{
+ std::cout << "Testing: " << re << std::endl;
+
+ double time;
+ results r(re, description);
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1300)
+ if(time_greta == true)
+ {
+ // time = g::time_find_all(re, text);
+ // r.greta_time = time;
+ // std::cout << "\tGRETA regex: " << time << "s\n";
+ }
+ if(time_safe_greta == true)
+ {
+ // time = gs::time_find_all(re, text);
+ // r.safe_greta_time = time;
+ // std::cout << "\tSafe GRETA regex: " << time << "s\n";
+ }
+#endif
+ if(time_dynamic_xpressive == true)
+ {
+ time = dxpr::time_find_all(re, text);
+ r.dynamic_xpressive_time = time;
+ std::cout << "\tdynamic xpressive regex: " << time << "s\n";
+ }
+ if(time_static_xpressive == true)
+ {
+ time = sxpr::time_find_all(re, text);
+ r.static_xpressive_time = time;
+ std::cout << "\tstatic xpressive regex: " << time << "s\n";
+ }
+ if(time_boost == true)
+ {
+ time = b::time_find_all(re, text);
+ r.boost_time = time;
+ std::cout << "\tBoost regex: " << time << "s\n";
+ }
+ //if(time_posix == true)
+ //{
+ // time = posix::time_find_all(re, text);
+ // r.posix_time = time;
+ // std::cout << "\tPOSIX regex: " << time << "s\n";
+ //}
+ //if(time_pcre == true)
+ //{
+ // time = pcr::time_find_all(re, text);
+ // r.pcre_time = time;
+ // std::cout << "\tPCRE regex: " << time << "s\n";
+ //}
+ r.finalise();
+ result_list.push_back(r);
+}
+
+//int cpp_main(int argc, char**const argv)
+int main(int argc, char**const argv)
+{
+ // start by processing the command line args:
+ if(argc < 2)
+ return show_usage();
+ int result = 0;
+ for(int c = 1; c < argc; ++c)
+ {
+ result += handle_argument(argv[c]);
+ }
+ if(result)
+ return result;
+
+ if(test_matches)
+ {
+ // 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_maddock@compuserve.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})(\\]?)$", "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");
+
+ output_xml_results(true, "Short Matches", "short_matches.xml");
+ }
+ std::string twain;
+
+ if(test_short_twain)
+ {
+ load_file(twain, "short_twain.txt");
+
+ test_find_all("Twain", twain);
+ test_find_all("Huck[[:alpha:]]+", twain);
+ test_find_all("[[:alpha:]]+ing", twain);
+ test_find_all("^[^\n]*?Twain", twain);
+ test_find_all("Tom|Sawyer|Huckleberry|Finn", twain);
+ test_find_all("(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)", twain);
+
+ output_xml_results(false, "Moderate Searches", "short_twain_search.xml");
+ }
+
+ if(test_long_twain)
+ {
+ load_file(twain, "3200.txt");
+
+ test_find_all("Twain", twain);
+ test_find_all("Huck[[:alpha:]]+", twain);
+ test_find_all("[[:alpha:]]+ing", twain);
+ test_find_all("^[^\n]*?Twain", twain);
+ test_find_all("Tom|Sawyer|Huckleberry|Finn", twain);
+ //time_posix = false;
+ test_find_all("(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)", twain);
+ //time_posix = true;
+
+ output_xml_results(false, "Long Searches", "long_twain_search.xml");
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/xpressive/perf/msvc/long_twain_search.xml b/src/boost/libs/xpressive/perf/msvc/long_twain_search.xml
new file mode 100644
index 000000000..bf8d5f1f2
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/msvc/long_twain_search.xml
@@ -0,0 +1,37 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ 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)
+-->
+<informaltable frame="all">
+<bridgehead renderas="sect4"><phrase role="table-title">Long Searches</phrase></bridgehead>
+<tgroup cols="4">
+<thead>
+<row>
+<entry>static xpressive</entry><entry>dynamic xpressive</entry><entry>Boost</entry><entry>Expression</entry>
+</row>
+</thead>
+<tbody>
+<row>
+<entry><phrase role="highlight">1<para/>(0.019s)</phrase></entry><entry><phrase role="highlight">1<para/>(0.019s)</phrase></entry><entry>2.98<para/>(0.0566s)</entry><entry><literal>Twain</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(0.0176s)</phrase></entry><entry><phrase role="highlight">1<para/>(0.0176s)</phrase></entry><entry>3.17<para/>(0.0556s)</entry><entry><literal>Huck[[:alpha:]]+</literal></entry>
+</row>
+<row>
+<entry>3.62<para/>(1.78s)</entry><entry>3.97<para/>(1.95s)</entry><entry><phrase role="highlight">1<para/>(0.492s)</phrase></entry><entry><literal>[[:alpha:]]+ing</literal></entry>
+</row>
+<row>
+<entry>2.32<para/>(0.344s)</entry><entry>3.06<para/>(0.453s)</entry><entry><phrase role="highlight">1<para/>(0.148s)</phrase></entry><entry><literal>^[^
+]*?Twain</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(0.0576s)</phrase></entry><entry><phrase role="highlight">1.05<para/>(0.0606s)</phrase></entry><entry>1.15<para/>(0.0664s)</entry><entry><literal>Tom|Sawyer|Huckleberry|Finn</literal></entry>
+</row>
+<row>
+<entry>1.24<para/>(0.164s)</entry><entry>1.44<para/>(0.191s)</entry><entry><phrase role="highlight">1<para/>(0.133s)</phrase></entry><entry><literal>(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)</literal></entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
diff --git a/src/boost/libs/xpressive/perf/msvc/short_matches.xml b/src/boost/libs/xpressive/perf/msvc/short_matches.xml
new file mode 100644
index 000000000..0adcdb3d7
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/msvc/short_matches.xml
@@ -0,0 +1,57 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ 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)
+-->
+<informaltable frame="all">
+<bridgehead renderas="sect4"><phrase role="table-title">Short Matches</phrase></bridgehead>
+<tgroup cols="5">
+<thead>
+<row>
+<entry>static xpressive</entry><entry>dynamic xpressive</entry><entry>Boost</entry><entry>Text</entry><entry>Expression</entry>
+</row>
+</thead>
+<tbody>
+<row>
+<entry><phrase role="highlight">1<para/>(3.2e&#8209;007s)</phrase></entry><entry>1.37<para/>(4.4e&#8209;007s)</entry><entry>2.38<para/>(7.6e&#8209;007s)</entry><entry>100- this is a line of ftp response which contains a message string</entry><entry><literal>^([0-9]+)(\-| |$)(.*)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(6.4e&#8209;007s)</phrase></entry><entry>1.12<para/>(7.15e&#8209;007s)</entry><entry>1.72<para/>(1.1e&#8209;006s)</entry><entry>1234-5678-1234-456</entry><entry><literal>([[:digit:]]{4}[- ]){3}[[:digit:]]{3,4}</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(9.82e&#8209;007s)</phrase></entry><entry>1.3<para/>(1.28e&#8209;006s)</entry><entry>1.61<para/>(1.58e&#8209;006s)</entry><entry>john_maddock@compuserve.com</entry><entry><literal>^([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})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(8.94e&#8209;007s)</phrase></entry><entry>1.3<para/>(1.16e&#8209;006s)</entry><entry>1.7<para/>(1.52e&#8209;006s)</entry><entry>foo12@foo.edu</entry><entry><literal>^([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})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(9.09e&#8209;007s)</phrase></entry><entry>1.28<para/>(1.16e&#8209;006s)</entry><entry>1.67<para/>(1.52e&#8209;006s)</entry><entry>bob.smith@foo.tv</entry><entry><literal>^([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})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.06e&#8209;007s)</phrase></entry><entry><phrase role="highlight">1.07<para/>(3.28e&#8209;007s)</phrase></entry><entry>1.95<para/>(5.96e&#8209;007s)</entry><entry>EH10 2QQ</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.13e&#8209;007s)</phrase></entry><entry><phrase role="highlight">1.09<para/>(3.42e&#8209;007s)</phrase></entry><entry>1.86<para/>(5.81e&#8209;007s)</entry><entry>G1 1AA</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.2e&#8209;007s)</phrase></entry><entry><phrase role="highlight">1.09<para/>(3.5e&#8209;007s)</phrase></entry><entry>1.86<para/>(5.96e&#8209;007s)</entry><entry>SW1 1ZZ</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(2.68e&#8209;007s)</phrase></entry><entry>1.22<para/>(3.28e&#8209;007s)</entry><entry>2<para/>(5.36e&#8209;007s)</entry><entry>4/1/2001</entry><entry><literal>^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(2.76e&#8209;007s)</phrase></entry><entry>1.16<para/>(3.2e&#8209;007s)</entry><entry>1.94<para/>(5.36e&#8209;007s)</entry><entry>12/12/2001</entry><entry><literal>^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(2.98e&#8209;007s)</phrase></entry><entry><phrase role="highlight">1.03<para/>(3.06e&#8209;007s)</phrase></entry><entry>1.85<para/>(5.51e&#8209;007s)</entry><entry>123</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.2e&#8209;007s)</phrase></entry><entry>1.12<para/>(3.58e&#8209;007s)</entry><entry>1.81<para/>(5.81e&#8209;007s)</entry><entry>+3.14159</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.28e&#8209;007s)</phrase></entry><entry>1.11<para/>(3.65e&#8209;007s)</entry><entry>1.77<para/>(5.81e&#8209;007s)</entry><entry>-3.14159</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
diff --git a/src/boost/libs/xpressive/perf/msvc/short_twain_search.xml b/src/boost/libs/xpressive/perf/msvc/short_twain_search.xml
new file mode 100644
index 000000000..52bc47898
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/msvc/short_twain_search.xml
@@ -0,0 +1,7 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ 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)
+-->
+<para><emphasis>Results not available...</emphasis></para>
diff --git a/src/boost/libs/xpressive/perf/regex_comparison.hpp b/src/boost/libs/xpressive/perf/regex_comparison.hpp
new file mode 100644
index 000000000..d293049d6
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/regex_comparison.hpp
@@ -0,0 +1,139 @@
+/*
+ *
+ * Copyright (c) 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)
+ *
+ */
+
+
+#ifndef REGEX_COMPARISON_HPP
+#define REGEX_COMPARISON_HPP
+
+#include <string>
+#include <list>
+#include <boost/limits.hpp>
+
+//
+// globals:
+//
+extern bool time_boost;
+extern bool time_greta;
+extern bool time_safe_greta;
+extern bool time_dynamic_xpressive;
+extern bool time_static_xpressive;
+//extern bool time_posix;
+//extern bool time_pcre;
+
+extern bool test_matches;
+extern bool test_short_twain;
+extern bool test_long_twain;
+
+extern std::string xml_out_file;
+extern std::string xml_contents;
+
+
+int handle_argument(const std::string& what);
+int show_usage();
+void load_file(std::string& text, const char* file);
+void output_xml_results(bool show_description, const std::string& title, const std::string& filename);
+
+struct results
+{
+ double boost_time;
+ double greta_time;
+ double safe_greta_time;
+ double dynamic_xpressive_time;
+ double static_xpressive_time;
+ //double posix_time;
+ //double pcre_time;
+ double factor;
+ std::string expression;
+ std::string description;
+ results(const std::string& ex, const std::string& desc)
+ : boost_time(-1),
+ greta_time(-1),
+ safe_greta_time(-1),
+ dynamic_xpressive_time(-1),
+ static_xpressive_time(-1),
+ //posix_time(-1),
+ //pcre_time(-1),
+ factor((std::numeric_limits<double>::max)()),
+ expression(ex),
+ description(desc)
+ {}
+ void finalise()
+ {
+ if((boost_time >= 0) && (boost_time < factor))
+ factor = boost_time;
+ if((greta_time >= 0) && (greta_time < factor))
+ factor = greta_time;
+ if((safe_greta_time >= 0) && (safe_greta_time < factor))
+ factor = safe_greta_time;
+ if((dynamic_xpressive_time >= 0) && (dynamic_xpressive_time < factor))
+ factor = dynamic_xpressive_time;
+ if((static_xpressive_time >= 0) && (static_xpressive_time < factor))
+ factor = static_xpressive_time;
+ //if((posix_time >= 0) && (posix_time < factor))
+ // factor = posix_time;
+ //if((pcre_time >= 0) && (pcre_time < factor))
+ // factor = pcre_time;
+ if((factor >= 0) && (factor < factor))
+ factor = factor;
+ }
+};
+
+extern std::list<results> result_list;
+
+
+namespace b {
+// boost tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+//namespace posix {
+//// posix tests:
+//double time_match(const std::string& re, const std::string& text);
+//double time_find_all(const std::string& re, const std::string& text);
+//
+//}
+//namespace pcr {
+//// pcre tests:
+//double time_match(const std::string& re, const std::string& text);
+//double time_find_all(const std::string& re, const std::string& text);
+//
+//}
+namespace g {
+// greta tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+namespace gs {
+// safe greta tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+namespace dxpr {
+// dynamic xpressive tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+namespace sxpr {
+// static xpressive tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+void test_match(const std::string& re, const std::string& text, const std::string& description);
+void test_find_all(const std::string& re, const std::string& text, const std::string& description);
+inline void test_match(const std::string& re, const std::string& text)
+{ test_match(re, text, text); }
+inline void test_find_all(const std::string& re, const std::string& text)
+{ test_find_all(re, text, ""); }
+
+
+#define REPEAT_COUNT 10
+
+#endif
diff --git a/src/boost/libs/xpressive/perf/time_boost.cpp b/src/boost/libs/xpressive/perf/time_boost.cpp
new file mode 100644
index 000000000..420f141c2
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/time_boost.cpp
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright (c) 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)
+ *
+ */
+
+#include "./regex_comparison.hpp"
+#include <boost/timer.hpp>
+#include <boost/regex.hpp>
+
+namespace b{
+
+double time_match(const std::string& re, const std::string& text)
+{
+ boost::regex e(re, boost::regex_constants::ECMAScript | boost::regex_constants::optimize);
+ boost::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::regex_match(text, what, e);
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ }while(result < 0.5);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::regex_match(text, what, e);
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+//bool dummy_grep_proc(const boost::smatch&)
+//{ return true; }
+
+struct noop
+{
+ void operator()( boost::smatch const & ) const
+ {
+ }
+};
+
+double time_find_all(const std::string& re, const std::string& text)
+{
+ boost::regex e(re, boost::regex_constants::ECMAScript | boost::regex_constants::optimize);
+ boost::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ //boost::regex_grep(&dummy_grep_proc, text, e);
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ }while(result < 0.5);
+ iter /= 2;
+
+ if(result >10)
+ return result / iter;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ //boost::regex_grep(&dummy_grep_proc, text, e);
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+}
diff --git a/src/boost/libs/xpressive/perf/time_dynamic_xpressive.cpp b/src/boost/libs/xpressive/perf/time_dynamic_xpressive.cpp
new file mode 100644
index 000000000..d6f0a98f0
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/time_dynamic_xpressive.cpp
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright (c) 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)
+ *
+ */
+
+#include "./regex_comparison.hpp"
+#include <cassert>
+#include <boost/timer.hpp>
+#include <boost/xpressive/xpressive.hpp>
+
+namespace dxpr
+{
+
+double time_match(const std::string& re, const std::string& text)
+{
+ boost::xpressive::sregex e(boost::xpressive::sregex::compile(re, boost::xpressive::regex_constants::optimize));
+ boost::xpressive::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ assert(boost::xpressive::regex_match( text, what, e ));
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::regex_match( text, what, e );
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ } while(result < 0.5);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::regex_match( text, what, e );
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+struct noop
+{
+ void operator()( boost::xpressive::smatch const & ) const
+ {
+ }
+};
+
+double time_find_all(const std::string& re, const std::string& text)
+{
+ boost::xpressive::sregex e(boost::xpressive::sregex::compile(re, boost::xpressive::regex_constants::optimize));
+ boost::xpressive::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ }while(result < 0.5);
+ iter /= 2;
+
+ if(result >10)
+ return result / iter;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+}
+
+
diff --git a/src/boost/libs/xpressive/perf/time_static_xpressive.cpp b/src/boost/libs/xpressive/perf/time_static_xpressive.cpp
new file mode 100644
index 000000000..b90d6b32f
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/time_static_xpressive.cpp
@@ -0,0 +1,224 @@
+/*
+ *
+ * Copyright (c) 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)
+ *
+ */
+
+#include "./regex_comparison.hpp"
+#include <map>
+#include <cassert>
+#include <boost/timer.hpp>
+#include <boost/xpressive/xpressive.hpp>
+
+namespace sxpr
+{
+
+using namespace boost::xpressive;
+
+// short matches
+char const * sz1 = "^([0-9]+)(\\-| |$)(.*)$";
+sregex rx1 = bol >> (s1= +range('0','9')) >> (s2= as_xpr('-')|' '|eol) >> (s3= *_) >> eol;
+
+char const * sz2 = "([[:digit:]]{4}[- ]){3}[[:digit:]]{3,4}";
+sregex rx2 = bol >> repeat<3>(s1= repeat<4>(set[digit]) >> (set='-',' ')) >> repeat<3,4>(set[digit]);
+
+char const * sz3 = "^([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})(\\]?)$";
+sregex rx3
+ = bol
+ >> (s1= +set[ range('a','z') | range('A','Z') | range('0','9') | '_' | '-' | '.' ])
+ >> '@'
+ >> (s2=
+ (s3= '[' >> repeat<1,3>(range('0','9')) >> '.' >> repeat<1,3>(range('0','9'))
+ >> '.' >> repeat<1,3>(range('0','9')) >> '.'
+ )
+ |
+ (s4= +(s5= +set[ range('a','z') | range('A','Z') | range('0','9') | '-' ] >> '.' ) )
+ )
+ >> (s6= repeat<2,4>(set[ range('a','z') | range('A','Z')]) | repeat<1,3>(range('0','9')))
+ >> (s7= !as_xpr(']'))
+ >> eol
+ ;
+
+char const * sz4 = "^([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})(\\]?)$";
+sregex rx4 = rx3;
+
+char const * sz5 = "^([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})(\\]?)$";
+sregex rx5 = rx3;
+
+char const * sz6 = "^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$";
+sregex rx6 = bol >> repeat<1,2>(set[ range('a','z') | range('A','Z') ])
+ >> range('0','9') >> repeat<0,1>(set[range('0','9')|range('A','Z')|range('a','z')])
+ >> repeat<0,1>(as_xpr(' ')) >> range('0','9')
+ >> repeat<2>(set[range('A','Z')|range('a','z')]) >> eol;
+
+char const * sz7 = "^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$";
+sregex rx7 = rx6;
+
+char const * sz8 = "^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$";
+sregex rx8 = rx6;
+
+char const * sz9 = "^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$";
+sregex rx9 = bol >> repeat<1,2>(set[digit]) >> '/' >> repeat<1,2>(set[digit]) >> '/' >> repeat<4>(set[digit]) >> eol;
+
+char const * sz10 = "^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$";
+sregex rx10 = rx9;
+
+char const * sz11 = "^[-+]?[[:digit:]]*\\.?[[:digit:]]*$";
+sregex rx11 = bol >> !(set= '-','+') >> *set[digit] >> !as_xpr('.') >> *set[digit] >> eol ;
+
+char const * sz12 = "^[-+]?[[:digit:]]*\\.?[[:digit:]]*$";
+sregex rx12 = rx11;
+
+char const * sz13 = "^[-+]?[[:digit:]]*\\.?[[:digit:]]*$";
+sregex rx13 = rx11;
+
+// long matches
+char const * sz14 = "Twain";
+boost::xpressive::sregex rx14 = as_xpr("Twain");
+
+char const * sz15 = "Huck[[:alpha:]]+";
+boost::xpressive::sregex rx15 = "Huck" >> +set[alpha];
+
+char const * sz16 = "[[:alpha:]]+ing";
+boost::xpressive::sregex rx16 = +set[alpha] >> "ing";
+
+char const * sz17 = "^[^\n]*?Twain";
+boost::xpressive::sregex rx17 = bol >> -*~as_xpr('\n') >> "Twain";
+
+char const * sz18 = "Tom|Sawyer|Huckleberry|Finn";
+boost::xpressive::sregex rx18 = ( as_xpr("Tom") | "Sawyer" | "Huckleberry" | "Finn" );
+
+//char const * sz18 = "Tom|Sawyer|.uckleberry|Finn";
+//boost::xpressive::sregex rx18 = ( as_xpr("Tom") | "Sawyer" | _ >> "uckleberry" | "Finn" );
+
+char const * sz19 = "(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)";
+boost::xpressive::sregex rx19 =
+ (s1= as_xpr("Tom") | "Sawyer" | "Huckleberry" | "Finn" )
+ >> repeat<0,30>(_)
+ >> "river"
+ |
+ "river"
+ >> repeat<0,30>(_)
+ >> (s2= as_xpr("Tom") | "Sawyer" | "Huckleberry" | "Finn" );
+
+std::map< std::string, sregex > rxmap;
+
+struct map_init
+{
+ map_init()
+ {
+ rxmap[ sz1 ] = rx1;
+ rxmap[ sz2 ] = rx2;
+ rxmap[ sz3 ] = rx3;
+ rxmap[ sz4 ] = rx4;
+ rxmap[ sz5 ] = rx5;
+ rxmap[ sz6 ] = rx6;
+ rxmap[ sz7 ] = rx7;
+ rxmap[ sz8 ] = rx8;
+ rxmap[ sz9 ] = rx9;
+ rxmap[ sz10 ] = rx10;
+ rxmap[ sz11 ] = rx11;
+ rxmap[ sz12 ] = rx12;
+ rxmap[ sz13 ] = rx13;
+ rxmap[ sz14 ] = rx14;
+ rxmap[ sz15 ] = rx15;
+ rxmap[ sz16 ] = rx16;
+ rxmap[ sz17 ] = rx17;
+ rxmap[ sz18 ] = rx18;
+ rxmap[ sz19 ] = rx19;
+ }
+};
+
+static map_init const i = map_init();
+
+double time_match(const std::string& re, const std::string& text)
+{
+ boost::xpressive::sregex const &e = rxmap[ re ];
+ boost::xpressive::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ assert(boost::xpressive::regex_match( text, what, e ));
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::regex_match( text, what, e );
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ } while(result < 0.5);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::regex_match( text, what, e );
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+struct noop
+{
+ void operator()( boost::xpressive::smatch const & ) const
+ {
+ }
+};
+
+double time_find_all(const std::string& re, const std::string& text)
+{
+ boost::xpressive::sregex const &e = rxmap[ re ];
+ boost::xpressive::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ }while(result < 0.5);
+ iter /= 2;
+
+ if(result >10)
+ return result / iter;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+}
+
+
diff --git a/src/boost/libs/xpressive/test/Jamfile.v2 b/src/boost/libs/xpressive/test/Jamfile.v2
new file mode 100644
index 000000000..c3652e1b7
--- /dev/null
+++ b/src/boost/libs/xpressive/test/Jamfile.v2
@@ -0,0 +1,84 @@
+# (C) Copyright 2004: Eric Niebler
+# 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)
+
+# bring in rules for testing
+import testing ;
+
+project
+ : requirements
+ <toolset>intel:<debug-symbols>off
+ # Turn off debug symbols on MSVC to bring down the size of object files
+ <toolset>msvc:<debug-symbols>off
+ <toolset>msvc-8.0:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>msvc-8.0:<define>_CRT_SECURE_NO_DEPRECATE
+ <toolset>msvc-9.0:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>msvc-10.0:<define>_SCL_SECURE_NO_WARNINGS
+ <toolset>msvc-11.0:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>msvc-11.0:<define>_SCL_SECURE_NO_WARNINGS
+ <toolset>gcc:<cxxflags>-ftemplate-depth-1024
+ <toolset>darwin:<cxxflags>-ftemplate-depth-1024
+# <toolset>gcc:<cxxflags>-W
+# <toolset>gcc:<cxxflags>-Wall
+# <toolset>msvc:<cxxflags>-W4
+ <toolset>msvc,<stdlib>stlport:<define>_STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+ <library>/boost/test//boost_unit_test_framework
+ <link>static
+ ;
+
+test-suite "xpressive"
+ : [ run regress.cpp : : regress.txt : <toolset>msvc:<cxxflags>/bigobj ]
+ [ run regress_u.cpp : : regress.txt : <toolset>msvc:<cxxflags>/bigobj ]
+ [ run c_traits.cpp : : regress.txt : <toolset>msvc:<cxxflags>/bigobj ]
+ [ run c_traits_u.cpp : : regress.txt : <toolset>msvc:<cxxflags>/bigobj ]
+ [ run test1.cpp ]
+ [ run test2.cpp ]
+ [ run test3.cpp ]
+ [ run test4.cpp ]
+ [ run test5.cpp ]
+ [ run test6.cpp ]
+ [ run test7.cpp ]
+ [ run test8.cpp ]
+ [ run test9.cpp ]
+ [ run test10.cpp ]
+ [ run test11.cpp ]
+ [ run test1u.cpp ]
+ [ run test2u.cpp ]
+ [ run test3u.cpp ]
+ [ run test4u.cpp ]
+ [ run test5u.cpp ]
+ [ run test6u.cpp ]
+ [ run test7u.cpp ]
+ [ run test8u.cpp ]
+ [ run test9u.cpp ]
+ [ run test10u.cpp ]
+ [ run test11u.cpp ]
+ [ run misc1.cpp ]
+ [ run misc2.cpp ]
+ [ run test_format.cpp ]
+ [ run test_cycles.cpp ]
+ [ run test_non_char.cpp ]
+ [ run test_static.cpp ]
+ [ run test_actions.cpp ]
+ [ run test_assert.cpp ]
+ [ run test_assert_with_placeholder.cpp ]
+ [ run test_symbols.cpp ]
+ [ run test_dynamic.cpp ]
+ [ run test_dynamic_grammar.cpp ]
+ [ run test_skip.cpp ]
+ [ link multiple_defs1.cpp multiple_defs2.cpp : : multiple_defs ]
+ [ compile test_basic_regex.cpp ]
+ [ compile test_match_results.cpp ]
+ [ compile test_regex_algorithms.cpp ]
+ [ compile test_regex_compiler.cpp ]
+ [ compile test_regex_constants.cpp ]
+ [ compile test_regex_error.cpp ]
+ [ compile test_regex_iterator.cpp ]
+ [ compile test_regex_primitives.cpp ]
+ [ compile test_regex_token_iterator.cpp ]
+ [ compile test_regex_traits.cpp ]
+ [ compile test_sub_match.cpp ]
+# [ compile test_typeof.cpp ]
+# [ compile test_typeof2.cpp ]
+ ;
+
diff --git a/src/boost/libs/xpressive/test/c_traits.cpp b/src/boost/libs/xpressive/test/c_traits.cpp
new file mode 100644
index 000000000..6e8ad48ce
--- /dev/null
+++ b/src/boost/libs/xpressive/test/c_traits.cpp
@@ -0,0 +1,16 @@
+//////////////////////////////////////////////////////////////////////////////
+// c_traits.cpp
+//
+// (C) Copyright Eric Niebler 2004.
+// 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)
+
+/*
+ Revision history:
+ 6 January 2006 : Initial version.
+*/
+
+#define BOOST_XPRESSIVE_USE_C_TRAITS
+#include "./regress.ipp"
+
diff --git a/src/boost/libs/xpressive/test/c_traits_u.cpp b/src/boost/libs/xpressive/test/c_traits_u.cpp
new file mode 100644
index 000000000..77c9d9f36
--- /dev/null
+++ b/src/boost/libs/xpressive/test/c_traits_u.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+// c_traits.cpp
+//
+// (C) Copyright Eric Niebler 2004.
+// 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)
+
+/*
+ Revision history:
+ 6 January 2006 : Initial version.
+*/
+
+#define BOOST_XPRESSIVE_USE_C_TRAITS
+#define BOOST_XPRESSIVE_TEST_WREGEX
+#include "./regress.ipp"
+
diff --git a/src/boost/libs/xpressive/test/misc1.cpp b/src/boost/libs/xpressive/test/misc1.cpp
new file mode 100644
index 000000000..9bcd63b1b
--- /dev/null
+++ b/src/boost/libs/xpressive/test/misc1.cpp
@@ -0,0 +1,252 @@
+///////////////////////////////////////////////////////////////////////////////
+// misc1.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <iostream>
+#include <boost/xpressive/xpressive.hpp>
+#include <boost/xpressive/traits/cpp_regex_traits.hpp>
+#include <boost/test/unit_test.hpp>
+
+using namespace boost::unit_test;
+using namespace boost::xpressive;
+
+void test1()
+{
+ // make sure the following compiles:
+ sregex a = _;
+ sregex b = _;
+ sregex c = a >> b;
+ c = 'a' >> b;
+ c = a >> 'b';
+ c = a | b;
+ c = 'a' | b;
+ c = a | 'b';
+ c = !a;
+ c = *a;
+ c = +a;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test for basic_regex in a keep
+//
+void test2()
+{
+ std::locale loc;
+ std::string str("Its a mad Mad mAd maD world");
+ sregex word = +_w;
+ sregex sentence = imbue(loc)(*(keep(word) >> +_s) >> word);
+ smatch what;
+
+ BOOST_REQUIRE(regex_match(str, what, sentence));
+ BOOST_REQUIRE(7 == what.nested_results().size());
+ smatch::nested_results_type::const_iterator pword = what.nested_results().begin();
+ BOOST_CHECK((*pword++)[0] == "Its");
+ BOOST_CHECK((*pword++)[0] == "a");
+ BOOST_CHECK((*pword++)[0] == "mad");
+ BOOST_CHECK((*pword++)[0] == "Mad");
+ BOOST_CHECK((*pword++)[0] == "mAd");
+ BOOST_CHECK((*pword++)[0] == "maD");
+ BOOST_CHECK((*pword++)[0] == "world");
+ BOOST_CHECK(pword == what.nested_results().end());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test for a simple non-recursive grammar
+//
+void test3()
+{
+ // test for a simple regex grammar
+ std::string buffer =
+ "FROGGIE\r\n"
+ "Volume = 1\r\n"
+ "Other1= 2\r\n"
+ "Channel=3\r\n"
+ "Other =4\r\n"
+ "\r\n"
+ "FROGGIE\r\n"
+ "Volume = 5\r\n"
+ "Other1= 6\r\n"
+ "Channel=7\r\n"
+ "Other =8\r\n"
+ "\r\n"
+ "FROGGIE\r\n"
+ "Volume = 9\r\n"
+ "Other1= 0\r\n"
+ "Channel=10\r\n"
+ "\r\n";
+
+ mark_tag name(1), value(2);
+
+ sregex name_value_pair_ =
+ (name= +alnum) >> *_s >> "=" >> *_s >>
+ (value= +_d) >> *_s >> _ln;
+
+ sregex message_ =
+ *_s >> "FROGGIE" >> _ln >> +name_value_pair_ >> _ln;
+
+ sregex re_ = +message_;
+
+ smatch::nested_results_type::const_iterator msg, nvp;
+ smatch tmpwhat;
+
+ BOOST_REQUIRE(regex_search(buffer, tmpwhat, re_));
+ // for giggles, make a deep-copy of the tree of results
+ smatch what = tmpwhat;
+ BOOST_REQUIRE(3 == what.nested_results().size());
+
+ msg = what.nested_results().begin();
+ BOOST_REQUIRE(4 == msg->nested_results().size());
+
+ nvp = msg->nested_results().begin();
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Volume" == (*nvp)[name]);
+ BOOST_CHECK("1" == (*nvp)[value]);
+ ++nvp;
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Other1" == (*nvp)[name]);
+ BOOST_CHECK("2" == (*nvp)[value]);
+ ++nvp;
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Channel" == (*nvp)[name]);
+ BOOST_CHECK("3" == (*nvp)[value]);
+ ++nvp;
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Other" == (*nvp)[name]);
+ BOOST_CHECK("4" == (*nvp)[value]);
+
+ ++msg;
+ BOOST_REQUIRE(4 == msg->nested_results().size());
+
+ nvp = msg->nested_results().begin();
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Volume" == (*nvp)[name]);
+ BOOST_CHECK("5" == (*nvp)[value]);
+ ++nvp;
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Other1" == (*nvp)[name]);
+ BOOST_CHECK("6" == (*nvp)[value]);
+ ++nvp;
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Channel" == (*nvp)[name]);
+ BOOST_CHECK("7" == (*nvp)[value]);
+ ++nvp;
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Other" == (*nvp)[name]);
+ BOOST_CHECK("8" == (*nvp)[value]);
+
+ ++msg;
+ BOOST_REQUIRE(3 == msg->nested_results().size());
+
+ nvp = msg->nested_results().begin();
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Volume" == (*nvp)[name]);
+ BOOST_CHECK("9" == (*nvp)[value]);
+ ++nvp;
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Other1" == (*nvp)[name]);
+ BOOST_CHECK("0" == (*nvp)[value]);
+ ++nvp;
+ BOOST_REQUIRE(3 == nvp->size());
+ BOOST_CHECK("Channel" == (*nvp)[name]);
+ BOOST_CHECK("10" == (*nvp)[value]);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test for a self-recursive regex
+//
+void test4()
+{
+ sregex parentheses;
+ parentheses // A balanced set of parentheses ...
+ = '(' // is an opening parenthesis ...
+ >> // followed by ...
+ *( // zero or more ...
+ keep( +~(set='(',')') ) // of a bunch of things that are not parentheses ...
+ | // or ...
+ by_ref(parentheses) // a balanced set of parentheses
+ ) // (ooh, recursion!) ...
+ >> // followed by ...
+ ')' // a closing parenthesis
+ ;
+
+ smatch what;
+ smatch::nested_results_type::const_iterator pwhat, pwhat2;
+ std::string str( "blah blah( a(b)c (c(e)f (g)h )i (j)6 )blah" );
+
+ BOOST_REQUIRE(regex_search(str, what, parentheses));
+ BOOST_REQUIRE(1 == what.size());
+ BOOST_CHECK("( a(b)c (c(e)f (g)h )i (j)6 )" == what[0]);
+
+ BOOST_REQUIRE(3 == what.nested_results().size());
+ pwhat = what.nested_results().begin();
+ BOOST_REQUIRE(1 == pwhat->size());
+ BOOST_CHECK("(b)" == (*pwhat)[0]);
+
+ ++pwhat;
+ BOOST_REQUIRE(1 == pwhat->size());
+ BOOST_CHECK("(c(e)f (g)h )" == (*pwhat)[0]);
+
+ BOOST_REQUIRE(2 == pwhat->nested_results().size());
+ pwhat2 = pwhat->nested_results().begin();
+ BOOST_REQUIRE(1 == pwhat2->size());
+ BOOST_CHECK("(e)" == (*pwhat2)[0]);
+
+ ++pwhat2;
+ BOOST_REQUIRE(1 == pwhat2->size());
+ BOOST_CHECK("(g)" == (*pwhat2)[0]);
+
+ ++pwhat;
+ BOOST_REQUIRE(1 == pwhat->size());
+ BOOST_CHECK("(j)" == (*pwhat)[0]);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test for a sub-match scoping
+//
+void test5()
+{
+ sregex inner = sregex::compile( "(.)\\1" );
+ sregex outer = (s1= _) >> inner >> s1;
+ std::string abba("ABBA");
+
+ BOOST_CHECK(regex_match(abba, outer));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Ye olde calculator. Test recursive grammar.
+//
+void test6()
+{
+ sregex group, factor, term, expression;
+
+ group = '(' >> by_ref(expression) >> ')';
+ factor = +_d | group;
+ term = factor >> *(('*' >> factor) | ('/' >> factor));
+ expression = term >> *(('+' >> term) | ('-' >> term));
+
+ smatch what;
+ std::string str("foo 9*(10+3) bar");
+
+ BOOST_REQUIRE(regex_search(str, what, expression));
+ BOOST_CHECK("9*(10+3)" == what[0]);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("miscelaneous tests and examples from the docs");
+
+ test->add(BOOST_TEST_CASE(&test1));
+ test->add(BOOST_TEST_CASE(&test2));
+ test->add(BOOST_TEST_CASE(&test3));
+ test->add(BOOST_TEST_CASE(&test4));
+ test->add(BOOST_TEST_CASE(&test5));
+ test->add(BOOST_TEST_CASE(&test6));
+
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/misc2.cpp b/src/boost/libs/xpressive/test/misc2.cpp
new file mode 100644
index 000000000..2c78e5943
--- /dev/null
+++ b/src/boost/libs/xpressive/test/misc2.cpp
@@ -0,0 +1,91 @@
+///////////////////////////////////////////////////////////////////////////////
+// misc2.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <map>
+#include <string>
+#include <boost/xpressive/xpressive.hpp>
+#include <boost/xpressive/regex_actions.hpp>
+#include <boost/test/unit_test.hpp>
+
+namespace xpr = boost::xpressive;
+using namespace xpr;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+void test_complement()
+{
+ sregex rx1 = ~_n >> ~(set='a') >> ~(set='a','b') >> ~set['a'] >> ~_ln
+ >> ~before('a') >> ~after('a') >> ~alpha >> ~range('a','b') >> ~_b >> ~as_xpr('a');
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ wsregex rx2 = ~_n >> ~(set=L'a') >> ~(set=L'a',L'b') >> ~set[L'a'] >> ~_ln
+ >> ~before(L'a') >> ~after(L'a') >> ~alpha >> ~range(L'a',L'b') >> ~_b >> ~as_xpr(L'a');
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+void test_static_actions_in_dynamic_keep()
+{
+ std::string result;
+ std::string str("foo");
+
+ sregex_compiler compiler;
+ compiler["rx0"] = (s1="foo")[ xpr::ref(result) = s1 ];
+ sregex rx = compiler.compile("(?>(?$rx0))");
+
+ bool ok = regex_match(str, rx);
+ BOOST_CHECK(ok);
+ BOOST_CHECK_EQUAL(result, "foo");
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+void test_static_actions_in_static_keep()
+{
+ std::string result;
+ std::string str("foo");
+
+ sregex rx0 = (s1="foo")[ xpr::ref(result) = s1 ];
+ sregex rx = keep(rx0);
+
+ bool ok = regex_match(str, rx);
+ BOOST_CHECK(ok);
+ BOOST_CHECK_EQUAL(result, "foo");
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+void test_replace_with_lambda()
+{
+ std::map<std::string, std::string> replacements;
+ replacements["X"] = "this";
+ replacements["Y"] = "that";
+
+ std::string input("\"$(X)\" has the value \"$(Y)\""), output;
+ std::string expected("\"this\" has the value \"that\"");
+ sregex rx = "$(" >> (s1= +~as_xpr(')')) >> ')';
+
+ output = regex_replace(input, rx, xpr::ref(replacements)[s1]);
+ BOOST_CHECK_EQUAL(output, expected);
+}
+
+using namespace boost::unit_test;
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("miscelaneous tests");
+
+ test->add(BOOST_TEST_CASE(&test_complement));
+ test->add(BOOST_TEST_CASE(&test_static_actions_in_dynamic_keep));
+ test->add(BOOST_TEST_CASE(&test_static_actions_in_static_keep));
+ test->add(BOOST_TEST_CASE(&test_replace_with_lambda));
+
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/multiple_defs1.cpp b/src/boost/libs/xpressive/test/multiple_defs1.cpp
new file mode 100644
index 000000000..8067294db
--- /dev/null
+++ b/src/boost/libs/xpressive/test/multiple_defs1.cpp
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// multiple_defs1.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/xpressive.hpp>
+extern int f();
+int main()
+{
+ using namespace boost::xpressive;
+ sregex srx = +_;
+ sregex drx = sregex::compile(".+");
+ return f();
+}
diff --git a/src/boost/libs/xpressive/test/multiple_defs2.cpp b/src/boost/libs/xpressive/test/multiple_defs2.cpp
new file mode 100644
index 000000000..b9305d81d
--- /dev/null
+++ b/src/boost/libs/xpressive/test/multiple_defs2.cpp
@@ -0,0 +1,17 @@
+///////////////////////////////////////////////////////////////////////////////
+// multiple_defs2.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/xpressive.hpp>
+
+int f()
+{
+ using namespace boost::xpressive;
+ sregex srx = +_;
+ sregex drx = sregex::compile(".+");
+
+ return 0;
+}
diff --git a/src/boost/libs/xpressive/test/regress.cpp b/src/boost/libs/xpressive/test/regress.cpp
new file mode 100644
index 000000000..f968d5e40
--- /dev/null
+++ b/src/boost/libs/xpressive/test/regress.cpp
@@ -0,0 +1,14 @@
+//////////////////////////////////////////////////////////////////////////////
+// regress.cpp
+//
+// (C) Copyright Eric Niebler 2004.
+// 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)
+
+/*
+ Revision history:
+ 6 January 2006 : Initial version.
+*/
+
+#include "./regress.ipp"
diff --git a/src/boost/libs/xpressive/test/regress.ipp b/src/boost/libs/xpressive/test/regress.ipp
new file mode 100644
index 000000000..683c8b1e6
--- /dev/null
+++ b/src/boost/libs/xpressive/test/regress.ipp
@@ -0,0 +1,451 @@
+//////////////////////////////////////////////////////////////////////////////
+// regress.ipp
+//
+// (C) Copyright Eric Niebler 2004.
+// 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)
+
+/*
+ Revision history:
+ 7 March 2004 : Initial version.
+*/
+
+#include <locale>
+#include <vector>
+#include <string>
+#include <fstream>
+#include <iostream>
+#include <boost/lexical_cast.hpp>
+#include <boost/xpressive/xpressive.hpp>
+#include <boost/test/unit_test.hpp>
+
+#if defined(_MSC_VER) && defined(_DEBUG)
+# define _CRTDBG_MAP_ALLOC
+# include <crtdbg.h>
+#endif
+
+#if defined(BOOST_XPRESSIVE_TEST_WREGEX) && !defined(BOOST_XPRESSIVE_NO_WREGEX)
+namespace std
+{
+ inline std::ostream &operator <<(std::ostream &sout, std::wstring const &wstr)
+ {
+ for(std::size_t n = 0; n < wstr.size(); ++n)
+ sout.put(BOOST_USE_FACET(std::ctype<wchar_t>, std::locale()).narrow(wstr[n], '?'));
+ return sout;
+ }
+}
+#endif
+
+#define BOOST_XPR_CHECK(pred) \
+ if(pred) {} else { BOOST_ERROR(case_ << #pred); }
+
+using namespace boost::unit_test;
+using namespace boost::xpressive;
+
+//////////////////////////////////////////////////////////////////////////////
+// xpr_test_case
+template<typename Char>
+struct xpr_test_case
+{
+ typedef std::basic_string<Char> string_type;
+ std::string section;
+ string_type str;
+ string_type pat;
+ string_type sub;
+ string_type res;
+ regex_constants::syntax_option_type syntax_flags;
+ regex_constants::match_flag_type match_flags;
+ std::vector<string_type> br;
+
+ xpr_test_case()
+ {
+ this->reset();
+ }
+
+ void reset()
+ {
+ this->section.clear();
+ this->str.clear();
+ this->pat.clear();
+ this->sub.clear();
+ this->res.clear();
+ this->br.clear();
+ this->syntax_flags = regex_constants::ECMAScript;
+ this->match_flags = regex_constants::match_default | regex_constants::format_first_only;
+ }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// globals
+std::ifstream in;
+unsigned int test_count = 0;
+
+// The global object that contains the current test case
+xpr_test_case<char> test;
+
+struct test_case_formatter
+{
+ friend std::ostream &operator <<(std::ostream &sout, test_case_formatter)
+ {
+ sout << test.section << " /" << test.pat << "/ : ";
+ return sout;
+ }
+};
+
+test_case_formatter const case_ = {};
+
+#if defined(BOOST_XPRESSIVE_TEST_WREGEX) && !defined(BOOST_XPRESSIVE_NO_WREGEX)
+///////////////////////////////////////////////////////////////////////////////
+// widen
+// make a std::wstring from a std::string by widening according to the
+// current ctype<char> facet
+inline std::wstring widen(std::string const &str)
+{
+ std::ctype<char> const &ct = BOOST_USE_FACET(std::ctype<char>, std::locale());
+ std::wstring res;
+ for(size_t i=0; i<str.size(); ++i)
+ {
+ res += ct.widen(str[i]);
+ }
+ return res;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// widen
+// widens an entire test case
+xpr_test_case<wchar_t> widen(xpr_test_case<char> const &test)
+{
+ xpr_test_case<wchar_t> wtest;
+ wtest.section = test.section;
+ wtest.str = ::widen(test.str);
+ wtest.pat = ::widen(test.pat);
+ wtest.sub = ::widen(test.sub);
+ wtest.res = ::widen(test.res);
+ wtest.syntax_flags = test.syntax_flags;
+ wtest.match_flags = test.match_flags;
+ wtest.br.reserve(test.br.size());
+ for(std::size_t i = 0; i < test.br.size(); ++i)
+ {
+ wtest.br.push_back(::widen(test.br[i]));
+ }
+ return wtest;
+}
+#endif // BOOST_XPRESSIVE_NO_WREGEX
+
+std::string escape(std::string str)
+{
+ for(std::string::size_type pos = 0; std::string::npos != (pos = str.find('\\', pos)); ++pos)
+ {
+ if(pos + 1 == str.size())
+ break;
+
+ switch(str[pos + 1])
+ {
+ case '\\': str.replace(pos, 2, "\\"); break;
+ case 'n': str.replace(pos, 2, "\n"); break;
+ case 'r': str.replace(pos, 2, "\r"); break;
+ }
+ }
+ return str;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test
+// read the next section out of the input file, and fill out
+// the global variables
+bool get_test()
+{
+ test.reset();
+ bool first = true;
+ std::string line;
+ smatch what;
+
+ sregex const rx_sec = '[' >> (s1= +_) >> ']';
+ sregex const rx_str = "str=" >> (s1= *_);
+ sregex const rx_pat = "pat=" >> (s1= *_);
+ sregex const rx_flg = "flg=" >> (s1= *_);
+ sregex const rx_sub = "sub=" >> (s1= *_);
+ sregex const rx_res = "res=" >> (s1= *_);
+ sregex const rx_br = "br" >> (s1= +digit) >> '=' >> (s2= *_);
+
+ while(in.good())
+ {
+ std::getline(in, line);
+
+ if(!line.empty() && '\r' == line[line.size()-1])
+ {
+ line.erase(line.size()-1);
+ }
+
+ if(regex_match(line, what, rx_sec))
+ {
+ if(!first)
+ {
+ if(what[1] != "end")
+ {
+ BOOST_FAIL(("invalid input : " + line).c_str());
+ }
+ break;
+ }
+
+ first = false;
+ test.section = what[1].str();
+ }
+ else if(regex_match(line, what, rx_str))
+ {
+ test.str = escape(what[1].str());
+ }
+ else if(regex_match(line, what, rx_pat))
+ {
+ test.pat = what[1].str();
+ }
+ else if(regex_match(line, what, rx_sub))
+ {
+ test.sub = what[1].str();
+ }
+ else if(regex_match(line, what, rx_res))
+ {
+ test.res = escape(what[1].str());
+ }
+ else if(regex_match(line, what, rx_flg))
+ {
+ std::string flg = what[1].str();
+
+ if(std::string::npos != flg.find('i'))
+ {
+ test.syntax_flags = test.syntax_flags | regex_constants::icase;
+ }
+ if(std::string::npos == flg.find('m'))
+ {
+ test.syntax_flags = test.syntax_flags | regex_constants::single_line;
+ }
+ if(std::string::npos == flg.find('s'))
+ {
+ test.syntax_flags = test.syntax_flags | regex_constants::not_dot_newline;
+ }
+ if(std::string::npos != flg.find('x'))
+ {
+ test.syntax_flags = test.syntax_flags | regex_constants::ignore_white_space;
+ }
+ if(std::string::npos != flg.find('g'))
+ {
+ test.match_flags = test.match_flags & ~regex_constants::format_first_only;
+ }
+ if(std::string::npos != flg.find('a'))
+ {
+ test.match_flags = test.match_flags | regex_constants::format_all;
+ }
+ if(std::string::npos != flg.find('p'))
+ {
+ test.match_flags = test.match_flags | regex_constants::format_perl;
+ }
+ if(std::string::npos != flg.find('d'))
+ {
+ test.match_flags = test.match_flags | regex_constants::format_sed;
+ }
+ }
+ else if(regex_match(line, what, rx_br))
+ {
+ std::size_t nbr = boost::lexical_cast<std::size_t>(what[1].str());
+
+ if(nbr >= test.br.size())
+ {
+ test.br.resize(nbr + 1);
+ }
+
+ test.br[nbr] = escape(what[2].str());
+ }
+ else if(!line.empty() && ';' != line[0])
+ {
+ BOOST_FAIL((std::string("invalid input : ") + line).c_str());
+ }
+ }
+
+ return !first;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// run_test_impl
+// run the test
+template<typename Char>
+void run_test_impl(xpr_test_case<Char> const &test)
+{
+ try
+ {
+ Char const empty[] = {0};
+ typedef typename std::basic_string<Char>::const_iterator iterator;
+ basic_regex<iterator> rx = basic_regex<iterator>::compile(test.pat, test.syntax_flags);
+
+ // Build the same regex for use with C strings
+ basic_regex<Char const *> c_rx = basic_regex<Char const *>::compile(test.pat, test.syntax_flags);
+
+ if(!test.res.empty())
+ {
+ // test regex_replace
+ std::basic_string<Char> res = regex_replace(test.str, rx, test.sub, test.match_flags);
+ BOOST_CHECK_MESSAGE(res == test.res, case_ << res << " != " << test.res );
+
+ // test regex_replace with NTBS format string
+ std::basic_string<Char> res2 = regex_replace(test.str, rx, test.sub.c_str(), test.match_flags);
+ BOOST_CHECK_MESSAGE(res2 == test.res, case_ << res2 << " != " << test.res );
+
+ // test regex_replace with NTBS input string
+ std::basic_string<Char> res3 = regex_replace(test.str.c_str(), c_rx, test.sub, test.match_flags);
+ BOOST_CHECK_MESSAGE(res3 == test.res, case_ << res3 << " != " << test.res );
+
+ // test regex_replace with NTBS input string and NTBS format string
+ std::basic_string<Char> res4 = regex_replace(test.str.c_str(), c_rx, test.sub.c_str(), test.match_flags);
+ BOOST_CHECK_MESSAGE(res4 == test.res, case_ << res4 << " != " << test.res );
+ }
+
+ if(0 == (test.match_flags & regex_constants::format_first_only))
+ {
+ {
+ // global search, use regex_iterator
+ std::vector<sub_match<iterator> > br;
+ regex_iterator<iterator> begin(test.str.begin(), test.str.end(), rx, test.match_flags), end;
+ for(; begin != end; ++begin)
+ {
+ match_results<iterator> const &what = *begin;
+ br.insert(br.end(), what.begin(), what.end());
+ }
+
+ // match succeeded: was it expected to succeed?
+ BOOST_XPR_CHECK(br.size() == test.br.size());
+
+ for(std::size_t i = 0; i < br.size() && i < test.br.size(); ++i)
+ {
+ BOOST_XPR_CHECK((!br[i].matched && test.br[i] == empty) || test.br[i] == br[i].str());
+ }
+ }
+
+ {
+ // global search, use regex_token_iterator
+ std::vector<typename sub_match<iterator>::string_type> br2;
+ std::vector<int> subs(rx.mark_count() + 1, 0);
+ // regex_token_iterator will extract all sub_matches, in order:
+ for(std::size_t i = 0; i < subs.size(); ++i)
+ {
+ subs[i] = static_cast<int>(i);
+ }
+ regex_token_iterator<iterator> begin2(test.str.begin(), test.str.end(), rx, subs, test.match_flags), end2;
+ for(; begin2 != end2; ++begin2)
+ {
+ br2.push_back(*begin2);
+ }
+
+ // match succeeded: was it expected to succeed?
+ BOOST_XPR_CHECK(br2.size() == test.br.size());
+
+ for(std::size_t i = 0; i < br2.size() && i < test.br.size(); ++i)
+ {
+ BOOST_XPR_CHECK(test.br[i] == br2[i]);
+ }
+ }
+ }
+ else
+ {
+ // test regex_search
+ match_results<iterator> what;
+ if(regex_search(test.str, what, rx, test.match_flags))
+ {
+ // match succeeded: was it expected to succeed?
+ BOOST_XPR_CHECK(what.size() == test.br.size());
+
+ for(std::size_t i = 0; i < what.size() && i < test.br.size(); ++i)
+ {
+ BOOST_XPR_CHECK((!what[i].matched && test.br[i] == empty) || test.br[i] == what[i].str());
+ }
+ }
+ else
+ {
+ // match failed: was it expected to fail?
+ BOOST_XPR_CHECK(0 == test.br.size());
+ }
+ }
+ }
+ catch(regex_error const &e)
+ {
+ BOOST_ERROR(case_ << e.what());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// run_test_impl
+// run the current test
+void run_test()
+{
+ #ifdef BOOST_XPRESSIVE_TEST_WREGEX
+ xpr_test_case<wchar_t> wtest = ::widen(test);
+ run_test_impl(wtest);
+ #else
+ run_test_impl(test);
+ #endif
+}
+
+static char const * s_argv1;
+
+///////////////////////////////////////////////////////////////////////////////
+// open_test
+bool open_test()
+{
+ in.open( s_argv1? s_argv1: "regress.txt" );
+ return in.good();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ #if !defined(BOOST_XPRESSIVE_TEST_WREGEX) || !defined(BOOST_XPRESSIVE_NO_WREGEX)
+ if(!open_test())
+ {
+ BOOST_ERROR("Error: unable to open input file.");
+ }
+
+ while(get_test())
+ {
+ run_test();
+ ++test_count;
+ }
+ #endif
+
+ std::cout << test_count << " tests completed." << std::endl;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ s_argv1 = argv[1];
+
+ test_suite *test = BOOST_TEST_SUITE("basic regression test");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// debug_init
+static const struct debug_init
+{
+ debug_init()
+ {
+ #if defined(_MSC_VER) && defined(_DEBUG)
+ // Send warnings, errors and asserts to STDERR
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+
+ // Check for leaks at program termination
+ _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
+
+ //_CrtSetBreakAlloc(221);
+ #endif
+ }
+} g_debug_init;
diff --git a/src/boost/libs/xpressive/test/regress.txt b/src/boost/libs/xpressive/test/regress.txt
new file mode 100644
index 000000000..803e9d6af
--- /dev/null
+++ b/src/boost/libs/xpressive/test/regress.txt
@@ -0,0 +1,3756 @@
+; Copyright 2004 Eric Niebler.
+;
+; 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)
+
+[test1]
+str=foobarboo
+pat=foo
+flg=
+br0=foo
+[end]
+
+[test2]
+str=foobarboo
+pat=bar
+flg=
+br0=bar
+[end]
+
+[test3]
+str=foobarboo
+pat=bat
+flg=
+[end]
+
+[test4]
+str=foobarboo
+pat=b.*ar
+flg=
+br0=bar
+[end]
+
+[test5]
+str=foobarboo
+pat=b.*r
+flg=
+br0=bar
+[end]
+
+[test6]
+str=foobarboo
+pat=b.*b
+flg=
+br0=barb
+[end]
+
+[test7]
+str=foobarboo
+pat=b.*o
+flg=
+br0=barboo
+[end]
+
+[test8]
+str=foobarboo
+pat=b.*oo
+flg=
+br0=barboo
+[end]
+
+[test9]
+str=foobarboo
+pat=b.+ar
+flg=
+[end]
+
+[test10]
+str=foobarboo
+pat=b.+r
+flg=
+br0=bar
+[end]
+
+[test11]
+str=foobarboo
+pat=b.+b
+flg=
+br0=barb
+[end]
+
+[test12]
+str=foobarboo
+pat=b.+o
+flg=
+br0=barboo
+[end]
+
+[test13]
+str=foobarboo
+pat=b.+oo
+flg=
+br0=barboo
+[end]
+
+[test14]
+str=foobarboo
+pat=^foo
+flg=
+br0=foo
+[end]
+
+[test15]
+str=foobarboo
+pat=^b.*ar
+flg=
+[end]
+
+[test16]
+str=foobarboo
+pat=b.+ar$
+flg=
+[end]
+
+[test17]
+str=foobarboo
+pat=b.+o$
+flg=
+br0=barboo
+[end]
+
+[test18]
+str=foobarboo
+pat=b.+oo$
+flg=
+br0=barboo
+[end]
+
+[test19]
+str=+1234.56789F
+pat=^([-+]?[0-9]+(\.[0-9]*)?)([CF])$
+flg=
+br0=+1234.56789F
+br1=+1234.56789
+br2=.56789
+br3=F
+[end]
+
+[test20]
+str=+1234.56789
+pat=(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?
+flg=
+br0=+1234.56789
+br1=+
+br2=1234.56789
+br3=
+br4=
+[end]
+
+[test21]
+str=-1234.56789
+pat=(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?
+flg=
+br0=-1234.56789
+br1=-
+br2=1234.56789
+br3=
+br4=
+[end]
+
+[test22]
+str=-1234.56789e-123123123
+pat=(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?
+flg=
+br0=-1234.56789e-123123123
+br1=-
+br2=1234.56789
+br3=e-123123123
+br4=-
+[end]
+
+[test23]
+str=-.1234.56789
+pat=^(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?$
+flg=
+[end]
+
+[test24]
+str=-1234.56789e-12312e123
+pat=^(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?$
+flg=
+[end]
+
+[test25]
+str=aaaaaaaaac
+pat=a*a*a*a*a*b
+flg=
+[end]
+
+[test26]
+str=ThIs iS a TeSt
+pat=[a-zA-Z]*
+flg=
+br0=ThIs
+[end]
+
+[test27]
+str=a^b
+pat=a^b
+flg=
+[end]
+
+[test28]
+str=a^b
+pat=a\^b
+flg=
+br0=a^b
+[end]
+
+[test29]
+str=a^b
+pat=a[^ ]b
+flg=
+br0=a^b
+[end]
+
+[test30]
+str=a^b
+pat=a[^^]b
+flg=
+[end]
+
+[test31]
+str=a^b
+pat=a[^\^]b
+flg=
+[end]
+
+[test31.1]
+str=a^b
+pat=a[\^]b
+flg=
+br0=a^b
+[end]
+
+[test32]
+str=foobazFOObar
+pat=foo(?=bar)
+flg=i
+br0=FOO
+[end]
+
+[test33]
+str=foobarFOObaz
+pat=foo(?!bar)
+flg=i
+br0=FOO
+[end]
+
+[test34]
+str=foobarFOO
+pat=foo(?!bar)
+flg=i
+br0=FOO
+[end]
+
+[test35]
+str=foobarFOObarfoo
+pat=((?>(foo))bar)+
+flg=i
+br0=foobarFOObar
+br1=FOObar
+br2=FOO
+[end]
+
+[test36]
+str=foobar
+pat=bar|(foo)
+flg=g
+br0=foo
+br1=foo
+br2=bar
+br3=
+[end]
+
+; These results seem odd to me, but
+; it comforms with perl
+
+[test37]
+str=foobar
+pat=(bar|(foo))+
+flg=
+br0=foobar
+br1=bar
+br2=foo
+[end]
+
+[test38]
+str=foobar
+pat=((bar)|foo)+
+flg=
+br0=foobar
+br1=bar
+br2=bar
+[end]
+
+[test39]
+str=foobar
+pat=(foo|(bar))+
+flg=
+br0=foobar
+br1=bar
+br2=bar
+[end]
+
+; These results seem odd to me, but
+; it comforms with perl
+
+[test40]
+str=foobar
+pat=((foo)|bar)+
+flg=
+br0=foobar
+br1=bar
+br2=foo
+[end]
+
+[test41]
+str=foobarFOObarfoo
+pat=((?i)FOO)(.*?)\1
+flg=
+br0=foobarFOObarfoo
+br1=foo
+br2=barFOObar
+[end]
+
+[test42]
+str=foobarFOObarfoo
+pat=((?i)FOO)(.*?)(?i:\1)
+flg=
+br0=foobarFOO
+br1=foo
+br2=bar
+[end]
+
+; perl allows this, and it is pretty sick.
+; But anything perl can do, I can do, too.[end]
+
+[test42.1]
+str=fooFOOOFOOOOObar
+pat=(foo|(?i:\1O))+
+flg=
+br0=fooFOOOFOOOO
+br1=FOOOO
+[end]
+
+[test43]
+str=zoo
+pat=^[A-Za-m]
+flg=
+[end]
+
+[test44]
+str=Here is a URL: http://www.cnn.com. OK?
+pat=(https?:/|www\.)[\w\./,?@#%!_=~&-]+\w
+flg=
+br0=http://www.cnn.com
+br1=http:/
+[end]
+
+[test45]
+str=fooooooooo
+pat=fo{2,5}
+flg=
+br0=fooooo
+[end]
+
+[test46]
+str=fooooooooo
+pat=fo{2,5}?
+flg=
+br0=foo
+[end]
+
+[test45.1]
+str=fooooooooo
+pat=fo{2,5}o
+flg=
+br0=foooooo
+[end]
+
+[test46.1]
+str=fooooooooo
+pat=fo{2,5}?o
+flg=
+br0=fooo
+[end]
+
+[test47]
+str={match this}
+pat=^{.*}$
+flg=
+br0={match this}
+[end]
+
+[test48]
+str=+-+-
+pat=[+-]+
+flg=
+br0=+-+-
+[end]
+
+[test49]
+str=+-+-
+pat=[-+]+
+flg=
+br0=+-+-
+[end]
+
+[test50]
+str=\\05g-9e
+pat=[\d-g]+
+flg=
+br0=05g-9
+[end]
+
+[test51]
+str=\\05g-9e
+pat=[\d-\g]+
+flg=
+br0=05g-9
+[end]
+
+[test52]
+str=\\05g-9e
+pat=[g-\d]+
+flg=
+br0=05g-9
+[end]
+
+[test53]
+str=\\05g-9e
+pat=[\g-\d]+
+flg=
+br0=05g-9
+[end]
+
+[test54]
+str=aBcdefg\\
+pat=[a-\g]+
+flg=i
+br0=aBcdefg
+[end]
+
+[test55]
+str=ab/.-ba
+pat=[--/]+
+flg=
+br0=/.-
+[end]
+
+[test56]
+str=ab+,-ba
+pat=[+--]+
+flg=
+br0=+,-
+[end]
+
+[test56.1]
+str=aaabbbb----
+pat=[b-b]+
+flg=
+br0=bbbb
+[end]
+
+[test57]
+str=foobarFOO5
+pat=(foo).*\15
+flg=i
+[end]
+
+[test58]
+str=Her number is 804-867-5309.
+pat=(?:\d{3}-){2}\d{4}
+flg=
+br0=804-867-5309
+[end]
+
+[test59]
+str=foo
+pat=fo+
+flg=
+br0=foo
+[end]
+
+; backtrack a group[end]
+
+[test60]
+str=fooFOObar
+pat=(foo)+foobar
+flg=i
+br0=fooFOObar
+br1=foo
+[end]
+
+; nested, matched parens [end]
+
+[test61]
+str=this is sublist(now(is(the(time),for(all),good(men))to(come)))ok?
+pat=\bsublist\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)\)[^()]*)*)\)[^()]*)*)\)[^()]*)*)\)[^()]*)*)\)
+flg=
+br0=sublist(now(is(the(time),for(all),good(men))to(come)))
+[end]
+
+; nested, matched parens [end]
+
+[test62]
+str=this is sublist(now(is(the(time),for(all),good(men))to(come))ok?
+pat=\bsublist\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)\)[^()]*)*)\)[^()]*)*)\)[^()]*)*)\)[^()]*)*)\)
+flg=
+[end]
+
+[test63]
+str=foobar
+pat=^baz|bar
+flg=
+br0=bar
+[end]
+
+[test64]
+str=Now <foo>is</foo> the time for all <BOLD>good</bald> men</bold> to come to the aid of their country.
+pat=<(.*?)>(.*?)</(\1)>
+flg=ig
+sub={$1}$2{/$3}
+res=Now {foo}is{/foo} the time for all {BOLD}good</bald> men{/bold} to come to the aid of their country.
+br0=<foo>is</foo>
+br1=foo
+br2=is
+br3=foo
+br4=<BOLD>good</bald> men</bold>
+br5=BOLD
+br6=good</bald> men
+br7=bold
+[end]
+
+[test64.sed]
+str=Now <foo>is</foo> the time for all <BOLD>good</bald> men</bold> to come to the aid of their country.
+pat=<(.*?)>(.*?)</(\1)>
+flg=igd
+sub={\1}\2{/\3}
+res=Now {foo}is{/foo} the time for all {BOLD}good</bald> men{/bold} to come to the aid of their country.
+br0=<foo>is</foo>
+br1=foo
+br2=is
+br3=foo
+br4=<BOLD>good</bald> men</bold>
+br5=BOLD
+br6=good</bald> men
+br7=bold
+[end]
+
+[test68]
+str=Now is the time for all good men to come to the aid of their country.
+pat=o
+flg=g
+sub=O
+res=NOw is the time fOr all gOOd men tO cOme tO the aid Of their cOuntry.
+br0=o
+br1=o
+br2=o
+br3=o
+br4=o
+br5=o
+br6=o
+br7=o
+br8=o
+[end]
+
+[test69]
+str=FooBarfoobar
+pat=.*foo
+flg=i
+br0=FooBarfoo
+[end]
+
+[test70]
+str=FooBarfoobar
+pat=.*boo
+flg=i
+[end]
+
+[test71]
+str=FooBarfoobar
+pat=.*boo|bar
+flg=i
+br0=Bar
+[end]
+
+[test72]
+str=FooBarfoobar
+pat=bar
+flg=i
+sub=($`$&)
+res=Foo(FooBar)foobar
+br0=Bar
+[end]
+
+[test72.perl]
+str=FooBarfoobar
+pat=bar
+flg=ip
+sub=($`$&)
+res=Foo(FooBar)foobar
+br0=Bar
+[end]
+
+[test73]
+str=FooBarfoobar
+pat=bar
+flg=gi
+sub=($`$&)
+res=Foo(FooBar)foo(FooBarfoobar)
+br0=Bar
+br1=bar
+[end]
+
+[test73.perl]
+str=FooBarfoobar
+pat=bar
+flg=gip
+sub=($`$&)
+res=Foo(FooBar)foo(FooBarfoobar)
+br0=Bar
+br1=bar
+[end]
+
+[test74]
+str=FooBarfoobar
+pat=bar
+flg=gi
+sub=($'$&)
+res=Foo(foobarBar)foo(bar)
+br0=Bar
+br1=bar
+[end]
+
+[test74.perl]
+str=FooBarfoobar
+pat=bar
+flg=gip
+sub=($'$&)
+res=Foo(foobarBar)foo(bar)
+br0=Bar
+br1=bar
+[end]
+
+[test75]
+str=fooooo
+pat=fo{1,}
+flg=
+br0=fooooo
+[end]
+
+[test76.perl]
+str=fOO bAr BaZ
+pat=\w+
+flg=gp
+sub=\L\u$&
+res=Foo Bar Baz
+br0=fOO
+br1=bAr
+br2=BaZ
+[end]
+
+[test76.all]
+str=fOO bAr BaZ
+pat=\w+
+flg=ga
+sub=\L\u$&
+res=Foo Bar Baz
+br0=fOO
+br1=bAr
+br2=BaZ
+[end]
+
+[test77.perl]
+str=fOO bAr BaZ
+pat=\w+
+flg=gp
+sub=a\LA\Ua\Ea
+res=aaAa aaAa aaAa
+br0=fOO
+br1=bAr
+br2=BaZ
+[end]
+
+[test77.all]
+str=fOO bAr BaZ
+pat=\w+
+flg=ga
+sub=a\LA\Ua\Ea
+res=aaAa aaAa aaAa
+br0=fOO
+br1=bAr
+br2=BaZ
+[end]
+
+[test78]
+str=This (has) parens
+pat=This (\Q(has)\E) (parens)
+flg=
+br0=This (has) parens
+br1=(has)
+br2=parens
+[end]
+
+[test79]
+str=This (has) parens
+pat=This \Q(has) parens\E
+flg=
+br0=This (has) parens
+[end]
+
+[test80]
+str=This (has) parens
+pat=This \Q(has) parens
+flg=
+br0=This (has) parens
+[end]
+
+;[test81]
+;str=THAT IS UPPERCASE is
+;pat=IS
+;flg=ig
+;sub=\Uu\Ql$&\E$&n't
+;res=THAT UL$&ISn't UPPERCASE UL$&isn't
+;br0=is
+;[end]
+
+[test82]
+str=abba1234abba
+pat=\d+
+flg=
+br0=1234
+[end]
+
+[test83]
+str=1234abba1234
+pat=\D+
+flg=
+br0=abba
+[end]
+
+[test84]
+str=abba1234abba
+pat=[\d]+
+flg=
+br0=1234
+[end]
+
+[test85]
+str=1234abba1234
+pat=[\D]+
+flg=
+br0=abba
+[end]
+
+[test86]
+str=abba1234abba
+pat=[^\D]+
+flg=
+br0=1234
+[end]
+
+[test87]
+str=1234abba1234
+pat=[^\d]+
+flg=
+br0=abba
+[end]
+
+[test88]
+str=1234abba1234
+pat=[\W\D]+
+flg=
+br0=abba
+[end]
+
+[test89]
+str=1234(.;)abba
+pat=[^\w\d]+
+flg=
+br0=(.;)
+[end]
+
+[test90]
+str=(boo[bar]baz)
+pat=(\(()|\[()).*?(\)\2|\]\3)
+flg=
+br0=(boo[bar]baz)
+br1=(
+br2=
+br3=
+br4=)
+[end]
+
+[test91]
+str=[boo(bar)baz]
+pat=(\(()|\[()).*?(\)\2|\]\3)
+flg=
+br0=[boo(bar)baz]
+br1=[
+br2=
+br3=
+br4=]
+[end]
+
+[test91]
+str=[boo[bar]baz]
+pat=(\(()|\[()).*?(\)\2|\]\3)
+flg=
+br0=[boo[bar]
+br1=[
+br2=
+br3=
+br4=]
+[end]
+
+[test92]
+str=foobarfoo
+pat=(?<=foo)bar
+flg=
+br0=bar
+[end]
+
+[test93]
+str=foobarfoo
+pat=(?<=(f.o))bar
+flg=
+br0=bar
+br1=foo
+[end]
+
+[test94]
+str=foOoo
+pat=(?<=(fo))o
+flg=i
+br0=O
+br1=fo
+[end]
+
+[test95]
+str=fOooo
+pat=(?<!(fo))o
+flg=i
+br0=O
+br1=
+[end]
+
+[test96]
+str=12foo12
+pat=[[:alpha:]]+
+flg=
+br0=foo
+[end]
+
+[test97]
+str=;12foo12;
+pat=[[:alpha:][:digit:]]+
+flg=
+br0=12foo12
+[end]
+
+[test98]
+str=aaaa
+pat=(?<=())a
+flg=
+br0=a
+br1=
+[end]
+
+[test99]
+str=ABCabc123foo
+pat=(?<=(abc\d{3}))foo
+flg=
+br0=foo
+br1=abc123
+[end]
+
+;[test100]
+;str=aaAAa
+;pat=aa
+;flg=gi
+;br0=AA
+;[end]
+
+;[test101]
+;str=aaAAaA
+;pat=aa
+;flg=gi
+;br0=aA
+;[end]
+
+;[test102]
+;str=foobarFOO
+;pat=foo
+;flg=ir
+;br0=FOO
+;[end]
+
+[test103]
+str=a\nxb\n
+pat=(?!^)x
+flg=m
+[end]
+
+[test104]
+str=a\nxb\n
+pat=(?!^)x
+flg=
+br0=x
+[end]
+
+[test105]
+str=a\nxb\n
+pat=(?!\A)x
+flg=m
+br0=x
+[end]
+
+[test106]
+str=(this)
+pat=^(?:\(()|())\w+(?:\)\1|\2)$
+flg=
+br0=(this)
+br1=
+br2=
+[end]
+
+[test107]
+str=this
+pat=^(?:\(()|())\w+(?:\)\1|\2)$
+flg=
+br0=this
+br1=
+br2=
+[end]
+
+[test108]
+str=this)
+pat=^(?:\(()|())\w+(?:\)\1|\2)$
+flg=
+[end]
+
+[test109]
+str=(this
+pat=^(?:\(()|())\w+(?:\)\1|\2)$
+flg=
+[end]
+
+[test110]
+str=abba123abba
+pat=[[:^alpha:]]+
+flg=
+br0=123
+[end]
+
+[test111]
+str=abba123abba
+pat=[[:^alpha:][:alpha:]]+
+flg=
+br0=abba123abba
+[end]
+
+[test112]
+str=123abba123
+pat=[^[:^alpha:]]+
+flg=
+br0=abba
+[end]
+
+;[test113]
+;str=123abba123
+;pat=[[:alpha:]\y]+
+;flg=
+;br0=123abba123
+;[end]
+
+[test114]
+str=abba123abba
+pat=[^[:^alnum:][:^digit:]]+
+flg=
+br0=123
+[end]
+
+[test115]
+str=aaaaA
+pat=^(a\1?){4}$
+flg=i
+br0=aaaaA
+br1=A
+[end]
+
+[test116]
+str=aaaaAa
+pat=^(a\1?){4}$
+flg=i
+br0=aaaaAa
+br1=Aa
+[end]
+
+; test for possible infinite recursion
+
+[test117]
+str=ab
+pat=(a|(?=b)(?R))+
+flg=
+br0=a
+br1=
+[end]
+
+[test118]
+str=abba
+pat=(?R)
+flg=
+br0=
+[end]
+
+[test119]
+str=nothere(HE(hehe(a(b(c)))nothere
+pat=\(((?>[^()]+)|(?R))*\)
+flg=
+br0=(a(b(c)))
+br1=(b(c))
+[end]
+
+[test120]
+str=1(abcd)(x(y)z)pqr
+pat=\(((?>[^()]+)|(?R))*\)
+flg=ga
+br0=(abcd)
+br1=abcd
+br2=(x(y)z)
+br3=z
+[end]
+
+[test121]
+str=()
+pat=\((?:(?>[^()]+)|(?R))?\)
+flg=
+br0=()
+[end]
+
+[test122]
+str=12(abcde(fsh)xyz(foo(bar))lmno)89
+pat=\((?:(?>[^()]+)|(?R))?\)
+flg=
+br0=(fsh)
+[end]
+
+[test123]
+str=(ab(xy)cd)
+pat=\((((?>[^()]+)|(?R))*)\)
+flg=
+br0=(ab(xy)cd)
+br1=ab(xy)cd
+br2=cd
+[end]
+
+[test124]
+str=(ab(xy)cd)
+pat=\((123)?(((?>[^()]+)|(?R))*)\)
+flg=
+br0=(ab(xy)cd)
+br1=
+br2=ab(xy)cd
+br3=cd
+[end]
+
+[test125]
+str=(123ab(xy)cd)
+pat=\((123)?(((?>[^()]+)|(?R))*)\)
+flg=
+br0=(123ab(xy)cd)
+br1=123
+br2=ab(xy)cd
+br3=cd
+[end]
+
+[test126]
+str=(abcd(xyz<p>qrs)123)
+pat=\((((?>[^()<>]+)|((?>[^()]+))|(?R))*)\)
+flg=
+br0=(abcd(xyz<p>qrs)123)
+br1=abcd(xyz<p>qrs)123
+br2=123
+;br3=<p>qrs
+br3=
+[end]
+
+[test127]
+str=foobar
+pat=foo(?#This is a comment[)bar
+flg=
+br0=foobar
+[end]
+
+[test128]
+str=foobar
+pat=^ f oo b ar $
+flg=x
+br0=foobar
+[end]
+
+[test129]
+str=foobar
+pat=^ f o *
+flg=x
+br0=foo
+[end]
+
+[test129.1]
+str=foobar
+pat=^ f \157 *
+flg=x
+br0=foo
+[end]
+
+[test130]
+str=foo bar
+pat=^ f oo\ b ar $
+flg=x
+br0=foo bar
+[end]
+
+[test131]
+str=foo bar
+pat=^ f oo [ ] b ar $
+flg=x
+br0=foo bar
+[end]
+
+[test132]
+str=foo bar
+pat=^ ( ? : f oo [ ] b ar ) $ # This is a comment
+flg=x
+br0=foo bar
+[end]
+
+[test133]
+str=foo bar
+pat=^ f oo [ ] b ar # This is a comment
+flg=x
+br0=foo bar
+[end]
+
+[test134]
+str=foo bar#Thisisnotacomment
+pat=^ f oo [ ] b ar \# This is not a comment
+flg=x
+br0=foo bar#Thisisnotacomment
+[end]
+
+[test135]
+str=f oo b ar
+pat=^f o(?x) o (?-x) b ar
+flg=
+br0=f oo b ar
+[end]
+
+;[test136]
+;str=foofoo
+;pat=(?:foo)\1
+;flg=
+;[end]
+
+[test137]
+str=a--
+pat=^(a?)*$
+flg=
+[end]
+
+[test138]
+str=a--
+pat=^(a?)*?$
+flg=
+[end]
+
+[test139]
+str=bc
+pat=^(b?){2}bc$
+flg=
+br0=bc
+br1=
+[end]
+
+[test140]
+str=bbc
+pat=^(b?){2}bc$
+flg=
+br0=bbc
+br1=
+[end]
+
+[test141]
+str=bbbc
+pat=^(b?){2}bc$
+flg=
+br0=bbbc
+br1=b
+[end]
+
+[test142]
+str=bbbbc
+pat=^(b?){2}bc$
+flg=
+[end]
+
+[test143]
+str=bbbbc
+pat=^(b?)*d$
+flg=
+[end]
+
+[test144]
+str=bc
+pat=^(b?){2}?bc$
+flg=
+br0=bc
+br1=
+[end]
+
+[test145]
+str=bbc
+pat=^(b?){2}?bc$
+flg=
+br0=bbc
+br1=
+[end]
+
+[test146]
+str=bbbc
+pat=^(b?){2}?bc$
+flg=
+br0=bbbc
+br1=b
+[end]
+
+[test147]
+str=bbbbc
+pat=^(b?){2}?bc$
+flg=
+[end]
+
+[test148]
+str=bbbbc
+pat=^(b?)*?d$
+flg=
+[end]
+
+[test149]
+str=bc
+pat=^(b??){2}bc$
+flg=
+br0=bc
+br1=
+[end]
+
+[test150]
+str=bbc
+pat=^(b??){2}bc$
+flg=
+br0=bbc
+br1=b
+[end]
+
+[test151]
+str=bbbc
+pat=^(b??){2}bc$
+flg=
+br0=bbbc
+br1=b
+[end]
+
+[test152]
+str=bbbbc
+pat=^(b??){2}bc$
+flg=
+[end]
+
+[test153]
+str=bbbbc
+pat=^(b??)*d$
+flg=
+[end]
+
+[test154]
+str=bc
+pat=^(b??){2}?bc$
+flg=
+br0=bc
+br1=
+[end]
+
+[test155]
+str=bbc
+pat=^(b??){2}?bc$
+flg=
+br0=bbc
+br1=b
+[end]
+
+[test156]
+str=bbbc
+pat=^(b??){2}?bc$
+flg=
+br0=bbbc
+br1=b
+[end]
+
+[test157]
+str=bbbbc
+pat=^(b??){2}?bc$
+flg=
+[end]
+
+[test158]
+str=bbbbc
+pat=^(b??)*?d$
+flg=
+[end]
+
+[test159]
+str=bbc
+pat=^(|||b)*bc$
+flg=
+br0=bbc
+br1=
+[end]
+
+[test160]
+str=bbc
+pat=^(|||b)*?bc$
+flg=
+br0=bbc
+br1=b
+[end]
+
+[test161]
+str=foo
+pat=\w??
+sub=<$&>
+flg=g
+res=<><f><><o><><o><>
+br0=
+br1=f
+br2=
+br3=o
+br4=
+br5=o
+br6=
+[end]
+
+[test161.sed]
+str=foo
+pat=\w??
+sub=<&>
+flg=gd
+res=<><f><><o><><o><>
+br0=
+br1=f
+br2=
+br3=o
+br4=
+br5=o
+br6=
+[end]
+
+[test162]
+str=foo
+pat=()
+sub=<$&>
+flg=g
+res=<>f<>o<>o<>
+br0=
+br1=
+br2=
+br3=
+br4=
+br5=
+br6=
+br7=
+[end]
+
+[test163]
+str=foo
+pat=()*
+sub=<$&>
+flg=g
+res=<>f<>o<>o<>
+br0=
+br1=
+br2=
+br3=
+br4=
+br5=
+br6=
+br7=
+[end]
+
+[test164]
+str=1yzZ^aAc2
+pat=[Z-a]+
+flg=i
+br0=zZ^aA
+[end]
+
+[test165]
+str=1yzZ^aAc2
+pat=[Z-a]+
+flg=
+br0=Z^a
+[end]
+
+[test166]
+str=G
+pat=f|(?i)g
+flg=
+br0=G
+[end]
+
+[test167]
+str=aBBa
+pat=[[:lower:]]+
+flg=i
+br0=aBBa
+[end]
+
+[test168]
+str=aA
+pat=\x61+
+flg=i
+br0=aA
+[end]
+
+[test169]
+str=aA
+pat=[\x61]+
+flg=i
+br0=aA
+[end]
+
+[test170]
+str=aA
+pat=\u0061+
+flg=i
+br0=aA
+[end]
+
+[test171]
+str=aA
+pat=[\u0061]+
+flg=i
+br0=aA
+[end]
+
+; Test for backreferences over 9
+[test172]
+str=hellohello
+pat=()()()()()()()()()()()(hello)\12
+br0=hellohello
+br1=
+br2=
+br3=
+br4=
+br5=
+br6=
+br7=
+br8=
+br9=
+br10=
+br11=
+br12=hello
+[end]
+
+; test for named captures
+[test173]
+str=hellohello
+pat=(?P<this>he(ll)o)(?P=this)
+br0=hellohello
+br1=hello
+br2=ll
+[end]
+
+; test for named captures
+[test174]
+str=hellohello
+pat=(?P<this>he(ll)o)(?P=this)
+flg=p
+sub=\u\g<this>, world
+res=Hello, world
+br0=hellohello
+br1=hello
+br2=ll
+[end]
+
+; test for quantified, non-capturing groups, bug report
+[test174]
+str=cabba\nabba\ndaba\n
+pat=^(c[^\r\n]*(?:\r?\n|\r)(?:(?!c)[^\r\n]*(?:\r?\n|\r))*)
+flg=
+br0=cabba\nabba\ndaba\n
+br1=cabba\nabba\ndaba\n
+[end]
+
+; tests pilfered from Boost.Regex test_tricky_cases.cpp
+
+[tricky1]
+str=abc
+pat=a(((b)))c
+flg=g
+br0=abc
+br1=b
+br2=b
+br3=b
+[end]
+
+[tricky2]
+str=abd
+pat=a(b|(c))d
+flg=g
+br0=abd
+br1=b
+br2=
+[end]
+
+[tricky3]
+str=acd
+pat=a(b|(c))d
+flg=g
+br0=acd
+br1=c
+br2=c
+[end]
+
+[tricky4]
+str=abbd
+pat=a(b*|c)d
+flg=g
+br0=abbd
+br1=bb
+[end]
+
+[tricky5]
+str=aaaaabaaaabaaaabaaaab
+pat=a[ab]{20}
+flg=g
+br0=aaaaabaaaabaaaabaaaab
+[end]
+
+[tricky6]
+str=aaaaabaaaabaaaabaaaab
+pat=a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]
+flg=g
+br0=aaaaabaaaabaaaabaaaab
+[end]
+
+[tricky7]
+str=aaaaabaaaabaaaabaaaabweeknights
+pat=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)
+flg=g
+br0=aaaaabaaaabaaaabaaaabweeknights
+br1=wee
+br2=knights
+[end]
+
+[tricky8]
+str=a1234567890123456789012345678901234567890123456789012345678901234567890b
+pat=1234567890123456789012345678901234567890123456789012345678901234567890
+flg=g
+br0=1234567890123456789012345678901234567890123456789012345678901234567890
+[end]
+
+[tricky9]
+str=xacegikmoq
+pat=[ab][cd][ef][gh][ij][kl][mn]
+flg=g
+br0=acegikm
+[end]
+
+[tricky10]
+str=xacegikmoq
+pat=[ab][cd][ef][gh][ij][kl][mn][op]
+flg=g
+br0=acegikmo
+[end]
+
+[tricky11]
+str=xacegikmoqy
+pat=[ab][cd][ef][gh][ij][kl][mn][op][qr]
+flg=g
+br0=acegikmoq
+[end]
+
+[tricky12]
+str=xacegikmoqy
+pat=[ab][cd][ef][gh][ij][kl][mn][op][q]
+flg=g
+br0=acegikmoq
+[end]
+
+[tricky13]
+str=zabcdefghi
+pat=(a)(b)(c)(d)(e)(f)(g)(h)
+flg=g
+br0=abcdefgh
+br1=a
+br2=b
+br3=c
+br4=d
+br5=e
+br6=f
+br7=g
+br8=h
+[end]
+
+[tricky14]
+str=zabcdefghij
+pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)
+flg=g
+br0=abcdefghi
+br1=a
+br2=b
+br3=c
+br4=d
+br5=e
+br6=f
+br7=g
+br8=h
+br9=i
+[end]
+
+[tricky15]
+str=zabcdefghijk
+pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)
+flg=g
+br0=abcdefghij
+br1=a
+br2=b
+br3=c
+br4=d
+br5=e
+br6=f
+br7=g
+br8=h
+br9=i
+br10=j
+[end]
+
+[tricky16]
+str=zabcdefghijkl
+pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)
+flg=g
+br0=abcdefghijk
+br1=a
+br2=b
+br3=c
+br4=d
+br5=e
+br6=f
+br7=g
+br8=h
+br9=i
+br10=j
+br11=k
+[end]
+
+[tricky17]
+str=abc
+pat=(a)d|(b)c
+flg=g
+br0=bc
+br1=
+br2=b
+[end]
+
+[tricky18]
+str=_wwwnocolon _mailto:
+pat=_+((www)|(ftp)|(mailto)):_*
+flg=g
+br0=_mailto:
+br1=mailto
+br2=
+br3=
+br4=mailto
+[end]
+
+; Boost.Regex bug
+[tricky19]
+str=acd
+pat=a(b)?c\1d
+flg=g
+;br0=acd
+;br1=
+[end]
+
+[tricky20]
+str=accd
+pat=a(b?c)+d
+flg=g
+br0=accd
+br1=c
+[end]
+
+[tricky21]
+str=weeknights
+pat=(wee|week)(knights|night)
+flg=g
+br0=weeknights
+br1=wee
+br2=knights
+[end]
+
+[tricky22]
+str=abc
+pat=.*
+flg=g
+br0=abc
+br1=
+[end]
+
+[tricky23]
+str=abd
+pat=a(b|(c))d
+flg=g
+br0=abd
+br1=b
+br2=
+[end]
+
+[tricky24]
+str=acd
+pat=a(b|(c))d
+flg=g
+br0=acd
+br1=c
+br2=c
+[end]
+
+[tricky25]
+str=abbd
+pat=a(b*|c|e)d
+flg=g
+br0=abbd
+br1=bb
+[end]
+
+[tricky26]
+str=acd
+pat=a(b*|c|e)d
+flg=g
+br0=acd
+br1=c
+[end]
+
+[tricky27]
+str=ad
+pat=a(b*|c|e)d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky28]
+str=abc
+pat=a(b?)c
+flg=g
+br0=abc
+br1=b
+[end]
+
+[tricky29]
+str=ac
+pat=a(b?)c
+flg=g
+br0=ac
+br1=
+[end]
+
+[tricky30]
+str=abc
+pat=a(b+)c
+flg=g
+br0=abc
+br1=b
+[end]
+
+[tricky31]
+str=abbbc
+pat=a(b+)c
+flg=g
+br0=abbbc
+br1=bbb
+[end]
+
+[tricky32]
+str=ac
+pat=a(b*)c
+flg=g
+br0=ac
+br1=
+[end]
+
+[tricky33]
+str=abcdef
+pat=(a|ab)(bc([de]+)f|cde)
+flg=g
+br0=abcdef
+br1=a
+br2=bcdef
+br3=de
+[end]
+
+[tricky34]
+str=abc
+pat=a([bc]?)c
+flg=g
+br0=abc
+br1=b
+[end]
+
+[tricky35]
+str=ac
+pat=a([bc]?)c
+flg=g
+br0=ac
+br1=
+[end]
+
+[tricky36]
+str=abc
+pat=a([bc]+)c
+flg=g
+br0=abc
+br1=b
+[end]
+
+[tricky37]
+str=abcc
+pat=a([bc]+)c
+flg=g
+br0=abcc
+br1=bc
+[end]
+
+[tricky38]
+str=abcbc
+pat=a([bc]+)bc
+flg=g
+br0=abcbc
+br1=bc
+[end]
+
+[tricky39]
+str=abb
+pat=a(bb+|b)b
+flg=g
+br0=abb
+br1=b
+[end]
+
+[tricky40]
+str=abb
+pat=a(bbb+|bb+|b)b
+flg=g
+br0=abb
+br1=b
+[end]
+
+[tricky41]
+str=abbb
+pat=a(bbb+|bb+|b)b
+flg=g
+br0=abbb
+br1=bb
+[end]
+
+[tricky42]
+str=abbb
+pat=a(bbb+|bb+|b)bb
+flg=g
+br0=abbb
+br1=b
+[end]
+
+[tricky43]
+str=abcdef
+pat=(.*).*
+flg=g
+br0=abcdef
+br1=abcdef
+br2=
+br3=
+[end]
+
+[tricky44]
+str=bc
+pat=(a*)*
+flg=g
+br0=
+br1=
+br2=
+br3=
+br4=
+br5=
+[end]
+
+[tricky45]
+str=bc
+pat=Z(((((((a+)+)+)+)+)+)+)+|Y(((((((a+)+)+)+)+)+)+)+|X(((((((a+)+)+)+)+)+)+)+|W(((((((a+)+)+)+)+)+)+)+|V(((((((a+)+)+)+)+)+)+)+|CZ(((((((a+)+)+)+)+)+)+)+|CY(((((((a+)+)+)+)+)+)+)+|CX(((((((a+)+)+)+)+)+)+)+|CW(((((((a+)+)+)+)+)+)+)+|CV(((((((a+)+)+)+)+)+)+)+|(a+)+
+flg=g
+[end]
+
+[tricky46]
+str=aaa
+pat=Z(((((((a+)+)+)+)+)+)+)+|Y(((((((a+)+)+)+)+)+)+)+|X(((((((a+)+)+)+)+)+)+)+|W(((((((a+)+)+)+)+)+)+)+|V(((((((a+)+)+)+)+)+)+)+|CZ(((((((a+)+)+)+)+)+)+)+|CY(((((((a+)+)+)+)+)+)+)+|CX(((((((a+)+)+)+)+)+)+)+|CW(((((((a+)+)+)+)+)+)+)+|CV(((((((a+)+)+)+)+)+)+)+|(a+)+
+flg=g
+br0=aaa
+br1=
+br2=
+br3=
+br4=
+br5=
+br6=
+br7=
+br8=
+br9=
+br10=
+br11=
+br12=
+br13=
+br14=
+br15=
+br16=
+br17=
+br18=
+br19=
+br20=
+br21=
+br22=
+br23=
+br24=
+br25=
+br26=
+br27=
+br28=
+br29=
+br30=
+br31=
+br32=
+br33=
+br34=
+br35=
+br36=
+br37=
+br38=
+br39=
+br40=
+br41=
+br42=
+br43=
+br44=
+br45=
+br46=
+br47=
+br48=
+br49=
+br50=
+br51=
+br52=
+br53=
+br54=
+br55=
+br56=
+br57=
+br58=
+br59=
+br60=
+br61=
+br62=
+br63=
+br64=
+br65=
+br66=
+br67=
+br68=
+br69=
+br70=
+br71=aaa
+[end]
+
+[tricky47]
+str=Zaaa
+pat=Z(((((((a+)+)+)+)+)+)+)+|Y(((((((a+)+)+)+)+)+)+)+|X(((((((a+)+)+)+)+)+)+)+|W(((((((a+)+)+)+)+)+)+)+|V(((((((a+)+)+)+)+)+)+)+|CZ(((((((a+)+)+)+)+)+)+)+|CY(((((((a+)+)+)+)+)+)+)+|CX(((((((a+)+)+)+)+)+)+)+|CW(((((((a+)+)+)+)+)+)+)+|CV(((((((a+)+)+)+)+)+)+)+|(a+)+
+flg=g
+br0=Zaaa
+br1=aaa
+br2=aaa
+br3=aaa
+br4=aaa
+br5=aaa
+br6=aaa
+br7=aaa
+br8=
+br9=
+br10=
+br11=
+br12=
+br13=
+br14=
+br15=
+br16=
+br17=
+br18=
+br19=
+br20=
+br21=
+br22=
+br23=
+br24=
+br25=
+br26=
+br27=
+br28=
+br29=
+br30=
+br31=
+br32=
+br33=
+br34=
+br35=
+br36=
+br37=
+br38=
+br39=
+br40=
+br41=
+br42=
+br43=
+br44=
+br45=
+br46=
+br47=
+br48=
+br49=
+br50=
+br51=
+br52=
+br53=
+br54=
+br55=
+br56=
+br57=
+br58=
+br59=
+br60=
+br61=
+br62=
+br63=
+br64=
+br65=
+br66=
+br67=
+br68=
+br69=
+br70=
+br71=
+[end]
+
+[tricky48]
+str=xyxxxxyxxxz
+pat=xyx*xz
+flg=g
+br0=xyxxxz
+[end]
+
+[tricky49]
+str=ad
+pat=a(b|c)*d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky50]
+str=abcd
+pat=a(b|c)*d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky51]
+str=abd
+pat=a(b|c)+d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky52]
+str=abcd
+pat=a(b|c)+d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky53]
+str=ad
+pat=a(b|c?)+d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky54]
+str=ad
+pat=a(b|c){0,0}d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky55]
+str=ad
+pat=a(b|c){0,1}d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky56]
+str=abd
+pat=a(b|c){0,1}d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky57]
+str=ad
+pat=a(b|c){0,2}d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky58]
+str=abcd
+pat=a(b|c){0,2}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky59]
+str=ad
+pat=a(b|c){0,}d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky60]
+str=abcd
+pat=a(b|c){0,}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky61]
+str=abd
+pat=a(b|c){1,1}d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky62]
+str=abd
+pat=a(b|c){1,2}d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky63]
+str=abcd
+pat=a(b|c){1,2}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky64]
+str=abd
+pat=a(b|c){1,}d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky65]
+str=abcd
+pat=a(b|c){1,}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky66]
+str=acbd
+pat=a(b|c){2,2}d
+flg=g
+br0=acbd
+br1=b
+[end]
+
+[tricky67]
+str=abcd
+pat=a(b|c){2,2}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky68]
+str=abcd
+pat=a(b|c){2,4}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky69]
+str=abcbd
+pat=a(b|c){2,4}d
+flg=g
+br0=abcbd
+br1=b
+[end]
+
+[tricky70]
+str=abcbcd
+pat=a(b|c){2,4}d
+flg=g
+br0=abcbcd
+br1=c
+[end]
+
+[tricky71]
+str=abcd
+pat=a(b|c){2,}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky72]
+str=abcbd
+pat=a(b|c){2,}d
+flg=g
+br0=abcbd
+br1=b
+[end]
+
+[tricky73]
+str=abc
+pat=a(((b)))c
+flg=g
+br0=abc
+br1=b
+br2=b
+br3=b
+[end]
+
+[tricky74]
+str=abd
+pat=a(b|(c))d
+flg=g
+br0=abd
+br1=b
+br2=
+[end]
+
+[tricky75]
+str=acd
+pat=a(b|(c))d
+flg=g
+br0=acd
+br1=c
+br2=c
+[end]
+
+[tricky76]
+str=abbd
+pat=a(b*|c)d
+flg=g
+br0=abbd
+br1=bb
+[end]
+
+[tricky77]
+str=aaaaabaaaabaaaabaaaab
+pat=a[ab]{20}
+flg=g
+br0=aaaaabaaaabaaaabaaaab
+[end]
+
+[tricky78]
+str=aaaaabaaaabaaaabaaaab
+pat=a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]
+flg=g
+br0=aaaaabaaaabaaaabaaaab
+[end]
+
+[tricky79]
+str=aaaaabaaaabaaaabaaaabweeknights
+pat=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)
+flg=g
+br0=aaaaabaaaabaaaabaaaabweeknights
+br1=wee
+br2=knights
+[end]
+
+[tricky80]
+str=a1234567890123456789012345678901234567890123456789012345678901234567890b
+pat=1234567890123456789012345678901234567890123456789012345678901234567890
+flg=g
+br0=1234567890123456789012345678901234567890123456789012345678901234567890
+[end]
+
+[tricky81]
+str=xacegikmoq
+pat=[ab][cd][ef][gh][ij][kl][mn]
+flg=g
+br0=acegikm
+[end]
+
+[tricky82]
+str=xacegikmoq
+pat=[ab][cd][ef][gh][ij][kl][mn][op]
+flg=g
+br0=acegikmo
+[end]
+
+[tricky83]
+str=xacegikmoqy
+pat=[ab][cd][ef][gh][ij][kl][mn][op][qr]
+flg=g
+br0=acegikmoq
+[end]
+
+[tricky84]
+str=xacegikmoqy
+pat=[ab][cd][ef][gh][ij][kl][mn][op][q]
+flg=g
+br0=acegikmoq
+[end]
+
+[tricky85]
+str=zabcdefghi
+pat=(a)(b)(c)(d)(e)(f)(g)(h)
+flg=g
+br0=abcdefgh
+br1=a
+br2=b
+br3=c
+br4=d
+br5=e
+br6=f
+br7=g
+br8=h
+[end]
+
+[tricky86]
+str=zabcdefghij
+pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)
+flg=g
+br0=abcdefghi
+br1=a
+br2=b
+br3=c
+br4=d
+br5=e
+br6=f
+br7=g
+br8=h
+br9=i
+[end]
+
+[tricky87]
+str=zabcdefghijk
+pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)
+flg=g
+br0=abcdefghij
+br1=a
+br2=b
+br3=c
+br4=d
+br5=e
+br6=f
+br7=g
+br8=h
+br9=i
+br10=j
+[end]
+
+[tricky88]
+str=zabcdefghijkl
+pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)
+flg=g
+br0=abcdefghijk
+br1=a
+br2=b
+br3=c
+br4=d
+br5=e
+br6=f
+br7=g
+br8=h
+br9=i
+br10=j
+br11=k
+[end]
+
+[tricky89]
+str=abc
+pat=(a)d|(b)c
+flg=g
+br0=bc
+br1=
+br2=b
+[end]
+
+[tricky90]
+str=_wwwnocolon _mailto:
+pat=_+((www)|(ftp)|(mailto)):_*
+flg=g
+br0=_mailto:
+br1=mailto
+br2=
+br3=
+br4=mailto
+[end]
+
+[tricky91]
+str=accd
+pat=a(b?c)+d
+flg=g
+br0=accd
+br1=c
+[end]
+
+[tricky92]
+str=weeknights
+pat=(wee|week)(knights|night)
+flg=g
+br0=weeknights
+br1=wee
+br2=knights
+[end]
+
+[tricky93]
+str=abc
+pat=.*
+flg=g
+br0=abc
+br1=
+[end]
+
+[tricky94]
+str=abd
+pat=a(b|(c))d
+flg=g
+br0=abd
+br1=b
+br2=
+[end]
+
+[tricky95]
+str=acd
+pat=a(b|(c))d
+flg=g
+br0=acd
+br1=c
+br2=c
+[end]
+
+[tricky96]
+str=abbd
+pat=a(b*|c|e)d
+flg=g
+br0=abbd
+br1=bb
+[end]
+
+[tricky97]
+str=acd
+pat=a(b*|c|e)d
+flg=g
+br0=acd
+br1=c
+[end]
+
+[tricky98]
+str=ad
+pat=a(b*|c|e)d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky99]
+str=abc
+pat=a(b?)c
+flg=g
+br0=abc
+br1=b
+[end]
+
+[tricky100]
+str=ac
+pat=a(b?)c
+flg=g
+br0=ac
+br1=
+[end]
+
+[tricky101]
+str=abc
+pat=a(b+)c
+flg=g
+br0=abc
+br1=b
+[end]
+
+[tricky102]
+str=abbbc
+pat=a(b+)c
+flg=g
+br0=abbbc
+br1=bbb
+[end]
+
+[tricky103]
+str=ac
+pat=a(b*)c
+flg=g
+br0=ac
+br1=
+[end]
+
+[tricky104]
+str=abcdef
+pat=(a|ab)(bc([de]+)f|cde)
+flg=g
+br0=abcdef
+br1=a
+br2=bcdef
+br3=de
+[end]
+
+[tricky105]
+str=abc
+pat=a([bc]?)c
+flg=g
+br0=abc
+br1=b
+[end]
+
+[tricky106]
+str=ac
+pat=a([bc]?)c
+flg=g
+br0=ac
+br1=
+[end]
+
+[tricky107]
+str=abc
+pat=a([bc]+)c
+flg=g
+br0=abc
+br1=b
+[end]
+
+[tricky108]
+str=abcc
+pat=a([bc]+)c
+flg=g
+br0=abcc
+br1=bc
+[end]
+
+[tricky109]
+str=abcbc
+pat=a([bc]+)bc
+flg=g
+br0=abcbc
+br1=bc
+[end]
+
+[tricky110]
+str=abb
+pat=a(bb+|b)b
+flg=g
+br0=abb
+br1=b
+[end]
+
+[tricky111]
+str=abb
+pat=a(bbb+|bb+|b)b
+flg=g
+br0=abb
+br1=b
+[end]
+
+[tricky112]
+str=abbb
+pat=a(bbb+|bb+|b)b
+flg=g
+br0=abbb
+br1=bb
+[end]
+
+[tricky113]
+str=abbb
+pat=a(bbb+|bb+|b)bb
+flg=g
+br0=abbb
+br1=b
+[end]
+
+[tricky114]
+str=abcdef
+pat=(.*).*
+flg=g
+br0=abcdef
+br1=abcdef
+br2=
+br3=
+[end]
+
+[tricky115]
+str=bc
+pat=(a*)*
+flg=g
+br0=
+br1=
+br2=
+br3=
+br4=
+br5=
+[end]
+
+[tricky116]
+str=xyxxxxyxxxz
+pat=xyx*xz
+flg=g
+br0=xyxxxz
+[end]
+
+[tricky117]
+str=ad
+pat=a(b|c)*d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky118]
+str=abcd
+pat=a(b|c)*d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky119]
+str=abd
+pat=a(b|c)+d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky120]
+str=abcd
+pat=a(b|c)+d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky121]
+str=ad
+pat=a(b|c?)+d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky122]
+str=ad
+pat=a(b|c){0,0}d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky123]
+str=ad
+pat=a(b|c){0,1}d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky124]
+str=abd
+pat=a(b|c){0,1}d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky125]
+str=ad
+pat=a(b|c){0,2}d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky126]
+str=abcd
+pat=a(b|c){0,2}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky127]
+str=ad
+pat=a(b|c){0,}d
+flg=g
+br0=ad
+br1=
+[end]
+
+[tricky128]
+str=abcd
+pat=a(b|c){0,}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky129]
+str=abd
+pat=a(b|c){1,1}d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky130]
+str=abd
+pat=a(b|c){1,2}d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky131]
+str=abcd
+pat=a(b|c){1,2}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky132]
+str=abd
+pat=a(b|c){1,}d
+flg=g
+br0=abd
+br1=b
+[end]
+
+[tricky133]
+str=abcd
+pat=a(b|c){1,}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky134]
+str=acbd
+pat=a(b|c){2,2}d
+flg=g
+br0=acbd
+br1=b
+[end]
+
+[tricky135]
+str=abcd
+pat=a(b|c){2,2}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky136]
+str=abcd
+pat=a(b|c){2,4}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky137]
+str=abcbd
+pat=a(b|c){2,4}d
+flg=g
+br0=abcbd
+br1=b
+[end]
+
+[tricky138]
+str=abcbcd
+pat=a(b|c){2,4}d
+flg=g
+br0=abcbcd
+br1=c
+[end]
+
+[tricky139]
+str=abcd
+pat=a(b|c){2,}d
+flg=g
+br0=abcd
+br1=c
+[end]
+
+[tricky140]
+str=abcbd
+pat=a(b|c){2,}d
+flg=g
+br0=abcbd
+br1=b
+[end]
+
+[tricky141]
+str=abcd
+pat=a(b|c?)+d
+flg=g
+br0=abcd
+br1=
+[end]
+
+[tricky142]
+str=abd
+pat=a(b+|((c)*))+d
+flg=g
+br0=abd
+br1=
+br2=
+br3=
+[end]
+
+; Boost.Regex bug
+[tricky143]
+str=abcd
+pat=a(b+|((c)*))+d
+flg=g
+br0=abcd
+br1=
+br2=
+;br3=c
+br3=
+[end]
+
+; Boost.Regex bug
+[tricky144]
+str=abcd
+pat=a(b|c?)+d
+flg=g
+br0=abcd
+;br1=c
+br1=
+[end]
+
+; Boost.Regex bug
+[tricky145]
+str=abcd
+pat=a(b|((c)*))+d
+flg=g
+br0=abcd
+;br1=c
+;br2=c
+;br3=c
+br1=
+br2=
+br3=
+[end]
+
+; Boost.Regex bug
+[tricky146]
+str=abd
+pat=a(b+|((c)*))+d
+flg=g
+br0=abd
+;br1=b
+br1=
+br2=
+br3=
+[end]
+
+; Boost.Regex bug
+[tricky147]
+str=abcd
+pat=a(b+|((c)*))+d
+flg=g
+br0=abcd
+;br1=c
+;br2=c
+;br3=c
+br1=
+br2=
+br3=
+[end]
+
+[tricky148]
+str=++i //here is a line comment\n
+pat=//[^\n]*
+flg=g
+br0=//here is a line comment
+[end]
+
+[tricky149]
+str=/* here is a block comment */
+pat=/\*([^*]|\*+[^*/])*\*+/
+flg=g
+br0=/* here is a block comment */
+br1=
+[end]
+
+[tricky150]
+str=/**/
+pat=/\*([^*]|\*+[^*/])*\*+/
+flg=g
+br0=/**/
+br1=
+[end]
+
+[tricky151]
+str=/***/
+pat=/\*([^*]|\*+[^*/])*\*+/
+flg=g
+br0=/***/
+br1=
+[end]
+
+[tricky152]
+str=/****/
+pat=/\*([^*]|\*+[^*/])*\*+/
+flg=g
+br0=/****/
+br1=
+[end]
+
+[tricky153]
+str=/*****/
+pat=/\*([^*]|\*+[^*/])*\*+/
+flg=g
+br0=/*****/
+br1=
+[end]
+
+[tricky154]
+str=/*****/*/
+pat=/\*([^*]|\*+[^*/])*\*+/
+flg=g
+br0=/*****/
+br1=
+[end]
+
+[tricky155]
+str=#define some_symbol
+pat=^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]*
+flg=g
+br0=#define some_symbol
+br1=
+[end]
+
+[tricky156]
+str=#define some_symbol(x) #x
+pat=^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]*
+flg=g
+br0=#define some_symbol(x) #x
+br1=
+[end]
+
+[tricky157]
+str=#define some_symbol(x) \\ \r\n foo();\\\r\n printf(#x);
+pat=^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]*
+flg=g
+br0=#define some_symbol(x) \\ \r\n foo();\\\r\n printf(#x);
+br1=foo();\\\r\n
+[end]
+
+[tricky158]
+str=aaaabab
+pat=(aaa)(ab)*
+flg=g
+br0=aaaabab
+br1=aaa
+br2=ab
+[end]
+
+[tricky159]
+str=0xFF
+pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
+flg=g
+br0=0xFF
+br1=0xFF
+br2=0xFF
+br3=
+br4=
+br5=
+br6=
+[end]
+
+[tricky160]
+str=35
+pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
+flg=g
+br0=35
+br1=35
+br2=
+br3=35
+br4=
+br5=
+br6=
+[end]
+
+[tricky161]
+str=0xFFu
+pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
+flg=g
+br0=0xFFu
+br1=0xFF
+br2=0xFF
+br3=
+br4=
+br5=
+br6=
+[end]
+
+[tricky162]
+str=0xFFL
+pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
+flg=g
+br0=0xFFL
+br1=0xFF
+br2=0xFF
+br3=
+br4=L
+br5=
+br6=
+[end]
+
+[tricky163]
+str=0xFFFFFFFFFFFFFFFFuint64
+pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
+flg=g
+br0=0xFFFFFFFFFFFFFFFFuint64
+br1=0xFFFFFFFFFFFFFFFF
+br2=0xFFFFFFFFFFFFFFFF
+br3=
+br4=int64
+br5=int64
+br6=64
+[end]
+
+[tricky164]
+str='\\x3A'
+pat='([^\\']|\\.)*'
+flg=g
+br0='\\x3A'
+br1=A
+[end]
+
+[tricky165]
+str='\\''
+pat='([^\\']|\\.)*'
+flg=g
+br0='\\''
+br1=\\'
+[end]
+
+[tricky166]
+str='\\n'
+pat='([^\\']|\\.)*'
+flg=g
+br0='\\n'
+br1=\\n
+[end]
+
+[tricky167]
+str=0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}
+pat=0123456789@abcdefghijklmnopqrstuvwxyz\[\\\]\^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ\{\|\}
+flg=gi
+br0=0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}
+[end]
+
+[tricky168]
+str=A
+pat=a
+flg=gi
+br0=A
+[end]
+
+[tricky169]
+str=a
+pat=A
+flg=gi
+br0=a
+[end]
+
+[tricky170]
+str=abcABC
+pat=[abc]+
+flg=gi
+br0=abcABC
+[end]
+
+[tricky171]
+str=abcABC
+pat=[ABC]+
+flg=gi
+br0=abcABC
+[end]
+
+[tricky172]
+str=abcABC
+pat=[a-z]+
+flg=gi
+br0=abcABC
+[end]
+
+[tricky173]
+str=abzANZ
+pat=[A-Z]+
+flg=gi
+br0=abzANZ
+[end]
+
+; Boost.Regex bug
+;[tricky174]
+;str=abzABZ
+;pat=[a-Z]+
+;flg=gi
+;br0=abzABZ
+;[end]
+
+[tricky175]
+str=abzABZ
+pat=[A-z]+
+flg=gi
+br0=abzABZ
+[end]
+
+[tricky176]
+str=abyzABYZ
+pat=[[:lower:]]+
+flg=gi
+br0=abyzABYZ
+[end]
+
+[tricky177]
+str=abzABZ
+pat=[[:upper:]]+
+flg=gi
+br0=abzABZ
+[end]
+
+[tricky178]
+str=abcZZZ
+pat=\w+
+flg=gi
+br0=abcZZZ
+[end]
+
+[tricky179]
+str=abyzABYZ
+pat=[[:alpha:]]+
+flg=gi
+br0=abyzABYZ
+[end]
+
+[tricky180]
+str=09abyzABYZ
+pat=[[:alnum:]]+
+flg=gi
+br0=09abyzABYZ
+[end]
+
+[tricky181]
+str=(
+pat=\(
+flg=g
+br0=(
+[end]
+
+[tricky182]
+str=)
+pat=\)
+flg=g
+br0=)
+[end]
+
+[tricky183]
+str=$
+pat=\$
+flg=g
+br0=$
+[end]
+
+[tricky184]
+str=^
+pat=\^
+flg=g
+br0=^
+[end]
+
+[tricky185]
+str=.
+pat=\.
+flg=g
+br0=.
+[end]
+
+[tricky186]
+str=*
+pat=\*
+flg=g
+br0=*
+[end]
+
+[tricky187]
+str=+
+pat=\+
+flg=g
+br0=+
+[end]
+
+[tricky188]
+str=?
+pat=\?
+flg=g
+br0=?
+[end]
+
+[tricky189]
+str=[
+pat=\[
+flg=g
+br0=[
+[end]
+
+[tricky190]
+str=]
+pat=\]
+flg=g
+br0=]
+[end]
+
+[tricky191]
+str=|
+pat=\|
+flg=g
+br0=|
+[end]
+
+[tricky192]
+str=\\
+pat=\\
+flg=g
+br0=\
+[end]
+
+[tricky193]
+str=#
+pat=#
+flg=g
+br0=#
+[end]
+
+[tricky194]
+str=#
+pat=\#
+flg=g
+br0=#
+[end]
+
+[tricky195]
+str=a-
+pat=a-
+flg=g
+br0=a-
+[end]
+
+[tricky196]
+str=-
+pat=\-
+flg=g
+br0=-
+[end]
+
+[tricky197]
+str={
+pat=\{
+flg=g
+br0={
+[end]
+
+[tricky198]
+str=}
+pat=\}
+flg=g
+br0=}
+[end]
+
+[tricky199]
+str=0
+pat=0
+flg=g
+br0=0
+[end]
+
+[tricky200]
+str=1
+pat=1
+flg=g
+br0=1
+[end]
+
+[tricky201]
+str=9
+pat=9
+flg=g
+br0=9
+[end]
+
+[tricky202]
+str=b
+pat=b
+flg=g
+br0=b
+[end]
+
+[tricky203]
+str=B
+pat=B
+flg=g
+br0=B
+[end]
+
+[tricky204]
+str=<
+pat=<
+flg=g
+br0=<
+[end]
+
+[tricky205]
+str=>
+pat=>
+flg=g
+br0=>
+[end]
+
+[tricky206]
+str=w
+pat=w
+flg=g
+br0=w
+[end]
+
+[tricky207]
+str=W
+pat=W
+flg=g
+br0=W
+[end]
+
+[tricky208]
+str=`
+pat=`
+flg=g
+br0=`
+[end]
+
+[tricky209]
+str=
+pat=
+flg=g
+br0=
+[end]
+
+[tricky210]
+str=\n
+pat=\n
+flg=g
+br0=\n
+[end]
+
+[tricky211]
+str=,
+pat=,
+flg=g
+br0=,
+[end]
+
+[tricky212]
+str=a
+pat=a
+flg=g
+br0=a
+[end]
+
+[tricky213]
+str=f
+pat=f
+flg=g
+br0=f
+[end]
+
+[tricky214]
+str=n
+pat=n
+flg=g
+br0=n
+[end]
+
+[tricky215]
+str=r
+pat=r
+flg=g
+br0=r
+[end]
+
+[tricky216]
+str=t
+pat=t
+flg=g
+br0=t
+[end]
+
+[tricky217]
+str=v
+pat=v
+flg=g
+br0=v
+[end]
+
+[tricky218]
+str=c
+pat=c
+flg=g
+br0=c
+[end]
+
+[tricky219]
+str=x
+pat=x
+flg=g
+br0=x
+[end]
+
+[tricky220]
+str=:
+pat=:
+flg=g
+br0=:
+[end]
+
+[tricky221]
+str=w.a.b
+pat=(\.[[:alnum:]]+){2}
+flg=g
+br0=.a.b
+br1=.b
+[end]
+
+[tricky222]
+str=foobar
+pat=(?!foo)bar
+flg=g
+br0=bar
+[end]
+
+[tricky223]
+str=??bar
+pat=(?!foo)bar
+flg=g
+br0=bar
+[end]
+
+[tricky224]
+str=barfoo
+pat=(?!foo)bar
+flg=g
+br0=bar
+[end]
+
+[tricky225]
+str=bar??
+pat=(?!foo)bar
+flg=g
+br0=bar
+[end]
+
+[tricky226]
+str=bar
+pat=(?!foo)bar
+flg=g
+br0=bar
+[end]
+
+[tricky227]
+str=a\nb
+pat=a\Z
+flg=g
+[end]
+
+[tricky228]
+str=abc
+pat=()
+flg=g
+br0=
+br1=
+br2=
+br3=
+br4=
+br5=
+br6=
+br7=
+[end]
+
+[tricky229]
+str=abc
+pat=^()
+flg=g
+br0=
+br1=
+[end]
+
+[tricky230]
+str=abc
+pat=^()+
+flg=g
+br0=
+br1=
+[end]
+
+[tricky231]
+str=abc
+pat=^(){1}
+flg=g
+br0=
+br1=
+[end]
+
+[tricky232]
+str=abc
+pat=^(){2}
+flg=g
+br0=
+br1=
+[end]
+
+[tricky233]
+str=abc
+pat=^((){2})
+flg=g
+br0=
+br1=
+br2=
+[end]
+
+[tricky234]
+str=a
+pat=()\1
+flg=g
+br0=
+br1=
+br2=
+br3=
+[end]
+
+[tricky235]
+str=ab
+pat=a()\1b
+flg=g
+br0=ab
+br1=
+[end]
+
+[tricky236]
+str=ab
+pat=a()b\1
+flg=g
+br0=ab
+br1=
+[end]
+
+[tricky237]
+str=abcbc
+pat=([a-c]+)\1
+flg=g
+br0=bcbc
+br1=bc
+[end]
+
+[tricky238]
+str=xxxxxxxxyyyyyyyyab
+pat=.+abc
+flg=g
+[end]
+
+[tricky239]
+str=abcdxxxyyyxxxyyy
+pat=(.+)\1
+flg=g
+br0=xxxyyyxxxyyy
+br1=xxxyyy
+[end]
+
+[tricky240]
+str=___________________________________________x
+pat=[_]+$
+flg=g
+[end]
+
+;[tricky241]
+;str=abcXYZ
+;pat=\l+
+;flg=gi
+;br0=abcXYZ
+;[end]
+
+;[tricky242]
+;str=abcXYZ
+;pat=\u+
+;flg=gi
+;br0=abcXYZ
+;[end]
+
+; Boost.Regex bug
+[tricky243]
+str=abcd
+pat=a(b|(((c))*))+d
+flg=g
+br0=abcd
+;br1=c
+;br2=c
+;br3=c
+br1=
+br2=
+br3=
+br4=c
+[end]
+
+[replace1]
+str=acab
+pat=(a(c)?)|(b)
+flg=iga
+sub=(?1(?2(C:):A):B:)
+res=C:AB:
+br0=ac
+br1=ac
+br2=c
+br3=
+br4=a
+br5=a
+br6=
+br7=
+br8=b
+br9=
+br10=
+br11=b
+[end]
+
+[track2157.1]
+str=abc\ndef\nghi
+pat=^.+$
+flg=m
+br0=abc
+[end]
+
+[track2157.2]
+str=abc\ndef\nghi
+pat=.$
+flg=m
+br0=c
+[end]
+
+[track2157.3]
+str=abc\ndef\nghi
+pat=^.+$
+flg=
+[end]
+
+[track2157.4]
+str=abc\ndef\nghi
+pat=.$
+flg=
+br0=i
+[end]
+
+[track2157.5]
+str=abc\r\ndef\r\nghi
+pat=^.+$
+flg=m
+br0=abc
+[end]
+
+[track2157.6]
+str=abc\r\ndef\r\nghi
+pat=.$
+flg=m
+br0=c
+[end]
+
+[nocasealternate]
+str=common HighLight and Blow this
+pat=highlight|blow
+flg=ig
+sub=<b>$&</b>
+res=common <b>HighLight</b> and <b>Blow</b> this
+br0=HighLight
+br1=Blow
+[end]
+
+[track2296]
+str=> ""
+pat=(?P<f>.+):(?P<l>[0-9]+):((?P<c>[0-9]+):)?.*
+flg=
+[end]
diff --git a/src/boost/libs/xpressive/test/regress_u.cpp b/src/boost/libs/xpressive/test/regress_u.cpp
new file mode 100644
index 000000000..7d15bfbc5
--- /dev/null
+++ b/src/boost/libs/xpressive/test/regress_u.cpp
@@ -0,0 +1,15 @@
+//////////////////////////////////////////////////////////////////////////////
+// regress_u.cpp
+//
+// (C) Copyright Eric Niebler 2004.
+// 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)
+
+/*
+ Revision history:
+ 6 January 2006 : Initial version.
+*/
+
+#define BOOST_XPRESSIVE_TEST_WREGEX
+#include "./regress.ipp"
diff --git a/src/boost/libs/xpressive/test/test.hpp b/src/boost/libs/xpressive/test/test.hpp
new file mode 100644
index 000000000..d4b3deae5
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test.hpp
@@ -0,0 +1,184 @@
+///////////////////////////////////////////////////////////////////////////////
+// test.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#ifndef BOOST_XPRESSIVE_TEST_TEST_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_TEST_TEST_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <string>
+#include <vector>
+#include <cstdio>
+#include <cstdarg>
+#include <functional>
+#include <boost/range/iterator_range.hpp>
+#include <boost/xpressive/xpressive_static.hpp>
+#include <boost/test/unit_test.hpp>
+
+using namespace boost::unit_test;
+using namespace boost::xpressive;
+
+#define L(x) BOOST_XPR_CSTR_(char_type, x)
+
+#define BOOST_XPR_CHECK(pred) \
+ if( pred ) {} else { BOOST_ERROR( this->section_ << " : " << #pred ); }
+
+using namespace boost::xpressive;
+
+///////////////////////////////////////////////////////////////////////////////
+// backrefs
+//
+#if defined(__cplusplus_cli)
+#pragma managed(push, off)
+#endif
+template<typename Char>
+inline std::vector<std::basic_string<Char> > backrefs(Char const *br0, ...)
+{
+ using namespace std;
+ std::vector<std::basic_string<Char> > backrefs;
+ if(0 != br0)
+ {
+ backrefs.push_back(br0);
+ va_list va;
+ va_start(va, br0);
+ Char const *brN;
+ while(0 != (brN = va_arg(va, Char const *)))
+ {
+ backrefs.push_back(brN);
+ }
+ va_end(va);
+ }
+ return backrefs;
+}
+#if defined(__cplusplus_cli)
+#pragma managed(pop)
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+//
+struct no_match_t {};
+no_match_t const no_match = {};
+
+///////////////////////////////////////////////////////////////////////////////
+// xpr_test_case
+//
+template<typename BidiIter>
+struct xpr_test_case
+{
+ typedef BidiIter iterator_type;
+ typedef typename boost::iterator_value<iterator_type>::type char_type;
+ typedef basic_regex<iterator_type> regex_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef std::vector<string_type> backrefs_type;
+
+ xpr_test_case(std::string section, string_type str, regex_type rex, backrefs_type brs)
+ : section_(section)
+ , str_(str)
+ , rex_(rex)
+ , brs_(brs)
+ {
+ }
+
+ xpr_test_case(std::string section, string_type str, regex_type rex, no_match_t)
+ : section_(section)
+ , str_(str)
+ , rex_(rex)
+ , brs_()
+ {
+ }
+
+ void run() const
+ {
+ char_type const empty[] = {0};
+ match_results<BidiIter> what;
+ if(regex_search(this->str_, what, this->rex_))
+ {
+ // match succeeded: was it expected to succeed?
+ BOOST_XPR_CHECK(what.size() == this->brs_.size());
+
+ for(std::size_t i = 0; i < what.size() && i < this->brs_.size(); ++i)
+ {
+ BOOST_XPR_CHECK((!what[i].matched && this->brs_[i] == empty) || this->brs_[i] == what[i].str());
+ }
+ }
+ else
+ {
+ // match failed: was it expected to fail?
+ BOOST_XPR_CHECK(0 == this->brs_.size());
+ }
+ }
+
+private:
+
+ std::string section_;
+ string_type str_;
+ regex_type rex_;
+ std::vector<string_type> brs_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// test_runner
+template<typename BidiIter>
+struct test_runner
+{
+ typedef xpr_test_case<BidiIter> argument_type;
+ typedef void result_type;
+
+ void operator ()(xpr_test_case<BidiIter> const &test) const
+ {
+ test.run();
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// helpful debug routines
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// remove all occurances of sz from str
+inline void string_remove(std::string &str, char const *sz)
+{
+ std::string::size_type i = 0, n = std::strlen(sz);
+ while(std::string::npos != (i=str.find(sz,i)))
+ {
+ str.erase(i,n);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// display_type2
+// for type T, write typeid::name after performing some substitutions
+template<typename T>
+inline void display_type2()
+{
+ std::string str = typeid(T).name();
+
+ string_remove(str, "struct ");
+ string_remove(str, "boost::");
+ string_remove(str, "xpressive::");
+ string_remove(str, "detail::");
+ string_remove(str, "fusion::");
+
+ //std::printf("%s\n\n", str.c_str());
+ std::printf("%s\nwdith=%d\nuse_simple_repeat=%s\n\n", str.c_str()
+ , detail::width_of<T, char>::value
+ , detail::use_simple_repeat<T, char>::value ? "true" : "false");
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// display_type
+// display the type of the deduced template argument
+template<typename T>
+inline void display_type(T const &)
+{
+ display_type2<T>();
+}
+
+#endif
diff --git a/src/boost/libs/xpressive/test/test1.cpp b/src/boost/libs/xpressive/test/test1.cpp
new file mode 100644
index 000000000..f272ee189
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test1.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test1.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test1.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test1");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test1.hpp b/src/boost/libs/xpressive/test/test1.hpp
new file mode 100644
index 000000000..4eebdcdb5
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test1.hpp
@@ -0,0 +1,139 @@
+///////////////////////////////////////////////////////////////////////////////
+// test1.h
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test1"
+ , L("foobarboo")
+ , regex_type(as_xpr(L("foo")))
+ , backrefs(L("foo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test2"
+ , L("foobarboo")
+ , regex_type(as_xpr(L("bar")))
+ , backrefs(L("bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test3"
+ , L("foobarboo")
+ , regex_type(as_xpr(L("bat")))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test4"
+ , L("foobarboo")
+ , regex_type(L('b') >> *_ >> L("ar"))
+ , backrefs(L("bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test5"
+ , L("foobarboo")
+ , regex_type(L('b') >> *_ >> L('r'))
+ , backrefs(L("bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test6"
+ , L("foobarboo")
+ , regex_type(L('b') >> *_ >> L('b'))
+ , backrefs(L("barb"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test7"
+ , L("foobarboo")
+ , regex_type(L('b') >> *_ >> L('o'))
+ , backrefs(L("barboo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test8"
+ , L("foobarboo")
+ , regex_type(L('b') >> *_ >> L("oo"))
+ , backrefs(L("barboo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test9"
+ , L("foobarboo")
+ , regex_type(L('b') >> +_ >> L("ar"))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test10"
+ , L("foobarboo")
+ , regex_type(L('b') >> +_ >> L('r'))
+ , backrefs(L("bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test11"
+ , L("foobarboo")
+ , regex_type(L('b') >> +_ >> L('b'))
+ , backrefs(L("barb"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test12"
+ , L("foobarboo")
+ , regex_type(L('b') >> +_ >> L('o'))
+ , backrefs(L("barboo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test13"
+ , L("foobarboo")
+ , regex_type(L('b') >> +_ >> L("oo"))
+ , backrefs(L("barboo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test14"
+ , L("foobarboo")
+ , regex_type(bos >> L("foo"))
+ , backrefs(L("foo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test15"
+ , L("foobarboo")
+ , regex_type(bos >> L('b') >> *_ >> L("ar"))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test15.1"
+ , L("fOo")
+ , regex_type(!icase(L('f') >> *as_xpr(L('o'))))
+ , backrefs(L("fOo"), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
+
diff --git a/src/boost/libs/xpressive/test/test10.cpp b/src/boost/libs/xpressive/test/test10.cpp
new file mode 100644
index 000000000..a6281a286
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test10.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test10.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test10.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test10");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test10.hpp b/src/boost/libs/xpressive/test/test10.hpp
new file mode 100644
index 000000000..28f1afad5
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test10.hpp
@@ -0,0 +1,65 @@
+///////////////////////////////////////////////////////////////////////////////
+// test10.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test16"
+ , L("foobarboo")
+ , regex_type(L('b') >> +_ >> L("ar") >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test17"
+ , L("foobarboo")
+ , regex_type(L('b') >> +_ >> L('o') >> eos)
+ , backrefs(L("barboo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test18"
+ , L("foobarboo")
+ , regex_type(L('b') >> +_ >> L("oo") >> eos)
+ , backrefs(L("barboo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test19"
+ , L("+1234.56789F")
+ , regex_type(bos >> (s1= !(set=L('-'),L('+')) >> +range(L('0'),L('9'))
+ >> !(s2= L('.') >> *range(L('0'),L('9'))))
+ >> (s3= (set=L('C'),L('F'))) >> eos)
+ , backrefs(L("+1234.56789F"), L("+1234.56789"), L(".56789"), L("F"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test20"
+ , L("+1234.56789")
+ , regex_type( !(s1= as_xpr(L('+'))|L('-')) >> (s2= +range(L('0'),L('9')) >> !as_xpr(L('.')) >> *range(L('0'),L('9')) |
+ L('.') >> +range(L('0'),L('9'))) >> !(s3= (set=L('e'),L('E')) >> !(s4= as_xpr(L('+'))|L('-')) >> +range(L('0'),L('9'))))
+ , backrefs(L("+1234.56789"), L("+"), L("1234.56789"), L(""), L(""), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
+
diff --git a/src/boost/libs/xpressive/test/test10u.cpp b/src/boost/libs/xpressive/test/test10u.cpp
new file mode 100644
index 000000000..926faaed9
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test10u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test10.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test10.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test10u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test11.cpp b/src/boost/libs/xpressive/test/test11.cpp
new file mode 100644
index 000000000..230b3b1ee
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test11.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test11.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test11.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test11");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test11.hpp b/src/boost/libs/xpressive/test/test11.hpp
new file mode 100644
index 000000000..0c920effd
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test11.hpp
@@ -0,0 +1,83 @@
+///////////////////////////////////////////////////////////////////////////////
+// test11.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test166"
+ , L("G")
+ , regex_type(L('f') | icase(L('g')))
+ , backrefs(L("G"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test167"
+ , L("aBBa")
+ , regex_type(icase(+lower))
+ , backrefs(L("aBBa"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test168"
+ , L("aA")
+ , regex_type(icase(+as_xpr(L('\x61'))))
+ , backrefs(L("aA"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test169"
+ , L("aA")
+ , regex_type(icase(+set[L('\x61')]))
+ , backrefs(L("aA"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test170"
+ , L("aA")
+ , regex_type(icase(+as_xpr(L('\x0061'))))
+ , backrefs(L("aA"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test171"
+ , L("aA")
+ , regex_type(icase(+set[L('\x0061')]))
+ , backrefs(L("aA"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test172"
+ , L("abcd")
+ , regex_type(L('a') >> +(s1= L('b') | (s2= *(s3= L('c')))) >> L('d'))
+ , backrefs(L("abcd"), L(""), L(""), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test173"
+ , L("abcd")
+ , regex_type(L('a') >> +(s1= L('b') | (s2= !(s3= L('c')))) >> L('d'))
+ , backrefs(L("abcd"), L(""), L(""), L(""), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
+
diff --git a/src/boost/libs/xpressive/test/test11u.cpp b/src/boost/libs/xpressive/test/test11u.cpp
new file mode 100644
index 000000000..533da6c17
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test11u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test11u.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test11.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test11u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test1u.cpp b/src/boost/libs/xpressive/test/test1u.cpp
new file mode 100644
index 000000000..ca975fa58
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test1u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test1.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test1.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test1u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test2.cpp b/src/boost/libs/xpressive/test/test2.cpp
new file mode 100644
index 000000000..2baf9ae4f
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test2.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test2.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test2.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test2");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test2.hpp b/src/boost/libs/xpressive/test/test2.hpp
new file mode 100644
index 000000000..d3de9aba2
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test2.hpp
@@ -0,0 +1,173 @@
+///////////////////////////////////////////////////////////////////////////////
+// test2.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ // "(\\+|-)?([0-9]+\\.?[0-9]*|\\.[0-9]+)([eE](\\+|-)?[0-9]+)?"
+ static regex_type const test21 = !(s1= as_xpr(L('+'))|L('-')) >> (s2= +range(L('0'),L('9')) >> !as_xpr(L('.')) >> *range(L('0'),L('9')) |
+ L('.') >> +range(L('0'),L('9'))) >> !(s3= (set=L('e'),L('E')) >> !(s4= as_xpr(L('+'))|L('-')) >> +range(L('0'),L('9')));
+
+ // "^(\\+|-)?([0-9]+\\.?[0-9]*|\\.[0-9]+)([eE](\\+|-)?[0-9]+)?$"
+ static regex_type const test23 = bos >> test21 >> eos;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test21"
+ , L("-1234.56789")
+ , test21
+ , backrefs(L("-1234.56789"), L("-"), L("1234.56789"), L(""), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test22"
+ , L("-1234.56789e-123123123")
+ , test21
+ , backrefs(L("-1234.56789e-123123123"), L("-"), L("1234.56789"), L("e-123123123"), L("-"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test23"
+ , L("-.1234.56789")
+ , test23
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test24"
+ , L("-1234.56789e-12312e123")
+ , test23
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test25"
+ , L("aaaaaaaaac")
+ , regex_type(*as_xpr(L('a')) >> *as_xpr(L('a')) >> *as_xpr(L('a')) >> *as_xpr(L('a')) >> *as_xpr(L('a')) >> L('b'))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test26"
+ , L("ThIs iS a TeSt")
+ , regex_type(*set[range(L('a'),L('z')) | range(L('A'),L('Z'))])
+ , backrefs(L("ThIs"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test27"
+ , L("a^b")
+ , regex_type(L('a') >> bos >> L('b'))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test28"
+ , L("a^b")
+ , regex_type(as_xpr(L("a^b")))
+ , backrefs(L("a^b"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test29"
+ , L("a^b")
+ , regex_type(L('a') >> ~set[L(' ')] >> L('b'))
+ , backrefs(L("a^b"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test30"
+ , L("a^b")
+ , regex_type(L('a') >> ~set[L('^')] >> L('b'))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test31"
+ , L("a^b")
+ , regex_type(L('a') >> ~set[L('^')] >> L('b'))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test31.1"
+ , L("a^b")
+ , regex_type(L('a') >> set[L('^')] >> L('b'))
+ , backrefs(L("a^b"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test32"
+ , L("foobazFOObar")
+ , regex_type(icase(L("foo") >> before(L("bar"))))
+ , backrefs(L("FOO"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test33"
+ , L("foobarFOObaz")
+ , regex_type(icase(L("foo") >> ~before(L("bar"))))
+ , backrefs(L("FOO"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test34"
+ , L("foobarFOO")
+ , regex_type(icase(L("foo") >> ~before(L("bar"))))
+ , backrefs(L("FOO"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test35"
+ , L("foobarFOObarfoo")
+ , regex_type(icase(+(s1= keep(s2= L("foo")) >> L("bar"))))
+ , backrefs(L("foobarFOObar"), L("FOObar"), L("FOO"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test37"
+ , L("foobar")
+ , regex_type(+(s1= L("bar") | (s2= L("foo"))))
+ , backrefs(L("foobar"), L("bar"), L("foo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test38"
+ , L("foobar")
+ , regex_type(+(s1= (s2= L("bar")) | L("foo")))
+ , backrefs(L("foobar"), L("bar"), L("bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test39"
+ , L("foobar")
+ , regex_type(+(s1= L("foo") | (s2= L("bar"))))
+ , backrefs(L("foobar"), L("bar"), L("bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test40"
+ , L("foobar")
+ , regex_type(+(s1= (s2= L("foo")) | L("bar")))
+ , backrefs(L("foobar"), L("bar"), L("foo"), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
diff --git a/src/boost/libs/xpressive/test/test2u.cpp b/src/boost/libs/xpressive/test/test2u.cpp
new file mode 100644
index 000000000..9ca9b84b9
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test2u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test2.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test2.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test2u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test3.cpp b/src/boost/libs/xpressive/test/test3.cpp
new file mode 100644
index 000000000..eb1f2da1e
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test3.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test3.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test3.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test3");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test3.hpp b/src/boost/libs/xpressive/test/test3.hpp
new file mode 100644
index 000000000..67e6a37d8
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test3.hpp
@@ -0,0 +1,196 @@
+///////////////////////////////////////////////////////////////////////////////
+// test3.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test41"
+ , L("foobarFOObarfoo")
+ , regex_type((s1= icase(L("FOO"))) >> (s2= -*_) >> s1)
+ , backrefs(L("foobarFOObarfoo"), L("foo"), L("barFOObar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test42"
+ , L("foobarFOObarfoo")
+ , regex_type((s1= icase(L("FOO"))) >> (s2= -*_) >> icase(s1))
+ , backrefs(L("foobarFOO"), L("foo"), L("bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test42.1"
+ , L("fooFOOOFOOOOObar")
+ , regex_type(+(s1= L("foo") | icase(s1 >> L('O'))))
+ , backrefs(L("fooFOOOFOOOO"), L("FOOOO"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test43"
+ , L("zoo")
+ , regex_type(bos >> set[range(L('A'),L('Z')) | range(L('a'),L('m'))])
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test44"
+ , L("Here is a URL: http://www.cnn.com. OK?")
+ , regex_type((s1= L("http") >> !as_xpr(L('s')) >> L(":/") | L("www."))
+ >> +set[_w | (set=L('.'),L('/'),L(','),L('?'),L('@'),L('#'),L('%'),L('!'),L('_'),L('='),L('~'),L('&'),L('-'))]
+ >> _w)
+ , backrefs(L("http://www.cnn.com"), L("http:/"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test45"
+ , L("fooooooooo")
+ , regex_type(L('f') >> repeat<2,5>(L('o')))
+ , backrefs(L("fooooo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test46"
+ , L("fooooooooo")
+ , regex_type(L('f') >> -repeat<2,5>(L('o')))
+ , backrefs(L("foo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test45.1"
+ , L("fooooooooo")
+ , regex_type(L('f') >> repeat<2,5>(L('o')) >> L('o'))
+ , backrefs(L("foooooo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test46.1"
+ , L("fooooooooo")
+ , regex_type(L('f') >> -repeat<2,5>(L('o')) >> L('o'))
+ , backrefs(L("fooo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test47"
+ , L("{match this}")
+ , regex_type(bos >> L('{') >> *_ >> L('}') >> eos)
+ , backrefs(L("{match this}"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test48"
+ , L("+-+-")
+ , regex_type(+(set=L('+'),L('-')))
+ , backrefs(L("+-+-"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test49"
+ , L("+-+-")
+ , regex_type(+(set=L('-'),L('+')))
+ , backrefs(L("+-+-"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test50"
+ , L("\\05g-9e")
+ , regex_type(+set[_d | L('-') | L('g')])
+ , backrefs(L("05g-9"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test51"
+ , L("\\05g-9e")
+ , regex_type(+set[_d | L('-') | L('g')])
+ , backrefs(L("05g-9"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test52"
+ , L("\\05g-9e")
+ , regex_type(+set[L('g') | as_xpr(L('-')) | _d])
+ , backrefs(L("05g-9"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test53"
+ , L("\\05g-9e")
+ , regex_type(+set[L('g') | as_xpr(L('-')) | _d])
+ , backrefs(L("05g-9"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test54"
+ , L("aBcdefg\\")
+ , regex_type(icase(+range(L('a'),L('g'))))
+ , backrefs(L("aBcdefg"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test55"
+ , L("ab/.-ba")
+ , regex_type(+range(L('-'),L('/')))
+ , backrefs(L("/.-"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test56"
+ , L("ab+,-ba")
+ , regex_type(+range(L('+'),L('-')))
+ , backrefs(L("+,-"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test56.1"
+ , L("aaabbbb----")
+ , regex_type(+range(L('b'),L('b')))
+ , backrefs(L("bbbb"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test57"
+ , L("foobarFOO5")
+ , regex_type(icase((s1= L("foo")) >> *_ >> L('\15')))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test58"
+ , L("Her number is 804-867-5309.")
+ , regex_type(repeat<2>(repeat<3>(_d) >> L('-')) >> repeat<4>(_d))
+ , backrefs(L("804-867-5309"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test59"
+ , L("foo")
+ , regex_type(L('f') >> +as_xpr(L('o')))
+ , backrefs(L("foo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test60"
+ , L("fooFOObar")
+ , regex_type(icase(+(s1= L("foo")) >> L("foobar")))
+ , backrefs(L("fooFOObar"), L("foo"), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
diff --git a/src/boost/libs/xpressive/test/test3u.cpp b/src/boost/libs/xpressive/test/test3u.cpp
new file mode 100644
index 000000000..550f4e0b8
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test3u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test3.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test3.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test3u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test4.cpp b/src/boost/libs/xpressive/test/test4.cpp
new file mode 100644
index 000000000..2e4495483
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test4.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test4.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test4.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test4");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test4.hpp b/src/boost/libs/xpressive/test/test4.hpp
new file mode 100644
index 000000000..98c17df4a
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test4.hpp
@@ -0,0 +1,109 @@
+///////////////////////////////////////////////////////////////////////////////
+// test4.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ // for testing recursive static regexes
+ //regex_type parens = L('(') >> *( keep( +~(set=L('('),L(')')) ) | self ) >> L(')');
+
+ regex_type parens;
+ parens = L('(') >> *( keep( +~(set=L('('),L(')')) ) | by_ref(parens) ) >> L(')');
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test61"
+ , L("this is sublist(now(is(the(time),for(all),good(men))to(come)))ok?")
+ , regex_type(_b >> L("sublist") >> parens)
+ , backrefs(L("sublist(now(is(the(time),for(all),good(men))to(come)))"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test62"
+ , L("this is sublist(now(is(the(time),for(all),good(men))to(come))ok?")
+ , regex_type(_b >> L("sublist") >> parens)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test63"
+ , L("foobar")
+ , regex_type(bos >> L("baz") | L("bar"))
+ , backrefs(L("bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test69"
+ , L("FooBarfoobar")
+ , regex_type(icase(*_ >> L("foo")))
+ , backrefs(L("FooBarfoo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test70"
+ , L("FooBarfoobar")
+ , regex_type(icase(*_ >> L("boo")))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test71"
+ , L("FooBarfoobar")
+ , regex_type(icase(*_ >> L("boo") | L("bar")))
+ , backrefs(L("Bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test72"
+ , L("FooBarfoobar")
+ , regex_type(icase(L("bar")))
+ , backrefs(L("Bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test75"
+ , L("fooooo")
+ , regex_type(L('f') >> repeat<1,repeat_max>(L('o')))
+ , backrefs(L("fooooo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test78"
+ , L("This (has) parens")
+ , regex_type(L("This ") >> (s1= L("(has)")) >> L(' ') >> (s2= L("parens")))
+ , backrefs(L("This (has) parens"), L("(has)"), L("parens"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test79"
+ , L("This (has) parens")
+ , regex_type(as_xpr(L("This (has) parens")))
+ , backrefs(L("This (has) parens"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test80"
+ , L("This (has) parens")
+ , regex_type(as_xpr(L("This (has) parens")))
+ , backrefs(L("This (has) parens"), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
diff --git a/src/boost/libs/xpressive/test/test4u.cpp b/src/boost/libs/xpressive/test/test4u.cpp
new file mode 100644
index 000000000..c941502ea
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test4u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test4.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test4.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test4u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test5.cpp b/src/boost/libs/xpressive/test/test5.cpp
new file mode 100644
index 000000000..c1640cae9
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test5.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test5.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test5.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test5");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test5.hpp b/src/boost/libs/xpressive/test/test5.hpp
new file mode 100644
index 000000000..b8ed5ffac
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test5.hpp
@@ -0,0 +1,159 @@
+///////////////////////////////////////////////////////////////////////////////
+// test5.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test82"
+ , L("abba1234abba")
+ , regex_type(+_d)
+ , backrefs(L("1234"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test83"
+ , L("1234abba1234")
+ , regex_type(+~_d)
+ , backrefs(L("abba"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test84"
+ , L("abba1234abba")
+ , regex_type(+set[_d])
+ , backrefs(L("1234"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test85"
+ , L("1234abba1234")
+ , regex_type(+set[~_d])
+ , backrefs(L("abba"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test86"
+ , L("abba1234abba")
+ , regex_type(+~set[~_d])
+ , backrefs(L("1234"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test87"
+ , L("1234abba1234")
+ , regex_type(+~set[_d])
+ , backrefs(L("abba"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test88"
+ , L("1234abba1234")
+ , regex_type(+set[~_w | ~_d])
+ , backrefs(L("abba"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test89"
+ , L("1234(.;)abba")
+ , regex_type(+~set[_w | _d])
+ , backrefs(L("(.;)"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test90"
+ , L("(boo[bar]baz)")
+ , regex_type((s1= L('(') >> (s2= nil) | L('[') >> (s3= nil)) >> -*_ >> (s4= L(')') >> s2 | L(']') >> s3))
+ , backrefs(L("(boo[bar]baz)"), L("("), L(""), L(""), L(")"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test91"
+ , L("[boo(bar)baz]")
+ , regex_type((s1= L('(') >> (s2= nil) | L('[') >> (s3= nil)) >> -*_ >> (s4= L(')') >> s2 | L(']') >> s3))
+ , backrefs(L("[boo(bar)baz]"), L("["), L(""), L(""), L("]"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test91"
+ , L("[boo[bar]baz]")
+ , regex_type((s1= L('(') >> (s2= nil) | L('[') >> (s3= nil)) >> -*_ >> (s4= L(')') >> s2 | L(']') >> s3))
+ , backrefs(L("[boo[bar]"), L("["), L(""), L(""), L("]"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test92"
+ , L("foobarfoo")
+ , regex_type(after(L("foo")) >> L("bar"))
+ , backrefs(L("bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test93"
+ , L("foobarfoo")
+ , regex_type(after(s1= L('f') >> _ >> L('o')) >> L("bar"))
+ , backrefs(L("bar"), L("foo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test94"
+ , L("foOoo")
+ , regex_type(icase(after(s1= L("fo")) >> L('o')))
+ , backrefs(L("O"), L("fo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test95"
+ , L("fOooo")
+ , regex_type(icase(~after(s1= L("fo")) >> L('o')))
+ , backrefs(L("O"), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test96"
+ , L("12foo12")
+ , regex_type(+alpha)
+ , backrefs(L("foo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test97"
+ , L(";12foo12;")
+ , regex_type(+set[alpha | digit])
+ , backrefs(L("12foo12"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test98"
+ , L("aaaa")
+ , regex_type(after(s1= nil) >> L('a'))
+ , backrefs(L("a"), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test99"
+ , L("ABCabc123foo")
+ , regex_type(after(s1= L("abc") >> repeat<3>(_d)) >> L("foo"))
+ , backrefs(L("foo"), L("abc123"), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
diff --git a/src/boost/libs/xpressive/test/test5u.cpp b/src/boost/libs/xpressive/test/test5u.cpp
new file mode 100644
index 000000000..82a65fa46
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test5u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test5.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test5.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test5u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test6.cpp b/src/boost/libs/xpressive/test/test6.cpp
new file mode 100644
index 000000000..26f570a25
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test6.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test6.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test6.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test6");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test6.hpp b/src/boost/libs/xpressive/test/test6.hpp
new file mode 100644
index 000000000..20a628741
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test6.hpp
@@ -0,0 +1,124 @@
+///////////////////////////////////////////////////////////////////////////////
+// test6.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test103"
+ , L("a\nxb\n")
+ , regex_type(~before(bol) >> L('x'))
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test104"
+ , L("a\nxb\n")
+ , regex_type(~before(bos) >> L('x'))
+ , backrefs(L("x"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test105"
+ , L("a\nxb\n")
+ , regex_type(~before(bos) >> L('x'))
+ , backrefs(L("x"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test106"
+ , L("(this)")
+ , regex_type(bos >> (L('(') >> (s1= nil) | (s2= nil)) >> +_w >> (L(')') >> s1 | s2) >> eos)
+ , backrefs(L("(this)"), L(""), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test107"
+ , L("this")
+ , regex_type(bos >> (L('(') >> (s1= nil) | (s2= nil)) >> +_w >> (L(')') >> s1 | s2) >> eos)
+ , backrefs(L("this"), L(""), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test108"
+ , L("this)")
+ , regex_type(bos >> (L('(') >> (s1= nil) | (s2= nil)) >> +_w >> (L(')') >> s1 | s2) >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test109"
+ , L("(this")
+ , regex_type(bos >> (L('(') >> (s1= nil) | (s2= nil)) >> +_w >> (L(')') >> s1 | s2) >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test110"
+ , L("abba123abba")
+ , regex_type(+~alpha)
+ , backrefs(L("123"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test111"
+ , L("abba123abba")
+ , regex_type(+set[alpha | ~alpha])
+ , backrefs(L("abba123abba"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test112"
+ , L("123abba123")
+ , regex_type(+~set[~alpha])
+ , backrefs(L("abba"), nilbr)
+ )
+ //, xpr_test_case
+ // (
+ // "test113"
+ // , L("123abba123")
+ // , regex_type(as_xpr(L("[[:alpha:]\\y]+")))
+ // , backrefs(L("123abba123"), nilbr)
+ // )
+ , xpr_test_case
+ (
+ "test114"
+ , L("abba123abba")
+ , regex_type(+~set[~alnum | ~digit])
+ , backrefs(L("123"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test115"
+ , L("aaaaA")
+ , regex_type(icase(bos >> repeat<4>(s1= L('a') >> !s1) >> eos))
+ , backrefs(L("aaaaA"), L("A"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test116"
+ , L("aaaaAa")
+ , regex_type(icase(bos >> repeat<4>(s1= L('a') >> !s1) >> eos))
+ , backrefs(L("aaaaAa"), L("Aa"), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
diff --git a/src/boost/libs/xpressive/test/test6u.cpp b/src/boost/libs/xpressive/test/test6u.cpp
new file mode 100644
index 000000000..44a951f62
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test6u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test6.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test6.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test6u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test7.cpp b/src/boost/libs/xpressive/test/test7.cpp
new file mode 100644
index 000000000..de1ac5f8b
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test7.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test7.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test7.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test7");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test7.hpp b/src/boost/libs/xpressive/test/test7.hpp
new file mode 100644
index 000000000..998c99418
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test7.hpp
@@ -0,0 +1,124 @@
+///////////////////////////////////////////////////////////////////////////////
+// test7.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test127"
+ , L("foobar")
+ , regex_type(as_xpr(L("foo")) >> /*This is a comment[*/ L("bar"))
+ , backrefs(L("foobar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test128"
+ , L("foobar")
+ , regex_type(bos >> L("foobar") >> eos)
+ , backrefs(L("foobar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test129"
+ , L("foobar")
+ , regex_type(bos >> L('f') >> *as_xpr(L('o')))
+ , backrefs(L("foo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test129.1"
+ , L("foobar")
+ , regex_type(bos >> L('f') >> *as_xpr(L('\157')))
+ , backrefs(L("foo"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test130"
+ , L("foo bar")
+ , regex_type(bos >> L("foo bar") >> eos)
+ , backrefs(L("foo bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test131"
+ , L("foo bar")
+ , regex_type(bos >> L("foo") >> set[L(' ')] >> L("bar") >> eos)
+ , backrefs(L("foo bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test132"
+ , L("foo bar")
+ , regex_type(bos >> (L("foo") >> set[L(' ')] >> L("bar")) >> eos /*This is a comment*/)
+ , backrefs(L("foo bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test133"
+ , L("foo bar")
+ , regex_type(bos >> L("foo") >> set[L(' ')] >> L("bar") /*This is a comment*/)
+ , backrefs(L("foo bar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test134"
+ , L("foo bar#Thisisnotacomment")
+ , regex_type(bos >> L("foo") >> set[L(' ')] >> L("bar#Thisisnotacomment"))
+ , backrefs(L("foo bar#Thisisnotacomment"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test135"
+ , L("f oo b ar")
+ , regex_type(bos >> L("f oo b ar"))
+ , backrefs(L("f oo b ar"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test137"
+ , L("a--")
+ , regex_type(bos >> *(s1= optional(L('a'))) >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test138"
+ , L("a--")
+ , regex_type(bos >> -*(s1= optional(L('a'))) >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test139"
+ , L("bc")
+ , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bc"), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test140"
+ , L("bbc")
+ , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bbc"), L(""), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
diff --git a/src/boost/libs/xpressive/test/test7u.cpp b/src/boost/libs/xpressive/test/test7u.cpp
new file mode 100644
index 000000000..53e6613bd
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test7u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test7.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test7.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test7u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test8.cpp b/src/boost/libs/xpressive/test/test8.cpp
new file mode 100644
index 000000000..e9e505895
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test8.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test8.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test8.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test8");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test8.hpp b/src/boost/libs/xpressive/test/test8.hpp
new file mode 100644
index 000000000..360e9bbb1
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test8.hpp
@@ -0,0 +1,96 @@
+///////////////////////////////////////////////////////////////////////////////
+// test8.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test141"
+ , L("bbbc")
+ , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bbbc"), L("b"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test142"
+ , L("bbbbc")
+ , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test143"
+ , L("bbbbc")
+ , regex_type(bos >> *(s1= optional(L('b'))) >> L('d') >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test144"
+ , L("bc")
+ , regex_type(bos >> -repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bc"), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test145"
+ , L("bbc")
+ , regex_type(bos >> -repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bbc"), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test146"
+ , L("bbbc")
+ , regex_type(bos >> -repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bbbc"), L("b"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test147"
+ , L("bbbbc")
+ , regex_type(bos >> -repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test148"
+ , L("bbbbc")
+ , regex_type(bos >> -*(s1= optional(L('b'))) >> L('d') >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test149"
+ , L("bc")
+ , regex_type(bos >> repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bc"), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test150"
+ , L("bbc")
+ , regex_type(bos >> repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bbc"), L("b"), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
diff --git a/src/boost/libs/xpressive/test/test8u.cpp b/src/boost/libs/xpressive/test/test8u.cpp
new file mode 100644
index 000000000..6cb75efc8
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test8u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test8.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test8.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test8u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test9.cpp b/src/boost/libs/xpressive/test/test9.cpp
new file mode 100644
index 000000000..c0f126d8f
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test9.cpp
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// test9.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test9.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+ typedef std::string::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test9");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test9.hpp b/src/boost/libs/xpressive/test/test9.hpp
new file mode 100644
index 000000000..3bab751d4
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test9.hpp
@@ -0,0 +1,110 @@
+///////////////////////////////////////////////////////////////////////////////
+// test9.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// get_test_cases
+//
+template<typename BidiIterT>
+boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
+{
+ typedef typename boost::iterator_value<BidiIterT>::type char_type;
+ typedef xpr_test_case<BidiIterT> xpr_test_case;
+ typedef basic_regex<BidiIterT> regex_type;
+
+ static char_type const *nilbr = 0;
+ static xpr_test_case const test_cases[] =
+ {
+ xpr_test_case
+ (
+ "test151"
+ , L("bbbc")
+ , regex_type(bos >> repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bbbc"), L("b"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test152"
+ , L("bbbbc")
+ , regex_type(bos >> repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test153"
+ , L("bbbbc")
+ , regex_type(bos >> *(s1= -optional(L('b'))) >> L('d') >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test154"
+ , L("bc")
+ , regex_type(bos >> -repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bc"), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test155"
+ , L("bbc")
+ , regex_type(bos >> -repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bbc"), L("b"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test156"
+ , L("bbbc")
+ , regex_type(bos >> -repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
+ , backrefs(L("bbbc"), L("b"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test157"
+ , L("bbbbc")
+ , regex_type(bos >> -repeat<2>(s1= -optional(L('b'))) >> L("bc") >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test158"
+ , L("bbbbc")
+ , regex_type(bos >> -*(s1= -optional(L('b'))) >> L('d') >> eos)
+ , no_match
+ )
+ , xpr_test_case
+ (
+ "test159"
+ , L("bbc")
+ , regex_type(bos >> *(s1= nil | nil | nil | L('b')) >> L("bc") >> eos)
+ , backrefs(L("bbc"), L(""), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test160"
+ , L("bbc")
+ , regex_type(bos >> -*(s1= nil | nil | nil | L('b')) >> L("bc") >> eos)
+ , backrefs(L("bbc"), L("b"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test164"
+ , L("1yzZ^aAc2")
+ , regex_type(icase(+range(L('Z'),L('a'))))
+ , backrefs(L("zZ^aA"), nilbr)
+ )
+ , xpr_test_case
+ (
+ "test165"
+ , L("1yzZ^aAc2")
+ , regex_type(+range(L('Z'),L('a')))
+ , backrefs(L("Z^a"), nilbr)
+ )
+ };
+
+ return boost::make_iterator_range(test_cases);
+}
diff --git a/src/boost/libs/xpressive/test/test9u.cpp b/src/boost/libs/xpressive/test/test9u.cpp
new file mode 100644
index 000000000..51b1986ed
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test9u.cpp
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////
+// test9.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include "./test9.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef std::wstring::const_iterator iterator_type;
+ boost::iterator_range<xpr_test_case<iterator_type> const *> rng = get_test_cases<iterator_type>();
+ std::for_each(rng.begin(), rng.end(), test_runner<iterator_type>());
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test9u");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test_actions.cpp b/src/boost/libs/xpressive/test/test_actions.cpp
new file mode 100644
index 000000000..44b443b56
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_actions.cpp
@@ -0,0 +1,287 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_actions.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+//#define BOOST_XPRESSIVE_BETTER_ERRORS
+
+#include <map>
+#include <list>
+#include <stack>
+#include <numeric>
+#include <boost/version.hpp>
+#include <boost/xpressive/xpressive_static.hpp>
+#include <boost/xpressive/regex_actions.hpp>
+#include <boost/test/unit_test.hpp>
+
+namespace xp = boost::xpressive;
+
+///////////////////////////////////////////////////////////////////////////////
+// test1
+// simple action which builds a string
+void test1()
+{
+ using namespace boost::xpressive;
+
+ std::string result;
+ std::string str("foo bar baz foo bar baz");
+ sregex rx = (+_w)[ xp::ref(result) += _ ] >> *(' ' >> (+_w)[ xp::ref(result) += ',' + _ ]);
+
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL(result, "foo,bar,baz,foo,bar,baz");
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test2
+// test backtracking over actions
+void test2()
+{
+ using namespace boost::xpressive;
+
+ std::string result;
+ std::string str("foo bar baz foo bar baz");
+ sregex rx = (+_w)[ xp::ref(result) += _ ] >> *(' ' >> (+_w)[ xp::ref(result) += ',' + _ ]) >> repeat<4>(_);
+
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL(result, "foo,bar,baz,foo,bar");
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test3
+// cast string to int, push back into list, use alternate ->* syntax
+void test3()
+{
+ using namespace boost::xpressive;
+
+ std::list<int> result;
+ std::string str("1 23 456 7890");
+#if BOOST_VERSION >= 103500
+ sregex rx = (+_d)[ xp::ref(result)->*push_back( as<int>(_) ) ]
+ >> *(' ' >> (+_d)[ xp::ref(result)->*push_back( as<int>(_) ) ]);
+#else
+ sregex rx = (+_d)[ push_back(xp::ref(result), as<int>(_) ) ]
+ >> *(' ' >> (+_d)[ push_back(xp::ref(result), as<int>(_) ) ]);
+#endif
+
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_REQUIRE_EQUAL(result.size(), 4u);
+ BOOST_CHECK_EQUAL(*result.begin(), 1);
+ BOOST_CHECK_EQUAL(*++result.begin(), 23);
+ BOOST_CHECK_EQUAL(*++++result.begin(), 456);
+ BOOST_CHECK_EQUAL(*++++++result.begin(), 7890);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test4
+// build a map of strings to integers
+void test4()
+{
+ using namespace boost::xpressive;
+
+ std::map<std::string, int> result;
+ std::string str("aaa=>1 bbb=>23 ccc=>456");
+ sregex pair = ( (s1= +_w) >> "=>" >> (s2= +_d) )[ xp::ref(result)[s1] = as<int>(s2) ];
+ sregex rx = pair >> *(+_s >> pair);
+
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_REQUIRE_EQUAL(result.size(), 3u);
+ BOOST_CHECK_EQUAL(result["aaa"], 1);
+ BOOST_CHECK_EQUAL(result["bbb"], 23);
+ BOOST_CHECK_EQUAL(result["ccc"], 456);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test4_aux
+// build a map of strings to integers, with a late-bound action argument.
+void test4_aux()
+{
+ using namespace boost::xpressive;
+ placeholder< std::map<std::string, int> > const _map = {{}};
+
+ sregex pair = ( (s1= +_w) >> "=>" >> (s2= +_d) )[ _map[s1] = as<int>(s2) ];
+ sregex rx = pair >> *(+_s >> pair);
+
+ std::string str("aaa=>1 bbb=>23 ccc=>456");
+ smatch what;
+ std::map<std::string, int> result;
+ what.let(_map = result); // bind the argument!
+
+ BOOST_REQUIRE(regex_match(str, what, rx));
+ BOOST_REQUIRE_EQUAL(result.size(), 3u);
+ BOOST_CHECK_EQUAL(result["aaa"], 1);
+ BOOST_CHECK_EQUAL(result["bbb"], 23);
+ BOOST_CHECK_EQUAL(result["ccc"], 456);
+
+ // Try the same test with regex_iterator
+ result.clear();
+ sregex_iterator it(str.begin(), str.end(), pair, let(_map=result)), end;
+ BOOST_REQUIRE_EQUAL(3, std::distance(it, end));
+ BOOST_REQUIRE_EQUAL(result.size(), 3u);
+ BOOST_CHECK_EQUAL(result["aaa"], 1);
+ BOOST_CHECK_EQUAL(result["bbb"], 23);
+ BOOST_CHECK_EQUAL(result["ccc"], 456);
+
+ // Try the same test with regex_token_iterator
+ result.clear();
+ sregex_token_iterator it2(str.begin(), str.end(), pair, (s1,s2), let(_map=result)), end2;
+ BOOST_REQUIRE_EQUAL(6, std::distance(it2, end2));
+ BOOST_REQUIRE_EQUAL(result.size(), 3u);
+ BOOST_CHECK_EQUAL(result["aaa"], 1);
+ BOOST_CHECK_EQUAL(result["bbb"], 23);
+ BOOST_CHECK_EQUAL(result["ccc"], 456);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test5
+// calculator that calculates. This is just silly, but hey.
+void test5()
+{
+ using namespace boost::xpressive;
+
+ // test for "local" variables.
+ local<int> left, right;
+
+ // test for reference<> to an existing variable
+ std::stack<int> stack_;
+ reference<std::stack<int> > stack(stack_);
+
+ std::string str("4+5*(3-1)");
+
+ sregex group, factor, term, expression;
+
+ group = '(' >> by_ref(expression) >> ')';
+ factor = (+_d)[ push(stack, as<int>(_)) ] | group;
+ term = factor >> *(
+ ('*' >> factor)
+ [ right = top(stack)
+ , pop(stack)
+ , left = top(stack)
+ , pop(stack)
+ , push(stack, left * right)
+ ]
+ | ('/' >> factor)
+ [ right = top(stack)
+ , pop(stack)
+ , left = top(stack)
+ , pop(stack)
+ , push(stack, left / right)
+ ]
+ );
+ expression = term >> *(
+ ('+' >> term)
+ [ right = top(stack)
+ , pop(stack)
+ , left = top(stack)
+ , pop(stack)
+ , push(stack, left + right)
+ ]
+ | ('-' >> term)
+ [ right = top(stack)
+ , pop(stack)
+ , left = top(stack)
+ , pop(stack)
+ , push(stack, left - right)
+ ]
+ );
+
+ if(!regex_match(str, expression))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_REQUIRE_EQUAL(stack_.size(), 1u);
+ BOOST_CHECK_EQUAL(stack_.top(), 14);
+
+ BOOST_REQUIRE_EQUAL(stack.get().size(), 1u);
+ BOOST_CHECK_EQUAL(stack.get().top(), 14);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test6
+// Test as<>() with wide strings. Bug #4496.
+void test6()
+{
+ using namespace boost::xpressive;
+
+ std::wstring version(L"0.9.500");
+
+ local<int> maj1(0), min1(0), build1(0);
+
+ wsregex re1 = (+_d)[maj1 = as<int>(_)] >> L"." >>
+ (+_d)[min1 = as<int>(_)] >> L"." >>
+ (+_d)[build1 = as<int>(_)];
+
+ BOOST_REQUIRE(regex_match(version, re1));
+
+ BOOST_CHECK_EQUAL(maj1.get(), 0);
+ BOOST_CHECK_EQUAL(min1.get(), 9);
+ BOOST_CHECK_EQUAL(build1.get(), 500);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test7
+// Test regex_replace with an xpressive lambda
+void test7()
+{
+ namespace xp = boost::xpressive;
+ using namespace xp;
+
+ std::map<std::string, std::string> env;
+ env["XXX"] = "!!!";
+ env["YYY"] = "???";
+
+ std::string text("This is a %XXX% string %YYY% and stuff.");
+ sregex var = '%' >> (s1 = +_w) >> '%';
+
+ text = regex_replace(text, var, xp::ref(env)[s1]);
+
+ BOOST_CHECK_EQUAL(text, "This is a !!! string ??? and stuff.");
+}
+
+using namespace boost::unit_test;
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test_actions");
+ test->add(BOOST_TEST_CASE(&test1));
+ test->add(BOOST_TEST_CASE(&test2));
+ test->add(BOOST_TEST_CASE(&test3));
+ test->add(BOOST_TEST_CASE(&test4));
+ test->add(BOOST_TEST_CASE(&test4_aux));
+ test->add(BOOST_TEST_CASE(&test5));
+ test->add(BOOST_TEST_CASE(&test6));
+ test->add(BOOST_TEST_CASE(&test7));
+ return test;
+}
+
diff --git a/src/boost/libs/xpressive/test/test_assert.cpp b/src/boost/libs/xpressive/test/test_assert.cpp
new file mode 100644
index 000000000..de0c0ae90
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_assert.cpp
@@ -0,0 +1,94 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_assert.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <iostream>
+#include <boost/xpressive/xpressive_static.hpp>
+#include <boost/xpressive/regex_actions.hpp>
+#include <boost/test/unit_test.hpp>
+
+using namespace boost::xpressive;
+
+bool three_or_six(ssub_match const &sub)
+{
+ return sub.length() == 3 || sub.length() == 6;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test1
+// simple custom assert that checks the length of a matched sub-expression
+void test1()
+{
+ std::string str("foo barbaz fink");
+ // match words of 3 characters or 6 characters.
+ sregex rx = (bow >> +_w >> eow)[ check(&three_or_six) ] ;
+
+ sregex_iterator first(str.begin(), str.end(), rx), last;
+ BOOST_CHECK_EQUAL(std::distance(first, last), 2);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test2
+// same as above, but using a lambda
+void test2()
+{
+ std::string str("foo barbaz fink");
+ // match words of 3 characters or 6 characters.
+ sregex rx = (bow >> +_w >> eow)[ check(length(_)==3 || length(_)==6) ] ;
+
+ sregex_iterator first(str.begin(), str.end(), rx), last;
+ BOOST_CHECK_EQUAL(std::distance(first, last), 2);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test3
+// more complicated use of custom assertions to validate a date
+void test3()
+{
+ int const days_per_month[] =
+ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 31, 31};
+
+ mark_tag month(1), day(2);
+ // find a valid date of the form month/day/year.
+ sregex date =
+ (
+ // Month must be between 1 and 12 inclusive
+ (month= _d >> !_d) [ check(as<int>(_) >= 1
+ && as<int>(_) <= 12) ]
+ >> '/'
+ // Day must be between 1 and 31 inclusive
+ >> (day= _d >> !_d) [ check(as<int>(_) >= 1
+ && as<int>(_) <= 31) ]
+ >> '/'
+ // Only consider years between 1970 and 2038
+ >> (_d >> _d >> _d >> _d) [ check(as<int>(_) >= 1970
+ && as<int>(_) <= 2038) ]
+ )
+ // Ensure the month actually has that many days.
+ [ check( ref(days_per_month)[as<int>(month)-1] >= as<int>(day) ) ]
+ ;
+
+ smatch what;
+ std::string str("99/99/9999 2/30/2006 2/28/2006");
+
+ BOOST_REQUIRE(regex_search(str, what, date));
+ BOOST_CHECK_EQUAL(what[0], "2/28/2006");
+}
+
+using namespace boost::unit_test;
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test_assert");
+ test->add(BOOST_TEST_CASE(&test1));
+ test->add(BOOST_TEST_CASE(&test2));
+ test->add(BOOST_TEST_CASE(&test3));
+ return test;
+}
+
diff --git a/src/boost/libs/xpressive/test/test_assert_with_placeholder.cpp b/src/boost/libs/xpressive/test/test_assert_with_placeholder.cpp
new file mode 100644
index 000000000..df8be5a09
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_assert_with_placeholder.cpp
@@ -0,0 +1,76 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_assert_with_placeholder.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/xpressive.hpp>
+#include <boost/xpressive/regex_actions.hpp>
+#include <boost/test/unit_test.hpp>
+
+using namespace boost::xpressive;
+
+placeholder<int> const _cnt = {{}};
+
+struct count_a_impl
+{
+ typedef void result_type;
+
+ void operator()(int &cnt) const
+ {
+ ++cnt;
+ }
+};
+
+boost::xpressive::function<count_a_impl>::type const count_a = {{}};
+
+struct check_a_impl
+{
+ typedef bool result_type;
+
+ bool operator()(int &cnt, int val) const
+ {
+ if(cnt < val)
+ {
+ ++cnt;
+ return true;
+ }
+ return false;
+ }
+};
+
+boost::xpressive::function<check_a_impl>::type const check_a = {{}};
+
+void test_assert_with_placeholder()
+{
+ int cnt = 0;
+ std::string a_str("a_aaaaa___a_aa_aaa_");
+ const sregex expr1(*(as_xpr('a')[count_a(_cnt)] | '_'));
+ const sregex expr2(*(as_xpr('a')[check(check_a(_cnt, 5))] | '_'));
+
+ sregex_iterator iter1(a_str.begin(), a_str.end(), expr1,
+ let(_cnt = cnt));
+ BOOST_CHECK_EQUAL(iter1->str(0), a_str);
+ BOOST_CHECK_EQUAL(cnt, 12);
+
+ cnt = 0;
+ sregex_iterator iter2(a_str.begin(), a_str.end(), expr2,
+ let(_cnt = cnt));
+
+ BOOST_CHECK_EQUAL(iter2->str(0), std::string("a_aaaa"));
+ BOOST_CHECK_EQUAL(cnt, 5);
+}
+
+using namespace boost::unit_test;
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test that custom assertions can use argument placeholders");
+
+ test->add(BOOST_TEST_CASE(&test_assert_with_placeholder));
+
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test_basic_regex.cpp b/src/boost/libs/xpressive/test/test_basic_regex.cpp
new file mode 100644
index 000000000..13ff2e621
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_basic_regex.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_basic_regex.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/basic_regex.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_cycles.cpp b/src/boost/libs/xpressive/test/test_cycles.cpp
new file mode 100644
index 000000000..844d2ea35
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_cycles.cpp
@@ -0,0 +1,236 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_cycles.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+// defining this causes regex_impl objects to be counted, allowing us to detect
+// leaks portably.
+#define BOOST_XPRESSIVE_DEBUG_CYCLE_TEST
+
+#include <iostream>
+#include <boost/test/unit_test.hpp>
+#include <boost/xpressive/xpressive.hpp>
+
+#if defined(_MSC_VER) && defined(_DEBUG)
+# define _CRTDBG_MAP_ALLOC
+# include <crtdbg.h>
+#endif
+
+using namespace boost::unit_test;
+using namespace boost::xpressive;
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// regexes referred to by other regexes are kept alive via reference counting.
+// but cycles are handled naturally. the following works as expected and doesn't leak.
+void test_main()
+{
+ {
+ sregex v;
+ {
+ sregex a,b,c;
+ a = 'a' >> !by_ref(b);
+ //std::cout << a << std::endl;
+ //std::cout << b << std::endl;
+ //std::cout << c << std::endl;
+
+ // just for giggles
+ c = a;
+ c = epsilon >> 'a';
+
+ b = epsilon >> by_ref(c);
+ //std::cout << a << std::endl;
+ //std::cout << b << std::endl;
+ //std::cout << c << std::endl;
+
+ c = epsilon >> by_ref(a);
+ //std::cout << a << std::endl;
+ //std::cout << b << std::endl;
+ //std::cout << c << std::endl;
+
+ v = a;
+ }
+ std::string const s("aaa");
+ smatch m;
+ if(!regex_match(s, m, v))
+ {
+ BOOST_ERROR("cycle test 1 failed");
+ }
+ }
+
+ if(0 != detail::regex_impl<std::string::const_iterator>::instances)
+ {
+ BOOST_ERROR("leaks detected (cycle test 1)");
+ detail::regex_impl<std::string::const_iterator>::instances = 0;
+ }
+
+ {
+ sregex v;
+ {
+ sregex a,b,c;
+ b = epsilon >> by_ref(c);
+ a = 'a' >> !by_ref(b);
+ c = epsilon >> by_ref(a);
+
+ //std::cout << a << std::endl;
+ //std::cout << b << std::endl;
+ //std::cout << c << std::endl;
+
+ v = a;
+ }
+ std::string const s("aaa");
+ smatch m;
+ if(!regex_match(s, m, v))
+ {
+ BOOST_ERROR("cycle test 2 failed");
+ }
+ }
+
+ if(0 != detail::regex_impl<std::string::const_iterator>::instances)
+ {
+ BOOST_ERROR("leaks detected (cycle test 2)");
+ detail::regex_impl<std::string::const_iterator>::instances = 0;
+ }
+
+ {
+ sregex v;
+ {
+ sregex a,b,c;
+
+ b = epsilon >> by_ref(c);
+ c = epsilon >> by_ref(a);
+ a = 'a' >> !by_ref(b);
+
+ //std::cout << a << std::endl;
+ //std::cout << b << std::endl;
+ //std::cout << c << std::endl;
+
+ v = a;
+ }
+ std::string const s("aaa");
+ smatch m;
+ if(!regex_match(s, m, v))
+ {
+ BOOST_ERROR("cycle test 3 failed");
+ }
+ }
+
+ if(0 != detail::regex_impl<std::string::const_iterator>::instances)
+ {
+ BOOST_ERROR("leaks detected (cycle test 3)");
+ detail::regex_impl<std::string::const_iterator>::instances = 0;
+ }
+
+ {
+ sregex v;
+ {
+ sregex a,b,c;
+ c = epsilon >> by_ref(a);
+ b = epsilon >> by_ref(c);
+ a = 'a' >> !by_ref(b);
+
+ //std::cout << a << std::endl;
+ //std::cout << b << std::endl;
+ //std::cout << c << std::endl;
+
+ v = a;
+ }
+ std::string const s("aaa");
+ smatch m;
+ if(!regex_match(s, m, v))
+ {
+ BOOST_ERROR("cycle test 4 failed");
+ }
+ }
+
+ if(0 != detail::regex_impl<std::string::const_iterator>::instances)
+ {
+ BOOST_ERROR("leaks detected (cycle test 4)");
+ detail::regex_impl<std::string::const_iterator>::instances = 0;
+ }
+
+ {
+ sregex v;
+ {
+ sregex a,b,c;
+ a = 'a' >> !by_ref(b);
+ b = epsilon >> by_ref(c);
+ c = epsilon >> by_ref(a);
+
+ sregex d,e;
+ d = epsilon >> by_ref(e);
+ e = epsilon >> "aa";
+
+ c = d;
+
+ //std::cout << a << std::endl;
+ //std::cout << b << std::endl;
+ //std::cout << c << std::endl;
+ //std::cout << e << std::endl;
+
+ e = 'a' >> by_ref(c);
+
+ //std::cout << "-new loop!\n";
+ //std::cout << a << std::endl;
+ //std::cout << b << std::endl;
+ //std::cout << c << std::endl;
+ //std::cout << e << std::endl;
+
+ v = a;
+
+ //std::cout << v << std::endl;
+
+ }
+ std::string const s("aaa");
+ smatch m;
+ if(regex_match(s, m, v)) // OK, this shouldn't match
+ {
+ BOOST_ERROR("cycle test 5 failed");
+ }
+ }
+
+ if(0 != detail::regex_impl<std::string::const_iterator>::instances)
+ {
+ BOOST_ERROR("leaks detected (cycle test 5)");
+ detail::regex_impl<std::string::const_iterator>::instances = 0;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test_cycles");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Debug stuff
+//
+namespace
+{
+ const struct debug_init
+ {
+ debug_init()
+ {
+ #ifdef _MSC_VER
+ // Send warnings, errors and asserts to STDERR
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+
+ // Check for leaks at program termination
+ _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
+
+ //_CrtSetBreakAlloc(221);
+ #endif
+ }
+ } dbg;
+}
diff --git a/src/boost/libs/xpressive/test/test_dynamic.cpp b/src/boost/libs/xpressive/test/test_dynamic.cpp
new file mode 100644
index 000000000..b1d2c30cf
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_dynamic.cpp
@@ -0,0 +1,38 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_dynamic.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/xpressive_dynamic.hpp>
+#include <boost/test/unit_test.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+void test_main()
+{
+ using namespace boost::xpressive;
+
+ std::string str("bar");
+ sregex rx = sregex::compile("b.*ar");
+ smatch what;
+
+ if(!regex_match(str, what, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+}
+
+using namespace boost::unit_test;
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test_dynamic");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
diff --git a/src/boost/libs/xpressive/test/test_dynamic_grammar.cpp b/src/boost/libs/xpressive/test/test_dynamic_grammar.cpp
new file mode 100644
index 000000000..c11f82672
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_dynamic_grammar.cpp
@@ -0,0 +1,107 @@
+//////////////////////////////////////////////////////////////////////////////
+// test_dynamic_grammar.cpp
+//
+// (C) Copyright Eric Niebler 2004.
+// 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)
+
+/*
+ Revision history:
+ 5 March 2007 : Initial version.
+*/
+
+// defining this causes regex_impl objects to be counted, allowing us to detect
+// leaks portably.
+#define BOOST_XPRESSIVE_DEBUG_CYCLE_TEST
+
+#include <boost/xpressive/xpressive.hpp>
+#include <boost/test/unit_test.hpp>
+
+void test_dynamic_grammar()
+{
+ using namespace boost::xpressive;
+
+ {
+ sregex expr;
+ {
+ sregex_compiler compiler;
+ regex_constants::syntax_option_type x = regex_constants::ignore_white_space;
+
+ compiler.compile( "(? $group = ) \\( (? $expr ) \\) ", x);
+ compiler.compile( "(? $factor = ) \\d+ | (? $group ) ", x);
+ compiler.compile( "(? $term = ) (? $factor ) (?: \\* (? $factor ) | / (? $factor ) )* ", x);
+ expr = compiler.compile( "(? $expr = ) (? $term ) (?: \\+ (? $term ) | - (? $term ) )* ", x);
+ }
+
+ std::string str("foo 9*(10+3) bar");
+ smatch what;
+
+ if(regex_search(str, what, expr))
+ {
+ BOOST_CHECK_EQUAL(what[0].str(), "9*(10+3)");
+ BOOST_CHECK_EQUAL((*what.nested_results().begin())[0].str(), "9*(10+3)");
+ BOOST_CHECK_EQUAL((*(*what.nested_results().begin()).nested_results().begin())[0].str(), "9");
+ BOOST_CHECK_EQUAL((*++(*what.nested_results().begin()).nested_results().begin())[0].str(), "(10+3)");
+ }
+ else
+ {
+ BOOST_ERROR("regex_search test 1 failed");
+ }
+ }
+
+ // Test that all regex_impl instances have been cleaned up correctly
+ BOOST_CHECK_EQUAL(0, detail::regex_impl<std::string::const_iterator>::instances);
+}
+
+void test_dynamic_grammar2()
+{
+ using namespace boost::xpressive;
+
+ {
+ sregex expr;
+ {
+ sregex_compiler compiler;
+ regex_constants::syntax_option_type x = regex_constants::ignore_white_space;
+
+ compiler["group"] = compiler.compile( "\\( (? $expr ) \\) ", x);
+ compiler["factor"] = compiler.compile( "\\d+ | (? $group ) ", x);
+ compiler["term"] = compiler.compile( "(? $factor ) (?: \\* (? $factor ) | / (? $factor ) )* ", x);
+ compiler["expr"] = compiler.compile( "(? $term ) (?: \\+ (? $term ) | - (? $term ) )* ", x);
+
+ expr = compiler["expr"];
+ }
+
+ std::string str("foo 9*(10+3) bar");
+ smatch what;
+
+ if(regex_search(str, what, expr))
+ {
+ BOOST_CHECK_EQUAL(what[0].str(), "9*(10+3)");
+ BOOST_CHECK_EQUAL((*what.nested_results().begin())[0].str(), "9*(10+3)");
+ BOOST_CHECK_EQUAL((*(*what.nested_results().begin()).nested_results().begin())[0].str(), "9");
+ BOOST_CHECK_EQUAL((*++(*what.nested_results().begin()).nested_results().begin())[0].str(), "(10+3)");
+ }
+ else
+ {
+ BOOST_ERROR("regex_search test 2 failed");
+ }
+ }
+
+ // Test that all regex_impl instances have been cleaned up correctly
+ BOOST_CHECK_EQUAL(0, detail::regex_impl<std::string::const_iterator>::instances);
+}
+
+using namespace boost;
+using namespace unit_test;
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("testing dynamic grammars");
+ test->add(BOOST_TEST_CASE(&test_dynamic_grammar));
+ test->add(BOOST_TEST_CASE(&test_dynamic_grammar2));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test_format.cpp b/src/boost/libs/xpressive/test/test_format.cpp
new file mode 100644
index 000000000..66941f3b8
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_format.cpp
@@ -0,0 +1,133 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_format.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+//
+// Test all the different ways to call regex_replace with a formatter.
+
+#include <map>
+#include <string>
+#include <boost/test/unit_test.hpp>
+#include <boost/xpressive/xpressive.hpp>
+
+using namespace boost::xpressive;
+
+std::map<std::string, std::string> replacements;
+
+struct format1
+{
+ template<typename BidiIter>
+ std::string operator()(match_results<BidiIter> const &what) const
+ {
+ return replacements[what[1].str()];
+ }
+};
+
+struct format2
+{
+ template<typename BidiIter, typename OutIter>
+ OutIter operator()(match_results<BidiIter> const &what, OutIter out) const
+ {
+ std::map<std::string, std::string>::const_iterator where = replacements.find(what[1].str());
+ if(where != replacements.end())
+ out = std::copy((*where).second.begin(), (*where).second.end(), out);
+ return out;
+ }
+};
+
+struct format3
+{
+ template<typename BidiIter, typename OutIter>
+ OutIter operator()(match_results<BidiIter> const &what, OutIter out, regex_constants::match_flag_type) const
+ {
+ std::map<std::string, std::string>::const_iterator where = replacements.find(what[1].str());
+ if(where != replacements.end())
+ out = std::copy((*where).second.begin(), (*where).second.end(), out);
+ return out;
+ }
+};
+
+std::string format_fun(smatch const &what)
+{
+ return replacements[what[1].str()];
+}
+
+std::string c_format_fun(cmatch const &what)
+{
+ return replacements[what[1].str()];
+}
+
+void test_main()
+{
+ replacements["X"] = "this";
+ replacements["Y"] = "that";
+
+ std::string input("\"$(X)\" has the value \"$(Y)\""), output;
+ sregex rx = sregex::compile("\\$\\(([^\\)]+)\\)");
+ cregex crx = cregex::compile("\\$\\(([^\\)]+)\\)");
+
+ std::string result("\"this\" has the value \"that\"");
+
+ output = regex_replace(input, rx, format1());
+ BOOST_CHECK_EQUAL(output, result);
+
+ output = regex_replace(input.c_str(), crx, format1());
+ BOOST_CHECK_EQUAL(output, result);
+
+ output = regex_replace(input, rx, format2());
+ BOOST_CHECK_EQUAL(output, result);
+
+ output = regex_replace(input.c_str(), crx, format2());
+ BOOST_CHECK_EQUAL(output, result);
+
+ output = regex_replace(input, rx, format3());
+ BOOST_CHECK_EQUAL(output, result);
+
+ output = regex_replace(input.c_str(), crx, format3());
+ BOOST_CHECK_EQUAL(output, result);
+
+ output = regex_replace(input, rx, format_fun);
+ BOOST_CHECK_EQUAL(output, result);
+
+ output = regex_replace(input.c_str(), crx, c_format_fun);
+ BOOST_CHECK_EQUAL(output, result);
+
+ output = regex_replace(input, rx, &format_fun);
+ BOOST_CHECK_EQUAL(output, result);
+
+ output = regex_replace(input.c_str(), crx, &c_format_fun);
+ BOOST_CHECK_EQUAL(output, result);
+
+ output.clear();
+ regex_replace(std::back_inserter(output), input.begin(), input.end(), rx, format1());
+ BOOST_CHECK_EQUAL(output, result);
+
+ output.clear();
+ regex_replace(std::back_inserter(output), input.begin(), input.end(), rx, format2());
+ BOOST_CHECK_EQUAL(output, result);
+
+ output.clear();
+ regex_replace(std::back_inserter(output), input.begin(), input.end(), rx, format2());
+ BOOST_CHECK_EQUAL(output, result);
+
+ output.clear();
+ regex_replace(std::back_inserter(output), input.begin(), input.end(), rx, format_fun);
+ BOOST_CHECK_EQUAL(output, result);
+
+ output.clear();
+ regex_replace(std::back_inserter(output), input.begin(), input.end(), rx, &format_fun);
+ BOOST_CHECK_EQUAL(output, result);
+}
+
+using namespace boost::unit_test;
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test_format");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test_match_results.cpp b/src/boost/libs/xpressive/test/test_match_results.cpp
new file mode 100644
index 000000000..879a83a5e
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_match_results.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_match_results.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/match_results.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_non_char.cpp b/src/boost/libs/xpressive/test/test_non_char.cpp
new file mode 100644
index 000000000..ebfb3d68e
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_non_char.cpp
@@ -0,0 +1,101 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_non_char.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <algorithm>
+#include <boost/xpressive/xpressive.hpp>
+#include <boost/xpressive/traits/null_regex_traits.hpp>
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_static
+void test_static()
+{
+ static int const data[] = {0, 1, 2, 3, 4, 5, 6};
+ null_regex_traits<int> nul;
+ basic_regex<int const *> rex = imbue(nul)(1 >> +((set= 2,3) | 4) >> 5);
+ match_results<int const *> what;
+
+ if(!regex_search(data, data + (sizeof(data)/sizeof(*data)), what, rex))
+ {
+ BOOST_ERROR("regex_search on integral data failed");
+ }
+ else
+ {
+ BOOST_CHECK(*what[0].first == 1);
+ BOOST_CHECK(*what[0].second == 6);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// UChar
+struct UChar
+{
+ UChar(unsigned int code = 0)
+ : code_(code)
+ {}
+
+ operator unsigned int () const
+ {
+ return this->code_;
+ }
+
+private:
+ unsigned int code_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// UChar_traits
+struct UChar_traits
+ : null_regex_traits<UChar>
+{};
+
+///////////////////////////////////////////////////////////////////////////////
+// test_dynamic
+void test_dynamic()
+{
+ typedef std::vector<UChar>::const_iterator uchar_iterator;
+ typedef basic_regex<uchar_iterator> uregex;
+ typedef match_results<uchar_iterator> umatch;
+ typedef regex_compiler<uchar_iterator, UChar_traits> uregex_compiler;
+
+ std::string pattern_("b.*r"), str_("foobarboo");
+ std::vector<UChar> pattern(pattern_.begin(), pattern_.end());
+ std::vector<UChar> str(str_.begin(), str_.end());
+
+ UChar_traits tr;
+ uregex_compiler compiler(tr);
+ uregex urx = compiler.compile(pattern);
+ umatch what;
+
+ if(!regex_search(str, what, urx))
+ {
+ BOOST_ERROR("regex_search on UChar failed");
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL(3, what.position());
+ BOOST_CHECK_EQUAL(3, what.length());
+ }
+
+ // test for range-based regex_replace
+ std::vector<UChar> output = regex_replace(str, urx, pattern_);
+ std::string output_(output.begin(), output.end());
+ std::string expected("foob.*rboo");
+ BOOST_CHECK_EQUAL(output_, expected);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test_non_char");
+ test->add(BOOST_TEST_CASE(&test_static));
+ test->add(BOOST_TEST_CASE(&test_dynamic));
+ return test;
+}
+
diff --git a/src/boost/libs/xpressive/test/test_partial_match.cpp b/src/boost/libs/xpressive/test/test_partial_match.cpp
new file mode 100644
index 000000000..03dfcb736
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_partial_match.cpp
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_partial_match.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include "./test.hpp"
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+// read the tests from the input file and execute them
+void test_main()
+{
+
+
+
+
+ return 0;
+}
+
diff --git a/src/boost/libs/xpressive/test/test_regex_algorithms.cpp b/src/boost/libs/xpressive/test/test_regex_algorithms.cpp
new file mode 100644
index 000000000..240baa299
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_regex_algorithms.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_regex_algorithms.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/regex_algorithms.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_regex_compiler.cpp b/src/boost/libs/xpressive/test/test_regex_compiler.cpp
new file mode 100644
index 000000000..53f1f75ee
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_regex_compiler.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_regex_compiler.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/regex_compiler.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_regex_constants.cpp b/src/boost/libs/xpressive/test/test_regex_constants.cpp
new file mode 100644
index 000000000..6cf44a333
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_regex_constants.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_regex_constants.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/regex_constants.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_regex_error.cpp b/src/boost/libs/xpressive/test/test_regex_error.cpp
new file mode 100644
index 000000000..b7bb464a9
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_regex_error.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_regex_error.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/regex_error.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_regex_iterator.cpp b/src/boost/libs/xpressive/test/test_regex_iterator.cpp
new file mode 100644
index 000000000..a2f1628be
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_regex_iterator.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_regex_iterator.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/regex_iterator.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_regex_primitives.cpp b/src/boost/libs/xpressive/test/test_regex_primitives.cpp
new file mode 100644
index 000000000..f1fac0d0e
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_regex_primitives.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_regex_primitives.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/regex_primitives.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_regex_token_iterator.cpp b/src/boost/libs/xpressive/test/test_regex_token_iterator.cpp
new file mode 100644
index 000000000..a38438279
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_regex_token_iterator.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_regex_token_iterator.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/regex_token_iterator.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_regex_traits.cpp b/src/boost/libs/xpressive/test/test_regex_traits.cpp
new file mode 100644
index 000000000..bb254903f
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_regex_traits.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_regex_traits.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/regex_traits.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_skip.cpp b/src/boost/libs/xpressive/test/test_skip.cpp
new file mode 100644
index 000000000..ba36194d9
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_skip.cpp
@@ -0,0 +1,96 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_skip.hpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <map>
+#include <iostream>
+#include <boost/xpressive/xpressive.hpp>
+#include <boost/xpressive/regex_actions.hpp>
+#include <boost/test/unit_test.hpp>
+
+using namespace boost::unit_test;
+using namespace boost::xpressive;
+
+void test1()
+{
+ std::string s = "a a b b c c";
+
+ sregex rx =
+ "a a" >>
+ skip(_s)
+ (
+ (s1= as_xpr('b')) >>
+ as_xpr('b') >>
+ *as_xpr('c') // causes backtracking
+ ) >>
+ "c c";
+
+ smatch what;
+ BOOST_CHECK( regex_match(s, what, rx) );
+
+ s = "123,456,789";
+ sregex rx2 = skip(',')(+_d);
+ BOOST_CHECK( regex_match(s, what, rx2) );
+
+ s = "foo";
+ sregex rx3 = skip(_s)(after("fo") >> 'o');
+ BOOST_CHECK( regex_search(s, what, rx3) );
+}
+
+template<typename Expr>
+void test_skip_aux(Expr const &expr)
+{
+ sregex rx = skip(_s)(expr);
+}
+
+void test_skip()
+{
+ int i=0;
+ std::map<std::string, int> syms;
+ std::locale loc;
+
+ test_skip_aux( 'a' );
+ test_skip_aux( _ );
+ test_skip_aux( +_ );
+ test_skip_aux( -+_ );
+ test_skip_aux( !_ );
+ test_skip_aux( -!_ );
+ test_skip_aux( repeat<0,42>(_) );
+ test_skip_aux( -repeat<0,42>(_) );
+ test_skip_aux( _ >> 'a' );
+ test_skip_aux( _ >> 'a' | _ );
+ test_skip_aux( _ >> 'a' | _ >> 'b' );
+ test_skip_aux( s1= _ >> 'a' | _ >> 'b' );
+ test_skip_aux( icase(_ >> 'a' | _ >> 'b') );
+ test_skip_aux( imbue(loc)(_ >> 'a' | _ >> 'b') );
+ test_skip_aux( (set='a') );
+ test_skip_aux( (set='a','b') );
+ test_skip_aux( ~(set='a') );
+ test_skip_aux( ~(set='a','b') );
+ test_skip_aux( range('a','b') );
+ test_skip_aux( ~range('a','b') );
+ test_skip_aux( set['a' | alpha] );
+ test_skip_aux( ~set['a' | alpha] );
+ test_skip_aux( before(_) );
+ test_skip_aux( ~before(_) );
+ test_skip_aux( after(_) );
+ test_skip_aux( ~after(_) );
+ test_skip_aux( keep(*_) );
+ test_skip_aux( (*_)[ref(i) = as<int>(_) + 1] );
+ test_skip_aux( (a1= syms)[ref(i) = a1 + 1] );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test skip()");
+
+ test->add(BOOST_TEST_CASE(&test1));
+
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test_static.cpp b/src/boost/libs/xpressive/test/test_static.cpp
new file mode 100644
index 000000000..1057c2f23
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_static.cpp
@@ -0,0 +1,38 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_static.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/xpressive_static.hpp>
+#include <boost/test/unit_test.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// test_main
+void test_main()
+{
+ using namespace boost::xpressive;
+
+ std::string str("bar");
+ sregex rx = 'b' >> *_ >> "ar";
+ smatch what;
+
+ if(!regex_match(str, what, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+}
+
+using namespace boost::unit_test;
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test_static");
+ test->add(BOOST_TEST_CASE(&test_main));
+ return test;
+}
+
diff --git a/src/boost/libs/xpressive/test/test_sub_match.cpp b/src/boost/libs/xpressive/test/test_sub_match.cpp
new file mode 100644
index 000000000..9a39fd561
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_sub_match.cpp
@@ -0,0 +1,9 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_sub_match.cpp
+//
+// Copyright 2008 Eric Niebler. 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)
+
+#include <boost/xpressive/sub_match.hpp>
+
diff --git a/src/boost/libs/xpressive/test/test_symbols.cpp b/src/boost/libs/xpressive/test/test_symbols.cpp
new file mode 100644
index 000000000..677e3cf89
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_symbols.cpp
@@ -0,0 +1,354 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_symbols.cpp
+//
+// Copyright 2008 David Jenkins.
+// Copyright 2008 Eric Niebler.
+//
+// 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)
+
+#include <string>
+#include <map>
+#include <boost/version.hpp>
+#include <boost/xpressive/xpressive_static.hpp>
+#include <boost/xpressive/regex_actions.hpp>
+#include <boost/test/unit_test.hpp>
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+namespace xp = boost::xpressive;
+
+///////////////////////////////////////////////////////////////////////////////
+// test1
+// simple action which builds a *translated* string
+void test1()
+{
+ using namespace boost::xpressive;
+
+ local<std::string> result;
+ std::string str("foo bar baz foo bar baz");
+ std::map<std::string,std::string> map1;
+ map1["foo"] = "1";
+ map1["bar"] = "2";
+ map1["baz"] = "3";
+
+ sregex rx = skip(_s) (+(a1=map1)
+ [ result += if_else(length(result) > 0, ",", "") + a1 ]
+ );
+
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL(result.get(), "1,2,3,1,2,3");
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test2
+// find longest match in symbol table
+void test2()
+{
+ using namespace boost::xpressive;
+
+ local<std::string> result;
+ std::string str("foobarbazfoobazbazfoobazbar");
+ std::map<std::string,std::string> map1;
+ map1["foo"] = "1";
+ map1["bar"] = "2";
+ map1["baz"] = "3";
+ map1["foobaz"] = "4";
+ map1["foobazbaz"] = "5";
+
+ sregex rx = skip(_s) (+(a1=map1)
+ [ result += if_else(length(result) > 0, ",", "") + a1 ]
+ );
+
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL(result.get(), "1,2,3,5,4,2");
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test3
+// *map* string to int, push back into list, use alternate ->* syntax
+void test3()
+{
+ using namespace boost::xpressive;
+
+ std::list<int> result;
+ std::string str("foo bar baz bop");
+ std::map<std::string,int> map1;
+ map1["foo"] = 1;
+ map1["bar"] = 23;
+ map1["baz"] = 456;
+ map1["bop"] = 7890;
+
+#if BOOST_VERSION >= 103500
+ sregex rx = skip(_s) (+(a1=map1)
+ [ xp::ref(result)->*push_back( a1 ) ]
+ );
+#else
+ sregex rx = skip(_s) (+(a1=map1)
+ [ push_back(xp::ref(result), a1 ) ]
+ );
+#endif
+
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_REQUIRE_EQUAL(result.size(), 4u);
+ BOOST_CHECK_EQUAL(*result.begin(), 1);
+ BOOST_CHECK_EQUAL(*++result.begin(), 23);
+ BOOST_CHECK_EQUAL(*++++result.begin(), 456);
+ BOOST_CHECK_EQUAL(*++++++result.begin(), 7890);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test4
+// use two input maps to build an output map, with a late-bound action argument.
+void test4()
+{
+ using namespace boost::xpressive;
+ placeholder< std::map<std::string, int> > const _map = {};
+
+ std::string str("aaa=>1 bbb=>2 ccc=>3");
+ std::map<std::string,std::string> map1;
+ map1["aaa"] = "foo";
+ map1["bbb"] = "bar";
+ map1["ccc"] = "baz";
+ std::map<std::string,int> map2;
+ map2["1"] = 1;
+ map2["2"] = 23;
+ map2["3"] = 456;
+
+ sregex pair = ( (a1=map1) >> "=>" >> (a2= map2) )[ _map[a1] = a2 ];
+ sregex rx = pair >> *(+_s >> pair);
+
+ smatch what;
+ std::map<std::string, int> result;
+ what.let(_map = result); // bind the argument!
+
+ if(!regex_match(str, what, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_REQUIRE_EQUAL(result.size(), 3u);
+ BOOST_CHECK_EQUAL(result["foo"], 1);
+ BOOST_CHECK_EQUAL(result["bar"], 23);
+ BOOST_CHECK_EQUAL(result["baz"], 456);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test5
+// test nine maps and attributes
+void test5()
+{
+ using namespace boost::xpressive;
+
+ local<int> result(0);
+ std::string str("abcdefghi");
+ std::map<std::string,int> map1;
+ std::map<std::string,int> map2;
+ std::map<std::string,int> map3;
+ std::map<std::string,int> map4;
+ std::map<std::string,int> map5;
+ std::map<std::string,int> map6;
+ std::map<std::string,int> map7;
+ std::map<std::string,int> map8;
+ std::map<std::string,int> map9;
+ map1["a"] = 1;
+ map2["b"] = 2;
+ map3["c"] = 3;
+ map4["d"] = 4;
+ map5["e"] = 5;
+ map6["f"] = 6;
+ map7["g"] = 7;
+ map8["h"] = 8;
+ map9["i"] = 9;
+
+ sregex rx =
+ (a1=map1)[ result += a1 ]
+ >> (a2=map2)[ result += a2 ]
+ >> (a3=map3)[ result += a3 ]
+ >> (a4=map4)[ result += a4 ]
+ >> (a5=map5)[ result += a5 ]
+ >> (a6=map6)[ result += a6 ]
+ >> (a7=map7)[ result += a7 ]
+ >> (a8=map8)[ result += a8 ]
+ >> (a9=map9)[ result += a9 ];
+
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL(result.get(), 45);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test6
+// test case-sensitivity
+void test6()
+{
+ using namespace boost::xpressive;
+
+ local<std::string> result;
+ std::map<std::string,std::string> map1;
+ map1["a"] = "1";
+ map1["A"] = "2";
+ map1["b"] = "3";
+ map1["B"] = "4";
+ std::string str("a A b B a A b B");
+ sregex rx = skip(_s)(
+ icase(a1= map1) [ result = a1 ]
+ >> repeat<3>( (icase(a1= map1) [ result += ',' + a1 ]) )
+ >> repeat<4>( ((a1= map1) [ result += ',' + a1 ]) )
+ );
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL(result.get(), "1,1,3,3,1,2,3,4");
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test7
+// test multiple mutually-exclusive maps and default attribute value
+void test7()
+{
+ using namespace boost::xpressive;
+
+ local<std::string> result;
+ std::map<std::string,std::string> map1;
+ map1["a"] = "1";
+ map1["b"] = "2";
+ std::map<std::string,std::string> map2;
+ map2["c"] = "3";
+ map2["d"] = "4";
+ std::string str("abcde");
+ sregex rx = *((a1= map1) | (a1= map2) | 'e') [ result += (a1 | "9") ];
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL(result.get(), "12349");
+ }
+}
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+struct City
+{
+ std::wstring name;
+ char const* nickname;
+ int population;
+};
+
+BOOST_TYPEOF_REGISTER_TYPE(City)
+
+///////////////////////////////////////////////////////////////////////////////
+// test8
+// test wide strings with structure result
+void test8()
+{
+ using namespace boost::xpressive;
+
+ City cities[] = {
+ {L"Chicago", "The Windy City", 945000},
+ {L"New York", "The Big Apple", 16626000},
+ {L"\u041c\u043E\u0441\u043A\u0432\u0430", "Moscow", 9299000}
+ };
+ int const nbr_cities = sizeof(cities)/sizeof(*cities);
+
+ std::map<std::wstring, City> map1;
+ for(int i=0; i<nbr_cities; ++i)
+ {
+ map1[cities[i].name] = cities[i];
+ }
+
+ std::wstring str(L"Chicago \u041c\u043E\u0441\u043A\u0432\u0430");
+ local<City> result1, result2;
+ wsregex rx = (a1= map1)[ result1 = a1 ] >> +_s
+ >> (a1= map1)[ result2 = a1 ];
+ if(!regex_match(str, rx))
+ {
+ BOOST_ERROR("oops");
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL(result1.get().nickname, "The Windy City");
+ BOOST_CHECK_EQUAL(result2.get().nickname, "Moscow");
+ }
+}
+#else
+void test8()
+{
+ // This test is empty
+}
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// test9
+// test "not before" using a map
+void test9()
+{
+ using namespace boost::xpressive;
+
+ std::string result;
+ std::string str("foobar");
+ std::map<std::string,int> map1;
+ map1["foo"] = 1;
+ sregex rx = ~before((a1=map1)[a1]) >>
+ (s1=*_w)[ xp::ref(result) = s1 ];
+ if(!regex_match(str, rx))
+ {
+ BOOST_CHECK_EQUAL(result, "");
+ }
+ else
+ {
+ BOOST_ERROR("oops");
+ }
+}
+
+using namespace boost::unit_test;
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test_symbols");
+ test->add(BOOST_TEST_CASE(&test1));
+ test->add(BOOST_TEST_CASE(&test2));
+ test->add(BOOST_TEST_CASE(&test3));
+ test->add(BOOST_TEST_CASE(&test4));
+ test->add(BOOST_TEST_CASE(&test5));
+ test->add(BOOST_TEST_CASE(&test6));
+ test->add(BOOST_TEST_CASE(&test7));
+ test->add(BOOST_TEST_CASE(&test8));
+ test->add(BOOST_TEST_CASE(&test9));
+ return test;
+}
+
diff --git a/src/boost/libs/xpressive/test/test_typeof.cpp b/src/boost/libs/xpressive/test/test_typeof.cpp
new file mode 100644
index 000000000..85917e4b7
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_typeof.cpp
@@ -0,0 +1,235 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_typeof.cpp
+//
+// Copyright 2008 David Jenkins. 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)
+
+#define BOOST_TYPEOF_LIMIT_SIZE 200
+#define BOOST_TYPEOF_EMULATION 1
+
+#include <string>
+#include <boost/version.hpp>
+#include <boost/xpressive/xpressive_static.hpp>
+#include <boost/xpressive/xpressive_typeof.hpp>
+#include <boost/test/unit_test.hpp>
+
+// I couldn't find these registrations anywhere else, so I put them here
+// They are necessary for this program to compile
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::int_, (int))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::reference_wrapper, (typename))
+
+// Here's the test for typeof registration, to be used on static regular expressions
+#define TYPEOF_TEST(Expr) { BOOST_PROTO_AUTO(Dummy, Expr); }
+
+namespace xp = boost::xpressive;
+
+///////////////////////////////////////////////////////////////////////////////
+// test_misc1
+// miscelaneous regular expressions
+static void test_misc1()
+{
+ using namespace boost::xpressive;
+
+ TYPEOF_TEST(epsilon);
+ TYPEOF_TEST(nil);
+ TYPEOF_TEST(alnum);
+ TYPEOF_TEST(bos);
+ TYPEOF_TEST(eos);
+ TYPEOF_TEST(bol);
+ TYPEOF_TEST(eol);
+ TYPEOF_TEST(bow);
+ TYPEOF_TEST(eow);
+ TYPEOF_TEST(_b);
+ TYPEOF_TEST(_w);
+ TYPEOF_TEST(_d);
+ TYPEOF_TEST(_s);
+ TYPEOF_TEST(_n);
+ TYPEOF_TEST(_ln);
+ TYPEOF_TEST(_);
+ TYPEOF_TEST(self);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test_misc2
+// miscelaneous regular expressions
+static void test_misc2()
+{
+ using namespace boost::xpressive;
+
+ TYPEOF_TEST(+set[_d | '-' | 'g']);
+ TYPEOF_TEST(+set['g' | as_xpr('-') | _d]);
+ TYPEOF_TEST(icase(+range('a','g')));
+ TYPEOF_TEST(+range('-','/'));
+ TYPEOF_TEST(+range('+','-'));
+ TYPEOF_TEST(+range('b','b'));
+ TYPEOF_TEST(icase((s1= "foo") >> *_ >> '\15'));
+ TYPEOF_TEST(repeat<2>(repeat<3>(_d) >> '-') >> repeat<4>(_d));
+ TYPEOF_TEST('f' >> +as_xpr('o'));
+ TYPEOF_TEST(icase(+(s1= "foo") >> "foobar"));
+ cregex parens = '(' >> *( keep( +~(set='(',')') ) | by_ref(parens) ) >> ')';
+ TYPEOF_TEST(_b >> "sublist" >> parens);
+ TYPEOF_TEST(bos >> "baz" | "bar");
+ TYPEOF_TEST(icase(*_ >> "foo"));
+ TYPEOF_TEST(icase(*_ >> "boo" | "bar"));
+ TYPEOF_TEST(icase("bar"));
+
+ TYPEOF_TEST(('f' >> repeat<1,repeat_max>('o')));
+ TYPEOF_TEST("This " >> (s1= "(has)") >> ' ' >> (s2= "parens"));
+ TYPEOF_TEST(as_xpr("This (has parens"));
+ TYPEOF_TEST(+_d);
+ TYPEOF_TEST(+~_d);
+ TYPEOF_TEST(+set[_d]);
+ TYPEOF_TEST(+set[~_d]);
+ TYPEOF_TEST(+~set[~_d]);
+ TYPEOF_TEST(+~set[_d]);
+ TYPEOF_TEST(+set[~_w | ~_d]);
+ TYPEOF_TEST(+~set[_w | _d]);
+ TYPEOF_TEST((s1= '(' >> (s2= nil) | '[' >> (s3= nil)) >> -*_ >> (s4= ')') >> s2 | ']' >> s3);
+ TYPEOF_TEST(after("foo") >> "bar");
+ TYPEOF_TEST(after(s1= 'f' >> _ >> 'o') >> "bar");
+ TYPEOF_TEST(icase(after(s1= "fo") >> 'o'));
+ TYPEOF_TEST(icase(~after(s1= "fo") >> 'o'));
+ TYPEOF_TEST(+alpha);
+ TYPEOF_TEST(+set[alpha | digit]);
+ TYPEOF_TEST(after(s1= nil) >> 'a');
+ TYPEOF_TEST(after(s1= "abc" >> repeat<3>(_d)) >> "foo");
+ TYPEOF_TEST(~before(bol) >> 'x');
+ TYPEOF_TEST(~before(bos) >> 'x');
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test_misc3
+// miscelaneous regular expressions
+
+static void test_misc3()
+{
+ using namespace boost::xpressive;
+
+ TYPEOF_TEST(as_xpr("foo"));
+ TYPEOF_TEST('b' >> *_ >> "ar");
+ TYPEOF_TEST('b' >> *_ >> 'r');
+ TYPEOF_TEST('b' >> +_ >> "ar");
+ TYPEOF_TEST('b' >> +_ >> 'r');
+ TYPEOF_TEST('b' >> +_ >> "oo");
+ TYPEOF_TEST(bos >> "foo");
+ TYPEOF_TEST(bos >> 'b' >> *_ >> "ar");
+ TYPEOF_TEST('b' >> +_ >> "ar" >> eos);
+ TYPEOF_TEST('b' >> +_ >> 'o' >> eos);
+ TYPEOF_TEST(bos >> (s1= !(set='-','+') >> +range('0','9')
+ >> !(s2= '.' >> *range('0','9')))
+ >> (s3= (set='C','F')) >> eos);
+ TYPEOF_TEST( !(s1= as_xpr('+')|'-') >> (s2= +range('0','9') >> !as_xpr('.') >> *range('0','9') |
+ '.' >> +range('0','9')) >> !(s3= (set='e','E') >> !(s4= as_xpr('+')|'-') >> +range('0','9')));
+ TYPEOF_TEST('f' | icase('g'));
+ TYPEOF_TEST(icase(+lower));
+ TYPEOF_TEST(icase(+as_xpr('\x61')));
+ TYPEOF_TEST(icase(+set['\x61']));
+ TYPEOF_TEST(icase(+as_xpr('\x0061')));
+ TYPEOF_TEST(icase(+set['\x0061']));
+ TYPEOF_TEST('a' >> +(s1= 'b' | (s2= *(s3= 'c'))) >> 'd');
+ TYPEOF_TEST('a' >> +(s1= 'b' | (s2= !(s3= 'c'))) >> 'd');
+ TYPEOF_TEST(*as_xpr('a') >> *as_xpr('a') >> *as_xpr('a') >> *as_xpr('a') >> *as_xpr('a') >> 'b');
+ TYPEOF_TEST(*set[range('a','z') | range('A','Z')]);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test_misc4
+// miscelaneous regular expressions
+static void test_misc4()
+{
+ using namespace boost::xpressive;
+ TYPEOF_TEST('a' >> bos >> 'b');
+ TYPEOF_TEST(as_xpr("a^b"));
+ TYPEOF_TEST('a' >> ~set[' '] >> 'b');
+ TYPEOF_TEST('a' >> ~set['^'] >> 'b');
+ TYPEOF_TEST('a' >> ~set['^'] >> 'b');
+ TYPEOF_TEST('a' >> set['^'] >> 'b');
+ TYPEOF_TEST(icase("foo" >> before("bar")));
+ TYPEOF_TEST(icase("foo" >> ~before("bar")));
+ TYPEOF_TEST(icase("foo" >> ~before("bar")));
+ TYPEOF_TEST(icase(+(s1= keep(s2= "foo") >> "bar")));
+ TYPEOF_TEST(+(s1= "bar" | (s2= "foo")));
+ TYPEOF_TEST(+(s1= (s2= "bar") | "foo"));
+ TYPEOF_TEST(+(s1= "foo" | (s2= "bar")));
+ TYPEOF_TEST(+(s1= (s2= "foo") | "bar"));
+ TYPEOF_TEST((s1= icase("FOO")) >> (s2= -*_) >> s1);
+ TYPEOF_TEST((s1= icase("FOO")) >> (s2= -*_) >> icase(s1));
+ TYPEOF_TEST(+(s1= "foo" | icase(s1 >> 'O')));
+ TYPEOF_TEST((bos >> set[range('A','Z') | range('a','m')]));
+ TYPEOF_TEST(('f' >> repeat<2,5>('o')));
+ TYPEOF_TEST(('f' >> -repeat<2,5>('o')));
+ TYPEOF_TEST(('f' >> repeat<2,5>('o') >> 'o'));
+ TYPEOF_TEST(('f' >> -repeat<2,5>('o') >> 'o'));
+ TYPEOF_TEST(bos >> '{' >> *_ >> '}' >> eos);
+ TYPEOF_TEST(+(set='+','-'));
+ TYPEOF_TEST(+(set='-','+'));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test_misc5
+// miscelaneous regular expressions
+static void test_misc5()
+{
+ using namespace boost::xpressive;
+ TYPEOF_TEST(bos >> ('(' >> (s1= nil) | (s2= nil)) >> +_w >> (')' >> s1 | s2) >> eos);
+ TYPEOF_TEST(+~alpha);
+ TYPEOF_TEST(+set[alpha | ~alpha]);
+ TYPEOF_TEST(+~set[~alpha]);
+ TYPEOF_TEST(as_xpr("[[:alpha:]\\y]+"));
+ TYPEOF_TEST(+~set[~alnum | ~digit]);
+ TYPEOF_TEST(icase(bos >> repeat<4>(s1= 'a' >> !s1) >> eos));
+ TYPEOF_TEST(as_xpr("foo") >> /*This is a comment[*/ "bar");
+ TYPEOF_TEST(bos >> "foobar" >> eos);
+ TYPEOF_TEST(bos >> 'f' >> *as_xpr('o'));
+ TYPEOF_TEST(bos >> 'f' >> *as_xpr('\157'));
+ TYPEOF_TEST(bos >> ("foo" >> set[' '] >> "bar") >> eos /*This is a comment*/);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test_misc6
+// miscelaneous regular expressions
+static void test_misc6()
+{
+ using namespace boost::xpressive;
+ TYPEOF_TEST(bos >> *(s1= optional('a')) >> eos);
+ TYPEOF_TEST(bos >> -*(s1= optional('a')) >> eos);
+ TYPEOF_TEST(bos >> repeat<2>(s1= optional('b')) >> "bc" >> eos);
+ TYPEOF_TEST(bos >> *(s1= optional('b')) >> 'd' >> eos);
+ TYPEOF_TEST(bos >> -repeat<2>(s1= optional('b')) >> "bc" >> eos);
+ TYPEOF_TEST(bos >> -*(s1= optional('b')) >> 'd' >> eos);
+ TYPEOF_TEST(bos >> repeat<2>(s1= -optional('b')) >> "bc" >> eos);
+ TYPEOF_TEST(bos >> *(s1= -optional('b')) >> 'd' >> eos);
+ TYPEOF_TEST(bos >> -repeat<2>(s1= -optional('b')) >> "bc" >> eos);
+ TYPEOF_TEST(bos >> -*(s1= -optional('b')) >> 'd' >> eos);
+ TYPEOF_TEST(bos >> *(s1= nil | nil | nil | 'b') >> "bc" >> eos);
+ TYPEOF_TEST(bos >> -*(s1= nil | nil | nil | 'b') >> "bc" >> eos);
+ TYPEOF_TEST(icase(+range('Z','a')));
+ TYPEOF_TEST(+range('Z','a'));
+}
+
+// These functions are defined in test_typeof2.cpp
+void test_actions();
+void test_symbols();
+void test_assert();
+
+using namespace boost::unit_test;
+
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test_typeof");
+ test->add(BOOST_TEST_CASE(&test_misc1));
+ test->add(BOOST_TEST_CASE(&test_misc2));
+ test->add(BOOST_TEST_CASE(&test_misc3));
+ test->add(BOOST_TEST_CASE(&test_misc4));
+ test->add(BOOST_TEST_CASE(&test_misc5));
+ test->add(BOOST_TEST_CASE(&test_misc6));
+ test->add(BOOST_TEST_CASE(&test_actions));
+ test->add(BOOST_TEST_CASE(&test_symbols));
+ test->add(BOOST_TEST_CASE(&test_assert));
+ return test;
+}
diff --git a/src/boost/libs/xpressive/test/test_typeof2.cpp b/src/boost/libs/xpressive/test/test_typeof2.cpp
new file mode 100644
index 000000000..e94f11c21
--- /dev/null
+++ b/src/boost/libs/xpressive/test/test_typeof2.cpp
@@ -0,0 +1,178 @@
+///////////////////////////////////////////////////////////////////////////////
+// test_typeof2.cpp
+//
+// Copyright 2008 David Jenkins. 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)
+
+#define BOOST_TYPEOF_LIMIT_SIZE 200
+#define BOOST_TYPEOF_EMULATION 1
+
+#include <string>
+#include <map>
+#include <list>
+#include <stack>
+#include <boost/version.hpp>
+#include <boost/xpressive/xpressive_static.hpp>
+#include <boost/xpressive/regex_actions.hpp>
+#include <boost/xpressive/xpressive_typeof.hpp>
+#include <boost/typeof/std/stack.hpp>
+#include <boost/typeof/std/list.hpp>
+#include <boost/test/unit_test.hpp>
+
+
+// I couldn't find these registrations anywhere else, so I put them here
+// They are necessary for this program to compile
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::int_, (int))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::reference_wrapper, (typename))
+
+// Here's the test for typeof registration, to be used on static regular expressions
+#define TYPEOF_TEST(Expr) { BOOST_PROTO_AUTO(Dummy, Expr); }
+
+namespace xp = boost::xpressive;
+
+///////////////////////////////////////////////////////////////////////////////
+// test_actions
+// regular expressions from test_actions.cpp
+void test_actions()
+{
+ using namespace boost::xpressive;
+ // regexes from test_actions.cpp
+ std::string result;
+ TYPEOF_TEST((+_w)[ xp::ref(result) += _ ] >> *(' ' >> (+_w)[ xp::ref(result) += ',' + _ ]));
+ TYPEOF_TEST((+_w)[ xp::ref(result) += _ ] >> *(' ' >> (+_w)[ xp::ref(result) += ',' + _ ]) >> repeat<4>(_));
+ std::list<int> result2;
+ TYPEOF_TEST((+_d)[ xp::ref(result2)->*push_back( as<int>(_) ) ]
+ >> *(' ' >> (+_d)[ xp::ref(result2)->*push_back( as<int>(_) ) ]));
+ std::map<std::string, int> result3;
+ TYPEOF_TEST(( (s1= +_w) >> "=>" >> (s2= +_d) )[ xp::ref(result3)[s1] = as<int>(s2) ]);
+ placeholder< std::map<std::string, int> > const _map5 = {{}};
+ TYPEOF_TEST(( (s1= +_w) >> "=>" >> (s2= +_d) )[ _map5[s1] = as<int>(s2) ]);
+
+ smatch what;
+ placeholder< std::map<std::string, int> > const _map6 = {{}};
+ std::map<std::string, int> result6;
+ what.let(_map6 = result6); // bind the argument!
+
+ local<int> left, right;
+ std::stack<int> stack_;
+ reference<std::stack<int> > stack(stack_);
+ cregex expression2, factor2, term2, group2;
+ TYPEOF_TEST( '(' >> by_ref(expression2) >> ')');
+ TYPEOF_TEST( (+_d)[ push(stack, as<int>(_)) ] | group2);
+ TYPEOF_TEST(factor2 >> *(
+ ('*' >> factor2)
+ [ right = top(stack)
+ , pop(stack)
+ , left = top(stack)
+ , pop(stack)
+ , push(stack, left * right)
+ ]
+ ));
+ TYPEOF_TEST(term2 >> *(
+ ('+' >> term2)
+ [ right = top(stack)
+ , pop(stack)
+ , left = top(stack)
+ , pop(stack)
+ , push(stack, left + right)
+ ]
+ ));
+}
+
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ struct City
+ {
+ std::wstring name;
+ char const* nickname;
+ int population;
+ };
+ BOOST_TYPEOF_REGISTER_TYPE(City)
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// test_symbols
+// regular expressions from test_symbols.cpp
+void test_symbols()
+{
+ using namespace boost::xpressive;
+ std::string result;
+ std::map<std::string,std::string> map10;
+ TYPEOF_TEST((a1=map10)[ xp::ref(result) = a1 ] >> *(' ' >> (a1=map10)[ xp::ref(result) += ',' + a1 ]));
+ TYPEOF_TEST((a1=map10)[ xp::ref(result) = a1 ]
+ >> *((a1=map10)[ xp::ref(result) += ',', xp::ref(result) += a1 ]));
+ std::list<int> result12;
+ std::map<std::string,int> map12;
+ TYPEOF_TEST((a1=map12)[ xp::ref(result12)->*push_back( a1 ) ]
+ >> *(' ' >> (a1=map12)[ xp::ref(result12)->*push_back( a1 ) ]));
+
+ placeholder< std::map<std::string, int> > const _map13 = {};
+ BOOST_PROTO_AUTO(pair13, ( (a1=map10) >> "=>" >> (a2= map12) )[ _map13[a1] = a2 ]);
+ smatch what;
+ std::map<std::string, int> result13;
+ what.let(_map13 = result13);
+ TYPEOF_TEST(pair13 >> *(+_s >> pair13));
+
+ int result14 = 0;
+ std::map<std::string,int> map1a;
+ std::map<std::string,int> map2a;
+ std::map<std::string,int> map3a;
+ TYPEOF_TEST((a1=map1a)[ xp::ref(result14) += a1 ]
+ >> (a2=map2a)[ xp::ref(result) += a2 ]
+ >> (a3=map3a)[ xp::ref(result) += a3 ]
+ );
+ {
+ TYPEOF_TEST(icase(a1= map10) [ xp::ref(result) = a1 ]
+ >> repeat<3>( (' ' >> icase(a1= map10) [ xp::ref(result) += ',', xp::ref(result) += a1 ]) )
+ );
+ TYPEOF_TEST(*((a1= map1a) | (a1= map2a) | 'e') [ xp::ref(result) += (a1 | "9") ]);
+ }
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+ City result17a, result17b;
+ std::map<std::wstring, City> map17;
+ TYPEOF_TEST((a1= map17)[ xp::ref(result17a) = a1 ] >> +_s
+ >> (a1= map17)[ xp::ref(result17b) = a1 ]);
+#else
+ // This test is empty
+#endif
+
+}
+
+bool three_or_six(xp::csub_match const &sub)
+{
+ return sub.length() == 3 || sub.length() == 6;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// test_assert
+// regular expressions from test_assert.cpp
+void test_assert()
+{
+ using namespace boost::xpressive;
+ std::string result;
+ TYPEOF_TEST((bow >> +_w >> eow)[ check(&three_or_six) ]);
+ TYPEOF_TEST((bow >> +_w >> eow)[ check(length(_)==3 || length(_)==6) ]);
+ int const days_per_month[] =
+ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 31, 31};
+ mark_tag month(1), day(2);
+ // Note: if you uncomment the lines below,
+ // the BOOST_TYPEOF_LIMIT_SIZE is exceeded
+ TYPEOF_TEST((
+ // Month must be between 1 and 12 inclusive
+ (month= _d >> !_d) [ check(as<int>(_) >= 1
+ && as<int>(_) <= 12) ]
+ //>> '/'
+ // // Day must be between 1 and 31 inclusive
+ //>> (day= _d >> !_d) [ check(as<int>(_) >= 1
+ // && as<int>(_) <= 31) ]
+ //>> '/'
+ // // Only consider years between 1970 and 2038
+ //>> (_d >> _d >> _d >> _d) [ check(as<int>(_) >= 1970
+ // && as<int>(_) <= 2038) ]
+ )
+ // Ensure the month actually has that many days.
+ [ check( ref(days_per_month)[as<int>(month)-1] >= as<int>(day) ) ]);
+}
+
diff --git a/src/boost/libs/xpressive/tools/Jamfile.v2 b/src/boost/libs/xpressive/tools/Jamfile.v2
new file mode 100644
index 000000000..ec2bb9601
--- /dev/null
+++ b/src/boost/libs/xpressive/tools/Jamfile.v2
@@ -0,0 +1,21 @@
+# (C) Copyright 2004: Eric Niebler
+# 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
+ <toolset>intel:<debug-symbols>off
+ <toolset>msvc-7.1:<debug-symbols>off
+ <toolset>msvc-8.0:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>msvc-8.0:<define>_CRT_SECURE_NO_DEPRECATE
+ <toolset>msvc-9.0:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>gcc:<cxxflags>-ftemplate-depth-1024
+ <toolset>msvc,<stdlib>stlport:<define>_STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+ ;
+
+exe perl2xpr
+ :
+ perl2xpr.cpp
+ :
+ <include>$(BOOST_ROOT)
+ ;
diff --git a/src/boost/libs/xpressive/tools/perl2xpr.cpp b/src/boost/libs/xpressive/tools/perl2xpr.cpp
new file mode 100644
index 000000000..663317617
--- /dev/null
+++ b/src/boost/libs/xpressive/tools/perl2xpr.cpp
@@ -0,0 +1,188 @@
+///////////////////////////////////////////////////////////////////////////////
+// perl2xpr.cpp
+// A utility for translating a Perl regular expression into an
+// xpressive static regular expression.
+//
+// Copyright 2007 Eric Niebler. 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)
+
+#include <stack>
+#include <string>
+#include <iostream>
+#include <boost/xpressive/xpressive_static.hpp>
+#include <boost/xpressive/regex_actions.hpp>
+
+namespace x = boost::xpressive;
+using namespace x;
+
+int main(int argc, char *argv[])
+{
+ int i = 1, j = 1;
+ bool nocase = false;
+ char const *dot = " ~_n ";
+ char const *bos = " bos ";
+ char const *eos = " eos ";
+
+ for(; i < argc && '-' == *argv[i]; argv[i][++j]? 0: (j=1,++i))
+ {
+ switch(argv[i][j])
+ {
+ case 'i': // perl /i modifier
+ nocase = true;
+ break;
+ case 's': // perl /s modifier
+ dot = " _ ";
+ break;
+ case 'm': // perl /m modifier
+ bos = " bol ";
+ eos = " eol ";
+ break;
+ default:
+ std::cerr << "Unknown option : " << argv[i] << std::endl;
+ return -1;
+ }
+ }
+
+ if(i == argc)
+ {
+ std::cerr << "Usage:\n perl2xpr [-i] [-s] [-m] 're'\n";
+ return -1;
+ }
+
+ // Local variables used by the semantic actions below
+ local<int> mark_nbr;
+ local<std::string> tmp;
+ local<std::stack<std::string> > strings;
+
+ // The rules in the dynamic regex grammar
+ cregex regex, alts, seq, quant, repeat, atom, escape, group, lit, charset, setelem;
+
+ lit = ~(set='.','^','$','*','+','?','(',')','{','}','[',']','\\','|')
+ ;
+
+ escape = as_xpr('b') [top(strings) += " _b "]
+ | as_xpr('B') [top(strings) += " ~_b "]
+ | as_xpr('d') [top(strings) += " _d "]
+ | as_xpr('D') [top(strings) += " ~_d "]
+ | as_xpr('s') [top(strings) += " _s "]
+ | as_xpr('S') [top(strings) += " ~_s "]
+ | as_xpr('w') [top(strings) += " _w "]
+ | as_xpr('W') [top(strings) += " ~_w "]
+ | _d [top(strings) += " s" + _ + " "]
+ | _ [top(strings) += " as_xpr('" + _ + "') "]
+ ;
+
+ group = (
+ as_xpr("?:") [top(strings) += " ( "]
+ | as_xpr("?i:") [top(strings) += " icase( "]
+ | as_xpr("?>") [top(strings) += " keep( "]
+ | as_xpr("?=") [top(strings) += " before( "]
+ | as_xpr("?!") [top(strings) += " ~before( "]
+ | as_xpr("?<=") [top(strings) += " after( "]
+ | as_xpr("?<!") [top(strings) += " ~after( "]
+ | nil [top(strings) += " ( s" + as<std::string>(++mark_nbr) + "= "]
+ )
+ >> x::ref(regex)
+ >> as_xpr(')') [top(strings) += " ) "]
+ ;
+
+ setelem = as_xpr('\\') >> _ [top(strings) += " as_xpr('" + _ + "') "]
+ | "[:" >> !as_xpr('^') [top(strings) += "~"]
+ >> (+_w) [top(strings) += _ ]
+ >> ":]"
+ | (
+ (s1=~as_xpr(']'))
+ >> '-'
+ >> (s2=~as_xpr(']'))
+ ) [top(strings) += "range('" + s1 + "','" + s2 + "')"]
+ ;
+
+ charset = !as_xpr('^') [top(strings) += " ~ "]
+ >> nil [top(strings) += " set[ "]
+ >> (
+ setelem
+ | (~as_xpr(']')) [top(strings) += " as_xpr('" + _ + "') "]
+ )
+ >>*(
+ nil [top(strings) += " | "]
+ >> (
+ setelem
+ | (~as_xpr(']')) [top(strings) += "'" + _ + "'"]
+ )
+ )
+ >> as_xpr(']') [top(strings) += " ] "]
+ ;
+
+ atom = (
+ +(lit >> ~before((set='*','+','?','{')))
+ | lit
+ ) [top(strings) += " as_xpr(\"" + _ + "\") "]
+ | as_xpr('.') [top(strings) += dot]
+ | as_xpr('^') [top(strings) += bos]
+ | as_xpr('$') [top(strings) += eos]
+ | '\\' >> escape
+ | '(' >> group
+ | '[' >> charset
+ ;
+
+ repeat = as_xpr('{') [tmp = " repeat<"]
+ >> (+_d) [tmp += _]
+ >> !(
+ as_xpr(',') [tmp += ","]
+ >> (
+ (+_d) [tmp += _]
+ | nil [tmp += "inf"]
+ )
+ )
+ >> as_xpr('}') [top(strings) = tmp + ">( " + top(strings) + " ) "]
+ ;
+
+ quant = nil [push(strings, "")]
+ >> atom
+ >> !(
+ (
+ as_xpr("*") [insert(top(strings), 0, " * ")] // [strings->*top()->*insert(0, " * ")]
+ | as_xpr("+") [insert(top(strings), 0, " + ")] // [strings->*top()->*insert(0, " + ")]
+ | as_xpr("?") [insert(top(strings), 0, " ! ")] // [strings->*top()->*insert(0, " ! ")]
+ | repeat
+ )
+ >> !as_xpr('?') [insert(top(strings), 0, " - ")]
+ )
+ >> nil [tmp = top(strings), pop(strings), top(strings) += tmp]
+ ;
+
+ seq = quant
+ >> *(
+ nil [top(strings) += " >> "]
+ >> quant
+ )
+ ;
+
+ alts = seq
+ >> *(
+ as_xpr('|') [top(strings) += " | "]
+ >> seq
+ )
+ ;
+
+ regex = alts
+ ;
+
+ strings.get().push("");
+ if(!regex_match(argv[i], regex))
+ {
+ std::cerr << "ERROR: unrecognized regular expression" << std::endl;
+ return -1;
+ }
+ else if(nocase)
+ {
+ std::cout << "icase( " << strings.get().top() << " )" << std::endl;
+ }
+ else
+ {
+ std::cout << strings.get().top() << std::endl;
+ }
+
+ return 0;
+}