From a83329dd28fe1f1821c153c4416eb5e4382650ef Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 23 Nov 2009 10:45:44 +0000 Subject: [PATCH] Allow std::locale's to not have a messages facet installed (fixes some STLPort issues). Allow match_results to handle singular iterators. Update docs to match. [SVN r57860] --- doc/history.qbk | 4 +- .../background_information/examples.html | 6 +- .../background_information/history.html | 20 ++-- .../background_information/locale.html | 8 +- .../background_information/standards.html | 10 +- doc/html/boost_regex/captures.html | 6 +- .../format/boost_format_syntax.html | 8 +- doc/html/boost_regex/install.html | 16 +-- doc/html/boost_regex/ref/bad_expression.html | 4 +- doc/html/boost_regex/ref/basic_regex.html | 18 +-- .../ref/concepts/traits_concept.html | 4 +- .../deprecated_interfaces/regex_format.html | 2 +- doc/html/boost_regex/ref/error_type.html | 4 +- doc/html/boost_regex/ref/match_flag_type.html | 2 +- doc/html/boost_regex/ref/match_results.html | 4 +- .../ref/non_std_strings/icu/unicode_algo.html | 6 +- .../ref/non_std_strings/icu/unicode_iter.html | 4 +- .../non_std_strings/mfc_strings/mfc_algo.html | 10 +- .../non_std_strings/mfc_strings/mfc_iter.html | 4 +- doc/html/boost_regex/ref/posix.html | 8 +- doc/html/boost_regex/ref/regex_iterator.html | 4 +- doc/html/boost_regex/ref/regex_match.html | 4 +- doc/html/boost_regex/ref/regex_replace.html | 4 +- doc/html/boost_regex/ref/regex_search.html | 4 +- .../boost_regex/ref/regex_token_iterator.html | 4 +- doc/html/boost_regex/ref/regex_traits.html | 2 +- doc/html/boost_regex/ref/sub_match.html | 8 +- .../boost_regex/syntax/basic_extended.html | 66 +++++------ doc/html/boost_regex/syntax/basic_syntax.html | 44 +++---- doc/html/boost_regex/syntax/perl_syntax.html | 96 +++++++-------- doc/html/boost_regex/unicode.html | 4 +- doc/html/index.html | 4 +- include/boost/regex/v4/cpp_regex_traits.hpp | 10 +- include/boost/regex/v4/match_results.hpp | 112 ++++++++++++++++-- src/cpp_regex_traits.cpp | 2 +- test/regress/test_regex_search.hpp | 20 +++- 36 files changed, 324 insertions(+), 212 deletions(-) diff --git a/doc/history.qbk b/doc/history.qbk index 93721338..cfe8be5a 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -15,7 +15,9 @@ * Fixed tickets [@https://svn.boost.org/trac/boost/ticket/2802 #2802], [@https://svn.boost.org/trac/boost/ticket/2802 #3425], -[@https://svn.boost.org/trac/boost/ticket/2802 #3507] +[@https://svn.boost.org/trac/boost/ticket/2802 #3507], +[@https://svn.boost.org/trac/boost/ticket/2802 #3631], +[@https://svn.boost.org/trac/boost/ticket/2802 #3632] [h4 Boost 1.40] diff --git a/doc/html/boost_regex/background_information/examples.html b/doc/html/boost_regex/background_information/examples.html index 1e41d80a..9e7c7b84 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
- + Test Programs
@@ -107,7 +107,7 @@ Files: captures_test.cpp.

- + Example programs
@@ -133,7 +133,7 @@ Files: regex_timer.cpp.

- + Code snippets
diff --git a/doc/html/boost_regex/background_information/history.html b/doc/html/boost_regex/background_information/history.html index 78843041..e2088341 100644 --- a/doc/html/boost_regex/background_information/history.html +++ b/doc/html/boost_regex/background_information/history.html @@ -26,7 +26,7 @@ History
- + Boost 1.42
@@ -41,11 +41,13 @@
  • Fixed tickets #2802, #3425, - #3507 + #3507, + #3631, + #3632
  • - + Boost 1.40
    @@ -54,7 +56,7 @@ branch resets and recursive regular expressions.
    - + Boost 1.38
    @@ -81,7 +83,7 @@
    - + Boost 1.34
    @@ -104,7 +106,7 @@
    - + Boost 1.33.1
    @@ -174,7 +176,7 @@
    - + Boost 1.33.0
    @@ -229,7 +231,7 @@
    - + Boost 1.32.1
    @@ -237,7 +239,7 @@ Fixed bug in partial matches of bounded repeats of '.'.
    - + Boost 1.31.0
    diff --git a/doc/html/boost_regex/background_information/locale.html b/doc/html/boost_regex/background_information/locale.html index 8295fabf..b45be24a 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:

    - + Win32 localization model.
    @@ -90,7 +90,7 @@ are treated as "unknown" graphic characters.

    - + C localization model.
    @@ -114,7 +114,7 @@ libraries including version 1 of this library.

    - + C++ localization model.
    @@ -151,7 +151,7 @@ in your code. The best way to ensure this is to add the #define to <boost/regex/user.hpp>.

    - + Providing a message catalogue
    diff --git a/doc/html/boost_regex/background_information/standards.html b/doc/html/boost_regex/background_information/standards.html index 3750ec0f..504d151f 100644 --- a/doc/html/boost_regex/background_information/standards.html +++ b/doc/html/boost_regex/background_information/standards.html @@ -28,7 +28,7 @@ Conformance
    - + C++

    @@ -36,7 +36,7 @@ Report on C++ Library Extensions.

    - + ECMAScript / JavaScript
    @@ -49,7 +49,7 @@ rather than a Unicode escape sequence; use \x{DDDD} for Unicode escape sequences.

    - + Perl

    @@ -62,7 +62,7 @@ (??{code}) Not implementable in a compiled strongly typed language.

    - + POSIX

    @@ -82,7 +82,7 @@ a custom traits class.

    - + Unicode

    diff --git a/doc/html/boost_regex/captures.html b/doc/html/boost_regex/captures.html index 0f96c192..513b2d70 100644 --- a/doc/html/boost_regex/captures.html +++ b/doc/html/boost_regex/captures.html @@ -35,7 +35,7 @@ accessed.

    - + Marked sub-expressions

    @@ -218,7 +218,7 @@ output stream.

    - + Unmatched Sub-Expressions

    @@ -231,7 +231,7 @@ you can determine which sub-expressions matched by accessing the sub_match::matched data member.

    - + Repeated Captures

    diff --git a/doc/html/boost_regex/format/boost_format_syntax.html b/doc/html/boost_regex/format/boost_format_syntax.html index 405559a1..cdd8df31 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 ':'.

    - + Grouping

    @@ -40,7 +40,7 @@ you want a to output literal parenthesis.

    - + Conditionals

    @@ -79,7 +79,7 @@ ?{NAME}true-expression:false-expression

    - + Placeholder Sequences
    @@ -319,7 +319,7 @@ as a literal.

    - + Escape Sequences
    diff --git a/doc/html/boost_regex/install.html b/doc/html/boost_regex/install.html index 3814b219..acb85bf4 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:

    - + Building with bjam

    @@ -58,7 +58,7 @@ started guide for more information.

    - + Building With Unicode and ICU Support
    @@ -96,11 +96,11 @@ ICU you are using is binary compatible with the toolset you use to build Boost.

    - + Building via makefiles
    - + Borland C++ Builder:
    - + GCC(2.95 and later)

    @@ -302,7 +302,7 @@ see the config library documentation.

    - + Sun Workshop 6.1

    @@ -347,7 +347,7 @@ will build v9 variants of the regex library named libboost_regex_v9.a etc.

    - + Makefiles for Other compilers
    diff --git a/doc/html/boost_regex/ref/bad_expression.html b/doc/html/boost_regex/ref/bad_expression.html index 59fd3394..7bfd4a15 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
    - + Synopsis
    #include <boost/pattern_except.hpp>
    @@ -54,7 +54,7 @@
     } // namespace boost
     
    - + Description
    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 3d075673..6cb54977 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
     
     
    - + Synopsis
    #include <boost/regex.hpp>
    @@ -244,7 +244,7 @@
     } // namespace boost
     
    - + Description

    @@ -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 cf7b4bfc..9b9a27f1 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.

    - + Minimal requirements.
    @@ -381,7 +381,7 @@
    - + Additional Optional Requirements
    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 e180cd65..46e4e192 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:

    - + Algorithm regex_format
    diff --git a/doc/html/boost_regex/ref/error_type.html b/doc/html/boost_regex/ref/error_type.html index be29dc1e..974e2e9e 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
    - + Synopsis

    @@ -57,7 +57,7 @@ } // namespace boost

    - + Description

    diff --git a/doc/html/boost_regex/ref/match_flag_type.html b/doc/html/boost_regex/ref/match_flag_type.html index 60e92782..cb815993 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 @@ } // namespace boost

    - + Description

    diff --git a/doc/html/boost_regex/ref/match_results.html b/doc/html/boost_regex/ref/match_results.html index ff713f31..85c793fc 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

    - + Synopsis
    #include <boost/regex.hpp>
    @@ -167,7 +167,7 @@
              match_results<BidirectionalIterator, Allocator>& m2);
     
    - + Description

    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 64e132b3..ea4990c7 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.

    - + u32regex_match

    @@ -89,7 +89,7 @@ }

    - + u32regex_search

    @@ -128,7 +128,7 @@ }

    - + u32regex_replace

    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 35218c32..b98491ba 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

    - + u32regex_iterator

    @@ -126,7 +126,7 @@ Provided of course that the input is encoded as UTF-8.

    - + u32regex_token_iterator

    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 aa5a33f3..446807c8 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:

    - + regex_match

    @@ -82,7 +82,7 @@ }

    - + regex_match (second overload)
    @@ -110,7 +110,7 @@ }
    - + regex_search

    @@ -149,7 +149,7 @@ }

    - + regex_search (second overload)
    @@ -164,7 +164,7 @@ + s.GetLength(), e, f);

    - + regex_replace

    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 4fb400ee..7da7204a 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:

    - + regex_iterator creation helper
    @@ -68,7 +68,7 @@ }
    - + regex_token_iterator creation helpers
    diff --git a/doc/html/boost_regex/ref/posix.html b/doc/html/boost_regex/ref/posix.html index 8b29bc24..d2347337 100644 --- a/doc/html/boost_regex/ref/posix.html +++ b/doc/html/boost_regex/ref/posix.html @@ -165,7 +165,7 @@

    - + regcomp

    @@ -379,7 +379,7 @@

    - + regerror

    @@ -467,7 +467,7 @@

    - + regexec

    @@ -537,7 +537,7 @@

    - + regfree

    diff --git a/doc/html/boost_regex/ref/regex_iterator.html b/doc/html/boost_regex/ref/regex_iterator.html index bad49256..15ddae1f 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);

    - + Description

    @@ -436,7 +436,7 @@ m.

    - + Examples

    diff --git a/doc/html/boost_regex/ref/regex_match.html b/doc/html/boost_regex/ref/regex_match.html index d583cb24..c16597ee 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);

    - + Description
    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).
           

    - + Examples

    diff --git a/doc/html/boost_regex/ref/regex_replace.html b/doc/html/boost_regex/ref/regex_replace.html index bc80e088..58dce2a9 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);

    - + Description
    template <class OutputIterator, class BidirectionalIterator, class traits, class Formatter>
    @@ -196,7 +196,7 @@
             and then returns result.
           

    - + Examples

    diff --git a/doc/html/boost_regex/ref/regex_search.html b/doc/html/boost_regex/ref/regex_search.html index 57c74191..271b4978 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);

    - + Description
    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).
           

    - + Examples

    diff --git a/doc/html/boost_regex/ref/regex_token_iterator.html b/doc/html/boost_regex/ref/regex_token_iterator.html index c27d4839..df51d3f2 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);

    - + Description

    @@ -383,7 +383,7 @@ m.

    - + Examples

    diff --git a/doc/html/boost_regex/ref/regex_traits.html b/doc/html/boost_regex/ref/regex_traits.html index de52d978..a2d4e8c1 100644 --- a/doc/html/boost_regex/ref/regex_traits.html +++ b/doc/html/boost_regex/ref/regex_traits.html @@ -46,7 +46,7 @@ } // namespace boost

    - + Description

    diff --git a/doc/html/boost_regex/ref/sub_match.html b/doc/html/boost_regex/ref/sub_match.html index 14974ee7..deafd743 100644 --- a/doc/html/boost_regex/ref/sub_match.html +++ b/doc/html/boost_regex/ref/sub_match.html @@ -329,11 +329,11 @@ } // namespace boost

    - + Description
    - + Members

    @@ -473,7 +473,7 @@

    - + sub_match non-member operators
    @@ -1008,7 +1008,7 @@ + m2.str().

    - + Stream inserter

    diff --git a/doc/html/boost_regex/syntax/basic_extended.html b/doc/html/boost_regex/syntax/basic_extended.html index 2e4acb2d..c489bf18 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

    - + Synopsis

    @@ -46,7 +46,7 @@

    - + POSIX Extended Syntax

    @@ -56,7 +56,7 @@

    .[{()\*+?|^$
    - + Wildcard:

    @@ -74,7 +74,7 @@

    - + Anchors:

    @@ -86,7 +86,7 @@ of an expression, or the last character of a sub-expression.

    - + Marked sub-expressions:
    @@ -98,7 +98,7 @@ to by a back-reference.

    - + Repeats:

    @@ -184,7 +184,7 @@ cab operator to be applied to.

    - + Back references:

    @@ -214,7 +214,7 @@ cab

    - + Alternation

    @@ -227,7 +227,7 @@ cab will match either of "abd" or "abef".

    - + Character sets:
    @@ -240,7 +240,7 @@ cab A bracket expression may contain any combination of the following:

    - + Single characters:
    @@ -249,7 +249,7 @@ cab or 'c'.

    - + Character ranges:
    @@ -265,7 +265,7 @@ cab the code points of the characters only.

    - + Negation:

    @@ -274,7 +274,7 @@ cab range a-c.

    - + Character classes:
    @@ -284,7 +284,7 @@ cab character class names.

    - + Collating Elements:
    @@ -312,7 +312,7 @@ cab matches a NUL character.

    - + Equivalence classes:
    @@ -329,7 +329,7 @@ cab or even all locales on one platform.

    - + Combinations:

    @@ -337,7 +337,7 @@ cab [[:digit:]a-c[.NUL.]].

    - + Escapes

    @@ -363,7 +363,7 @@ cab extensions are also supported by Boost.Regex:

    - + Escapes matching a specific character
    @@ -552,7 +552,7 @@ cab
    - + "Single character" character classes:
    @@ -706,7 +706,7 @@ cab
    - + Character Properties
    @@ -813,7 +813,7 @@ cab matches any "digit" character, as does \p{digit}.

    - + Word Boundaries

    @@ -888,7 +888,7 @@ cab

    - + Buffer boundaries
    @@ -979,7 +979,7 @@ cab
    - + Continuation Escape
    @@ -991,7 +991,7 @@ cab match to start where the last one ended.

    - + Quoting escape
    @@ -1005,7 +1005,7 @@ cab \*+aaa
    - + Unicode escapes
    @@ -1056,7 +1056,7 @@ cab
    - + Any other escape
    @@ -1065,7 +1065,7 @@ cab \@ matches a literal '@'.

    - + Operator precedence
    @@ -1101,7 +1101,7 @@ cab
    - + What Gets Matched
    @@ -1111,11 +1111,11 @@ cab rule.

    - + Variations

    - + Egrep

    @@ -1136,7 +1136,7 @@ cab used with the -E option.

    - + awk

    @@ -1150,7 +1150,7 @@ cab these by default anyway.

    - + Options

    @@ -1163,7 +1163,7 @@ cab modify how the case and locale sensitivity are to be applied.

    - + References

    diff --git a/doc/html/boost_regex/syntax/basic_syntax.html b/doc/html/boost_regex/syntax/basic_syntax.html index 8e72991b..4aefc902 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

    - + Synopsis

    @@ -45,7 +45,7 @@

    - + POSIX Basic Syntax

    @@ -55,7 +55,7 @@

    .[\*^$
    - + Wildcard:

    @@ -73,7 +73,7 @@

    - + Anchors:

    @@ -85,7 +85,7 @@ of an expression, or the last character of a sub-expression.

    - + Marked sub-expressions:
    @@ -97,7 +97,7 @@ by a back-reference.

    - + Repeats:

    @@ -155,7 +155,7 @@ aaaa to.

    - + Back references:

    @@ -173,7 +173,7 @@ aaaa

    aaabba
    - + Character sets:
    @@ -186,7 +186,7 @@ aaaa A bracket expression may contain any combination of the following:

    - + Single characters:
    @@ -195,7 +195,7 @@ aaaa or 'c'.

    - + Character ranges:
    @@ -211,7 +211,7 @@ aaaa of the characters only.

    - + Negation:

    @@ -220,7 +220,7 @@ aaaa range a-c.

    - + Character classes:
    @@ -230,7 +230,7 @@ aaaa character class names.

    - + Collating Elements:
    @@ -259,7 +259,7 @@ aaaa element names.

    - + Equivalence classes:
    @@ -276,7 +276,7 @@ aaaa or even all locales on one platform.

    - + Combinations:

    @@ -284,7 +284,7 @@ aaaa [[:digit:]a-c[.NUL.]].

    - + Escapes

    @@ -299,7 +299,7 @@ aaaa will match either a literal '\' or a '^'.

    - + What Gets Matched

    @@ -309,13 +309,13 @@ aaaa rule.

    - + Variations

    - + Grep

    @@ -333,7 +333,7 @@ aaaa As its name suggests, this behavior is consistent with the Unix utility grep.

    - + emacs

    @@ -613,7 +613,7 @@ aaaa leftmost-longest rule.

    - + Options

    @@ -627,7 +627,7 @@ aaaa options modify how the case and locale sensitivity are to be applied.

    - + References

    diff --git a/doc/html/boost_regex/syntax/perl_syntax.html b/doc/html/boost_regex/syntax/perl_syntax.html index d25b6b42..51b89f2b 100644 --- a/doc/html/boost_regex/syntax/perl_syntax.html +++ b/doc/html/boost_regex/syntax/perl_syntax.html @@ -28,7 +28,7 @@ Syntax

    - + Synopsis

    @@ -43,7 +43,7 @@ boost::regex e2(my_expression, boost::regex::perl|boost::regex::icase);

    - + Perl Regular Expression Syntax

    @@ -53,7 +53,7 @@

    .[{()\*+?|^$
    - + Wildcard

    @@ -73,7 +73,7 @@

    - + Anchors

    @@ -83,7 +83,7 @@ A '$' character shall match the end of a line.

    - + Marked sub-expressions
    @@ -94,7 +94,7 @@ can also repeated, or referred to by a back-reference.

    - + Non-marking grouping
    @@ -107,7 +107,7 @@ without splitting out any separate sub-expressions.

    - + Repeats

    @@ -188,7 +188,7 @@ to be applied to.

    - + Non greedy repeats
    @@ -218,7 +218,7 @@ while consuming as little input as possible.

    - + Pocessive repeats
    @@ -250,7 +250,7 @@ while giving nothing back.

    - + Back references

    @@ -360,7 +360,7 @@ named "two".

    - + Alternation

    @@ -387,7 +387,7 @@ (?:abc)?? has exactly the same effect.

    - + Character sets

    @@ -399,7 +399,7 @@ A bracket expression may contain any combination of the following:

    - + Single characters

    @@ -407,7 +407,7 @@ 'b', or 'c'.

    - + Character ranges
    @@ -421,7 +421,7 @@ sensitive.

    - + Negation

    @@ -430,7 +430,7 @@ matches any character that is not in the range a-c.

    - + Character classes
    @@ -441,7 +441,7 @@ class names.

    - + Collating Elements
    @@ -463,7 +463,7 @@ matches a \0 character.

    - + Equivalence classes
    @@ -480,7 +480,7 @@ or even all locales on one platform.

    - + Escaped Characters
    @@ -492,7 +492,7 @@ is not a "word" character.

    - + Combinations

    @@ -500,7 +500,7 @@ [[:digit:]a-c[.NUL.]].

    - + Escapes

    @@ -692,7 +692,7 @@

    - + "Single character" character classes:
    @@ -894,7 +894,7 @@
    - + Character Properties
    @@ -1002,7 +1002,7 @@ as does \p{digit}.

    - + Word Boundaries

    @@ -1021,7 +1021,7 @@ \B Matches only when not at a word boundary.

    - + Buffer boundaries

    @@ -1046,7 +1046,7 @@ to the regular expression \n*\z

    - + Continuation Escape
    @@ -1058,7 +1058,7 @@ one ended.

    - + Quoting escape

    @@ -1071,7 +1071,7 @@ \*+aaa

    - + Unicode escapes

    @@ -1081,7 +1081,7 @@ followed by a sequence of zero or more combining characters.

    - + Matching Line Endings
    @@ -1090,7 +1090,7 @@ sequence, specifically it is identical to the expression (?>\x0D\x0A?|[\x0A-\x0C\x85\x{2028}\x{2029}]).

    - + Keeping back some text
    @@ -1105,7 +1105,7 @@ This can be used to simulate variable width lookbehind assertions.

    - + Any other escape
    @@ -1114,7 +1114,7 @@ \@ matches a literal '@'.

    - + Perl Extended Patterns
    @@ -1123,7 +1123,7 @@ (?.

    - + Named Subexpressions
    @@ -1145,14 +1145,14 @@ format string for search and replace operations, or in the match_results member functions.

    - + Comments

    (?# ... ) is treated as a comment, it's contents are ignored.

    - + Modifiers

    @@ -1166,7 +1166,7 @@ pattern only.

    - + Non-marking groups
    @@ -1175,7 +1175,7 @@ an additional sub-expression.

    - + Branch reset

    @@ -1197,7 +1197,7 @@ # 1 2 2 3 2 3 4

    - + Lookahead

    @@ -1220,7 +1220,7 @@ could be used to validate the password.

    - + Lookbehind

    @@ -1234,7 +1234,7 @@ (pattern must be of fixed length).

    - + Independent sub-expressions
    @@ -1247,7 +1247,7 @@ no match is found at all.

    - + Recursive Expressions
    @@ -1271,7 +1271,7 @@ to the next sub-expression to be declared.

    - + Conditional Expressions
    @@ -1319,7 +1319,7 @@
    - + Operator precedence
    @@ -1354,7 +1354,7 @@

    - + What gets matched

    @@ -1529,7 +1529,7 @@

    - + Variations

    @@ -1538,7 +1538,7 @@ and JScript are all synonyms for perl.

    - + Options

    @@ -1550,7 +1550,7 @@ are to be applied.

    - + Pattern Modifiers

    @@ -1562,7 +1562,7 @@ and no_mod_s.

    - + References

    diff --git a/doc/html/boost_regex/unicode.html b/doc/html/boost_regex/unicode.html index c42b2069..e8b83118 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:

    - + Rely on wchar_t

    @@ -56,7 +56,7 @@

    - + Use a Unicode Aware Regular Expression Type.
    diff --git a/doc/html/index.html b/doc/html/index.html index 49e413a5..7a07ac36 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -28,7 +28,7 @@
    -

    +

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    @@ -196,7 +196,7 @@

    - +

    Last revised: November 06, 2009 at 18:12:56 GMT

    Last revised: November 19, 2009 at 18:39:18 GMT


    diff --git a/include/boost/regex/v4/cpp_regex_traits.hpp b/include/boost/regex/v4/cpp_regex_traits.hpp index 5255404b..bb40aa1e 100644 --- a/include/boost/regex/v4/cpp_regex_traits.hpp +++ b/include/boost/regex/v4/cpp_regex_traits.hpp @@ -187,6 +187,7 @@ struct cpp_regex_traits_base #ifndef BOOST_NO_STD_MESSAGES if(m_pmessages == b.m_pmessages) { + return m_pcollate < b.m_pcollate; } return m_pmessages < b.m_pmessages; #else @@ -212,7 +213,7 @@ std::locale cpp_regex_traits_base::imbue(const std::locale& l) m_locale = l; m_pctype = &BOOST_USE_FACET(std::ctype, l); #ifndef BOOST_NO_STD_MESSAGES - m_pmessages = &BOOST_USE_FACET(std::messages, l); + m_pmessages = BOOST_HAS_FACET(std::messages, l) ? &BOOST_USE_FACET(std::messages, l) : 0; #endif m_pcollate = &BOOST_USE_FACET(std::collate, l); return result; @@ -276,7 +277,7 @@ void cpp_regex_traits_char_layer::init() typename std::messages::catalog cat = reinterpret_cast::catalog>(-1); #endif std::string cat_name(cpp_regex_traits::get_catalog_name()); - if(cat_name.size()) + if(cat_name.size() && (this->m_pmessages != 0)) { cat = this->m_pmessages->open( cat_name, @@ -309,7 +310,8 @@ void cpp_regex_traits_char_layer::init() } catch(...) { - this->m_pmessages->close(cat); + if(this->m_pmessages) + this->m_pmessages->close(cat); throw; } #endif @@ -653,7 +655,7 @@ void cpp_regex_traits_implementation::init() typename std::messages::catalog cat = reinterpret_cast::catalog>(-1); #endif std::string cat_name(cpp_regex_traits::get_catalog_name()); - if(cat_name.size()) + if(cat_name.size() && (this->m_pmessages != 0)) { cat = this->m_pmessages->open( cat_name, diff --git a/include/boost/regex/v4/match_results.hpp b/include/boost/regex/v4/match_results.hpp index 000bb43a..d71908ee 100644 --- a/include/boost/regex/v4/match_results.hpp +++ b/include/boost/regex/v4/match_results.hpp @@ -74,16 +74,30 @@ public: // construct/copy/destroy: explicit match_results(const Allocator& a = Allocator()) #ifndef BOOST_NO_STD_ALLOCATOR - : m_subs(a), m_base(), m_last_closed_paren(0) {} + : m_subs(a), m_base(), m_last_closed_paren(0), m_is_singular(true) {} #else - : m_subs(), m_base(), m_last_closed_paren(0) { (void)a; } + : m_subs(), m_base(), m_last_closed_paren(0), m_is_singular(true) { (void)a; } #endif match_results(const match_results& m) - : m_subs(m.m_subs), m_base(m.m_base) {} + : m_subs(m.m_subs), m_named_subs(m.m_named_subs), m_last_closed_paren(m.m_last_closed_paren), m_is_singular(m.m_is_singular) + { + if(!m_is_singular) + { + m_base = m.m_base; + m_null = m.m_null; + } + } match_results& operator=(const match_results& m) { m_subs = m.m_subs; - m_base = m.m_base; + m_named_subs = m.m_named_subs; + m_last_closed_paren = m.m_last_closed_paren; + m_is_singular = m.m_is_singular; + if(!m_is_singular) + { + m_base = m.m_base; + m_null = m.m_null; + } return *this; } ~match_results(){} @@ -98,6 +112,8 @@ public: // element access: difference_type length(int sub = 0) const { + if(m_is_singular) + raise_logic_error(); sub += 2; if((sub < (int)m_subs.size()) && (sub > 0)) return m_subs[sub].length(); @@ -105,6 +121,8 @@ public: } difference_type length(const char_type* sub) const { + if(m_is_singular) + raise_logic_error(); const char_type* end = sub; while(*end) ++end; return length(named_subexpression_index(sub, end)); @@ -112,6 +130,8 @@ public: template difference_type length(const charT* sub) const { + if(m_is_singular) + raise_logic_error(); const charT* end = sub; while(*end) ++end; return length(named_subexpression_index(sub, end)); @@ -123,6 +143,8 @@ public: } difference_type position(size_type sub = 0) const { + if(m_is_singular) + raise_logic_error(); sub += 2; if(sub < m_subs.size()) { @@ -154,6 +176,8 @@ public: } string_type str(int sub = 0) const { + if(m_is_singular) + raise_logic_error(); sub += 2; string_type result; if(sub < (int)m_subs.size() && (sub > 0)) @@ -187,6 +211,8 @@ public: } const_reference operator[](int sub) const { + if(m_is_singular && m_subs.empty()) + raise_logic_error(); sub += 2; if(sub < (int)m_subs.size() && (sub >= 0)) { @@ -199,6 +225,8 @@ public: // const_reference named_subexpression(const char_type* i, const char_type* j) const { + if(m_is_singular) + raise_logic_error(); int index = m_named_subs->get_id(i, j); return index > 0 ? (*this)[index] : m_null; } @@ -215,6 +243,8 @@ public: } int named_subexpression_index(const char_type* i, const char_type* j) const { + if(m_is_singular) + raise_logic_error(); int index = m_named_subs->get_id(i, j); return index > 0 ? index : -20; } @@ -266,11 +296,15 @@ public: const_reference prefix() const { + if(m_is_singular) + raise_logic_error(); return (*this)[-1]; } const_reference suffix() const { + if(m_is_singular) + raise_logic_error(); return (*this)[-2]; } const_iterator begin() const @@ -287,6 +321,8 @@ public: Functor fmt, match_flag_type flags = format_default) const { + if(m_is_singular) + raise_logic_error(); typedef typename re_detail::compute_functor_type, OutputIterator>::type F; F func(fmt); return func(*this, out, flags); @@ -294,6 +330,8 @@ public: template string_type format(Functor fmt, match_flag_type flags = format_default) const { + if(m_is_singular) + raise_logic_error(); std::basic_string result; re_detail::string_out_iterator > i(result); @@ -310,6 +348,8 @@ public: match_flag_type flags, const RegexT& re) const { + if(m_is_singular) + raise_logic_error(); typedef ::boost::regex_traits_wrapper traits_type; typedef typename re_detail::compute_functor_type, OutputIterator, traits_type>::type F; F func(fmt); @@ -320,6 +360,8 @@ public: match_flag_type flags, const RegexT& re) const { + if(m_is_singular) + raise_logic_error(); typedef ::boost::regex_traits_wrapper traits_type; std::basic_string result; re_detail::string_out_iterator > i(result); @@ -333,6 +375,8 @@ public: const_reference get_last_closed_paren()const { + if(m_is_singular) + raise_logic_error(); return m_last_closed_paren == 0 ? m_null : (*this)[m_last_closed_paren]; } @@ -347,13 +391,39 @@ public: void swap(match_results& that) { std::swap(m_subs, that.m_subs); - std::swap(m_base, that.m_base); std::swap(m_named_subs, that.m_named_subs); std::swap(m_last_closed_paren, that.m_last_closed_paren); + std::swap(m_is_singular, that.m_is_singular); + if(m_is_singular) + { + if(!that.m_is_singular) + { + m_base = that.m_base; + m_null = that.m_null; + } + } + else if(that.m_is_singular) + { + that.m_base = m_base; + that.m_null = m_null; + } + else + { + std::swap(m_base, that.m_base); + std::swap(m_null, that.m_null); + } } bool operator==(const match_results& that)const { - return (m_subs == that.m_subs) && (m_base == that.m_base); + if(m_is_singular) + { + return that.m_is_singular; + } + else if(that.m_is_singular) + { + return false; + } + return (m_subs == that.m_subs) && (m_base == that.m_base) && (m_last_closed_paren == that.m_last_closed_paren); } bool operator!=(const match_results& that)const { return !(*this == that); } @@ -363,6 +433,8 @@ public: const capture_sequence_type& captures(int i)const { + if(m_is_singular) + raise_logic_error(); return (*this)[i].captures(); } #endif @@ -379,6 +451,7 @@ public: m_null.first = i; m_null.second = i; m_null.matched = false; + m_is_singular = false; } void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false) @@ -396,6 +469,7 @@ public: m_null.first = i; m_null.second = i; m_null.matched = false; + m_is_singular = false; } } void BOOST_REGEX_CALL set_size(size_type n, BidiIterator i, BidiIterator j) @@ -462,16 +536,32 @@ public: } private: - vector_type m_subs; // subexpressions - BidiIterator m_base; // where the search started from - sub_match m_null; // a null match - boost::shared_ptr m_named_subs; - int m_last_closed_paren; + // + // Error handler called when an uninitialized match_results is accessed: + // + static void raise_logic_error() + { + std::logic_error e("Attempt to access an uninitialzed boost::match_results<> class."); + boost::throw_exception(e); + } + + + vector_type m_subs; // subexpressions + BidiIterator m_base; // where the search started from + sub_match m_null; // a null match + boost::shared_ptr m_named_subs; // Shared copy of named subs in the regex object + int m_last_closed_paren; // Last ) to be seen - used for formatting + bool m_is_singular; // True if our stored iterators are singular }; template void BOOST_REGEX_CALL match_results::maybe_assign(const match_results& m) { + if(m_is_singular) + { + *this = m; + return; + } const_iterator p1, p2; p1 = begin(); p2 = m.begin(); diff --git a/src/cpp_regex_traits.cpp b/src/cpp_regex_traits.cpp index 9ed66be6..1d24cc1a 100644 --- a/src/cpp_regex_traits.cpp +++ b/src/cpp_regex_traits.cpp @@ -42,7 +42,7 @@ void cpp_regex_traits_char_layer::init() std::messages::catalog cat = reinterpret_cast::catalog>(-1); #endif std::string cat_name(cpp_regex_traits::get_catalog_name()); - if(cat_name.size()) + if(cat_name.size() && (m_pmessages != 0)) { cat = this->m_pmessages->open( cat_name, diff --git a/test/regress/test_regex_search.hpp b/test/regress/test_regex_search.hpp index debb1efb..bb6df2d3 100644 --- a/test/regress/test_regex_search.hpp +++ b/test/regress/test_regex_search.hpp @@ -29,12 +29,17 @@ struct test_regex_search_tag{}; template -void test_sub_match(const boost::sub_match& sub, BidirectionalIterator base, const int* answer_table, int i) +void test_sub_match(const boost::sub_match& sub, BidirectionalIterator base, const int* answer_table, int i, bool recurse = true) { #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4244) #endif + if(recurse) + { + boost::sub_match copy(sub); + test_sub_match(copy, base, answer_table, i, false); + } typedef typename boost::sub_match::value_type charT; if((sub.matched == 0) && @@ -71,8 +76,19 @@ void test_sub_match(const boost::sub_match& sub, Bidirect } template -void test_result(const boost::match_results& what, BidirectionalIterator base, const int* answer_table) +void test_result(const boost::match_results& what, BidirectionalIterator base, const int* answer_table, bool recurse = true) { + if(recurse) + { + boost::match_results copy(what); + test_result(copy, base, answer_table, false); + boost::match_results s; + s.swap(copy); + test_result(s, base, answer_table, false); + boost::match_results s2; + s2 = what; + test_result(s2, base, answer_table, false); + } for(unsigned i = 0; i < what.size(); ++i) { test_sub_match(what[i], base, answer_table, i);