From 67f5369cae0fcd02b39779a1484f2c4f56239a50 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Wed, 17 Mar 2010 18:20:09 +0000 Subject: [PATCH] Add support for Boost.Ref in match_results::format. Update docs accordingly. Fixes #4020. [SVN r60678] --- .../background_information/examples.html | 6 +- .../background_information/history.html | 16 +- .../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 | 11 +- .../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 | 9 +- 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 +- doc/match_result.qbk | 7 +- doc/regex_replace.qbk | 5 +- include/boost/regex/concepts.hpp | 203 ++++++++++++++---- include/boost/regex/v4/perl_matcher.hpp | 4 +- .../boost/regex/v4/perl_matcher_common.hpp | 22 +- include/boost/regex/v4/regex_format.hpp | 9 +- 37 files changed, 391 insertions(+), 255 deletions(-) diff --git a/doc/html/boost_regex/background_information/examples.html b/doc/html/boost_regex/background_information/examples.html index ccb5bb96..ce903688 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 2e6b72a3..e501b8c9 100644 --- a/doc/html/boost_regex/background_information/history.html +++ b/doc/html/boost_regex/background_information/history.html @@ -36,7 +36,7 @@ All issues including closed ones can be viewed here.

- + Boost 1.42
@@ -65,7 +65,7 @@
- + Boost 1.40
@@ -74,7 +74,7 @@ branch resets and recursive regular expressions.
- + Boost 1.38
@@ -101,7 +101,7 @@
- + Boost 1.34
@@ -124,7 +124,7 @@
- + Boost 1.33.1
@@ -194,7 +194,7 @@
- + Boost 1.33.0
@@ -249,7 +249,7 @@
- + Boost 1.32.1
@@ -257,7 +257,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 8302d908..4b8f962c 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 30df7010..17ce4aca 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

@@ -73,7 +73,7 @@ the Unicode requirements below.

- + POSIX

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

- + Unicode

diff --git a/doc/html/boost_regex/captures.html b/doc/html/boost_regex/captures.html index 088b8072..7406acec 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 fa344262..b017ac87 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 73d67dbf..d3e3325e 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 90b2416b..c05df79a 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 49e82201..a0ab9a47 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 54c6be56..61571515 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 5c27b8f0..e0aa3d8b 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 3eb45ad7..2661dae8 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 49232a3c..58e7eb12 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 c7ae5aaa..63a5ac15 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

@@ -579,7 +579,10 @@ out) or fmt(*this, out, flags), both of which write the replacement text to *out, - and then return the new OutputIterator position. + and then return the new OutputIterator position. Note that if the formatter + is a functor, then it is passed by value: users that + want to pass function objects with internal state might want to use Boost.Ref to wrap the object + so that it's passed by reference.

Effects: If fmt @@ -601,7 +604,7 @@

- + 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 9500e1bf..805adf6c 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 241f62e6..cedd2580 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 80eb6d3d..4117a6f7 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 4e296925..25b27409 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 7433add6..92e54980 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 b2b4aad8..a3a8e7bb 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>
@@ -101,7 +101,10 @@
         or fmt(what, out, flags), both of which write the replacement text
         to *out,
         and then return the new OutputIterator position. In each case what is the match_results object that represents
-        the match found.
+        the match found. Note that if the formatter is a functor, then it is passed
+        by value: users that want to pass function objects with internal
+        state might want to use Boost.Ref
+        to wrap the object so that it's passed by reference.
       

Effects: Constructs an regex_iterator object: @@ -196,7 +199,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 54231840..36edb25d 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 871a4ffd..a2af4f26 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 413f79a2..7e3c06b6 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 96215727..cc49dc1a 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 8e6e9660..97b80722 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 8ecc6e72..ff4e7d54 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 642085da..1b68cffe 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

@@ -1048,7 +1048,7 @@ (?=\n?\z).

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

- + Quoting escape

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

- + Unicode escapes

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

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

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

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

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

- + Named Subexpressions
@@ -1147,14 +1147,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

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

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

- + Branch reset

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

- + Lookahead

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

- + Lookbehind

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

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

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

- + Conditional Expressions
@@ -1321,7 +1321,7 @@
- + Operator precedence
@@ -1356,7 +1356,7 @@

- + What gets matched

@@ -1531,7 +1531,7 @@

- + Variations

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

- + Options

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

- + Pattern Modifiers

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

- + References

diff --git a/doc/html/boost_regex/unicode.html b/doc/html/boost_regex/unicode.html index 6c01a369..978001d7 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 f846b391..c4f7fee0 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: February 05, 2010 at 17:00:10 GMT

Last revised: March 17, 2010 at 16:59:52 GMT


diff --git a/doc/match_result.qbk b/doc/match_result.qbk index 680f868f..4238de92 100644 --- a/doc/match_result.qbk +++ b/doc/match_result.qbk @@ -368,7 +368,10 @@ that computes the replacement string from a function call: either `fmt(*this)` which must return a container of `char_type`'s to be used as the replacement text, or either `fmt(*this, out)` or `fmt(*this, out, flags)`, both of which write the replacement text to `*out`, and then return the new -OutputIterator position. +OutputIterator position. Note that if the formatter is a functor, then it is +['passed by value]: users that want to pass function objects with internal state +might want to use [@../../../../doc/html/ref.html Boost.Ref] to wrap the object so +that it's passed by reference. [*Effects]: If `fmt` is either a null-terminated string, or a container of `char_type`'s, then copies the character sequence `[fmt.begin(), fmt.end())` to @@ -383,7 +386,7 @@ ECMA-262, ECMAScript Language Specification, Chapter 15 part If `fmt` is a function object, then depending on the number of arguments the function object accepts, it will either: -* Call `fmt(*this)` and copy the result to `OutputIterator` +* Call `fmt(*this)` and copy the string returned to `OutputIterator` /out/. * Call `fmt(*this, out)`. * Call `fmt(*this, out, flags)`. diff --git a/doc/regex_replace.qbk b/doc/regex_replace.qbk index 58f88778..43e0760f 100644 --- a/doc/regex_replace.qbk +++ b/doc/regex_replace.qbk @@ -69,7 +69,10 @@ that computes the replacement string from a function call: either replacement text, or either `fmt(what, out)` or `fmt(what, out, flags)`, both of which write the replacement text to `*out`, and then return the new OutputIterator position. In each case `what` is the [match_results] object -that represents the match found. +that represents the match found. Note that if the formatter is a functor, then it is +['passed by value]: users that want to pass function objects with internal state +might want to use [@../../../../doc/html/ref.html Boost.Ref] to wrap the object so +that it's passed by reference. [*Effects]: Constructs an [regex_iterator] object: diff --git a/include/boost/regex/concepts.hpp b/include/boost/regex/concepts.hpp index fa2ea48c..28d5aeb6 100644 --- a/include/boost/regex/concepts.hpp +++ b/include/boost/regex/concepts.hpp @@ -76,6 +76,46 @@ namespace std{ typedef boost::char_architype char_type; }; } +// +// Allocator architype: +// +template +class allocator_architype +{ +public: + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + typedef T value_type; + typedef unsigned size_type; + typedef int difference_type; + + template + struct rebind + { + typedef allocator_architype other; + }; + + pointer address(reference r); + const_pointer address(const_reference r); + pointer allocate(size_type); + pointer allocate(size_type, pointer); + void deallocate(pointer, size_type); + size_type max_size()const; + + allocator_architype(); + allocator_architype(const allocator_architype&); + + void construct(pointer, const_reference); + void destroy(pointer); +}; + +template +bool operator == (const allocator_architype&, const allocator_architype&); +template +bool operator != (const allocator_architype&, const allocator_architype&); + namespace boost{ // // regex_traits_architype: @@ -244,7 +284,8 @@ struct BaseRegexConcept typedef const value_type* pointer_type; typedef bidirectional_iterator_archetype BidiIterator; typedef global_regex_namespace::sub_match sub_match_type; - typedef global_regex_namespace::match_results match_results_type; + typedef global_regex_namespace::match_results > match_results_type; + typedef global_regex_namespace::match_results match_results_default_type; typedef output_iterator_archetype OutIterator; typedef typename regex_traits_computer::type traits_type; typedef global_regex_namespace::regex_iterator regex_iterator_type; @@ -318,7 +359,7 @@ struct BaseRegexConcept const global_regex_namespace::regex_error except(e1); e1 = except.code(); - typedef typename Regex::value_type value_type; + typedef typename Regex::value_type regex_value_type; function_requires< RegexTraitsConcept > >(); function_requires< BaseRegexConcept > >(); } @@ -484,10 +525,10 @@ struct BaseRegexConcept typedef typename regex_iterator_type::reference rit_reference; typedef typename regex_iterator_type::iterator_category rit_iterator_category; BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + BOOST_STATIC_ASSERT((::boost::is_same::value)); BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + BOOST_STATIC_ASSERT((::boost::is_same::value)); + BOOST_STATIC_ASSERT((::boost::is_same::value)); BOOST_STATIC_ASSERT((::boost::is_convertible::value)); // this takes care of most of the checks needed: function_requires >(); @@ -540,7 +581,10 @@ struct BaseRegexConcept OutIterator m_out; BidiIterator m_in; global_regex_namespace::regex_constants::match_flag_type m_mft; - global_regex_namespace::match_results m_pmatch; + global_regex_namespace::match_results< + pointer_type, + allocator_architype > > + m_pmatch; BaseRegexConcept(); BaseRegexConcept(const BaseRegexConcept&); @@ -564,7 +608,7 @@ struct RegexConcept typedef std::basic_string string_type; typedef boost::bidirectional_iterator_archetype BidiIterator; typedef global_regex_namespace::sub_match sub_match_type; - typedef global_regex_namespace::match_results match_results_type; + typedef global_regex_namespace::match_results > match_results_type; typedef output_iterator_archetype OutIterator; @@ -739,7 +783,7 @@ struct RegexConcept OutIterator m_out; BidiIterator m_in; global_regex_namespace::regex_constants::match_flag_type m_mft; - global_regex_namespace::match_results m_smatch; + global_regex_namespace::match_results > > m_smatch; RegexConcept(); RegexConcept(const RegexConcept&); @@ -752,7 +796,7 @@ template struct functor1 { typedef typename M::char_type char_type; - const char_type* operator()(const M&) + const char_type* operator()(const M&)const { static const char_type c = static_cast(0); return &c; @@ -762,7 +806,7 @@ template struct functor1b { typedef typename M::char_type char_type; - std::vector operator()(const M&) + std::vector operator()(const M&)const { static const std::vector c; return c; @@ -772,7 +816,7 @@ template struct functor2 { template - O operator()(const M& /*m*/, O i) + O operator()(const M& /*m*/, O i)const { return i; } @@ -781,7 +825,7 @@ template struct functor3 { template - O operator()(const M& /*m*/, O i, regex_constants::match_flag_type) + O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)const { return i; } @@ -806,7 +850,8 @@ struct BoostRegexConcept typedef bidirectional_iterator_archetype BidiIterator; typedef output_iterator_archetype OutputIterator; typedef global_regex_namespace::sub_match sub_match_type; - typedef global_regex_namespace::match_results match_results_type; + typedef global_regex_namespace::match_results > match_results_type; + typedef global_regex_namespace::match_results match_results_default_type; void constraints() { @@ -930,36 +975,90 @@ struct BoostRegexConcept // regex_constants::match_flag_type f = regex_constants::match_default; OutputIterator out = static_object::get(); - functor3 func3; - out = regex_format(out, m_cresults, func3, f); - out = regex_format(out, m_cresults, func3); - functor2 func2; - out = regex_format(out, m_cresults, func2, f); - out = regex_format(out, m_cresults, func2); - functor1 func1; - out = regex_format(out, m_cresults, func1, f); - out = regex_format(out, m_cresults, func1); + + functor3 func3; + functor2 func2; + functor1 func1; + + functor3 func3b; + functor2 func2b; + functor1 func1b; - m_string += regex_format(m_cresults, func3, f); - m_string += regex_format(m_cresults, func3); - m_string += regex_format(m_cresults, func2, f); - m_string += regex_format(m_cresults, func2); - m_string += regex_format(m_cresults, func1, f); - m_string += regex_format(m_cresults, func1); + out = regex_format(out, m_cresults, func3b, f); + out = regex_format(out, m_cresults, func3b); + out = regex_format(out, m_cresults, func2b, f); + out = regex_format(out, m_cresults, func2b); + out = regex_format(out, m_cresults, func1b, f); + out = regex_format(out, m_cresults, func1b); + out = regex_format(out, m_cresults, ref(func3b), f); + out = regex_format(out, m_cresults, ref(func3b)); + out = regex_format(out, m_cresults, ref(func2b), f); + out = regex_format(out, m_cresults, ref(func2b)); + out = regex_format(out, m_cresults, ref(func1b), f); + out = regex_format(out, m_cresults, ref(func1b)); + out = regex_format(out, m_cresults, cref(func3b), f); + out = regex_format(out, m_cresults, cref(func3b)); + out = regex_format(out, m_cresults, cref(func2b), f); + out = regex_format(out, m_cresults, cref(func2b)); + out = regex_format(out, m_cresults, cref(func1b), f); + out = regex_format(out, m_cresults, cref(func1b)); - out = m_cresults.format(out, func3, f); - out = m_cresults.format(out, func3); - out = m_cresults.format(out, func2, f); - out = m_cresults.format(out, func2); - out = m_cresults.format(out, func1, f); - out = m_cresults.format(out, func1); + m_string += regex_format(m_cresults, func3b, f); + m_string += regex_format(m_cresults, func3b); + m_string += regex_format(m_cresults, func2b, f); + m_string += regex_format(m_cresults, func2b); + m_string += regex_format(m_cresults, func1b, f); + m_string += regex_format(m_cresults, func1b); + m_string += regex_format(m_cresults, ref(func3b), f); + m_string += regex_format(m_cresults, ref(func3b)); + m_string += regex_format(m_cresults, ref(func2b), f); + m_string += regex_format(m_cresults, ref(func2b)); + m_string += regex_format(m_cresults, ref(func1b), f); + m_string += regex_format(m_cresults, ref(func1b)); + m_string += regex_format(m_cresults, cref(func3b), f); + m_string += regex_format(m_cresults, cref(func3b)); + m_string += regex_format(m_cresults, cref(func2b), f); + m_string += regex_format(m_cresults, cref(func2b)); + m_string += regex_format(m_cresults, cref(func1b), f); + m_string += regex_format(m_cresults, cref(func1b)); - m_string += m_cresults.format(func3, f); - m_string += m_cresults.format(func3); - m_string += m_cresults.format(func2, f); - m_string += m_cresults.format(func2); - m_string += m_cresults.format(func1, f); - m_string += m_cresults.format(func1); + out = m_cresults.format(out, func3b, f); + out = m_cresults.format(out, func3b); + out = m_cresults.format(out, func2b, f); + out = m_cresults.format(out, func2b); + out = m_cresults.format(out, func1b, f); + out = m_cresults.format(out, func1b); + out = m_cresults.format(out, ref(func3b), f); + out = m_cresults.format(out, ref(func3b)); + out = m_cresults.format(out, ref(func2b), f); + out = m_cresults.format(out, ref(func2b)); + out = m_cresults.format(out, ref(func1b), f); + out = m_cresults.format(out, ref(func1b)); + out = m_cresults.format(out, cref(func3b), f); + out = m_cresults.format(out, cref(func3b)); + out = m_cresults.format(out, cref(func2b), f); + out = m_cresults.format(out, cref(func2b)); + out = m_cresults.format(out, cref(func1b), f); + out = m_cresults.format(out, cref(func1b)); + + m_string += m_cresults.format(func3b, f); + m_string += m_cresults.format(func3b); + m_string += m_cresults.format(func2b, f); + m_string += m_cresults.format(func2b); + m_string += m_cresults.format(func1b, f); + m_string += m_cresults.format(func1b); + m_string += m_cresults.format(ref(func3b), f); + m_string += m_cresults.format(ref(func3b)); + m_string += m_cresults.format(ref(func2b), f); + m_string += m_cresults.format(ref(func2b)); + m_string += m_cresults.format(ref(func1b), f); + m_string += m_cresults.format(ref(func1b)); + m_string += m_cresults.format(cref(func3b), f); + m_string += m_cresults.format(cref(func3b)); + m_string += m_cresults.format(cref(func2b), f); + m_string += m_cresults.format(cref(func2b)); + m_string += m_cresults.format(cref(func1b), f); + m_string += m_cresults.format(cref(func1b)); out = regex_replace(out, m_in, m_in, ce, func3, f); out = regex_replace(out, m_in, m_in, ce, func3); @@ -967,6 +1066,18 @@ struct BoostRegexConcept out = regex_replace(out, m_in, m_in, ce, func2); out = regex_replace(out, m_in, m_in, ce, func1, f); out = regex_replace(out, m_in, m_in, ce, func1); + out = regex_replace(out, m_in, m_in, ce, ref(func3), f); + out = regex_replace(out, m_in, m_in, ce, ref(func3)); + out = regex_replace(out, m_in, m_in, ce, ref(func2), f); + out = regex_replace(out, m_in, m_in, ce, ref(func2)); + out = regex_replace(out, m_in, m_in, ce, ref(func1), f); + out = regex_replace(out, m_in, m_in, ce, ref(func1)); + out = regex_replace(out, m_in, m_in, ce, cref(func3), f); + out = regex_replace(out, m_in, m_in, ce, cref(func3)); + out = regex_replace(out, m_in, m_in, ce, cref(func2), f); + out = regex_replace(out, m_in, m_in, ce, cref(func2)); + out = regex_replace(out, m_in, m_in, ce, cref(func1), f); + out = regex_replace(out, m_in, m_in, ce, cref(func1)); functor3 > func3s; functor2 > func2s; @@ -977,6 +1088,18 @@ struct BoostRegexConcept m_string += regex_replace(m_string, ce, func2s); m_string += regex_replace(m_string, ce, func1s, f); m_string += regex_replace(m_string, ce, func1s); + m_string += regex_replace(m_string, ce, ref(func3s), f); + m_string += regex_replace(m_string, ce, ref(func3s)); + m_string += regex_replace(m_string, ce, ref(func2s), f); + m_string += regex_replace(m_string, ce, ref(func2s)); + m_string += regex_replace(m_string, ce, ref(func1s), f); + m_string += regex_replace(m_string, ce, ref(func1s)); + m_string += regex_replace(m_string, ce, cref(func3s), f); + m_string += regex_replace(m_string, ce, cref(func3s)); + m_string += regex_replace(m_string, ce, cref(func2s), f); + m_string += regex_replace(m_string, ce, cref(func2s)); + m_string += regex_replace(m_string, ce, cref(func1s), f); + m_string += regex_replace(m_string, ce, cref(func1s)); } std::basic_ostream m_stream; diff --git a/include/boost/regex/v4/perl_matcher.hpp b/include/boost/regex/v4/perl_matcher.hpp index 3f0e57de..d2be50fd 100644 --- a/include/boost/regex/v4/perl_matcher.hpp +++ b/include/boost/regex/v4/perl_matcher.hpp @@ -468,9 +468,9 @@ private: // matching flags in use: match_flag_type m_match_flags; // how many states we have examined so far: - boost::uintmax_t state_count; + std::ptrdiff_t state_count; // max number of states to examine before giving up: - boost::uintmax_t max_state_count; + std::ptrdiff_t max_state_count; // whether we should ignore case or not: bool icase; // set to true when (position == last), indicates that we may have a partial match: diff --git a/include/boost/regex/v4/perl_matcher_common.hpp b/include/boost/regex/v4/perl_matcher_common.hpp index 1657d483..b5bd5936 100644 --- a/include/boost/regex/v4/perl_matcher_common.hpp +++ b/include/boost/regex/v4/perl_matcher_common.hpp @@ -98,23 +98,23 @@ void perl_matcher::estimate_max_state_count(std // // Calculate NS^2 first: // - static const boost::uintmax_t k = 100000; - boost::uintmax_t dist = boost::re_detail::distance(base, last); + static const std::ptrdiff_t k = 100000; + std::ptrdiff_t dist = boost::re_detail::distance(base, last); if(dist == 0) dist = 1; - boost::uintmax_t states = re.size(); + std::ptrdiff_t states = re.size(); if(states == 0) states = 1; states *= states; - if((std::numeric_limits::max)() / dist < states) + if((std::numeric_limits::max)() / dist < states) { - max_state_count = (std::numeric_limits::max)() - 2; + max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits::max)() - 2); return; } states *= dist; - if((std::numeric_limits::max)() - k < states) + if((std::numeric_limits::max)() - k < states) { - max_state_count = (std::numeric_limits::max)() - 2; + max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits::max)() - 2); return; } states += k; @@ -125,15 +125,15 @@ void perl_matcher::estimate_max_state_count(std // Now calculate N^2: // states = dist; - if((std::numeric_limits::max)() / dist < states) + if((std::numeric_limits::max)() / dist < states) { - max_state_count = (std::numeric_limits::max)() - 2; + max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits::max)() - 2); return; } states *= dist; - if((std::numeric_limits::max)() - k < states) + if((std::numeric_limits::max)() - k < states) { - max_state_count = (std::numeric_limits::max)() - 2; + max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits::max)() - 2); return; } states += k; diff --git a/include/boost/regex/v4/regex_format.hpp b/include/boost/regex/v4/regex_format.hpp index 51fc62ae..f4d87681 100644 --- a/include/boost/regex/v4/regex_format.hpp +++ b/include/boost/regex/v4/regex_format.hpp @@ -34,6 +34,7 @@ #ifndef BOOST_NO_SFINAE #include #endif +#include namespace boost{ @@ -895,7 +896,7 @@ private: // F must be a pointer, a function, or a class with a function call operator: // BOOST_STATIC_ASSERT((::boost::is_pointer::value || ::boost::is_function::value || ::boost::is_class::value)); - static formatter_wrapper f; + static formatter_wrapper::type> f; static M m; static O out; static boost::regex_constants::match_flag_type flags; @@ -963,7 +964,7 @@ struct format_functor3 template OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f) { - return func(m, i, f); + return unwrap_ref(func)(m, i, f); } template OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&) @@ -983,7 +984,7 @@ struct format_functor2 template OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/) { - return func(m, i); + return unwrap_ref(func)(m, i); } template OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&) @@ -1020,7 +1021,7 @@ struct format_functor1 template OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/) { - return do_format_string(func(m), i); + return do_format_string(unwrap_ref(func)(m), i); } template OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)