Compare commits

..

1 Commits

Author SHA1 Message Date
6445cd7906 This commit was manufactured by cvs2svn to create tag
'Version_1_25_0'.

[SVN r11317]
2001-10-01 16:59:12 +00:00
16 changed files with 68 additions and 223 deletions

View File

@ -1295,22 +1295,21 @@ for forcing me to think about algorithms and their performance,
and to the folks at boost for forcing me to <i>think</i>, period.
The following people have all contributed useful comments or
fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree
Balasubramanian, Jan B<>lsche, Beman Dawes, Paul Baxter, David
Bergman, David Dennerline, Edward Diener, Peter Dimov, Robert
Dunn, Fabio Forno, Tobias Gabrielsson, Rob Gillen, Marc Gregoire,
Chris Hecker, Nick Hodapp, Jesse Jones, Martin Jost, Boris
Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens Maurer,
Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie
Smith, Mike Smyth, Alexander Sokolovsky, Herv<EFBFBD> Poirier, Michael
Raykh, Marc Recht, Scott VanCamp, Bruno Voigt, Alexey Voinov,
Jerry Waldorf, Rob Ward, Lealon Watts, Thomas Witt and Yuval
Yosef. I am also grateful to the manuals supplied with the Henry
Spencer, Perl and GNU regular expression libraries - wherever
possible I have tried to maintain compatibility with these
libraries and with the POSIX standard - the code however is
entirely my own, including any bugs! I can absolutely guarantee
that I will not fix any bugs I don't know about, so if you have
any comments or spot any bugs, please get in touch. </p>
Balasubramanian, Beman Dawes, Paul Baxter, David Bergman, David
Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno,
Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick
Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan
Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Heiko Schmidt,
Jason Shirk, Scobie Smith, Alexander Sokolovsky, Herv<72> Poirier,
Marc Recht, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward,
Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to
the manuals supplied with the Henry Spencer, Perl and GNU regular
expression libraries - wherever possible I have tried to maintain
compatibility with these libraries and with the POSIX standard -
the code however is entirely my own, including any bugs! I can
absolutely guarantee that I will not fix any bugs I don't know
about, so if you have any comments or spot any bugs, please get
in touch. </p>
<p>Useful further information can be found at: </p>

View File

@ -5,23 +5,23 @@ SOURCES = c_regex_traits c_regex_traits_common cpp_regex_traits
regex_synch w32_regex_traits wide_posix_api ;
lib libboost_regex$(SUFLIB) : ../src/$(SOURCES).cpp
:
<include>$(BOOST_ROOT)
<define>BOOST_RE_NO_LIB=1
:
debug release
:
<include>../../../
<define>BOOST_RE_NO_LIB=1
:
debug release
<runtime-link>dynamic
;
;
dll libboost_regex$(SUFDLL[1]) : ../src/$(SOURCES).cpp
:
<include>$(BOOST_ROOT)
<define>BOOST_RE_BUILD_DLL=1
:
debug release
:
<include>../../../
<define>BOOST_RE_BUILD_DLL=1
:
debug release
<runtime-link>dynamic
;
;

View File

@ -31,29 +31,7 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
boost::regex expression(re);
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)");
class IndexClassesPred
{

View File

@ -32,30 +32,7 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
boost::regex expression(re);
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)");
map_type class_index;
std::string::const_iterator base;

View File

@ -33,29 +33,6 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
class class_index
{
boost::regex expression;
@ -68,7 +45,7 @@ public:
void IndexClasses(const std::string& file);
class_index()
: index(),
expression(re)
expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)")
{}
};

View File

@ -33,29 +33,6 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
class class_index
{
boost::regex expression;
@ -70,7 +47,7 @@ public:
void IndexClasses(const std::string& file);
class_index()
: index(),
expression(re)
expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)")
{}
};

View File

@ -31,30 +31,7 @@
typedef std::map<std::string, int, std::less<std::string> > map_type;
const char* re =
// possibly leading whitespace:
"^[[:space:]]*"
// possible template declaration:
"(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"
// class or struct:
"(class|struct)[[:space:]]*"
// leading declspec macros etc:
"("
"\\<\\w+\\>"
"("
"[[:blank:]]*\\([^)]*\\)"
")?"
"[[:space:]]*"
")*"
// the class name
"(\\<\\w*\\>)[[:space:]]*"
// template specialisation parameters
"(<[^;:{]+>)?[[:space:]]*"
// terminate in { or :
"(\\{|:[^;\\{()]*\\{)";
boost::regex expression(re);
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)");
void IndexClasses(map_type& m, const std::string& file)
{

View File

@ -890,7 +890,7 @@ protected:
// protected contructor for derived class...
match_results_base(bool){}
void BOOST_REGEX_CALL m_free();
void BOOST_REGEX_CALL free();
public:
@ -906,7 +906,7 @@ public:
~match_results_base()
{
m_free();
free();
}
size_type BOOST_REGEX_CALL size()const
@ -1096,7 +1096,7 @@ inline match_results_base<iterator, Allocator>& BOOST_REGEX_CALL match_results_b
{
if(ref != m.ref)
{
m_free();
free();
ref = m.ref;
++(ref->count);
}
@ -1105,7 +1105,7 @@ inline match_results_base<iterator, Allocator>& BOOST_REGEX_CALL match_results_b
template <class iterator, class Allocator>
void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::m_free()
void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::free()
{
if(--(ref->count) == 0)
{
@ -1162,7 +1162,7 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_typ
new (p1) sub_match<iterator>();
++p1;
}
m_free();
free();
}
catch(...)
{
@ -1204,7 +1204,7 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_typ
new (p1) sub_match<iterator>(j);
++p1;
}
m_free();
free();
}
catch(...)
{

View File

@ -270,7 +270,7 @@ using std::distance;
# define BOOST_REGEX_USE_C_LOCALE
#endif
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
#ifdef BOOST_REGEX_USE_WIN32_LOCALE
# include <windows.h>
#endif

View File

@ -34,27 +34,6 @@ namespace boost{
#pragma option push -a4 -b -Ve -pc -w-8026
#endif
//
// Unfortunately Rogue Waves standard library appears to have a bug
// in std::basic_string::compare that results in eroneous answers
// in some cases (tested with Borland C++ 5.1, Rogue Wave lib version
// 0x020101) the test case was:
// {39135,0} < {0xff,0}
// which succeeds when it should not.
//
#ifndef _RWSTD_VER
# define STR_COMP(s,p) s.compare(p)
#else
template <class C, class T, class A>
int string_compare(const std::basic_string<C,T,A>& s, const C* p)
{ return s.compare(p); }
int string_compare(const std::string& s, const char* p)
{ return std::strcmp(s.c_str(), p); }
int string_compare(const std::wstring& s, const wchar_t* p)
{ return std::wcscmp(s.c_str(), p); }
# define STR_COMP(s,p) string_compare(s,p)
#endif
template <class iterator, class charT, class traits_type, class Allocator>
iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
iterator last,
@ -125,11 +104,11 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
traits_inst.transform(s1, s2);
for(i = 0; i < set_->cranges; ++i)
{
if(STR_COMP(s1, p) <= 0)
if(s1 <= p)
{
while(*p)++p;
++p;
if(STR_COMP(s1, p) >= 0)
if(s1 >= p)
return set_->isnot ? next : ++next;
}
else
@ -150,7 +129,7 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
traits_inst.transform_primary(s1, s2);
for(i = 0; i < set_->cequivalents; ++i)
{
if(STR_COMP(s1, p) == 0)
if(s1 == p)
return set_->isnot ? next : ++next;
// skip string
while(*p)++p;
@ -184,9 +163,9 @@ public:
~_priv_match_data()
{
m_free();
free();
}
void m_free();
void free();
void set_accumulator_size(unsigned int size);
int* get_accumulators()
{
@ -212,7 +191,7 @@ void _priv_match_data<iterator, Allocator>::set_accumulator_size(unsigned int si
{
if(size > caccumulators)
{
m_free();
free();
caccumulators = size;
accumulators = i_alloc(temp_match.allocator()).allocate(caccumulators);
loop_starts = it_alloc(temp_match.allocator()).allocate(caccumulators);
@ -222,7 +201,7 @@ void _priv_match_data<iterator, Allocator>::set_accumulator_size(unsigned int si
}
template <class iterator, class Allocator>
void _priv_match_data<iterator, Allocator>::m_free()
void _priv_match_data<iterator, Allocator>::free()
{
if(caccumulators)
{
@ -1072,6 +1051,10 @@ namespace{
template <class Predicate, class I, class charT, class traits, class A, class A2>
unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<charT, traits, A>& e, unsigned flags, A2 a)
{
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable: 4800)
#endif
typedef access_t<charT, traits, A> access;
if(e.flags() & regbase::failbit)

View File

@ -239,7 +239,7 @@ public:
}
~c_regex_traits()
{
m_free();
free();
}
struct sentry
{
@ -250,7 +250,7 @@ public:
static void BOOST_REGEX_CALL update();
private:
static void BOOST_REGEX_CALL init();
static void BOOST_REGEX_CALL m_free();
static void BOOST_REGEX_CALL free();
static c_regex_traits<char> i;
static unsigned sort_type;
@ -307,7 +307,7 @@ public:
c_regex_traits<wchar_t>()
{ init(); }
~c_regex_traits<wchar_t>()
{ m_free(); }
{ free(); }
struct sentry
{
sentry(const c_regex_traits<wchar_t>&)
@ -319,7 +319,7 @@ public:
static unsigned int BOOST_REGEX_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2);
private:
static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
static void BOOST_REGEX_CALL m_free();
static void BOOST_REGEX_CALL free();
static void BOOST_REGEX_CALL init();
static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
static c_regex_traits<wchar_t> init_;

View File

@ -158,14 +158,12 @@ result of a match contains a number of sub-expression matches in
addition to the overall match. When the library needs to report a
regular expression match it does so using an instance of the
class <a href="template_class_ref.htm#reg_match">match_results</a>,
as before there are typedefs of this class for the most common
cases: </p>
as before there are typedefs of this class for the two most
common cases: </p>
<pre><b>namespace </b>boost{
<b>typedef</b> match_results&lt;<b>const</b> <b>char</b>*&gt; cmatch;
<b>typedef</b> match_results&lt;<b>const</b> <b>wchar_t</b>*&gt; wcmatch;
<strong>typedef</strong> match_results&lt;std::string::const_iterator&gt; smatch;
<strong>typedef</strong> match_results&lt;std::wstring::const_iterator&gt; wsmatch;
}</pre>
<p>The algorithms <a href="template_class_ref.htm#reg_search">regex_search</a>

View File

@ -619,7 +619,7 @@ void BOOST_REGEX_CALL c_regex_traits<char>::update()
sort_type = re_detail::find_sort_syntax(&i, &sort_delim);
}
void BOOST_REGEX_CALL c_regex_traits<char>::m_free()
void BOOST_REGEX_CALL c_regex_traits<char>::free()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS
@ -838,7 +838,7 @@ void BOOST_REGEX_CALL c_regex_traits<wchar_t>::update()
}
}
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::m_free()
void BOOST_REGEX_CALL c_regex_traits<wchar_t>::free()
{
BOOST_RE_GUARD_STACK
#ifdef BOOST_RE_THREADS

View File

@ -871,9 +871,7 @@ each sub-expression match being contained in an object of type <i>sub_match</i>.
&nbsp;&nbsp; <b>bool</b> <b>operator</b>&lt;(<b>const</b> match_results&amp; that)<b>const</b>;
};
<strong>typedef</strong> match_results&lt;<strong>const</strong> <strong>char</strong>*&gt; cmatch;
<strong>typedef</strong> match_results&lt;<strong>const</strong> <strong>wchar_t</strong>*&gt; wcmatch;
<strong>typedef</strong> match_results&lt;std::string::const_iterator&gt; smatch;
<strong>typedef</strong> match_results&lt;std::wstring::const_iterator&gt; wsmatch; </pre>
<strong>typedef</strong> match_results&lt;<strong>const</strong> <strong>wchar_t</strong>*&gt; wcmatch; </pre>
<p>Class match_results is used for reporting what matched a
regular expression, it is passed to the matching algorithms <a
@ -1130,10 +1128,10 @@ properties. </p>
<p>The algorithm regex _match determines whether a given regular
expression matches a given sequence denoted by a pair of
bidirectional-iterators, the algorithm is defined as follows, <em>note
that the result is true only if the expression matches the whole
of the input sequence</em>, the main use of this function is data
input validation: </p>
bidirectional-iterators, the algorithm is defined as follows,
note that the result is true only if the expression matches the
whole of the input sequence, the main use of this function is
data input validation: </p>
<pre><b>template</b> &lt;<b>class</b> iterator, <b>class</b> Allocator, <b>class</b> charT, <b>class</b> traits, <b>class</b> Allocator2&gt;
<b>bool</b> regex_match(iterator first,&nbsp;
@ -1207,12 +1205,7 @@ return true or false and do not indicate what matched: </p>
will be less than or equal to last. m[1] denotes the
first subexpression m[2] the second subexpression and so
on. If no match occurred then m[0].first = m[0].second =
last.<p>Note that since the match_results structure
stores only iterators, and not strings, the iterators/strings
passed to regex_match must be valid for as long as the
result is to be used. For that reason never pass
temporary string objects to regex_match.</p>
</td>
last.</td>
<td>&nbsp;</td>
</tr>
<tr>
@ -1463,13 +1456,7 @@ upon your compilers capabilities]: </p>
that matched, m[0].first and m[0].second will be less
than or equal to last. m[1] denotes the first sub-expression
m[2] the second sub-expression and so on. If no match
occurred then m[0].first = m[0].second = last.<p>Note
that since the match_results structure stores only
iterators, and not strings, the iterators/strings passed
to regex_search must be valid for as long as the result
is to be used. For that reason never pass temporary
string objects to regex_search.</p>
</td>
occurred then m[0].first = m[0].second = last.</td>
<td>&nbsp;</td>
</tr>
<tr>
@ -1998,7 +1985,7 @@ not match are copied to the output unchanged only if the flags
parameter does not have the flag <a href="#format_flags">format_no_copy</a>
set. If the flag <a href="#format_flags">format_first_only</a> is
set then only the first occurance is replaced rather than all
occurrences.</p>
occurances.</p>
<pre><b>template</b> &lt;<b>class</b> OutputIterator, <b>class</b> iterator, <b>class</b> traits, <b>class</b> Allocator, <b>class</b> charT&gt;
OutputIterator regex_merge(OutputIterator out,&nbsp;

View File

@ -37,16 +37,11 @@ using namespace boost;
flag_info flag_data[] = {
{ BOOST_RE_STR("REG_BASIC"), 9, REG_BASIC, 0 },
{ BOOST_RE_STR("REG_EXTENDED"), 12, REG_EXTENDED, 0 },
{ BOOST_RE_STR("REG_ESCAPE_IN_LISTS"), 19, REG_ESCAPE_IN_LISTS, 0 },
{ BOOST_RE_STR("REG_ICASE"), 9, REG_ICASE, 0 },
{ BOOST_RE_STR("REG_NOSUB"), 9, REG_NOSUB, 0 },
{ BOOST_RE_STR("REG_NEWLINE"), 11, REG_NEWLINE, 0 },
{ BOOST_RE_STR("REG_NOCOLLATE"), 13, REG_NOCOLLATE, 0 },
{ BOOST_RE_STR("REG_NEWLINE"), 11, REG_NEWLINE, 0 },
{ BOOST_RE_STR("REG_NOSPEC"), 10, REG_NOSPEC, 0 },
{ BOOST_RE_STR("REG_NEWLINE_ALT"), 15, REG_NEWLINE_ALT , 0 },
{ BOOST_RE_STR("REG_PERL"), 8, REG_PERL, 0 },
{ BOOST_RE_STR("REG_AWK"), 7, REG_AWK, 0 },
{ BOOST_RE_STR("REG_EGREP"), 9, REG_EGREP, 0 },
{ BOOST_RE_STR("REG_NOTBOL"), 10, REG_NOTBOL, 1 },
{ BOOST_RE_STR("REG_NOTEOL"), 10, REG_NOTEOL, 1 },

View File

@ -503,10 +503,8 @@ a(b+|((c)*))+d abcd 0 4 2 3 2 3 2 3
'([^\\']|\\.)*' '\\n' 0 4 1 3
; now try and test some unicode specific characters:
- match_default normal REG_PERL REG_UNICODE_ONLY
- match_default normal REG_EXTENDED REG_UNICODE_ONLY
[[:unicode:]]+ a\0300\0400z 1 3
[\x10-\xff] \39135\12409 -1 -1
[\01-\05]{5} \36865\36865\36865\36865\36865 -1 -1
; finally try some case insensitive matches:
- match_default normal REG_EXTENDED REG_ICASE
@ -882,4 +880,3 @@ a+(?#b+)b+ xaaabbba 1 7