diff --git a/doc/history.qbk b/doc/history.qbk
index 4350cb8d..93721338 100644
--- a/doc/history.qbk
+++ b/doc/history.qbk
@@ -11,6 +11,7 @@
[h4 Boost 1.42]
* Added support for Functors rather than strings as format expressions.
+* Improved error reporting when throwing exceptions to include better more relevant information.
* Fixed tickets
[@https://svn.boost.org/trac/boost/ticket/2802 #2802],
[@https://svn.boost.org/trac/boost/ticket/2802 #3425],
diff --git a/doc/html/boost_regex/background_information/examples.html b/doc/html/boost_regex/background_information/examples.html
index fa062bf7..1e41d80a 100644
--- a/doc/html/boost_regex/background_information/examples.html
+++ b/doc/html/boost_regex/background_information/examples.html
@@ -28,7 +28,7 @@
Example Programs
@@ -107,7 +107,7 @@
Files: captures_test.cpp .
@@ -133,7 +133,7 @@
Files: regex_timer.cpp .
diff --git a/doc/html/boost_regex/background_information/history.html b/doc/html/boost_regex/background_information/history.html
index 76fdcb90..78843041 100644
--- a/doc/html/boost_regex/background_information/history.html
+++ b/doc/html/boost_regex/background_information/history.html
@@ -26,7 +26,7 @@
History
@@ -34,6 +34,10 @@
Added support for Functors rather than strings as format expressions.
+
+ Improved error reporting when throwing exceptions to include better more
+ relevant information.
+
Fixed tickets #2802 ,
#3425 ,
@@ -41,7 +45,7 @@
@@ -50,7 +54,7 @@
branch resets and recursive regular expressions.
@@ -77,7 +81,7 @@
@@ -100,7 +104,7 @@
@@ -170,7 +174,7 @@
@@ -225,7 +229,7 @@
@@ -233,7 +237,7 @@
Fixed bug in partial matches of bounded repeats of '.'.
diff --git a/doc/html/boost_regex/background_information/locale.html b/doc/html/boost_regex/background_information/locale.html
index 18196254..8295fabf 100644
--- a/doc/html/boost_regex/background_information/locale.html
+++ b/doc/html/boost_regex/background_information/locale.html
@@ -58,7 +58,7 @@
There are three separate localization mechanisms supported by Boost.Regex:
@@ -90,7 +90,7 @@
are treated as "unknown" graphic characters.
@@ -114,7 +114,7 @@
libraries including version 1 of this library.
@@ -151,7 +151,7 @@
in your code. The best way to ensure this is to add the #define to < boost / regex / user . hpp >
.
diff --git a/doc/html/boost_regex/background_information/standards.html b/doc/html/boost_regex/background_information/standards.html
index d0a8ec9f..3750ec0f 100644
--- a/doc/html/boost_regex/background_information/standards.html
+++ b/doc/html/boost_regex/background_information/standards.html
@@ -28,7 +28,7 @@
Conformance
@@ -36,7 +36,7 @@
Report on C++ Library Extensions.
@@ -49,7 +49,7 @@
rather than a Unicode escape sequence; use \x{DDDD} for Unicode escape sequences.
@@ -62,7 +62,7 @@
(??{code}) Not implementable in a compiled strongly typed language.
@@ -82,7 +82,7 @@
a custom traits class.
diff --git a/doc/html/boost_regex/captures.html b/doc/html/boost_regex/captures.html
index 647a31bb..0f96c192 100644
--- a/doc/html/boost_regex/captures.html
+++ b/doc/html/boost_regex/captures.html
@@ -35,7 +35,7 @@
accessed.
@@ -218,7 +218,7 @@
output stream.
@@ -231,7 +231,7 @@
you can determine which sub-expressions matched by accessing the sub_match :: matched
data member.
diff --git a/doc/html/boost_regex/format/boost_format_syntax.html b/doc/html/boost_regex/format/boost_format_syntax.html
index af6214dd..405559a1 100644
--- a/doc/html/boost_regex/format/boost_format_syntax.html
+++ b/doc/html/boost_regex/format/boost_format_syntax.html
@@ -32,7 +32,7 @@
'$', '\', '(', ')', '?', and ':'.
@@ -40,7 +40,7 @@
you want a to output literal parenthesis.
@@ -79,7 +79,7 @@
?{NAME}true-expression:false-expression
@@ -319,7 +319,7 @@
as a literal.
diff --git a/doc/html/boost_regex/install.html b/doc/html/boost_regex/install.html
index f5353f48..3814b219 100644
--- a/doc/html/boost_regex/install.html
+++ b/doc/html/boost_regex/install.html
@@ -49,7 +49,7 @@
file before you can use it, instructions for specific platforms are as follows:
@@ -58,7 +58,7 @@
started guide for more information.
@@ -96,11 +96,11 @@
ICU you are using is binary compatible with the toolset you use to build Boost.
@@ -166,7 +166,7 @@
a lot in compile times!
@@ -253,7 +253,7 @@
@@ -302,7 +302,7 @@
see the config library documentation .
@@ -347,7 +347,7 @@
will build v9 variants of the regex library named libboost_regex_v9.a etc.
diff --git a/doc/html/boost_regex/ref/bad_expression.html b/doc/html/boost_regex/ref/bad_expression.html
index d7400e2b..59fd3394 100644
--- a/doc/html/boost_regex/ref/bad_expression.html
+++ b/doc/html/boost_regex/ref/bad_expression.html
@@ -27,7 +27,7 @@
bad_expression
#include < boost / pattern_except . hpp >
@@ -54,7 +54,7 @@
}
regex_error ( const std :: string & s , regex_constants :: error_type err , std :: ptrdiff_t pos );
diff --git a/doc/html/boost_regex/ref/basic_regex.html b/doc/html/boost_regex/ref/basic_regex.html
index b9603b98..3d075673 100644
--- a/doc/html/boost_regex/ref/basic_regex.html
+++ b/doc/html/boost_regex/ref/basic_regex.html
@@ -27,7 +27,7 @@
basic_regex
#include < boost / regex . hpp >
@@ -244,7 +244,7 @@
}
@@ -327,7 +327,7 @@
basic_regex
.
-
Table 1. basic_regex default construction postconditions
+
Table 1. basic_regex default construction postconditions
@@ -407,7 +407,7 @@
flags specified in f .
-
Table 2. Postconditions for basic_regex construction
+
Table 2. Postconditions for basic_regex construction
@@ -512,7 +512,7 @@
specified in f .
-
Table 3. Postconditions for basic_regex construction
+
Table 3. Postconditions for basic_regex construction
@@ -616,7 +616,7 @@
according the option flags specified in f .
-
Table 4. Postconditions for basic_regex construction
+
Table 4. Postconditions for basic_regex construction
@@ -727,7 +727,7 @@
flags specified in f .
-
Table 5. Postconditions for basic_regex construction
+
Table 5. Postconditions for basic_regex construction
@@ -829,7 +829,7 @@
flags specified in f .
-
Table 6. Postconditions for basic_regex construction
+
Table 6. Postconditions for basic_regex construction
@@ -1043,7 +1043,7 @@
in f .
-
Table 7. Postconditions for basic_regex::assign
+
Table 7. Postconditions for basic_regex::assign
diff --git a/doc/html/boost_regex/ref/concepts/traits_concept.html b/doc/html/boost_regex/ref/concepts/traits_concept.html
index b4ef8e33..cf7b4bfc 100644
--- a/doc/html/boost_regex/ref/concepts/traits_concept.html
+++ b/doc/html/boost_regex/ref/concepts/traits_concept.html
@@ -34,7 +34,7 @@
Boost-specific enhanced interface.
@@ -381,7 +381,7 @@
diff --git a/doc/html/boost_regex/ref/deprecated_interfaces/regex_format.html b/doc/html/boost_regex/ref/deprecated_interfaces/regex_format.html
index e7fc5577..e180cd65 100644
--- a/doc/html/boost_regex/ref/deprecated_interfaces/regex_format.html
+++ b/doc/html/boost_regex/ref/deprecated_interfaces/regex_format.html
@@ -34,7 +34,7 @@
previous version of Boost.Regex and will not be further updated:
diff --git a/doc/html/boost_regex/ref/error_type.html b/doc/html/boost_regex/ref/error_type.html
index 8f99f11b..be29dc1e 100644
--- a/doc/html/boost_regex/ref/error_type.html
+++ b/doc/html/boost_regex/ref/error_type.html
@@ -27,7 +27,7 @@
error_type
@@ -57,7 +57,7 @@
}
diff --git a/doc/html/boost_regex/ref/match_flag_type.html b/doc/html/boost_regex/ref/match_flag_type.html
index a1e02b6c..60e92782 100644
--- a/doc/html/boost_regex/ref/match_flag_type.html
+++ b/doc/html/boost_regex/ref/match_flag_type.html
@@ -69,7 +69,7 @@
}
diff --git a/doc/html/boost_regex/ref/match_results.html b/doc/html/boost_regex/ref/match_results.html
index 1a7161ae..ff713f31 100644
--- a/doc/html/boost_regex/ref/match_results.html
+++ b/doc/html/boost_regex/ref/match_results.html
@@ -27,7 +27,7 @@
match_results
#include < boost / regex . hpp >
@@ -167,7 +167,7 @@
match_results < BidirectionalIterator , Allocator >& m2 );
diff --git a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_algo.html b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_algo.html
index eae2345b..64e132b3 100644
--- a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_algo.html
+++ b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_algo.html
@@ -43,7 +43,7 @@
on to the "real" algorithm.
@@ -89,7 +89,7 @@
}
@@ -128,7 +128,7 @@
}
diff --git a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_iter.html b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_iter.html
index 369b4d7f..35218c32 100644
--- a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_iter.html
+++ b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_iter.html
@@ -28,7 +28,7 @@
Unicode Aware Regex Iterators
@@ -126,7 +126,7 @@
Provided of course that the input is encoded as UTF-8.
diff --git a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_algo.html b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_algo.html
index d431ac25..aa5a33f3 100644
--- a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_algo.html
+++ b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_algo.html
@@ -34,7 +34,7 @@
here they are anyway:
@@ -82,7 +82,7 @@
}
@@ -110,7 +110,7 @@
}
@@ -149,7 +149,7 @@
}
@@ -164,7 +164,7 @@
+ s . GetLength (), e , f );
diff --git a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html
index 9b897d92..4fb400ee 100644
--- a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html
+++ b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html
@@ -32,7 +32,7 @@
an MFC/ATL string to a regex_iterator
or regex_token_iterator
:
@@ -68,7 +68,7 @@
}
diff --git a/doc/html/boost_regex/ref/posix.html b/doc/html/boost_regex/ref/posix.html
index 1fd8fad8..8b29bc24 100644
--- a/doc/html/boost_regex/ref/posix.html
+++ b/doc/html/boost_regex/ref/posix.html
@@ -165,7 +165,7 @@
@@ -379,7 +379,7 @@
@@ -467,7 +467,7 @@
@@ -537,7 +537,7 @@
diff --git a/doc/html/boost_regex/ref/regex_iterator.html b/doc/html/boost_regex/ref/regex_iterator.html
index 0bb65c83..bad49256 100644
--- a/doc/html/boost_regex/ref/regex_iterator.html
+++ b/doc/html/boost_regex/ref/regex_iterator.html
@@ -78,7 +78,7 @@
regex_constants :: match_flag_type m = regex_constants :: match_default );
@@ -436,7 +436,7 @@
m .
diff --git a/doc/html/boost_regex/ref/regex_match.html b/doc/html/boost_regex/ref/regex_match.html
index 31c1a74f..d583cb24 100644
--- a/doc/html/boost_regex/ref/regex_match.html
+++ b/doc/html/boost_regex/ref/regex_match.html
@@ -80,7 +80,7 @@
match_flag_type flags = match_default );
template < class BidirectionalIterator , class Allocator , class charT , class traits >
@@ -360,7 +360,7 @@
Effects : Returns the result of regex_match ( s . begin (), s . end (), e , flags )
.
diff --git a/doc/html/boost_regex/ref/regex_replace.html b/doc/html/boost_regex/ref/regex_replace.html
index ed074af2..bc80e088 100644
--- a/doc/html/boost_regex/ref/regex_replace.html
+++ b/doc/html/boost_regex/ref/regex_replace.html
@@ -53,7 +53,7 @@
match_flag_type flags = match_default );
template < class OutputIterator , class BidirectionalIterator , class traits , class Formatter >
@@ -196,7 +196,7 @@
and then returns result
.
diff --git a/doc/html/boost_regex/ref/regex_search.html b/doc/html/boost_regex/ref/regex_search.html
index 3e782333..57c74191 100644
--- a/doc/html/boost_regex/ref/regex_search.html
+++ b/doc/html/boost_regex/ref/regex_search.html
@@ -73,7 +73,7 @@
match_flag_type flags = match_default );
template < class BidirectionalIterator , class Allocator , class charT , class traits >
@@ -355,7 +355,7 @@
Effects : Returns the result of regex_search ( s . begin (), s . end (), e , flags )
.
diff --git a/doc/html/boost_regex/ref/regex_token_iterator.html b/doc/html/boost_regex/ref/regex_token_iterator.html
index d3280756..c27d4839 100644
--- a/doc/html/boost_regex/ref/regex_token_iterator.html
+++ b/doc/html/boost_regex/ref/regex_token_iterator.html
@@ -136,7 +136,7 @@
regex_constants :: match_flag_type m = regex_constants :: match_default );
@@ -383,7 +383,7 @@
m .
diff --git a/doc/html/boost_regex/ref/regex_traits.html b/doc/html/boost_regex/ref/regex_traits.html
index b755fa1f..de52d978 100644
--- a/doc/html/boost_regex/ref/regex_traits.html
+++ b/doc/html/boost_regex/ref/regex_traits.html
@@ -46,7 +46,7 @@
}
diff --git a/doc/html/boost_regex/ref/sub_match.html b/doc/html/boost_regex/ref/sub_match.html
index 3bf60be1..14974ee7 100644
--- a/doc/html/boost_regex/ref/sub_match.html
+++ b/doc/html/boost_regex/ref/sub_match.html
@@ -329,11 +329,11 @@
}
@@ -473,7 +473,7 @@
@@ -1008,7 +1008,7 @@
+ m2 . str () .
diff --git a/doc/html/boost_regex/syntax/basic_extended.html b/doc/html/boost_regex/syntax/basic_extended.html
index 05a0ee58..2e4acb2d 100644
--- a/doc/html/boost_regex/syntax/basic_extended.html
+++ b/doc/html/boost_regex/syntax/basic_extended.html
@@ -28,7 +28,7 @@
Expression Syntax
@@ -46,7 +46,7 @@
@@ -56,7 +56,7 @@
.[{()\*+?|^$
@@ -74,7 +74,7 @@
@@ -86,7 +86,7 @@
of an expression, or the last character of a sub-expression.
@@ -98,7 +98,7 @@
to by a back-reference.
@@ -184,7 +184,7 @@ cab
operator to be applied to.
@@ -214,7 +214,7 @@ cab
@@ -227,7 +227,7 @@ cab
will match either of "abd" or "abef".
@@ -240,7 +240,7 @@ cab
A bracket expression may contain any combination of the following:
@@ -249,7 +249,7 @@ cab
or 'c'.
@@ -265,7 +265,7 @@ cab
the code points of the characters only.
@@ -274,7 +274,7 @@ cab
range a - c
.
@@ -284,7 +284,7 @@ cab
character class names .
@@ -312,7 +312,7 @@ cab
matches a NUL character.
@@ -329,7 +329,7 @@ cab
or even all locales on one platform.
@@ -337,7 +337,7 @@ cab
[[: digit :] a - c [. NUL .]]
.
@@ -363,7 +363,7 @@ cab
extensions are also supported by Boost.Regex:
@@ -552,7 +552,7 @@ cab
@@ -706,7 +706,7 @@ cab
@@ -813,7 +813,7 @@ cab
matches any "digit" character, as does
\ p { digit }
.
@@ -888,7 +888,7 @@ cab
@@ -979,7 +979,7 @@ cab
@@ -991,7 +991,7 @@ cab
match to start where the last one ended.
@@ -1005,7 +1005,7 @@ cab
\*+ aaa
@@ -1056,7 +1056,7 @@ cab
@@ -1065,7 +1065,7 @@ cab
\@ matches a literal '@'.
@@ -1101,7 +1101,7 @@ cab
@@ -1111,11 +1111,11 @@ cab
rule.
@@ -1136,7 +1136,7 @@ cab
used with the -E option.
@@ -1150,7 +1150,7 @@ cab
these by default anyway.
@@ -1163,7 +1163,7 @@ cab
modify how the case and locale sensitivity are to be applied.
diff --git a/doc/html/boost_regex/syntax/basic_syntax.html b/doc/html/boost_regex/syntax/basic_syntax.html
index e3271b52..8e72991b 100644
--- a/doc/html/boost_regex/syntax/basic_syntax.html
+++ b/doc/html/boost_regex/syntax/basic_syntax.html
@@ -28,7 +28,7 @@
Expression Syntax
@@ -45,7 +45,7 @@
@@ -55,7 +55,7 @@
.[\*^$
@@ -73,7 +73,7 @@
@@ -85,7 +85,7 @@
of an expression, or the last character of a sub-expression.
@@ -97,7 +97,7 @@
by a back-reference.
@@ -155,7 +155,7 @@ aaaa
to.
@@ -173,7 +173,7 @@ aaaa
aaabba
@@ -186,7 +186,7 @@ aaaa
A bracket expression may contain any combination of the following:
@@ -195,7 +195,7 @@ aaaa
or 'c'.
@@ -211,7 +211,7 @@ aaaa
of the characters only.
@@ -220,7 +220,7 @@ aaaa
range a-c.
@@ -230,7 +230,7 @@ aaaa
character class names .
@@ -259,7 +259,7 @@ aaaa
element names.
@@ -276,7 +276,7 @@ aaaa
or even all locales on one platform.
@@ -284,7 +284,7 @@ aaaa
[[: digit :] a - c [. NUL .]].
@@ -299,7 +299,7 @@ aaaa
will match either a literal '\' or a '^'.
@@ -309,13 +309,13 @@ aaaa
rule.
@@ -333,7 +333,7 @@ aaaa
As its name suggests, this behavior is consistent with the Unix utility grep.
@@ -613,7 +613,7 @@ aaaa
leftmost-longest rule.
@@ -627,7 +627,7 @@ aaaa
options modify how the case and locale sensitivity are to be applied.
diff --git a/doc/html/boost_regex/syntax/perl_syntax.html b/doc/html/boost_regex/syntax/perl_syntax.html
index 2cf6ea4a..d25b6b42 100644
--- a/doc/html/boost_regex/syntax/perl_syntax.html
+++ b/doc/html/boost_regex/syntax/perl_syntax.html
@@ -28,7 +28,7 @@
Syntax
@@ -43,7 +43,7 @@
boost :: regex e2 ( my_expression , boost :: regex :: perl | boost :: regex :: icase );
@@ -53,7 +53,7 @@
.[{()\*+?|^$
@@ -73,7 +73,7 @@
@@ -83,7 +83,7 @@
A '$' character shall match the end of a line.
@@ -94,7 +94,7 @@
can also repeated, or referred to by a back-reference.
@@ -107,7 +107,7 @@
without splitting out any separate sub-expressions.
@@ -188,7 +188,7 @@
to be applied to.
@@ -218,7 +218,7 @@
while consuming as little input as possible.
@@ -250,7 +250,7 @@
while giving nothing back.
@@ -360,7 +360,7 @@
named "two".
@@ -387,7 +387,7 @@
(?:abc)??
has exactly the same effect.
@@ -399,7 +399,7 @@
A bracket expression may contain any combination of the following:
@@ -407,7 +407,7 @@
'b', or 'c'.
@@ -421,7 +421,7 @@
sensitive.
@@ -430,7 +430,7 @@
matches any character that is not in the range a-c
.
@@ -441,7 +441,7 @@
class names.
@@ -463,7 +463,7 @@
matches a \0
character.
@@ -480,7 +480,7 @@
or even all locales on one platform.
@@ -492,7 +492,7 @@
is not a "word" character.
@@ -500,7 +500,7 @@
[[:digit:]a-c[.NUL.]]
.
@@ -692,7 +692,7 @@
@@ -894,7 +894,7 @@
@@ -1002,7 +1002,7 @@
as does \p{digit}
.
@@ -1021,7 +1021,7 @@
\B
Matches only when not at a word boundary.
@@ -1046,7 +1046,7 @@
to the regular expression \n*\z
@@ -1058,7 +1058,7 @@
one ended.
@@ -1071,7 +1071,7 @@
\*+ aaa
@@ -1081,7 +1081,7 @@
followed by a sequence of zero or more combining characters.
@@ -1090,7 +1090,7 @@
sequence, specifically it is identical to the expression (?>\x0D\x0A?|[\x0A-\x0C\x85\x{2028}\x{2029}])
.
@@ -1105,7 +1105,7 @@
This can be used to simulate variable width lookbehind assertions.
@@ -1114,7 +1114,7 @@
\@ matches a literal '@'.
@@ -1123,7 +1123,7 @@
(?
.
@@ -1145,14 +1145,14 @@
format string for search and replace operations, or in the match_results
member functions.
(?# ... )
is treated as a comment, it's contents are ignored.
@@ -1166,7 +1166,7 @@
pattern only.
@@ -1175,7 +1175,7 @@
an additional sub-expression.
@@ -1197,7 +1197,7 @@
# 1 2 2 3 2 3 4
@@ -1220,7 +1220,7 @@
could be used to validate the password.
@@ -1234,7 +1234,7 @@
(pattern must be of fixed length).
@@ -1247,7 +1247,7 @@
no match is found at all.
@@ -1271,7 +1271,7 @@
to the next sub-expression to be declared.
@@ -1319,7 +1319,7 @@
@@ -1354,7 +1354,7 @@
@@ -1529,7 +1529,7 @@
@@ -1538,7 +1538,7 @@
and JScript
are all synonyms for perl
.
@@ -1550,7 +1550,7 @@
are to be applied.
@@ -1562,7 +1562,7 @@
and no_mod_s
.
diff --git a/doc/html/boost_regex/unicode.html b/doc/html/boost_regex/unicode.html
index 54450406..c42b2069 100644
--- a/doc/html/boost_regex/unicode.html
+++ b/doc/html/boost_regex/unicode.html
@@ -30,7 +30,7 @@
There are two ways to use Boost.Regex with Unicode strings:
@@ -56,7 +56,7 @@
diff --git a/doc/html/index.html b/doc/html/index.html
index 2f620435..49e413a5 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -28,7 +28,7 @@
Copyright © 1998 -2007 John Maddock
-Last revised: October 30, 2009 at 18:27:08 GMT
+Last revised: November 06, 2009 at 18:12:56 GMT
diff --git a/example/snippets/regex_grep_example_1.cpp b/example/snippets/regex_grep_example_1.cpp
index 13161dfb..0f0f4ede 100644
--- a/example/snippets/regex_grep_example_1.cpp
+++ b/example/snippets/regex_grep_example_1.cpp
@@ -67,6 +67,8 @@ public:
what[5].first - base;
return true;
}
+private:
+ IndexClassesPred& operator=(const IndexClassesPred&);
};
void IndexClasses(map_type& m, const std::string& file)
diff --git a/example/snippets/regex_match_example.cpp b/example/snippets/regex_match_example.cpp
index bd35d169..f714f94b 100644
--- a/example/snippets/regex_match_example.cpp
+++ b/example/snippets/regex_match_example.cpp
@@ -55,11 +55,11 @@ int process_ftp(const char* response, std::string* msg)
istream& getline(istream& is, std::string& s)
{
s.erase();
- char c = is.get();
+ char c = static_cast
(is.get());
while(c != '\n')
{
s.append(1, c);
- c = is.get();
+ c = static_cast(is.get());
}
return is;
}
diff --git a/example/snippets/regex_merge_example.cpp b/example/snippets/regex_merge_example.cpp
index 9b226ecd..a537189d 100644
--- a/example/snippets/regex_merge_example.cpp
+++ b/example/snippets/regex_merge_example.cpp
@@ -86,8 +86,8 @@ int main(int argc, const char** argv)
return 0;
}
-extern const char* pre_expression = "(<)|(>)|\\r";
-extern const char* pre_format = "(?1<)(?2>)";
+const char* pre_expression = "(<)|(>)|\\r";
+const char* pre_format = "(?1<)(?2>)";
const char* expression_text = // preprocessor directives: index 1
diff --git a/example/snippets/regex_replace_example.cpp b/example/snippets/regex_replace_example.cpp
index 69ca40ed..a864d79f 100644
--- a/example/snippets/regex_replace_example.cpp
+++ b/example/snippets/regex_replace_example.cpp
@@ -86,8 +86,8 @@ int main(int argc, const char** argv)
return 0;
}
-extern const char* pre_expression = "(<)|(>)|(&)|\\r";
-extern const char* pre_format = "(?1<)(?2>)(?3&)";
+const char* pre_expression = "(<)|(>)|(&)|\\r";
+const char* pre_format = "(?1<)(?2>)(?3&)";
const char* expression_text = // preprocessor directives: index 1
diff --git a/example/snippets/regex_split_example_1.cpp b/example/snippets/regex_split_example_1.cpp
index 25d2e576..4db5bdd0 100644
--- a/example/snippets/regex_split_example_1.cpp
+++ b/example/snippets/regex_split_example_1.cpp
@@ -36,11 +36,11 @@ using namespace std;
istream& getline(istream& is, std::string& s)
{
s.erase();
- char c = is.get();
+ char c = static_cast(is.get());
while(c != '\n')
{
s.append(1, c);
- c = is.get();
+ c = static_cast(is.get());
}
return is;
}
diff --git a/example/snippets/regex_token_iterator_eg_1.cpp b/example/snippets/regex_token_iterator_eg_1.cpp
index e12881e8..f1ecb44d 100644
--- a/example/snippets/regex_token_iterator_eg_1.cpp
+++ b/example/snippets/regex_token_iterator_eg_1.cpp
@@ -29,11 +29,11 @@ using namespace std;
istream& getline(istream& is, std::string& s)
{
s.erase();
- char c = is.get();
+ char c = static_cast(is.get());
while(c != '\n')
{
s.append(1, c);
- c = is.get();
+ c = static_cast(is.get());
}
return is;
}
diff --git a/example/timer/regex_timer.cpp b/example/timer/regex_timer.cpp
index 112b0cb0..ad94e7ff 100644
--- a/example/timer/regex_timer.cpp
+++ b/example/timer/regex_timer.cpp
@@ -9,6 +9,10 @@
*
*/
+#ifdef _MSC_VER
+#pragma warning(disable: 4996 4127)
+#endif
+
#include
#include
#include
@@ -54,7 +58,7 @@ ostream& operator << (ostream& os, const std::wstring& s)
j = s.end();
while(i != j)
{
- os.put(*i);
+ os.put(static_cast(*i));
++i;
}
return os;
@@ -96,15 +100,15 @@ namespace boost{
istream& getline(istream& is, std::string& s)
{
s.erase();
- char c = is.get();
+ char c = static_cast(is.get());
while(c != '\n')
{
s.append(1, c);
- c = is.get();
+ c = static_cast(is.get());
}
return is;
}
-#elif defined(__CYGWIN__)
+#else
istream& getline(istream& is, std::string& s)
{
std::getline(is, s);
@@ -112,8 +116,6 @@ istream& getline(istream& is, std::string& s)
s.erase(s.size() - 1);
return is;
}
-#else
-using std::getline;
#endif
}
@@ -148,8 +150,8 @@ int main(int argc, char**argv)
std::size_t nsubs;
boost::timer t;
double tim;
- bool result;
- int iters = 100;
+ int result = 0;
+ unsigned iters = 100;
double wait_time = (std::min)(t.elapsed_min() * 1000, 1.0);
while(true)
@@ -202,7 +204,7 @@ int main(int argc, char**argv)
ds.erase(ds.begin(), ds.end());
std::copy(s2.begin(), s2.end(), std::back_inserter(ds));
- int i;
+ unsigned i;
iters = 10;
tim = 1.1;
@@ -217,7 +219,7 @@ int main(int argc, char**argv)
// measure time interval for basic_regex
do{
- iters *= (tim > 0.001) ? (1.1/tim) : 100;
+ iters *= static_cast((tim > 0.001) ? (1.1/tim) : 100);
t.restart();
for(i =0; i < iters; ++i)
{
@@ -251,7 +253,7 @@ int main(int argc, char**argv)
// cache load:
regex_search(ws2, wsm, wex);
do{
- iters *= (tim > 0.001) ? (1.1/tim) : 100;
+ iters *= static_cast((tim > 0.001) ? (1.1/tim) : 100);
t.restart();
for(i = 0; i < iters; ++i)
{
@@ -289,7 +291,7 @@ int main(int argc, char**argv)
// cache load:
regex_search(ds.begin(), ds.end(), dm, ex);
do{
- iters *= (tim > 0.001) ? (1.1/tim) : 100;
+ iters *= static_cast((tim > 0.001) ? (1.1/tim) : 100);
t.restart();
for(i = 0; i < iters; ++i)
{
@@ -326,7 +328,7 @@ int main(int argc, char**argv)
// cache load:
regexecA(&r, s2.c_str(), nsubs, matches.get(), 0);
do{
- iters *= (tim > 0.001) ? (1.1/tim) : 100;
+ iters *= static_cast((tim > 0.001) ? (1.1/tim) : 100);
t.restart();
for(i = 0; i < iters; ++i)
{
@@ -357,7 +359,7 @@ int main(int argc, char**argv)
ts.erase();
ts.assign(s2.begin() + matches[0].rm_eo, s2.end());
cout << ts;
- cout << "\" (matched=" << (matches[0].rm_eo != s2.size()) << ")" << endl << endl;
+ cout << "\" (matched=" << (matches[0].rm_eo != (int)s2.size()) << ")" << endl << endl;
}
}
regfreeA(&r);
diff --git a/include/boost/regex/concepts.hpp b/include/boost/regex/concepts.hpp
index 886395ec..fa2ea48c 100644
--- a/include/boost/regex/concepts.hpp
+++ b/include/boost/regex/concepts.hpp
@@ -752,7 +752,7 @@ template
struct functor1
{
typedef typename M::char_type char_type;
- const char_type* operator()(const M& m)
+ const char_type* operator()(const M&)
{
static const char_type c = static_cast(0);
return &c;
@@ -762,7 +762,7 @@ template
struct functor1b
{
typedef typename M::char_type char_type;
- std::vector operator()(const M& m)
+ std::vector operator()(const M&)
{
static const std::vector c;
return c;
diff --git a/include/boost/regex/pending/object_cache.hpp b/include/boost/regex/pending/object_cache.hpp
index 2a7e00bc..e1aa191d 100644
--- a/include/boost/regex/pending/object_cache.hpp
+++ b/include/boost/regex/pending/object_cache.hpp
@@ -73,7 +73,9 @@ boost::shared_ptr object_cache::get(const Key& k, siz
// for now just throw, but we should never really get here...
//
::boost::throw_exception(std::runtime_error("Error in thread safety code: could not acquire a lock"));
+#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
return boost::shared_ptr();
+#endif
#else
return do_get(k, max_cache_size);
#endif
diff --git a/include/boost/regex/v4/basic_regex_creator.hpp b/include/boost/regex/v4/basic_regex_creator.hpp
index 6f005054..d847b96f 100644
--- a/include/boost/regex/v4/basic_regex_creator.hpp
+++ b/include/boost/regex/v4/basic_regex_creator.hpp
@@ -787,7 +787,7 @@ void basic_regex_creator::fixup_recursions(re_syntax_base* state)
//
if(0 == (this->flags() & regex_constants::no_except))
{
- std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
+ std::string message = "Encountered a forward reference to a marked sub-expression that does not exist.";
boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
e.raise();
}
@@ -828,7 +828,7 @@ void basic_regex_creator::fixup_recursions(re_syntax_base* state)
//
if(0 == (this->flags() & regex_constants::no_except))
{
- std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
+ std::string message = "Encountered a forward reference to a recursive sub-expression that does not exist.";
boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
e.raise();
}
@@ -893,7 +893,7 @@ void basic_regex_creator::create_startmaps(re_syntax_base* state)
//
if(0 == (this->flags() & regex_constants::no_except))
{
- std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
+ std::string message = "Invalid lookbehind assertion encountered in the regular expression.";
boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
e.raise();
}
diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp
index 0fa35786..44c3e618 100644
--- a/include/boost/regex/v4/basic_regex_parser.hpp
+++ b/include/boost/regex/v4/basic_regex_parser.hpp
@@ -45,6 +45,11 @@ public:
basic_regex_parser(regex_data* data);
void parse(const charT* p1, const charT* p2, unsigned flags);
void fail(regex_constants::error_type error_code, std::ptrdiff_t position);
+ void fail(regex_constants::error_type error_code, std::ptrdiff_t position, std::string message, std::ptrdiff_t start_pos);
+ void fail(regex_constants::error_type error_code, std::ptrdiff_t position, const std::string& message)
+ {
+ fail(error_code, position, message, position);
+ }
bool parse_all();
bool parse_basic();
@@ -144,7 +149,7 @@ void basic_regex_parser::parse(const charT* p1, const charT* p2,
default:
// Ooops, someone has managed to set more than one of the main option flags,
// so this must be an error:
- fail(regex_constants::error_unknown, 0);
+ fail(regex_constants::error_unknown, 0, "An invalid combination of regular expression syntax flags was used.");
return;
}
@@ -160,7 +165,7 @@ void basic_regex_parser::parse(const charT* p1, const charT* p2,
// have had an unexpected ')' :
if(!result)
{
- fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_position));
+ fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_position), "Found a closing ) with no corresponding openening parenthesis.");
return;
}
// if an error has been set then give up now:
@@ -173,13 +178,40 @@ void basic_regex_parser::parse(const charT* p1, const charT* p2,
template
void basic_regex_parser::fail(regex_constants::error_type error_code, std::ptrdiff_t position)
+{
+ // get the error message:
+ std::string message = this->m_pdata->m_ptraits->error_string(error_code);
+ fail(error_code, position, message);
+}
+
+template
+void basic_regex_parser::fail(regex_constants::error_type error_code, std::ptrdiff_t position, std::string message, std::ptrdiff_t start_pos)
{
if(0 == this->m_pdata->m_status) // update the error code if not already set
this->m_pdata->m_status = error_code;
m_position = m_end; // don't bother parsing anything else
- // get the error message:
- std::string message = this->m_pdata->m_ptraits->error_string(error_code);
- // and raise the exception, this will do nothing if exceptions are disabled:
+
+ //
+ // Augment error message with the regular expression text:
+ //
+ if(start_pos == position)
+ start_pos = (std::max)(static_cast(0), position - 10);
+ std::ptrdiff_t end_pos = (std::min)(position + 10, m_end - m_base);
+ if(error_code != regex_constants::error_empty)
+ {
+ if((start_pos != 0) || (end_pos != (m_end - m_base)))
+ message += " The error occured while parsing the regular expression fragment: '";
+ else
+ message += " The error occured while parsing the regular expression: '";
+ if(start_pos != end_pos)
+ {
+ message += std::string(m_base + start_pos, m_base + position);
+ message += ">>>HERE>>>";
+ message += std::string(m_base + position, m_base + end_pos);
+ }
+ message += "'.";
+ }
+
#ifndef BOOST_NO_EXCEPTIONS
if(0 == (this->flags() & regex_constants::no_except))
{
@@ -287,7 +319,7 @@ bool basic_regex_parser::parse_extended()
case regex_constants::syntax_star:
if(m_position == this->m_base)
{
- fail(regex_constants::error_badrepeat, 0);
+ fail(regex_constants::error_badrepeat, 0, "The repeat operator \"*\" cannot start a regular expression.");
return false;
}
++m_position;
@@ -295,7 +327,7 @@ bool basic_regex_parser::parse_extended()
case regex_constants::syntax_question:
if(m_position == this->m_base)
{
- fail(regex_constants::error_badrepeat, 0);
+ fail(regex_constants::error_badrepeat, 0, "The repeat operator \"?\" cannot start a regular expression.");
return false;
}
++m_position;
@@ -303,7 +335,7 @@ bool basic_regex_parser::parse_extended()
case regex_constants::syntax_plus:
if(m_position == this->m_base)
{
- fail(regex_constants::error_badrepeat, 0);
+ fail(regex_constants::error_badrepeat, 0, "The repeat operator \"+\" cannot start a regular expression.");
return false;
}
++m_position;
@@ -312,7 +344,7 @@ bool basic_regex_parser::parse_extended()
++m_position;
return parse_repeat_range(false);
case regex_constants::syntax_close_brace:
- fail(regex_constants::error_brace, this->m_position - this->m_end);
+ fail(regex_constants::error_brace, this->m_position - this->m_base, "Found a closing repetition operator } with no corresponding {.");
return false;
case regex_constants::syntax_or:
return parse_alt();
@@ -517,7 +549,7 @@ bool basic_regex_parser::parse_basic_escape()
case regex_constants::syntax_close_brace:
if(this->flags() & regbase::no_intervals)
return parse_literal();
- fail(regex_constants::error_brace, this->m_position - this->m_base);
+ fail(regex_constants::error_brace, this->m_position - this->m_base, "Found a closing repetition operator } with no corresponding {.");
return false;
case regex_constants::syntax_or:
if(this->flags() & regbase::bk_vbar)
@@ -612,7 +644,7 @@ bool basic_regex_parser::parse_basic_escape()
case 'c':
case 'C':
// not supported yet:
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, "The \\c and \\C escape sequences are not supported by POSIX basic regular expressions: try the Perl syntax instead.");
return false;
default:
break;
@@ -710,7 +742,7 @@ escape_type_class_jump:
char_class_type m;
if(m_position == m_end)
{
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, "Incomplete property escape found.");
return false;
}
// maybe have \p{ddd}
@@ -722,7 +754,7 @@ escape_type_class_jump:
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, "Closing } missing from property escape sequence.");
return false;
}
m = this->m_traits.lookup_classname(++base, m_position++);
@@ -745,7 +777,7 @@ escape_type_class_jump:
}
return true;
}
- fail(regex_constants::error_ctype, m_position - m_base);
+ fail(regex_constants::error_ctype, m_position - m_base, "Escape sequence was neither a valid property nor a valid character class name.");
return false;
}
case regex_constants::escape_type_reset_start_mark:
@@ -781,9 +813,10 @@ escape_type_class_jump:
{
bool have_brace = false;
bool negative = false;
+ static const char* incomplete_message = "Incomplete \\g escape found.";
if(++m_position == m_end)
{
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, incomplete_message);
return false;
}
// maybe have \g{ddd}
@@ -791,7 +824,7 @@ escape_type_class_jump:
{
if(++m_position == m_end)
{
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, incomplete_message);
return false;
}
have_brace = true;
@@ -799,7 +832,7 @@ escape_type_class_jump:
negative = (*m_position == static_cast('-'));
if((negative) && (++m_position == m_end))
{
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, incomplete_message);
return false;
}
const charT* pc = m_position;
@@ -824,7 +857,7 @@ escape_type_class_jump:
}
else
{
- fail(regex_constants::error_backref, m_position - m_end);
+ fail(regex_constants::error_backref, m_position - m_base);
return false;
}
m_position = pc;
@@ -832,7 +865,7 @@ escape_type_class_jump:
{
if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
{
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, incomplete_message);
return false;
}
++m_position;
@@ -899,7 +932,7 @@ bool basic_regex_parser::parse_repeat(std::size_t low, std::size_
}
if(0 == this->m_last_state)
{
- fail(regex_constants::error_badrepeat, ::boost::re_detail::distance(m_base, m_position));
+ fail(regex_constants::error_badrepeat, ::boost::re_detail::distance(m_base, m_position), "Nothing to repeat.");
return false;
}
if(this->m_last_state->type == syntax_element_endmark)
@@ -986,6 +1019,7 @@ bool basic_regex_parser::parse_repeat(std::size_t low, std::size_
template
bool basic_regex_parser::parse_repeat_range(bool isbasic)
{
+ static const char* incomplete_message = "Missing } in quantified repetition.";
//
// parse a repeat-range:
//
@@ -997,7 +1031,7 @@ bool basic_regex_parser::parse_repeat_range(bool isbasic)
// fail if at end:
if(this->m_position == this->m_end)
{
- fail(regex_constants::error_brace, this->m_position - this->m_base);
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
return false;
}
// get min:
@@ -1012,7 +1046,7 @@ bool basic_regex_parser::parse_repeat_range(bool isbasic)
}
else if(this->m_position == this->m_end)
{
- fail(regex_constants::error_brace, this->m_position - this->m_base);
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
return false;
}
min = v;
@@ -1026,7 +1060,7 @@ bool basic_regex_parser::parse_repeat_range(bool isbasic)
++m_position;
if(this->m_position == this->m_end)
{
- fail(regex_constants::error_brace, this->m_position - this->m_base);
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
return false;
}
// get the value if any:
@@ -1044,7 +1078,7 @@ bool basic_regex_parser::parse_repeat_range(bool isbasic)
// OK now check trailing }:
if(this->m_position == this->m_end)
{
- fail(regex_constants::error_brace, this->m_position - this->m_base);
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
return false;
}
if(isbasic)
@@ -1054,13 +1088,13 @@ bool basic_regex_parser::parse_repeat_range(bool isbasic)
++m_position;
if(this->m_position == this->m_end)
{
- fail(regex_constants::error_brace, this->m_position - this->m_base);
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
return false;
}
}
else
{
- fail(regex_constants::error_badbrace, this->m_position - this->m_base);
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
return false;
}
}
@@ -1068,7 +1102,7 @@ bool basic_regex_parser::parse_repeat_range(bool isbasic)
++m_position;
else
{
- fail(regex_constants::error_badbrace, this->m_position - this->m_base);
+ fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
return false;
}
//
@@ -1076,7 +1110,11 @@ bool basic_regex_parser::parse_repeat_range(bool isbasic)
//
if(min > max)
{
- fail(regex_constants::error_badbrace, this->m_position - this->m_base);
+ // Backtrack to error location:
+ m_position -= 2;
+ while(this->m_traits.isctype(*m_position, this->m_word_mask)) --m_position;
+ ++m_position;
+ fail(regex_constants::error_badbrace, m_position - m_base);
return false;
}
return parse_repeat(min, max);
@@ -1099,7 +1137,7 @@ bool basic_regex_parser::parse_alt()
)
)
{
- fail(regex_constants::error_empty, this->m_position - this->m_base);
+ fail(regex_constants::error_empty, this->m_position - this->m_base, "A regular expression can start with the alternation operator |.");
return false;
}
//
@@ -1151,10 +1189,11 @@ bool basic_regex_parser::parse_alt()
template
bool basic_regex_parser::parse_set()
{
+ static const char* incomplete_message = "Character set declaration starting with [ terminated prematurely - either no ] was found or the set had no content.";
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_brack, m_position - m_base);
+ fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
return false;
}
basic_char_set char_set;
@@ -1187,7 +1226,7 @@ bool basic_regex_parser::parse_set()
++m_position;
if(0 == this->append_set(char_set))
{
- fail(regex_constants::error_range, m_position - m_base);
+ fail(regex_constants::error_ctype, m_position - m_base);
return false;
}
}
@@ -1242,6 +1281,7 @@ bool basic_regex_parser::parse_set()
template
bool basic_regex_parser::parse_inner_set(basic_char_set& char_set)
{
+ static const char* incomplete_message = "Character class declaration starting with [ terminated prematurely - either no ] was found or the set had no content.";
//
// we have either a character class [:name:]
// a collating element [.name.]
@@ -1249,7 +1289,7 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position))
@@ -1274,14 +1314,14 @@ bool basic_regex_parser::parse_inner_set(basic_char_set::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
{
- fail(regex_constants::error_brack, m_position - m_base);
+ fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
return false;
}
//
@@ -1351,14 +1391,14 @@ bool basic_regex_parser::parse_inner_set(basic_char_set::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
{
- fail(regex_constants::error_brack, m_position - m_base);
+ fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
return false;
}
string_type m = this->m_traits.lookup_collatename(name_first, name_last);
@@ -1563,7 +1603,7 @@ charT basic_regex_parser::unescape_character()
charT result(0);
if(m_position == m_end)
{
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, "Escape sequence terminated prematurely.");
return false;
}
switch(this->m_traits.escape_syntax_type(*m_position))
@@ -1596,24 +1636,22 @@ charT basic_regex_parser::unescape_character()
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_escape, m_position - m_base);
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+ fail(regex_constants::error_escape, m_position - m_base, "ASCII escape sequence terminated prematurely.");
return result;
}
- /*
- if((*m_position < charT('@'))
- || (*m_position > charT(125)) )
- {
- fail(regex_constants::error_escape, m_position - m_base);
- return result;
- }
- */
result = static_cast(*m_position % 32);
break;
case regex_constants::escape_type_hex:
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_escape, m_position - m_base);
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+ fail(regex_constants::error_escape, m_position - m_base, "Hexadecimal escape sequence terminated prematurely.");
return result;
}
// maybe have \x{ddd}
@@ -1622,7 +1660,10 @@ charT basic_regex_parser::unescape_character()
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_escape, m_position - m_base);
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+ fail(regex_constants::error_escape, m_position - m_base, "Missing } in hexadecimal escape sequence.");
return result;
}
int i = this->m_traits.toi(m_position, m_end, 16);
@@ -1631,7 +1672,10 @@ charT basic_regex_parser::unescape_character()
|| ((std::numeric_limits::is_specialized) && (i > (int)(std::numeric_limits::max)()))
|| (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
{
- fail(regex_constants::error_badbrace, m_position - m_base);
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+ fail(regex_constants::error_badbrace, m_position - m_base, "Hexadecimal escape sequence was invalid.");
return result;
}
++m_position;
@@ -1644,7 +1688,10 @@ charT basic_regex_parser::unescape_character()
if((i < 0)
|| !valid_value(charT(0), i))
{
- fail(regex_constants::error_escape, m_position - m_base);
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+ fail(regex_constants::error_escape, m_position - m_base, "Escape sequence did not encode a valid character.");
return result;
}
result = charT(i);
@@ -1659,14 +1706,20 @@ charT basic_regex_parser::unescape_character()
int val = this->m_traits.toi(bp, bp + 1, 8);
if(val != 0)
{
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
// Oops not an octal escape after all:
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, "Invalid octal escape sequence.");
return result;
}
val = this->m_traits.toi(m_position, m_position + len, 8);
if(val < 0)
{
- fail(regex_constants::error_escape, m_position - m_base);
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+ fail(regex_constants::error_escape, m_position - m_base, "Octal escape sequence is invalid.");
return result;
}
return static_cast(val);
@@ -1676,6 +1729,9 @@ charT basic_regex_parser::unescape_character()
++m_position;
if(m_position == m_end)
{
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
fail(regex_constants::error_escape, m_position - m_base);
return false;
}
@@ -1688,12 +1744,18 @@ charT basic_regex_parser::unescape_character()
++m_position;
if(m_position == m_end)
{
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
fail(regex_constants::error_escape, m_position - m_base);
return false;
}
string_type s = this->m_traits.lookup_collatename(++base, m_position++);
if(s.empty())
{
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
fail(regex_constants::error_collate, m_position - m_base);
return false;
}
@@ -1703,6 +1765,9 @@ charT basic_regex_parser::unescape_character()
}
}
// fall through is a failure:
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
fail(regex_constants::error_escape, m_position - m_base);
return false;
}
@@ -1738,7 +1803,10 @@ bool basic_regex_parser::parse_backref()
}
else
{
- fail(regex_constants::error_backref, m_position - m_end);
+ // Rewind to start of escape:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+ fail(regex_constants::error_backref, m_position - m_base);
return false;
}
return true;
@@ -1770,7 +1838,7 @@ bool basic_regex_parser::parse_QE()
}
if(++m_position == m_end) // skip the escape
{
- fail(regex_constants::error_escape, m_position - m_base);
+ fail(regex_constants::error_escape, m_position - m_base, "Unterminated \\Q...\\E sequence.");
return false;
}
// check to see if it's a \E:
@@ -1801,7 +1869,10 @@ bool basic_regex_parser::parse_perl_extension()
{
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
//
@@ -1860,7 +1931,10 @@ bool basic_regex_parser::parse_perl_extension()
v = this->m_traits.toi(m_position, m_end, 10);
if((v < 0) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark))
{
- fail(regex_constants::error_backref, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base, "The recursive sub-expression refers to an invalid marking group, or is unterminated.");
return false;
}
insert_recursion:
@@ -1879,7 +1953,10 @@ insert_recursion:
v = this->m_traits.toi(m_position, m_end, 10);
if((v <= 0) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark))
{
- fail(regex_constants::error_backref, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression.");
return false;
}
v += m_mark_count;
@@ -1899,7 +1976,10 @@ insert_recursion:
v = m_mark_count + 1 - v;
if(v <= 0)
{
- fail(regex_constants::error_backref, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression.");
return false;
}
goto insert_recursion;
@@ -1922,7 +2002,10 @@ insert_recursion:
// a lookbehind assertion:
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
regex_constants::syntax_type t = this->m_traits.syntax_type(*m_position);
@@ -1960,7 +2043,10 @@ insert_recursion:
pb->index = markid = -4;
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
int v = this->m_traits.toi(m_position, m_end, 10);
@@ -1968,7 +2054,10 @@ insert_recursion:
{
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(*m_position == charT('&'))
@@ -1978,7 +2067,10 @@ insert_recursion:
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
v = -static_cast(hash_value_from_capture_name(base, m_position));
@@ -1991,12 +2083,18 @@ insert_recursion:
br->index = v < 0 ? (v - 1) : 0;
if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
}
@@ -2007,7 +2105,10 @@ insert_recursion:
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
v = static_cast(hash_value_from_capture_name(base, m_position));
@@ -2015,17 +2116,26 @@ insert_recursion:
br->index = v;
if(((*m_position != charT('>')) && (*m_position != charT('\''))) || (++m_position == m_end))
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base, "Unterminated named capture.");
return false;
}
if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
}
@@ -2036,19 +2146,28 @@ insert_recursion:
++m_position, ++def;
if((m_position == m_end) || *def)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
re_brace* br = static_cast(this->append_state(syntax_element_assert_backref, sizeof(re_brace)));
br->index = 9999; // special magic value!
if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
}
@@ -2058,12 +2177,18 @@ insert_recursion:
br->index = v;
if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
}
@@ -2072,25 +2197,37 @@ insert_recursion:
// verify that we have a lookahead or lookbehind assert:
if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_question)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(this->m_traits.syntax_type(*m_position) == regex_constants::escape_type_left_word)
{
if(++m_position == m_end)
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if((this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)
&& (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_not))
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
m_position -= 3;
@@ -2100,7 +2237,10 @@ insert_recursion:
if((this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)
&& (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_not))
{
- fail(regex_constants::error_paren, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
m_position -= 2;
@@ -2109,7 +2249,10 @@ insert_recursion:
break;
}
case regex_constants::syntax_close_mark:
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
case regex_constants::escape_type_end_buffer:
{
@@ -2131,14 +2274,20 @@ named_capture_jump:
const charT* base = ++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_paren, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
while((m_position != m_end) && (*m_position != name_delim))
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_paren, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
this->m_pdata->set_name(base, m_position, markid);
@@ -2152,7 +2301,10 @@ named_capture_jump:
v = 0;
if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
{
- fail(regex_constants::error_backref, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
goto insert_recursion;
@@ -2165,7 +2317,10 @@ named_capture_jump:
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_backref, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
v = static_cast(hash_value_from_capture_name(base, m_position));
@@ -2176,7 +2331,10 @@ named_capture_jump:
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_backref, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(*m_position == charT('>'))
@@ -2187,7 +2345,10 @@ named_capture_jump:
++m_position;
if(m_position == m_end)
{
- fail(regex_constants::error_backref, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
v = static_cast(hash_value_from_capture_name(base, m_position));
@@ -2200,7 +2361,13 @@ named_capture_jump:
option_group_jump:
regex_constants::syntax_option_type opts = parse_options();
if(m_position == m_end)
+ {
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
+ }
// make a note of whether we have a case change:
m_has_case_change = ((opts & regbase::icase) != (this->flags() & regbase::icase));
pb->index = markid = 0;
@@ -2219,7 +2386,10 @@ option_group_jump:
}
else
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
@@ -2241,12 +2411,21 @@ option_group_jump:
// Unwind alternatives:
//
if(0 == unwind_alts(last_paren_start))
+ {
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base, "Invalid alternation operators within (?...) block.");
return false;
+ }
//
// we either have a ')' or we have run out of characters prematurely:
//
if(m_position == m_end)
{
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
this->fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_end));
return false;
}
@@ -2277,7 +2456,10 @@ option_group_jump:
if(this->m_last_state == jmp)
{
// Oops... we didn't have anything inside the assertion:
- fail(regex_constants::error_empty, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_perl_extension, m_position - m_base, "Invalid or empty zero width assertion.");
return false;
}
}
@@ -2297,7 +2479,10 @@ option_group_jump:
else if(this->getaddress(static_cast(b)->alt.i, b)->type == syntax_element_alt)
{
// Can't have seen more than one alternative:
- fail(regex_constants::error_bad_pattern, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_bad_pattern, m_position - m_base, "More than one alternation operator | was encountered inside a conditional expression.");
return false;
}
else
@@ -2306,7 +2491,10 @@ option_group_jump:
b = this->getaddress(b->next.i, b);
if((b->type == syntax_element_assert_backref) && (static_cast(b)->index == 9999))
{
- fail(regex_constants::error_bad_pattern, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_bad_pattern, m_position - m_base, "Alternation operators are not allowed inside a DEFINE block.");
return false;
}
}
@@ -2316,7 +2504,10 @@ option_group_jump:
if((b->type != syntax_element_assert_backref)
&& (b->type != syntax_element_startmark))
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+ fail(regex_constants::error_badrepeat, m_position - m_base, "A repetition operator cannot be applied to a zero-width assertion.");
return false;
}
}
@@ -2371,6 +2562,9 @@ bool basic_regex_parser::add_emacs_code(bool negate)
//
if(++m_position == m_end)
{
+ // Rewind to start of sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
fail(regex_constants::error_escape, m_position - m_base);
return false;
}
@@ -2471,6 +2665,9 @@ regex_constants::syntax_option_type basic_regex_parser::parse_opt
}
if(++m_position == m_end)
{
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
fail(regex_constants::error_paren, m_position - m_base);
return false;
}
@@ -2481,6 +2678,9 @@ regex_constants::syntax_option_type basic_regex_parser::parse_opt
{
if(++m_position == m_end)
{
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
fail(regex_constants::error_paren, m_position - m_base);
return false;
}
@@ -2507,6 +2707,9 @@ regex_constants::syntax_option_type basic_regex_parser::parse_opt
}
if(++m_position == m_end)
{
+ // Rewind to start of (? sequence:
+ --m_position;
+ while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
fail(regex_constants::error_paren, m_position - m_base);
return false;
}
@@ -2533,7 +2736,7 @@ bool basic_regex_parser::unwind_alts(std::ptrdiff_t last_paren_st
)
)
{
- fail(regex_constants::error_empty, this->m_position - this->m_base);
+ fail(regex_constants::error_empty, this->m_position - this->m_base, "Can't terminate a sub-expression with an alternation operator |.");
return false;
}
//
diff --git a/include/boost/regex/v4/cregex.hpp b/include/boost/regex/v4/cregex.hpp
index cafe396c..7b3df1e5 100644
--- a/include/boost/regex/v4/cregex.hpp
+++ b/include/boost/regex/v4/cregex.hpp
@@ -124,11 +124,11 @@ typedef enum{
REG_STARTEND = 00004
} reg_exec_flags;
-//
-// POSIX error codes:
-//
+/*
+ * POSIX error codes:
+ */
typedef unsigned reg_error_t;
-typedef reg_error_t reg_errcode_t; // backwards compatibility
+typedef reg_error_t reg_errcode_t; /* backwards compatibility */
static const reg_error_t REG_NOERROR = 0; /* Success. */
static const reg_error_t REG_NOMATCH = 1; /* Didn't find a match (for regexec). */
@@ -154,8 +154,9 @@ static const reg_error_t REG_EMPTY = 17; /* empty expression */
static const reg_error_t REG_E_MEMORY = 15; /* = REG_ESIZE : out of memory */
static const reg_error_t REG_ECOMPLEXITY = 18; /* complexity too high */
static const reg_error_t REG_ESTACK = 19; /* out of stack space */
-static const reg_error_t REG_E_UNKNOWN = 20; /* unknown error */
-static const reg_error_t REG_ENOSYS = 20; /* = REG_E_UNKNOWN : Reserved. */
+static const reg_error_t REG_E_PERL = 20; /* Perl (?...) error */
+static const reg_error_t REG_E_UNKNOWN = 21; /* unknown error */
+static const reg_error_t REG_ENOSYS = 21; /* = REG_E_UNKNOWN : Reserved. */
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
@@ -195,14 +196,14 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
#endif
#ifdef __cplusplus
-} // extern "C"
-} // namespace
+} /* extern "C" */
+} /* namespace */
#endif
-//
-// C++ high level wrapper goes here:
-//
#if defined(__cplusplus)
+/*
+ * C++ high level wrapper goes here:
+ */
#include
#include
namespace boost{
@@ -228,7 +229,7 @@ struct pred2;
struct pred3;
struct pred4;
-} // namespace re_detail
+} /* namespace re_detail */
#if (defined(BOOST_MSVC) || defined(__BORLANDC__)) && !defined(BOOST_DISABLE_WIN32)
typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
@@ -257,9 +258,9 @@ public:
unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
std::string Expression()const;
unsigned int error_code()const;
- //
- // now matching operators:
- //
+ /*
+ * now matching operators:
+ */
bool Match(const char* p, match_flag_type flags = match_default);
bool Match(const std::string& s, match_flag_type flags = match_default) { return Match(s.c_str(), flags); }
bool Search(const char* p, match_flag_type flags = match_default);
@@ -283,9 +284,9 @@ public:
bool copy = true, match_flag_type flags = match_default);
std::size_t Split(std::vector& v, std::string& s, match_flag_type flags = match_default, unsigned max_count = ~0);
- //
- // now operators for returning what matched in more detail:
- //
+ /*
+ * now operators for returning what matched in more detail:
+ */
std::size_t Position(int i = 0)const;
std::size_t Length(int i = 0)const;
bool Matched(int i = 0)const;
@@ -312,11 +313,11 @@ public:
#pragma warning(pop)
#endif
-} // namespace boost
+} /* namespace boost */
-#endif
+#endif /* __cplusplus */
-#endif // include guard
+#endif /* include guard */
diff --git a/include/boost/regex/v4/error_type.hpp b/include/boost/regex/v4/error_type.hpp
index b6633a00..afcc71e3 100644
--- a/include/boost/regex/v4/error_type.hpp
+++ b/include/boost/regex/v4/error_type.hpp
@@ -28,8 +28,8 @@ namespace regex_constants{
enum error_type{
- error_ok = 0, // not used
- error_no_match = 1, // not used
+ error_ok = 0, /* not used */
+ error_no_match = 1, /* not used */
error_bad_pattern = 2,
error_collate = 3,
error_ctype = 4,
@@ -42,17 +42,18 @@ enum error_type{
error_range = 11,
error_space = 12,
error_badrepeat = 13,
- error_end = 14, // not used
+ error_end = 14, /* not used */
error_size = 15,
- error_right_paren = 16, // not used
+ error_right_paren = 16, /* not used */
error_empty = 17,
error_complexity = 18,
error_stack = 19,
- error_unknown = 20
+ error_perl_extension = 20,
+ error_unknown = 21
};
}
}
-#endif // __cplusplus
+#endif /* __cplusplus */
#endif
diff --git a/include/boost/regex/v4/match_flags.hpp b/include/boost/regex/v4/match_flags.hpp
index 9585aca8..26bde9a5 100644
--- a/include/boost/regex/v4/match_flags.hpp
+++ b/include/boost/regex/v4/match_flags.hpp
@@ -31,43 +31,43 @@ namespace boost{
typedef enum _match_flags
{
match_default = 0,
- match_not_bol = 1, // first is not start of line
- match_not_eol = match_not_bol << 1, // last is not end of line
- match_not_bob = match_not_eol << 1, // first is not start of buffer
- match_not_eob = match_not_bob << 1, // last is not end of buffer
- match_not_bow = match_not_eob << 1, // first is not start of word
- match_not_eow = match_not_bow << 1, // last is not end of word
- match_not_dot_newline = match_not_eow << 1, // \n is not matched by '.'
- match_not_dot_null = match_not_dot_newline << 1, // '\0' is not matched by '.'
- match_prev_avail = match_not_dot_null << 1, // *--first is a valid expression
- match_init = match_prev_avail << 1, // internal use
- match_any = match_init << 1, // don't care what we match
- match_not_null = match_any << 1, // string can't be null
- match_continuous = match_not_null << 1, // each grep match must continue from
- // uninterupted from the previous one
- match_partial = match_continuous << 1, // find partial matches
+ match_not_bol = 1, /* first is not start of line */
+ match_not_eol = match_not_bol << 1, /* last is not end of line */
+ match_not_bob = match_not_eol << 1, /* first is not start of buffer */
+ match_not_eob = match_not_bob << 1, /* last is not end of buffer */
+ match_not_bow = match_not_eob << 1, /* first is not start of word */
+ match_not_eow = match_not_bow << 1, /* last is not end of word */
+ match_not_dot_newline = match_not_eow << 1, /* \n is not matched by '.' */
+ match_not_dot_null = match_not_dot_newline << 1, /* '\0' is not matched by '.' */
+ match_prev_avail = match_not_dot_null << 1, /* *--first is a valid expression */
+ match_init = match_prev_avail << 1, /* internal use */
+ match_any = match_init << 1, /* don't care what we match */
+ match_not_null = match_any << 1, /* string can't be null */
+ match_continuous = match_not_null << 1, /* each grep match must continue from */
+ /* uninterupted from the previous one */
+ match_partial = match_continuous << 1, /* find partial matches */
- match_stop = match_partial << 1, // stop after first match (grep) V3 only
- match_not_initial_null = match_stop, // don't match initial null, V4 only
- match_all = match_stop << 1, // must find the whole of input even if match_any is set
- match_perl = match_all << 1, // Use perl matching rules
- match_posix = match_perl << 1, // Use POSIX matching rules
- match_nosubs = match_posix << 1, // don't trap marked subs
- match_extra = match_nosubs << 1, // include full capture information for repeated captures
- match_single_line = match_extra << 1, // treat text as single line and ignor any \n's when matching ^ and $.
- match_unused1 = match_single_line << 1, // unused
- match_unused2 = match_unused1 << 1, // unused
- match_unused3 = match_unused2 << 1, // unused
+ match_stop = match_partial << 1, /* stop after first match (grep) V3 only */
+ match_not_initial_null = match_stop, /* don't match initial null, V4 only */
+ match_all = match_stop << 1, /* must find the whole of input even if match_any is set */
+ match_perl = match_all << 1, /* Use perl matching rules */
+ match_posix = match_perl << 1, /* Use POSIX matching rules */
+ match_nosubs = match_posix << 1, /* don't trap marked subs */
+ match_extra = match_nosubs << 1, /* include full capture information for repeated captures */
+ match_single_line = match_extra << 1, /* treat text as single line and ignor any \n's when matching ^ and $. */
+ match_unused1 = match_single_line << 1, /* unused */
+ match_unused2 = match_unused1 << 1, /* unused */
+ match_unused3 = match_unused2 << 1, /* unused */
match_max = match_unused3,
- format_perl = 0, // perl style replacement
- format_default = 0, // ditto.
- format_sed = match_max << 1, // sed style replacement.
- format_all = format_sed << 1, // enable all extentions to sytax.
- format_no_copy = format_all << 1, // don't copy non-matching segments.
- format_first_only = format_no_copy << 1, // Only replace first occurance.
- format_is_if = format_first_only << 1, // internal use only.
- format_literal = format_is_if << 1 // treat string as a literal
+ format_perl = 0, /* perl style replacement */
+ format_default = 0, /* ditto. */
+ format_sed = match_max << 1, /* sed style replacement. */
+ format_all = format_sed << 1, /* enable all extentions to sytax. */
+ format_no_copy = format_all << 1, /* don't copy non-matching segments. */
+ format_first_only = format_no_copy << 1, /* Only replace first occurance. */
+ format_is_if = format_first_only << 1, /* internal use only. */
+ format_literal = format_is_if << 1 /* treat string as a literal */
} match_flags;
@@ -96,10 +96,10 @@ inline match_flags& operator^=(match_flags& m1, match_flags m2)
#endif
#ifdef __cplusplus
-} // namespace regex_constants
-//
-// import names into boost for backwards compatiblity:
-//
+} /* namespace regex_constants */
+/*
+ * import names into boost for backwards compatiblity:
+ */
using regex_constants::match_flag_type;
using regex_constants::match_default;
using regex_constants::match_not_bol;
@@ -111,28 +111,28 @@ using regex_constants::match_not_eow;
using regex_constants::match_not_dot_newline;
using regex_constants::match_not_dot_null;
using regex_constants::match_prev_avail;
-//using regex_constants::match_init;
+/* using regex_constants::match_init; */
using regex_constants::match_any;
using regex_constants::match_not_null;
using regex_constants::match_continuous;
using regex_constants::match_partial;
-//using regex_constants::match_stop;
+/*using regex_constants::match_stop; */
using regex_constants::match_all;
using regex_constants::match_perl;
using regex_constants::match_posix;
using regex_constants::match_nosubs;
using regex_constants::match_extra;
using regex_constants::match_single_line;
-//using regex_constants::match_max;
+/*using regex_constants::match_max; */
using regex_constants::format_all;
using regex_constants::format_sed;
using regex_constants::format_perl;
using regex_constants::format_default;
using regex_constants::format_no_copy;
using regex_constants::format_first_only;
-//using regex_constants::format_is_if;
+/*using regex_constants::format_is_if;*/
-} // namespace boost
-#endif // __cplusplus
-#endif // include guard
+} /* namespace boost */
+#endif /* __cplusplus */
+#endif /* include guard */
diff --git a/include/boost/regex/v4/perl_matcher_non_recursive.hpp b/include/boost/regex/v4/perl_matcher_non_recursive.hpp
index 2ce7ebe0..343afc02 100644
--- a/include/boost/regex/v4/perl_matcher_non_recursive.hpp
+++ b/include/boost/regex/v4/perl_matcher_non_recursive.hpp
@@ -188,7 +188,7 @@ bool perl_matcher::match_all_states()
if(!(this->*proc)())
{
if(state_count > max_state_count)
- raise_error(traits_inst, regex_constants::error_space);
+ raise_error(traits_inst, regex_constants::error_complexity);
if((m_match_flags & match_partial) && (position == last) && (position != search_base))
m_has_partial_match = true;
bool successful_unwind = unwind(false);
@@ -219,7 +219,7 @@ void perl_matcher::extend_stack()
m_backup_state = block;
}
else
- raise_error(traits_inst, regex_constants::error_size);
+ raise_error(traits_inst, regex_constants::error_stack);
}
template
diff --git a/include/boost/regex/v4/perl_matcher_recursive.hpp b/include/boost/regex/v4/perl_matcher_recursive.hpp
index 48f08b7b..d0de8025 100644
--- a/include/boost/regex/v4/perl_matcher_recursive.hpp
+++ b/include/boost/regex/v4/perl_matcher_recursive.hpp
@@ -99,7 +99,7 @@ bool perl_matcher::match_all_states()
};
if(state_count > max_state_count)
- raise_error(traits_inst, regex_constants::error_space);
+ raise_error(traits_inst, regex_constants::error_complexity);
while(pstate)
{
matcher_proc_type proc = s_match_vtable[pstate->type];
diff --git a/include/boost/regex/v4/regex_format.hpp b/include/boost/regex/v4/regex_format.hpp
index 52e0f6b1..bd88d218 100644
--- a/include/boost/regex/v4/regex_format.hpp
+++ b/include/boost/regex/v4/regex_format.hpp
@@ -831,7 +831,7 @@ OutputIterator regex_format_imp(OutputIterator out,
#ifndef BOOST_NO_SFINAE
-BOOST_MPL_HAS_XXX_TRAIT_DEF(const_iterator);
+BOOST_MPL_HAS_XXX_TRAIT_DEF(const_iterator)
struct any_type { any_type(...); };
typedef char no_type;
@@ -972,6 +972,8 @@ struct format_functor3
}
private:
Base func;
+ format_functor3(const format_functor3&);
+ format_functor3& operator=(const format_functor3&);
};
template
@@ -990,6 +992,8 @@ struct format_functor2
}
private:
Base func;
+ format_functor2(const format_functor2&);
+ format_functor2& operator=(const format_functor2&);
};
template
@@ -1025,6 +1029,8 @@ struct format_functor1
}
private:
Base func;
+ format_functor1(const format_functor1&);
+ format_functor1& operator=(const format_functor1&);
};
template
@@ -1042,6 +1048,8 @@ struct format_functor_c_string
}
private:
const charT* func;
+ format_functor_c_string(const format_functor_c_string&);
+ format_functor_c_string& operator=(const format_functor_c_string&);
};
template
@@ -1057,6 +1065,8 @@ struct format_functor_container
}
private:
const Container& func;
+ format_functor_container(const format_functor_container&);
+ format_functor_container& operator=(const format_functor_container&);
};
template >
diff --git a/include/boost/regex/v4/regex_traits_defaults.hpp b/include/boost/regex/v4/regex_traits_defaults.hpp
index 5b2c6bc3..a8361083 100644
--- a/include/boost/regex/v4/regex_traits_defaults.hpp
+++ b/include/boost/regex/v4/regex_traits_defaults.hpp
@@ -322,7 +322,7 @@ inline const charT* get_escape_R_string()
{
#ifdef BOOST_MSVC
# pragma warning(push)
-# pragma warning(disable:4309)
+# pragma warning(disable:4309 4245)
#endif
static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?',
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', '\\', 'x', '{', '2', '0', '2', '8', '}',
diff --git a/src/cregex.cpp b/src/cregex.cpp
index fb12373a..f67d3718 100644
--- a/src/cregex.cpp
+++ b/src/cregex.cpp
@@ -563,11 +563,7 @@ std::string RegEx::What(int i)const
return result;
}
-#ifdef BOOST_HAS_LONG_LONG
-const std::size_t RegEx::npos = static_cast(~0ULL);
-#else
-const std::size_t RegEx::npos = static_cast(~0UL);
-#endif
+const std::size_t RegEx::npos = ~static_cast(0);
} // namespace boost
diff --git a/src/posix_api.cpp b/src/posix_api.cpp
index 1564cedb..37ed4221 100644
--- a/src/posix_api.cpp
+++ b/src/posix_api.cpp
@@ -58,6 +58,7 @@ const char* names[] = {
"REG_EMPTY",
"REG_ECOMPLEXITY",
"REG_ESTACK",
+ "REG_E_PERL",
"REG_E_UNKNOWN",
};
} // namespace
diff --git a/src/regex_traits_defaults.cpp b/src/regex_traits_defaults.cpp
index c9596a3d..31b79184 100644
--- a/src/regex_traits_defaults.cpp
+++ b/src/regex_traits_defaults.cpp
@@ -111,30 +111,31 @@ BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants
BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n)
{
static const char* const s_default_error_messages[] = {
- "Success", /* REG_NOERROR */
- "No match", /* REG_NOMATCH */
- "Invalid regular expression", /* REG_BADPAT */
- "Invalid collation character", /* REG_ECOLLATE */
- "Invalid character class name", /* REG_ECTYPE */
- "Invalid or trailing backslash", /* REG_EESCAPE */
- "Invalid back reference", /* REG_ESUBREG */
- "Unmatched [ or [^", /* REG_EBRACK */
- "Unmatched ( or \\(", /* REG_EPAREN */
- "Unmatched { or \\{", /* REG_EBRACE */
- "Invalid content of repeat range", /* REG_BADBR */
- "Invalid range end", /* REG_ERANGE */
- "Memory exhausted", /* REG_ESPACE */
- "Invalid preceding regular expression", /* REG_BADRPT */
- "Premature end of regular expression", /* REG_EEND */
- "Regular expression too big", /* REG_ESIZE */
- "Unmatched ) or \\)", /* REG_ERPAREN */
- "Empty expression", /* REG_EMPTY */
- "Complexity requirements exceeded", /* REG_ECOMPLEXITY */
- "Out of stack space", /* REG_ESTACK */
- "Unknown error", /* REG_E_UNKNOWN */
- "",
- "",
- "",
+ "Success", /* REG_NOERROR 0 error_ok */
+ "No match", /* REG_NOMATCH 1 error_no_match */
+ "Invalid regular expression.", /* REG_BADPAT 2 error_bad_pattern */
+ "Invalid collation character.", /* REG_ECOLLATE 3 error_collate */
+ "Invalid character class name, collating name, or character range.", /* REG_ECTYPE 4 error_ctype */
+ "Invalid or unterminated escape sequence.", /* REG_EESCAPE 5 error_escape */
+ "Invalid back reference: specified capturing group does not exist.", /* REG_ESUBREG 6 error_backref */
+ "Unmatched [ or [^ in character class declaration.", /* REG_EBRACK 7 error_brack */
+ "Unmatched marking parenthesis ( or \\(.", /* REG_EPAREN 8 error_paren */
+ "Unmatched quantified repeat operator { or \\{.", /* REG_EBRACE 9 error_brace */
+ "Invalid content of repeat range.", /* REG_BADBR 10 error_badbrace */
+ "Invalid range end in character class", /* REG_ERANGE 11 error_range */
+ "Out of memory.", /* REG_ESPACE 12 error_space NOT USED */
+ "Invalid preceding regular expression prior to repetition operator.", /* REG_BADRPT 13 error_badrepeat */
+ "Premature end of regular expression", /* REG_EEND 14 error_end NOT USED */
+ "Regular expression is too large.", /* REG_ESIZE 15 error_size NOT USED */
+ "Unmatched ) or \\)", /* REG_ERPAREN 16 error_right_paren NOT USED */
+ "Empty regular expression.", /* REG_EMPTY 17 error_empty */
+ "The complexity of matching the regular expression exceeded predefined bounds. "
+ "Try refactoring the regular expression to make each choice made by the state machine unambiguous. "
+ "This exception is thrown to prevent \"eternal\" matches that take an "
+ "indefinite period time to locate.", /* REG_ECOMPLEXITY 18 error_complexity */
+ "Ran out of stack space trying to match the regular expression.", /* REG_ESTACK 19 error_stack */
+ "Invalid or unterminated Perl (?...) sequence.", /* REG_E_PERL 20 error_perl */
+ "Unknown error.", /* REG_E_UNKNOWN 21 error_unknown */
};
return (n > ::boost::regex_constants::error_unknown) ? s_default_error_messages[ ::boost::regex_constants::error_unknown] : s_default_error_messages[n];
diff --git a/src/wide_posix_api.cpp b/src/wide_posix_api.cpp
index c8a91902..bdb7580e 100644
--- a/src/wide_posix_api.cpp
+++ b/src/wide_posix_api.cpp
@@ -65,6 +65,7 @@ const wchar_t* wnames[] = {
L"REG_EMPTY",
L"REG_ECOMPLEXITY",
L"REG_ESTACK",
+ L"REG_E_PERL",
L"REG_E_UNKNOWN",
};
}
diff --git a/test/c_compiler_checks/posix_api_check.cpp b/test/c_compiler_checks/posix_api_check.cpp
index 9a94c651..8daae8f2 100644
--- a/test/c_compiler_checks/posix_api_check.cpp
+++ b/test/c_compiler_checks/posix_api_check.cpp
@@ -34,13 +34,13 @@ int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
int main()
{
regex_tA re;
- int result;
+ unsigned int result;
result = regcompA(&re, expression, REG_AWK);
if(result > REG_NOERROR)
{
char buf[256];
regerrorA(result, &re, buf, sizeof(buf));
- printf(buf);
+ printf("%s", buf);
return result;
}
BOOST_TEST(re.re_nsub == 0);
@@ -51,11 +51,11 @@ int main()
{
char buf[256];
regerrorA(result, &re, buf, sizeof(buf));
- printf(buf);
+ printf("%s", buf);
regfreeA(&re);
return result;
}
- BOOST_TEST(matches[0].rm_so == matches[0].rm_eo == 1);
+ BOOST_TEST(matches[0].rm_so == matches[0].rm_eo);
regfreeA(&re);
printf("no errors found\n");
return boost::report_errors();
diff --git a/test/c_compiler_checks/wide_posix_api_check.cpp b/test/c_compiler_checks/wide_posix_api_check.cpp
index 7e699f03..30172619 100644
--- a/test/c_compiler_checks/wide_posix_api_check.cpp
+++ b/test/c_compiler_checks/wide_posix_api_check.cpp
@@ -40,7 +40,7 @@ int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
int main()
{
regex_t re;
- int result;
+ unsigned result;
result = regcomp(&re, expression, REG_AWK);
if(result > REG_NOERROR)
{
@@ -48,8 +48,8 @@ int main()
regerror(result, &re, buf, sizeof(buf));
char nbuf[256];
for(int i = 0; i < 256; ++i)
- nbuf[i] = buf[i];
- printf(nbuf);
+ nbuf[i] = static_cast(buf[i]);
+ printf("%s", nbuf);
return result;
}
if(re.re_nsub != 0)
@@ -66,8 +66,8 @@ int main()
regerror(result, &re, buf, sizeof(buf));
char nbuf[256];
for(int i = 0; i < 256; ++i)
- nbuf[i] = buf[i];
- printf(nbuf);
+ nbuf[i] = static_cast(buf[i]);
+ printf("%s", nbuf);
regfree(&re);
return result;
}
@@ -77,7 +77,7 @@ int main()
exit(-1);
}
regfree(&re);
- printf("no errors found\n");
+ printf("%s", "no errors found\n");
return 0;
}
diff --git a/test/regress/test_deprecated.cpp b/test/regress/test_deprecated.cpp
index 84eefb9f..276fa599 100644
--- a/test/regress/test_deprecated.cpp
+++ b/test/regress/test_deprecated.cpp
@@ -137,7 +137,7 @@ void test_deprecated(const char&, const test_regex_search_tag&)
if(test_info::syntax_options() & ~boost::regex::icase)
return;
try{
- boost::RegEx e(expression, test_info::syntax_options() & boost::regex::icase);
+ boost::RegEx e(expression, (test_info::syntax_options() & boost::regex::icase) != 0);
if(e.error_code())
{
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << e.error_code(), char);
@@ -303,7 +303,7 @@ void test_deprecated(const char&, const test_invalid_regex_tag&)
return;
bool have_catch = false;
try{
- boost::RegEx e(expression, test_info::syntax_options() & boost::regex::icase);
+ boost::RegEx e(expression, (test_info::syntax_options() & boost::regex::icase) != 0);
if(e.error_code())
have_catch = true;
}
diff --git a/test/regress/test_escapes.cpp b/test/regress/test_escapes.cpp
index d2dbbe43..e3d675be 100644
--- a/test/regress/test_escapes.cpp
+++ b/test/regress/test_escapes.cpp
@@ -12,7 +12,7 @@
#include "test.hpp"
#ifdef BOOST_MSVC
-#pragma warning(disable:4127)
+#pragma warning(disable:4127 4428)
#endif
void test_character_escapes()
diff --git a/test/regress/test_simple_repeats.cpp b/test/regress/test_simple_repeats.cpp
index 690c71eb..1ebdc707 100644
--- a/test/regress/test_simple_repeats.cpp
+++ b/test/regress/test_simple_repeats.cpp
@@ -172,6 +172,7 @@ void test_simple_repeats()
TEST_REGEX_SEARCH("^a{0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
TEST_REGEX_SEARCH("^(?:a){0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
TEST_REGEX_SEARCH("^a(?:bc)?", perl, "abcbc", match_any|match_all, make_array(-2, -2));
+ test_simple_repeats2();
}
void test_simple_repeats2()
diff --git a/test/static_mutex/static_mutex_test.cpp b/test/static_mutex/static_mutex_test.cpp
index 72a8cd49..b31eefac 100644
--- a/test/static_mutex/static_mutex_test.cpp
+++ b/test/static_mutex/static_mutex_test.cpp
@@ -161,7 +161,7 @@ startup1 up1;
int main()
{
- BOOST_TEST(0 != &up1);
+ (void)up1;
std::list > threads;
for(int i = 0; i < 2; ++i)