forked from boostorg/regex
Compare commits
28 Commits
overflow_f
...
recusion_s
Author | SHA1 | Date | |
---|---|---|---|
10df075bc5 | |||
1e0938cca6 | |||
2609fccb23 | |||
5ee5453d56 | |||
ae34d3cfc5 | |||
b99ec17c8e | |||
1a6c4cfb10 | |||
1d50b15245 | |||
b86985e65a | |||
237e69caf6 | |||
372d3f7a7e | |||
362c85cf66 | |||
430419705b | |||
1cad53766e | |||
39e5c86f44 | |||
adae246a46 | |||
86b2fbe600 | |||
99653df37d | |||
1a750a42d1 | |||
6213ff03fc | |||
3e4bcb75b6 | |||
2a8e6d9189 | |||
a142dfecda | |||
c23e7b857a | |||
3efc3f93c7 | |||
e5979ae1af | |||
72f81888a5 | |||
54a5ed8509 |
53
.github/workflows/ci.yml
vendored
53
.github/workflows/ci.yml
vendored
@ -13,12 +13,12 @@ on:
|
||||
release:
|
||||
types: [published, created, edited]
|
||||
jobs:
|
||||
ubuntu-focal:
|
||||
runs-on: ubuntu-20.04
|
||||
ubuntu-jammy:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [ g++-9, g++-10, clang++-9, clang++-10 ]
|
||||
compiler: [ g++-11, g++-12, g++-13 ]
|
||||
standard: [ c++11, c++14, c++17, c++2a ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -34,7 +34,7 @@ jobs:
|
||||
- name: Add repository
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Install packages
|
||||
run: sudo apt install g++-9 g++-10 clang-9 clang-10 libicu-dev
|
||||
run: sudo apt install g++-11 g++-12 g++-13
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
@ -55,21 +55,43 @@ jobs:
|
||||
- name: Generate user config
|
||||
run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : <cxxflags>-std=${{ matrix.standard }} ;" > ~/user-config.jam'
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ../../../b2 config_info_travis_install toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: ./config_info_travis
|
||||
run: ../../../b2 print_config_info toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ../../../b2 toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/regex/test
|
||||
ubuntu-bionic:
|
||||
runs-on: ubuntu-18.04
|
||||
ubuntu-jammy-standalone:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [ g++-7, g++-8, clang++-7, clang++-8 ]
|
||||
compiler: [ g++ ]
|
||||
standard: [ c++11, c++14, c++17, c++2a ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Set TOOLSET
|
||||
run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
|
||||
- name: Add repository
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Install packages
|
||||
run: sudo apt install libicu-dev
|
||||
- name: Test
|
||||
run: ${{ matrix.compiler }} -std=${{ matrix.standard }} -I../../include *.cpp ../../src/*.cpp -o regress && ./regress
|
||||
working-directory: ./test/regress
|
||||
ubuntu-jammy-clang:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [ clang++-15 ]
|
||||
standard: [ c++11, c++14, c++17 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -85,7 +107,7 @@ jobs:
|
||||
- name: Add repository
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Install packages
|
||||
run: sudo apt install g++-7 g++-8 clang-7 clang-8 libicu-dev
|
||||
run: sudo apt install clang-15
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
- name: Update tools/boostdep
|
||||
@ -106,11 +128,8 @@ jobs:
|
||||
- name: Generate user config
|
||||
run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} : <cxxflags>-std=${{ matrix.standard }} ;" > ~/user-config.jam'
|
||||
working-directory: ../boost-root
|
||||
- name: Config info install
|
||||
run: ../../../b2 config_info_travis_install toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Config info
|
||||
run: ./config_info_travis
|
||||
run: ../../../b2 print_config_info toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/config/test
|
||||
- name: Test
|
||||
run: ../../../b2 toolset=$TOOLSET define=CI_SUPPRESS_KNOWN_ISSUES define=SLOW_COMPILER
|
||||
@ -158,7 +177,7 @@ jobs:
|
||||
run: ../../../b2 toolset=${{ matrix.toolset }} cxxstd=${{ matrix.standard }}
|
||||
working-directory: ../boost-root/libs/regex/test
|
||||
windows_gcc:
|
||||
runs-on: windows-latest
|
||||
runs-on: windows-2019
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
|
65
doc/html/boost_regex/configuration/standalone.html
Normal file
65
doc/html/boost_regex/configuration/standalone.html
Normal file
@ -0,0 +1,65 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Use in Standalone Mode (without the rest of Boost)</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Boost.Regex 7.0.1">
|
||||
<link rel="up" href="../configuration.html" title="Configuration">
|
||||
<link rel="prev" href="compiler.html" title="Compiler Setup">
|
||||
<link rel="next" href="locale.html" title="Locale and traits class selection">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="compiler.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.configuration.standalone"></a><a class="link" href="standalone.html" title="Use in Standalone Mode (without the rest of Boost)">Use in Standalone
|
||||
Mode (without the rest of Boost)</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
This library may now be used in "standalone" mode without the rest
|
||||
of the Boost C++ libraries, in order to do this you must either:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Have a C++17 compiler that supports <code class="computeroutput"><span class="identifier">__has_include</span></code>,
|
||||
in this case if <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">config</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> is <span class="bold"><strong>not</strong></span>
|
||||
present then the library will automoatically enter standalone mode. Or:
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Define BOOST_REGEX_STANDALONE when building.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The main difference between the 2 modes, is that when Boost.Config is present
|
||||
the library will automatically configure itself around various compiler defects.
|
||||
In particular in order to use the library with exception support turned off,
|
||||
you will either need a copy of Boost.Config in your include path, or else
|
||||
manually define BOOST_NO_EXCEPTIONS when building.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="compiler.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -215,7 +215,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: March 08, 2022 at 11:25:00 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: December 09, 2022 at 16:44:04 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
@ -47,19 +47,19 @@ test-suite regex-examples :
|
||||
[ regex-test-run snippets/partial_regex_grep.cpp : $(BOOST_ROOT)/libs/regex/index.htm ]
|
||||
[ regex-test-run snippets/partial_regex_iterate.cpp : $(BOOST_ROOT)/libs/regex/index.htm ]
|
||||
[ regex-test-run snippets/partial_regex_match.cpp : 1234-5678-8765-4 ]
|
||||
[ regex-test-run snippets/regex_grep_example_1.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
|
||||
[ regex-test-run snippets/regex_grep_example_2.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
|
||||
[ regex-test-run snippets/regex_grep_example_3.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
|
||||
[ regex-test-run snippets/regex_grep_example_4.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
|
||||
[ regex-test-run snippets/regex_grep_example_1.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
|
||||
[ regex-test-run snippets/regex_grep_example_2.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
|
||||
[ regex-test-run snippets/regex_grep_example_3.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
|
||||
[ regex-test-run snippets/regex_grep_example_4.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
|
||||
[ regex-test-run snippets/regex_match_example.cpp : -auto ]
|
||||
[ regex-test-run snippets/regex_merge_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
|
||||
[ regex-test-run snippets/regex_replace_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
|
||||
[ regex-test-run snippets/regex_search_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
|
||||
[ regex-test-run snippets/regex_merge_example.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
|
||||
[ regex-test-run snippets/regex_replace_example.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
|
||||
[ regex-test-run snippets/regex_search_example.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
|
||||
[ regex-test-run snippets/regex_split_example_1.cpp : -auto ]
|
||||
[ regex-test-run snippets/regex_split_example_2.cpp : $(BOOST_ROOT)/libs/regex/doc/html/index.html ]
|
||||
[ regex-test-run snippets/regex_token_iterator_eg_1.cpp : -auto ]
|
||||
[ regex-test-run snippets/regex_token_iterator_eg_2.cpp : $(BOOST_ROOT)/libs/regex/doc/html/index.html ]
|
||||
[ regex-test-run snippets/regex_iterator_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ]
|
||||
[ regex-test-run snippets/regex_iterator_example.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
|
||||
[ run snippets/captures_example.cpp
|
||||
../test/captures//boost_regex_extra
|
||||
: : : <threading>multi <define>BOOST_REGEX_MATCH_EXTRA=1 ]
|
||||
|
@ -13,6 +13,8 @@
|
||||
#pragma warning(disable: 4996 4127)
|
||||
#endif
|
||||
|
||||
#define BOOST_TIMER_ENABLE_DEPRECATED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/cregex.hpp>
|
||||
|
@ -127,6 +127,9 @@ bool operator == (const allocator_architype<T>&, const allocator_architype<T>&)
|
||||
template <class T>
|
||||
bool operator != (const allocator_architype<T>&, const allocator_architype<T>&) { return false; }
|
||||
|
||||
template <class T>
|
||||
void consume_type() {}
|
||||
|
||||
namespace boost{
|
||||
//
|
||||
// regex_traits_architype:
|
||||
@ -371,6 +374,8 @@ struct BaseRegexConcept
|
||||
e1 = except.code();
|
||||
|
||||
typedef typename Regex::value_type regex_value_type;
|
||||
regex_value_type val{};
|
||||
ignore_unused_variable_warning(val);
|
||||
function_requires< RegexTraitsConcept<global_regex_namespace::regex_traits<char> > >();
|
||||
function_requires< BaseRegexConcept<global_regex_namespace::basic_regex<char> > >();
|
||||
}
|
||||
@ -446,15 +451,25 @@ struct BaseRegexConcept
|
||||
// match_results tests - some typedefs are not used, however these
|
||||
// guarante that they exist (some compilers may warn on non-usage)
|
||||
typedef typename match_results_type::value_type mr_value_type;
|
||||
consume_type<mr_value_type>();
|
||||
typedef typename match_results_type::const_reference mr_const_reference;
|
||||
consume_type<mr_const_reference>();
|
||||
typedef typename match_results_type::reference mr_reference;
|
||||
consume_type<mr_reference>();
|
||||
typedef typename match_results_type::const_iterator mr_const_iterator;
|
||||
consume_type<mr_const_iterator>();
|
||||
typedef typename match_results_type::iterator mr_iterator;
|
||||
consume_type<mr_iterator>();
|
||||
typedef typename match_results_type::difference_type mr_difference_type;
|
||||
consume_type<mr_difference_type>();
|
||||
typedef typename match_results_type::size_type mr_size_type;
|
||||
consume_type<mr_size_type>();
|
||||
typedef typename match_results_type::allocator_type mr_allocator_type;
|
||||
consume_type<mr_allocator_type>();
|
||||
typedef typename match_results_type::char_type mr_char_type;
|
||||
consume_type<mr_char_type>();
|
||||
typedef typename match_results_type::string_type mr_string_type;
|
||||
consume_type<mr_string_type>();
|
||||
|
||||
match_results_type m1;
|
||||
mr_allocator_type at;
|
||||
|
@ -90,6 +90,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define BOOST_REGEX_MAX_RECURSION_DEPTH 100
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
|
@ -93,3 +93,7 @@
|
||||
|
||||
// define this if you want regex to use __cdecl calling convensions, even when __fastcall is available:
|
||||
// #define BOOST_REGEX_NO_FASTCALL
|
||||
|
||||
// define this to control how deep non-avoidable recursive function calls can go, typical expressions
|
||||
// and format strings should only recurse a handful of times, this is mainly to prevent DOS type attacks.
|
||||
// #define BOOST_REGEX_MAX_RECURSION_DEPTH 100
|
||||
|
@ -198,10 +198,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
if (lenSourceWithNull > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
if (lenSourceWithNull > sizeInBytes)
|
||||
return 1;
|
||||
std::memcpy(strDestination, strSource, lenSourceWithNull);
|
||||
std::memcpy(strDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
inline std::size_t strcat_s(
|
||||
@ -210,11 +210,11 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
std::size_t lenDestination = std::strlen(strDestination);
|
||||
if (lenSourceWithNull + lenDestination > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
std::size_t lenDestination = std::strlen(strDestination);
|
||||
if (lenSourceWithNull + lenDestination > sizeInBytes)
|
||||
return 1;
|
||||
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
|
||||
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ private:
|
||||
void fixup_recursions(re_syntax_base* state);
|
||||
void create_startmaps(re_syntax_base* state);
|
||||
int calculate_backstep(re_syntax_base* state);
|
||||
void create_startmap(re_syntax_base* state, unsigned char* l_map, unsigned int* pnull, unsigned char mask);
|
||||
void create_startmap(re_syntax_base* state, unsigned char* l_map, unsigned int* pnull, unsigned char mask, unsigned recursion_count = 0);
|
||||
unsigned get_restart_type(re_syntax_base* state);
|
||||
void set_all_masks(unsigned char* bits, unsigned char);
|
||||
bool is_bad_repeat(re_syntax_base* pt);
|
||||
@ -1074,7 +1074,7 @@ struct recursion_saver
|
||||
};
|
||||
|
||||
template <class charT, class traits>
|
||||
void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, unsigned char* l_map, unsigned int* pnull, unsigned char mask)
|
||||
void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, unsigned char* l_map, unsigned int* pnull, unsigned char mask, unsigned recursion_count)
|
||||
{
|
||||
recursion_saver saved_recursions(&m_recursion_checks);
|
||||
int not_last_jump = 1;
|
||||
@ -1085,6 +1085,28 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
// track case sensitivity:
|
||||
bool l_icase = m_icase;
|
||||
|
||||
if (recursion_count > BOOST_REGEX_MAX_RECURSION_DEPTH)
|
||||
{
|
||||
// Oops error:
|
||||
if (0 == this->m_pdata->m_status) // update the error code if not already set
|
||||
this->m_pdata->m_status = boost::regex_constants::error_complexity;
|
||||
//
|
||||
// clear the expression, we should be empty:
|
||||
//
|
||||
this->m_pdata->m_expression = 0;
|
||||
this->m_pdata->m_expression_len = 0;
|
||||
//
|
||||
// and throw if required:
|
||||
//
|
||||
if (0 == (this->flags() & regex_constants::no_except))
|
||||
{
|
||||
std::string message = "Expression complexity exceeded.";
|
||||
boost::regex_error e(message, boost::regex_constants::error_complexity, 0);
|
||||
e.raise();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
while(state)
|
||||
{
|
||||
switch(state->type)
|
||||
@ -1122,7 +1144,7 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
}
|
||||
// now figure out if we can match a NULL string at this point:
|
||||
if(pnull)
|
||||
create_startmap(state->next.p, 0, pnull, mask);
|
||||
create_startmap(state->next.p, 0, pnull, mask, ++recursion_count);
|
||||
return;
|
||||
}
|
||||
case syntax_element_recurse:
|
||||
@ -1184,7 +1206,7 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
case syntax_element_word_start:
|
||||
{
|
||||
// recurse, then AND with all the word characters:
|
||||
create_startmap(state->next.p, l_map, pnull, mask);
|
||||
create_startmap(state->next.p, l_map, pnull, mask, ++recursion_count);
|
||||
if(l_map)
|
||||
{
|
||||
l_map[0] |= mask_init;
|
||||
@ -1199,7 +1221,7 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
case syntax_element_word_end:
|
||||
{
|
||||
// recurse, then AND with all the word characters:
|
||||
create_startmap(state->next.p, l_map, pnull, mask);
|
||||
create_startmap(state->next.p, l_map, pnull, mask, ++recursion_count);
|
||||
if(l_map)
|
||||
{
|
||||
l_map[0] |= mask_init;
|
||||
@ -1291,11 +1313,11 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
return;
|
||||
}
|
||||
set_bad_repeat(state);
|
||||
create_startmap(state->next.p, l_map, pnull, mask);
|
||||
create_startmap(state->next.p, l_map, pnull, mask, ++recursion_count);
|
||||
if((state->type == syntax_element_alt)
|
||||
|| (static_cast<re_repeat*>(state)->min == 0)
|
||||
|| (not_last_jump == 0))
|
||||
create_startmap(rep->alt.p, l_map, pnull, mask);
|
||||
create_startmap(rep->alt.p, l_map, pnull, mask, ++recursion_count);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -1354,7 +1376,7 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
if(ok && ((m_recursion_checks[static_cast<re_brace*>(state)->index] & 2u) == 0))
|
||||
{
|
||||
m_recursion_checks[static_cast<re_brace*>(state)->index] |= 2u;
|
||||
create_startmap(p->next.p, l_map, pnull, mask);
|
||||
create_startmap(p->next.p, l_map, pnull, mask, ++recursion_count);
|
||||
}
|
||||
}
|
||||
state = state->next.p;
|
||||
|
@ -190,8 +190,8 @@ public:
|
||||
constexpr char_class_type mask_xdigit = char_class_type(1) << offset_xdigit;
|
||||
constexpr char_class_type mask_underscore = char_class_type(1) << offset_underscore;
|
||||
constexpr char_class_type mask_unicode = char_class_type(1) << offset_unicode;
|
||||
constexpr char_class_type mask_any = char_class_type(1) << offset_any;
|
||||
constexpr char_class_type mask_ascii = char_class_type(1) << offset_ascii;
|
||||
//constexpr char_class_type mask_any = char_class_type(1) << offset_any;
|
||||
//constexpr char_class_type mask_ascii = char_class_type(1) << offset_ascii;
|
||||
constexpr char_class_type mask_horizontal = char_class_type(1) << offset_horizontal;
|
||||
constexpr char_class_type mask_vertical = char_class_type(1) << offset_vertical;
|
||||
|
||||
@ -365,15 +365,15 @@ private:
|
||||
|
||||
static char_class_type lookup_icu_mask(const ::UChar32* p1, const ::UChar32* p2)
|
||||
{
|
||||
constexpr char_class_type mask_blank = char_class_type(1) << offset_blank;
|
||||
constexpr char_class_type mask_space = char_class_type(1) << offset_space;
|
||||
constexpr char_class_type mask_xdigit = char_class_type(1) << offset_xdigit;
|
||||
constexpr char_class_type mask_underscore = char_class_type(1) << offset_underscore;
|
||||
constexpr char_class_type mask_unicode = char_class_type(1) << offset_unicode;
|
||||
//constexpr char_class_type mask_blank = char_class_type(1) << offset_blank;
|
||||
//constexpr char_class_type mask_space = char_class_type(1) << offset_space;
|
||||
//constexpr char_class_type mask_xdigit = char_class_type(1) << offset_xdigit;
|
||||
//constexpr char_class_type mask_underscore = char_class_type(1) << offset_underscore;
|
||||
//constexpr char_class_type mask_unicode = char_class_type(1) << offset_unicode;
|
||||
constexpr char_class_type mask_any = char_class_type(1) << offset_any;
|
||||
constexpr char_class_type mask_ascii = char_class_type(1) << offset_ascii;
|
||||
constexpr char_class_type mask_horizontal = char_class_type(1) << offset_horizontal;
|
||||
constexpr char_class_type mask_vertical = char_class_type(1) << offset_vertical;
|
||||
//constexpr char_class_type mask_horizontal = char_class_type(1) << offset_horizontal;
|
||||
//constexpr char_class_type mask_vertical = char_class_type(1) << offset_vertical;
|
||||
|
||||
static const ::UChar32 prop_name_table[] = {
|
||||
/* any */ 'a', 'n', 'y',
|
||||
|
@ -97,11 +97,11 @@ private:
|
||||
|
||||
void put(char_type c);
|
||||
void put(const sub_match_type& sub);
|
||||
void format_all();
|
||||
void format_all(unsigned recursion_count = 0);
|
||||
void format_perl();
|
||||
void format_escape();
|
||||
void format_conditional();
|
||||
void format_until_scope_end();
|
||||
void format_conditional(unsigned recursion_count);
|
||||
void format_until_scope_end(unsigned recursion_count);
|
||||
bool handle_perl_verb(bool have_brace);
|
||||
|
||||
inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j, const std::integral_constant<bool, false>&)
|
||||
@ -199,7 +199,7 @@ OutputIterator basic_regex_formatter<OutputIterator, Results, traits, ForwardIte
|
||||
}
|
||||
|
||||
template <class OutputIterator, class Results, class traits, class ForwardIter>
|
||||
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_all()
|
||||
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_all(unsigned recursion_count)
|
||||
{
|
||||
// over and over:
|
||||
while(m_position != m_end)
|
||||
@ -219,12 +219,12 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
format_escape();
|
||||
break;
|
||||
case '(':
|
||||
if(m_flags & boost::regex_constants::format_all)
|
||||
if((m_flags & boost::regex_constants::format_all) && (recursion_count < BOOST_REGEX_MAX_RECURSION_DEPTH))
|
||||
{
|
||||
++m_position;
|
||||
bool have_conditional = m_have_conditional;
|
||||
m_have_conditional = false;
|
||||
format_until_scope_end();
|
||||
format_until_scope_end(recursion_count);
|
||||
m_have_conditional = have_conditional;
|
||||
if(m_position == m_end)
|
||||
return;
|
||||
@ -252,10 +252,10 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
++m_position;
|
||||
break;
|
||||
case '?':
|
||||
if(m_flags & boost::regex_constants::format_all)
|
||||
if((m_flags & boost::regex_constants::format_all) && (recursion_count < BOOST_REGEX_MAX_RECURSION_DEPTH))
|
||||
{
|
||||
++m_position;
|
||||
format_conditional();
|
||||
format_conditional(recursion_count);
|
||||
break;
|
||||
}
|
||||
put(*m_position);
|
||||
@ -644,7 +644,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
}
|
||||
|
||||
template <class OutputIterator, class Results, class traits, class ForwardIter>
|
||||
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_conditional()
|
||||
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_conditional(unsigned recursion_count)
|
||||
{
|
||||
if(m_position == m_end)
|
||||
{
|
||||
@ -692,7 +692,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
if(m_results[v].matched)
|
||||
{
|
||||
m_have_conditional = true;
|
||||
format_all();
|
||||
format_all(++recursion_count);
|
||||
m_have_conditional = false;
|
||||
if((m_position != m_end) && (*m_position == static_cast<char_type>(':')))
|
||||
{
|
||||
@ -702,7 +702,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
output_state saved_state = m_state;
|
||||
m_state = output_none;
|
||||
// format the rest of this scope:
|
||||
format_until_scope_end();
|
||||
format_until_scope_end(recursion_count);
|
||||
// restore output state:
|
||||
m_state = saved_state;
|
||||
}
|
||||
@ -714,7 +714,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
m_state = output_none;
|
||||
// format until ':' or ')':
|
||||
m_have_conditional = true;
|
||||
format_all();
|
||||
format_all(++recursion_count);
|
||||
m_have_conditional = false;
|
||||
// restore state:
|
||||
m_state = saved_state;
|
||||
@ -723,17 +723,17 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
// skip the ':':
|
||||
++m_position;
|
||||
// format the rest of this scope:
|
||||
format_until_scope_end();
|
||||
format_until_scope_end(recursion_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class OutputIterator, class Results, class traits, class ForwardIter>
|
||||
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_until_scope_end()
|
||||
void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_until_scope_end(unsigned recursion_count)
|
||||
{
|
||||
do
|
||||
{
|
||||
format_all();
|
||||
format_all(++recursion_count);
|
||||
if((m_position == m_end) || (*m_position == static_cast<char_type>(')')))
|
||||
return;
|
||||
put(*m_position++);
|
||||
|
@ -116,10 +116,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
if (lenSourceWithNull > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
if (lenSourceWithNull > sizeInBytes)
|
||||
return 1;
|
||||
std::memcpy(strDestination, strSource, lenSourceWithNull);
|
||||
std::memcpy(strDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
inline std::size_t strcat_s(
|
||||
@ -128,11 +128,11 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
std::size_t lenDestination = std::strlen(strDestination);
|
||||
if (lenSourceWithNull + lenDestination > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
std::size_t lenDestination = std::strlen(strDestination);
|
||||
if (lenSourceWithNull + lenDestination > sizeInBytes)
|
||||
return 1;
|
||||
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
|
||||
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ class u32regex_iterator_implementation
|
||||
public:
|
||||
u32regex_iterator_implementation(const regex_type* p, BidirectionalIterator last, match_flag_type f)
|
||||
: base(), end(last), re(*p), flags(f){}
|
||||
u32regex_iterator_implementation(const u32regex_iterator_implementation&) = default;
|
||||
bool init(BidirectionalIterator first)
|
||||
{
|
||||
base = first;
|
||||
|
@ -18,19 +18,19 @@
|
||||
|
||||
#define BOOST_REGEX_SOURCE
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/cregex.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::sprintf;
|
||||
using ::strcpy;
|
||||
using ::strcmp;
|
||||
}
|
||||
#ifndef BOOST_WORKAROUND
|
||||
#define BOOST_WORKAROUND(x, y) false
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
#include <boost/core/snprintf.hpp>
|
||||
#else
|
||||
namespace boost { namespace core { using std::snprintf; } }
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
@ -87,7 +87,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char
|
||||
return REG_E_MEMORY;
|
||||
#endif
|
||||
// set default flags:
|
||||
boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
|
||||
unsigned flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
|
||||
expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
|
||||
// and translate those that are actually set:
|
||||
|
||||
@ -176,11 +176,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
|
||||
// We're converting an integer i to a string, and since i <= REG_E_UNKNOWN
|
||||
// a five character string is *always* large enough:
|
||||
//
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
int r = (::sprintf_s)(localbuf, 5, "%d", i);
|
||||
#else
|
||||
int r = (std::sprintf)(localbuf, "%d", i);
|
||||
#endif
|
||||
int r = (boost::core::snprintf)(localbuf, 5, "%d", i);
|
||||
if(r < 0)
|
||||
return 0; // sprintf failed
|
||||
if(std::strlen(localbuf) < buf_size)
|
||||
@ -188,11 +184,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
|
||||
return std::strlen(localbuf) + 1;
|
||||
}
|
||||
}
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
int r = (::sprintf_s)(localbuf, 5, "%d", 0);
|
||||
#else
|
||||
int r = (std::sprintf)(localbuf, "%d", 0);
|
||||
#endif
|
||||
int r = (boost::core::snprintf)(localbuf, 5, "%d", 0);
|
||||
if(r < 0)
|
||||
return 0; // sprintf failed
|
||||
if(std::strlen(localbuf) < buf_size)
|
||||
|
@ -25,6 +25,16 @@
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/cregex.hpp>
|
||||
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
#include <boost/core/snprintf.hpp>
|
||||
#else
|
||||
namespace boost { namespace core { using std::swprintf; } }
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_WORKAROUND
|
||||
#define BOOST_WORKAROUND(x, y) false
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cwchar>
|
||||
@ -33,15 +43,6 @@
|
||||
#pragma warning(disable:981)
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE) || defined(__NetBSD__)
|
||||
namespace std{
|
||||
# ifndef BOOST_NO_SWPRINTF
|
||||
using ::swprintf;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace {
|
||||
@ -97,7 +98,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha
|
||||
return REG_E_MEMORY;
|
||||
#endif
|
||||
// set default flags:
|
||||
boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? wregex::extended : wregex::basic);
|
||||
unsigned flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? wregex::extended : wregex::basic);
|
||||
expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
|
||||
|
||||
// and translate those that are actually set:
|
||||
@ -177,7 +178,6 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#if !defined(BOOST_NO_SWPRINTF)
|
||||
if(code == REG_ATOI)
|
||||
{
|
||||
wchar_t localbuf[5];
|
||||
@ -190,7 +190,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
#if defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
(std::swprintf)(localbuf, L"%d", i);
|
||||
#else
|
||||
(std::swprintf)(localbuf, 5, L"%d", i);
|
||||
(boost::core::swprintf)(localbuf, 5, L"%d", i);
|
||||
#endif
|
||||
if(std::wcslen(localbuf) < buf_size)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
@ -204,7 +204,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
#if defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
(std::swprintf)(localbuf, L"%d", 0);
|
||||
#else
|
||||
(std::swprintf)(localbuf, 5, L"%d", 0);
|
||||
(boost::core::swprintf)(localbuf, 5, L"%d", 0);
|
||||
#endif
|
||||
if(std::wcslen(localbuf) < buf_size)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
@ -214,7 +214,6 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
#endif
|
||||
return std::wcslen(localbuf) + 1;
|
||||
}
|
||||
#endif
|
||||
if(code <= (int)REG_E_UNKNOWN)
|
||||
{
|
||||
std::string p;
|
||||
|
179
test/Jamfile.v2
179
test/Jamfile.v2
@ -78,149 +78,60 @@ lib boost_regex_recursive :
|
||||
|
||||
local regress-sources = regress/$(R_SOURCE) ;
|
||||
|
||||
test-suite regex
|
||||
:
|
||||
[ run regress/$(R_SOURCE) ../build//boost_regex ../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
: regex_regress ]
|
||||
run regress/$(R_SOURCE) ../build//boost_regex ../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
: regex_regress ;
|
||||
|
||||
[ run regress/$(R_SOURCE) ../build//boost_regex
|
||||
../../thread/build//boost_thread ../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
<define>TEST_THREADS
|
||||
: regex_regress_threaded ]
|
||||
run regress/$(R_SOURCE) ../build//boost_regex
|
||||
../../thread/build//boost_thread ../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
<define>TEST_THREADS
|
||||
: regex_regress_threaded ;
|
||||
|
||||
[ run regress/$(R_SOURCE) ../build//boost_regex
|
||||
../../thread/build//boost_thread ../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
<define>TEST_THREADS
|
||||
<define>BOOST_REGEX_MAX_CACHE_BLOCKS=0
|
||||
: regex_regress_threaded_no_cache ]
|
||||
|
||||
[ regex-test posix_api_check : c_compiler_checks/posix_api_check.c ]
|
||||
|
||||
[ compile c_compiler_checks/wide_posix_api_check.c
|
||||
: : wide_posix_api_check_c ]
|
||||
|
||||
[ regex-test posix_api_check_cpp : c_compiler_checks/posix_api_check.cpp ]
|
||||
|
||||
[ regex-test wide_posix_api_check_cpp
|
||||
: c_compiler_checks/wide_posix_api_check.cpp ]
|
||||
|
||||
[ run pathology/bad_expression_test.cpp : : :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
]
|
||||
|
||||
[ run pathology/recursion_test.cpp : : :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
]
|
||||
|
||||
[ run named_subexpressions/named_subexpressions_test.cpp : : :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
]
|
||||
|
||||
[ run unicode/unicode_iterator_test.cpp : : :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
release <define>TEST_UTF8 : unicode_iterator_test_utf8 ]
|
||||
[ run unicode/unicode_iterator_test.cpp : : :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
release <define>TEST_UTF16 : unicode_iterator_test_utf16 ]
|
||||
[ run unicode/unicode_casefold_test.cpp
|
||||
../build//boost_regex ../build//icu_options
|
||||
]
|
||||
[ run static_mutex/static_mutex_test.cpp
|
||||
../../thread/build//boost_thread ../build//boost_regex
|
||||
]
|
||||
[ run object_cache/object_cache_test.cpp : : :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
]
|
||||
|
||||
[ run config_info/regex_config_info.cpp
|
||||
../build//boost_regex/<link>static
|
||||
: # command line
|
||||
: # input files
|
||||
: <test-info>always_show_run_output
|
||||
]
|
||||
[ run config_info/regex_config_info.cpp ../build//boost_regex
|
||||
: # command line
|
||||
: # input files
|
||||
: <test-info>always_show_run_output
|
||||
: regex_dll_config_info
|
||||
]
|
||||
|
||||
[ run collate_info/collate_info.cpp ../build//boost_regex
|
||||
: : : <test-info>always_show_run_output : test_collate_info ]
|
||||
|
||||
|
||||
[ link concepts/concept_check.cpp :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
]
|
||||
[ link concepts/concept_check.cpp :
|
||||
<define>BOOST_REGEX_STANDALONE [ check-target-builds ../build//is_legacy_03 : : <build>no ] : standalone_concept_check
|
||||
]
|
||||
[ link concepts/icu_concept_check.cpp :
|
||||
<define>BOOST_REGEX_STANDALONE [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
]
|
||||
[ link concepts/icu_concept_check.cpp :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <build>no ] : standalone_icu_concept_check
|
||||
]
|
||||
[ link concepts/range_concept_check.cpp :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
]
|
||||
[ run concepts/test_bug_11988.cpp : : :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
]
|
||||
|
||||
[ run
|
||||
# sources
|
||||
captures/captures_test.cpp
|
||||
../build//icu_options
|
||||
: # additional args
|
||||
: # test-files
|
||||
: # requirements
|
||||
<threading>multi
|
||||
<define>BOOST_REGEX_MATCH_EXTRA=1
|
||||
<define>BOOST_REGEX_NO_LIB=1
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
: # test name
|
||||
captures_test
|
||||
]
|
||||
|
||||
[ run regress/$(R_SOURCE) .//boost_regex_recursive
|
||||
../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
<define>BOOST_REGEX_RECURSIVE=1
|
||||
<define>BOOST_REGEX_CXX03=1
|
||||
: regex_regress_recursive ]
|
||||
|
||||
[ run regress/$(R_SOURCE) ./noeh_test//boost_regex_noeh
|
||||
../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
<define>BOOST_NO_EXCEPTIONS=1
|
||||
<exception-handling>off
|
||||
<link>static
|
||||
<runtime-link>shared
|
||||
: regex_regress_noeh ]
|
||||
|
||||
;
|
||||
run regress/$(R_SOURCE) ../build//boost_regex
|
||||
../../thread/build//boost_thread ../build//icu_options
|
||||
: # command line
|
||||
: # input files
|
||||
: # requirements
|
||||
<define>TEST_THREADS
|
||||
<define>BOOST_REGEX_MAX_CACHE_BLOCKS=0
|
||||
: regex_regress_threaded_no_cache ;
|
||||
|
||||
regex-test posix_api_check : c_compiler_checks/posix_api_check.c ;
|
||||
compile c_compiler_checks/wide_posix_api_check.c : : wide_posix_api_check_c ;
|
||||
regex-test posix_api_check_cpp : c_compiler_checks/posix_api_check.cpp ;
|
||||
regex-test wide_posix_api_check_cpp : c_compiler_checks/wide_posix_api_check.cpp ;
|
||||
run pathology/bad_expression_test.cpp : : : [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] ;
|
||||
run pathology/recursion_test.cpp : : : [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] ;
|
||||
run named_subexpressions/named_subexpressions_test.cpp : : : [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] ;
|
||||
run unicode/unicode_iterator_test.cpp : : : [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] release <define>TEST_UTF8 : unicode_iterator_test_utf8 ;
|
||||
run unicode/unicode_iterator_test.cpp : : : [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] release <define>TEST_UTF16 : unicode_iterator_test_utf16 ;
|
||||
run unicode/unicode_casefold_test.cpp ../build//boost_regex ../build//icu_options ;
|
||||
run static_mutex/static_mutex_test.cpp ../../thread/build//boost_thread ../build//boost_regex ;
|
||||
run object_cache/object_cache_test.cpp : : : [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] ;
|
||||
run config_info/regex_config_info.cpp ../build//boost_regex/<link>static : : : <test-info>always_show_run_output ;
|
||||
run config_info/regex_config_info.cpp ../build//boost_regex : : : <test-info>always_show_run_output : regex_dll_config_info ;
|
||||
run collate_info/collate_info.cpp ../build//boost_regex : : : <test-info>always_show_run_output : test_collate_info ;
|
||||
link concepts/concept_check.cpp : [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
|
||||
link concepts/concept_check.cpp : <define>BOOST_REGEX_STANDALONE [ check-target-builds ../build//is_legacy_03 : : <build>no ] <toolset>gcc:<cxxflags>-Wno-deprecated-copy : standalone_concept_check ;
|
||||
link concepts/icu_concept_check.cpp : <define>BOOST_REGEX_STANDALONE [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
|
||||
link concepts/icu_concept_check.cpp : [ check-target-builds ../build//is_legacy_03 : : <build>no ] <toolset>gcc:<cxxflags>-Wno-deprecated-copy : standalone_icu_concept_check ;
|
||||
link concepts/range_concept_check.cpp : [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
|
||||
run concepts/test_bug_11988.cpp : : : [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] ;
|
||||
run captures/captures_test.cpp ../build//icu_options : : : <threading>multi <define>BOOST_REGEX_MATCH_EXTRA=1 <define>BOOST_REGEX_NO_LIB=1
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] : captures_test ;
|
||||
run regress/$(R_SOURCE) .//boost_regex_recursive ../build//icu_options : : : <define>BOOST_REGEX_RECURSIVE=1 <define>BOOST_REGEX_CXX03=1 : regex_regress_recursive ;
|
||||
run regress/$(R_SOURCE) ./noeh_test//boost_regex_noeh ../build//icu_options : : : <define>BOOST_NO_EXCEPTIONS=1 <exception-handling>off <link>static <runtime-link>shared : regex_regress_noeh ;
|
||||
compile test_consolidated.cpp ;
|
||||
|
||||
build-project ../example ;
|
||||
|
||||
# `quick` target (for CI)
|
||||
run quick.cpp ../build//boost_regex ;
|
||||
|
||||
compile test_warnings.cpp
|
||||
: <toolset>msvc:<warnings>all <toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings>all <toolset>gcc:<warnings-as-errors>on
|
||||
|
@ -16,14 +16,6 @@
|
||||
* DESCRIPTION: main regex test declarations.
|
||||
*/
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x560)
|
||||
// we get unresolved externals from basic_string
|
||||
// unless we do this, a well known Borland bug:
|
||||
#define _RWSTD_COMPILE_INSTANTIATE
|
||||
#endif
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
@ -217,6 +217,13 @@ int main(int argc, char * argv[])
|
||||
return cpp_main(argc, argv);
|
||||
}
|
||||
|
||||
#elif defined(BOOST_REGEX_STANDALONE)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return cpp_main(argc, argv);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/detail/lightweight_main.hpp>
|
||||
|
@ -27,6 +27,23 @@
|
||||
#pragma warning(disable:1418 981 383 1419 7)
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_WORKAROUND
|
||||
#define BOOST_WORKAROUND(x, y) false
|
||||
#endif
|
||||
#ifdef BOOST_REGEX_STANDALONE
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost { using std::uint32_t; }
|
||||
|
||||
#define BOOST_JOIN(X, Y) BOOST_DO_JOIN(X, Y)
|
||||
#define BOOST_DO_JOIN(X, Y) BOOST_DO_JOIN2(X,Y)
|
||||
#define BOOST_DO_JOIN2(X, Y) X##Y
|
||||
|
||||
#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
|
||||
#define BOOST_DO_STRINGIZE(X) #X
|
||||
|
||||
#endif
|
||||
|
||||
#include <typeinfo>
|
||||
#include "test_not_regex.hpp"
|
||||
#include "test_regex_search.hpp"
|
||||
|
@ -51,5 +51,9 @@ void test_alt()
|
||||
TEST_REGEX_SEARCH("a\nb", grep, "a", match_default, make_array(0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("a\nb", egrep, "b", match_default, make_array(0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("a\nb", egrep, "a", match_default, make_array(0, 1, -2, -2));
|
||||
// DOS protection:
|
||||
#ifndef BOOST_REGEX_RECURSIVE
|
||||
TEST_INVALID_REGEX("(|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||(?0))", perl);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,10 @@ void test_anchors()
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x560)
|
||||
TEST_REGEX_SEARCH_W(L"^.", boost::regex::extended, L"\x2028 \x2028", match_default, make_array(0, 1, -2, 1, 2, -2, -2));
|
||||
TEST_REGEX_SEARCH_W(L".$", boost::regex::extended, L" \x2028 \x2028", match_default, make_array(0, 1, -2, 2, 3, -2, 3, 4, -2, -2));
|
||||
#endif
|
||||
// DOS attack prevention:
|
||||
#ifndef BOOST_REGEX_RECURSIVE
|
||||
TEST_INVALID_REGEX("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", perl);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,19 @@
|
||||
// We can only build this if we have ICU support:
|
||||
//
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_ICU) && !defined(BOOST_NO_STD_WSTRING)
|
||||
|
||||
#include <boost/regex/icu.hpp>
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
#include <boost/mpl/int.hpp>
|
||||
#else
|
||||
#include <type_traits>
|
||||
namespace boost { namespace mpl {
|
||||
template <int I>
|
||||
using int_ = ::std::integral_constant<int, I>;
|
||||
} }
|
||||
#endif
|
||||
#include "test.hpp"
|
||||
|
||||
namespace unnecessary_fix{
|
||||
|
@ -19,7 +19,7 @@
|
||||
//
|
||||
// We can only build this if we have ATL support:
|
||||
//
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
#ifdef TEST_MFC
|
||||
|
||||
|
@ -194,5 +194,9 @@ void test_replace()
|
||||
TEST_REGEX_REPLACE("(a*)", perl, "aabb", match_default, "{$1}", "{aa}{}b{}b{}");
|
||||
TEST_REGEX_REPLACE("(a*)", boost::regex::extended, "aabb", match_default, "{$1}", "{aa}{}b{}b{}");
|
||||
TEST_REGEX_REPLACE("(a*)", boost::regex::extended, "aabb", match_default|match_posix, "{$1}", "{aa}b{}b{}");
|
||||
#ifndef BOOST_REGEX_RECURSIVE
|
||||
// DOS protection:
|
||||
TEST_REGEX_REPLACE("foo", boost::regex::perl, "foobar", match_default|format_all, "(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((", "(((((((((((((((((((((bar");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
* DESCRIPTION: test program for boost::static_mutex.
|
||||
*/
|
||||
|
||||
#define BOOST_TIMER_ENABLE_DEPRECATED
|
||||
|
||||
#include <boost/regex/pending/static_mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/timer.hpp>
|
||||
|
Reference in New Issue
Block a user