Empty expressions, and empty alternatives are now

allowed when using the Perl regular expression syntax.  This change has
been added for Perl compatibility, when the new [syntax_option_type]
['no_empty_expressions] is set then the old behaviour is preserved and
empty expressions are prohibited.  This is issue
[@https://svn.boost.org/trac/boost/ticket/1081 #1081].

Fixes #1081.

[SVN r50374]
This commit is contained in:
John Maddock
2008-12-23 19:06:04 +00:00
parent b4152cd74d
commit e4b31ea37f
25 changed files with 147 additions and 81 deletions

View File

@ -28,7 +28,7 @@
Example Programs</a>
</h3></div></div></div>
<a name="boost_regex.background_information.examples.test_programs"></a><h5>
<a name="id685514"></a>
<a name="id685550"></a>
<a class="link" href="examples.html#boost_regex.background_information.examples.test_programs">Test
Programs</a>
</h5>
@ -107,7 +107,7 @@
Files: <a href="../../../../test/captures/captures_test.cpp" target="_top">captures_test.cpp</a>.
</p>
<a name="boost_regex.background_information.examples.example_programs"></a><h5>
<a name="id685902"></a>
<a name="id685938"></a>
<a class="link" href="examples.html#boost_regex.background_information.examples.example_programs">Example
programs</a>
</h5>
@ -133,7 +133,7 @@
Files: <a href="../../../../example/timer/regex_timer.cpp" target="_top">regex_timer.cpp</a>.
</p>
<a name="boost_regex.background_information.examples.code_snippets"></a><h5>
<a name="id685983"></a>
<a name="id686019"></a>
<a class="link" href="examples.html#boost_regex.background_information.examples.code_snippets">Code
snippets</a>
</h5>

View File

@ -26,11 +26,18 @@
<a name="boost_regex.background_information.history"></a><a class="link" href="history.html" title="History"> History</a>
</h3></div></div></div>
<a name="boost_regex.background_information.history.boost_1_38"></a><h5>
<a name="id688124"></a>
<a name="id688173"></a>
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_38">Boost
1.38</a>
</h5>
<div class="itemizedlist"><ul type="disc">
<li>
<span class="bold"><strong>Breaking change</strong></span>: empty expressions, and
empty alternatives are now allowed when using the Perl regular expression
syntax. This change has been added for Perl compatibility, when the new
<a class="link" href="../ref/syntax_option_type.html" title="syntax_option_type"><code class="computeroutput"><span class="identifier">syntax_option_type</span></code></a><span class="emphasis"><em>no_empty_expressions</em></span> is set then the old behaviour
is preserved and empty expressions are prohibited.
</li>
<li>
Added support for Perl style ${n} expressions in format strings (issue
<a href="https://svn.boost.org/trac/boost/ticket/2556" target="_top">#2556</a>).
@ -40,12 +47,13 @@
regular expression string (issue <a href="https://svn.boost.org/trac/boost/ticket/2269" target="_top">#2269</a>).
</li>
<li>
Fixed compiler compatibility issues <a href="https://svn.boost.org/trac/boost/ticket/2244" target="_top">#2244</a>
Fixed compiler compatibility issues <a href="https://svn.boost.org/trac/boost/ticket/2244" target="_top">#2244</a>,
<a href="https://svn.boost.org/trac/boost/ticket/2514" target="_top">#2514</a>,
and <a href="https://svn.boost.org/trac/boost/ticket/2244" target="_top">#2458</a>.
</li>
</ul></div>
<a name="boost_regex.background_information.history.boost_1_34"></a><h5>
<a name="id688198"></a>
<a name="id688292"></a>
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_34">Boost
1.34</a>
</h5>
@ -68,7 +76,7 @@
</li>
</ul></div>
<a name="boost_regex.background_information.history.boost_1_33_1"></a><h5>
<a name="id688249"></a>
<a name="id688343"></a>
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_33_1">Boost
1.33.1</a>
</h5>
@ -138,7 +146,7 @@
</li>
</ul></div>
<a name="boost_regex.background_information.history.boost_1_33_0"></a><h5>
<a name="id688378"></a>
<a name="id688472"></a>
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_33_0">Boost
1.33.0</a>
</h5>
@ -193,7 +201,7 @@
</li>
</ul></div>
<a name="boost_regex.background_information.history.boost_1_32_1"></a><h5>
<a name="id688484"></a>
<a name="id688569"></a>
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_32_1">Boost
1.32.1</a>
</h5>
@ -201,7 +209,7 @@
Fixed bug in partial matches of bounded repeats of '.'.
</li></ul></div>
<a name="boost_regex.background_information.history.boost_1_31_0"></a><h5>
<a name="id688518"></a>
<a name="id688603"></a>
<a class="link" href="history.html#boost_regex.background_information.history.boost_1_31_0">Boost
1.31.0</a>
</h5>

View File

@ -58,7 +58,7 @@
There are three separate localization mechanisms supported by Boost.Regex:
</p>
<a name="boost_regex.background_information.locale.win32_localization_model_"></a><h5>
<a name="id682026"></a>
<a name="id682058"></a>
<a class="link" href="locale.html#boost_regex.background_information.locale.win32_localization_model_">Win32
localization model.</a>
</h5>
@ -90,7 +90,7 @@
are treated as "unknown" graphic characters.
</p>
<a name="boost_regex.background_information.locale.c_localization_model_"></a><h5>
<a name="id682260"></a>
<a name="id682296"></a>
<a class="link" href="locale.html#boost_regex.background_information.locale.c_localization_model_">C
localization model.</a>
</h5>
@ -114,7 +114,7 @@
libraries including version 1 of this library.
</p>
<a name="boost_regex.background_information.locale.c___localization_model_"></a><h5>
<a name="id682372"></a>
<a name="id682409"></a>
<a class="link" href="locale.html#boost_regex.background_information.locale.c___localization_model_">C++
localization model.</a>
</h5>
@ -151,7 +151,7 @@
in your code. The best way to ensure this is to add the #define to <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">regex</span><span class="special">/</span><span class="identifier">user</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>.
</p>
<a name="boost_regex.background_information.locale.providing_a_message_catalogue"></a><h5>
<a name="id682832"></a>
<a name="id682868"></a>
<a class="link" href="locale.html#boost_regex.background_information.locale.providing_a_message_catalogue">Providing
a message catalogue</a>
</h5>

View File

@ -28,7 +28,7 @@
Conformance</a>
</h3></div></div></div>
<a name="boost_regex.background_information.standards.c__"></a><h5>
<a name="id686962"></a>
<a name="id686998"></a>
<a class="link" href="standards.html#boost_regex.background_information.standards.c__">C++</a>
</h5>
<p>
@ -36,7 +36,7 @@
Report on C++ Library Extensions</a>.
</p>
<a name="boost_regex.background_information.standards.ecmascript___javascript"></a><h5>
<a name="id687001"></a>
<a name="id687036"></a>
<a class="link" href="standards.html#boost_regex.background_information.standards.ecmascript___javascript">ECMAScript
/ JavaScript</a>
</h5>
@ -49,7 +49,7 @@
rather than a Unicode escape sequence; use \x{DDDD} for Unicode escape sequences.
</p>
<a name="boost_regex.background_information.standards.perl"></a><h5>
<a name="id687040"></a>
<a name="id687075"></a>
<a class="link" href="standards.html#boost_regex.background_information.standards.perl">Perl</a>
</h5>
<p>
@ -62,7 +62,7 @@
(??{code}) Not implementable in a compiled strongly typed language.
</p>
<a name="boost_regex.background_information.standards.posix"></a><h5>
<a name="id687078"></a>
<a name="id687114"></a>
<a class="link" href="standards.html#boost_regex.background_information.standards.posix">POSIX</a>
</h5>
<p>
@ -82,7 +82,7 @@
a custom traits class.
</p>
<a name="boost_regex.background_information.standards.unicode"></a><h5>
<a name="id687125"></a>
<a name="id687161"></a>
<a class="link" href="standards.html#boost_regex.background_information.standards.unicode">Unicode</a>
</h5>
<p>

View File

@ -34,7 +34,7 @@
Boost-specific enhanced interface.
</p>
<a name="boost_regex.ref.concepts.traits_concept.minimal_requirements_"></a><h5>
<a name="id661128"></a>
<a name="id661185"></a>
<a class="link" href="traits_concept.html#boost_regex.ref.concepts.traits_concept.minimal_requirements_">Minimal
requirements.</a>
</h5>
@ -381,7 +381,7 @@
</tbody>
</table></div>
<a name="boost_regex.ref.concepts.traits_concept.additional_optional_requirements"></a><h5>
<a name="id661935"></a>
<a name="id661996"></a>
<a class="link" href="traits_concept.html#boost_regex.ref.concepts.traits_concept.additional_optional_requirements">Additional
Optional Requirements</a>
</h5>

View File

@ -34,7 +34,7 @@
previous version of Boost.Regex and will not be further updated:
</p>
<a name="boost_regex.ref.deprecated_interfaces.regex_format.algorithm_regex_format"></a><h5>
<a name="id662675"></a>
<a name="id662740"></a>
<a class="link" href="regex_format.html#boost_regex.ref.deprecated_interfaces.regex_format.algorithm_regex_format">Algorithm
regex_format</a>
</h5>

View File

@ -27,7 +27,7 @@
<a name="boost_regex.ref.error_type"></a><a class="link" href="error_type.html" title="error_type"> error_type</a>
</h3></div></div></div>
<a name="boost_regex.ref.error_type.synopsis"></a><h5>
<a name="id640527"></a>
<a name="id640585"></a>
<a class="link" href="error_type.html#boost_regex.ref.error_type.synopsis">Synopsis</a>
</h5>
<p>
@ -57,7 +57,7 @@
</span><span class="special">}</span> <span class="comment">// namespace boost
</span></pre>
<a name="boost_regex.ref.error_type.description"></a><h5>
<a name="id641091"></a>
<a name="id641149"></a>
<a class="link" href="error_type.html#boost_regex.ref.error_type.description">Description</a>
</h5>
<p>

View File

@ -69,7 +69,7 @@
</span><span class="special">}</span> <span class="comment">// namespace boost
</span></pre>
<a name="boost_regex.ref.match_flag_type.description"></a><h5>
<a name="id639762"></a>
<a name="id639820"></a>
<a class="link" href="match_flag_type.html#boost_regex.ref.match_flag_type.description">Description</a>
</h5>
<p>

View File

@ -43,7 +43,7 @@
on to the "real" algorithm.
</p>
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_match"></a><h5>
<a name="id643526"></a>
<a name="id643583"></a>
<a class="link" href="unicode_algo.html#boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_match">u32regex_match</a>
</h5>
<p>
@ -89,7 +89,7 @@
<span class="special">}</span>
</pre>
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_search"></a><h5>
<a name="id644246"></a>
<a name="id644302"></a>
<a class="link" href="unicode_algo.html#boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_search">u32regex_search</a>
</h5>
<p>
@ -128,7 +128,7 @@
<span class="special">}</span>
</pre>
<a name="boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_replace"></a><h5>
<a name="id644840"></a>
<a name="id644896"></a>
<a class="link" href="unicode_algo.html#boost_regex.ref.non_std_strings.icu.unicode_algo.u32regex_replace">u32regex_replace</a>
</h5>
<p>

View File

@ -28,7 +28,7 @@
Unicode Aware Regex Iterators</a>
</h5></div></div></div>
<a name="boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_iterator"></a><h5>
<a name="id645300"></a>
<a name="id645356"></a>
<a class="link" href="unicode_iter.html#boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_iterator">u32regex_iterator</a>
</h5>
<p>
@ -126,7 +126,7 @@
Provided of course that the input is encoded as UTF-8.
</p>
<a name="boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_token_iterator"></a><h5>
<a name="id647046"></a>
<a name="id647103"></a>
<a class="link" href="unicode_iter.html#boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_token_iterator">u32regex_token_iterator</a>
</h5>
<p>

View File

@ -34,7 +34,7 @@
here they are anyway:
</p>
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match"></a><h5>
<a name="id652203"></a>
<a name="id652259"></a>
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match">regex_match</a>
</h5>
<p>
@ -82,7 +82,7 @@
<span class="special">}</span>
</pre>
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match__second_overload_"></a><h5>
<a name="id653115"></a>
<a name="id653171"></a>
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_match__second_overload_">regex_match
(second overload)</a>
</h5>
@ -110,7 +110,7 @@
<span class="special">}</span>
</pre>
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search"></a><h5>
<a name="id653706"></a>
<a name="id653763"></a>
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search">regex_search</a>
</h5>
<p>
@ -149,7 +149,7 @@
<span class="special">}</span>
</pre>
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search__second_overload_"></a><h5>
<a name="id654444"></a>
<a name="id654500"></a>
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_search__second_overload_">regex_search
(second overload)</a>
</h5>
@ -164,7 +164,7 @@
<span class="special">+</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetLength</span><span class="special">(),</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">f</span><span class="special">);</span></code>
</p>
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_replace"></a><h5>
<a name="id654848"></a>
<a name="id654904"></a>
<a class="link" href="mfc_algo.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_algo.regex_replace">regex_replace</a>
</h5>
<p>

View File

@ -32,7 +32,7 @@
an MFC/ATL string to a <a class="link" href="../../regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> or <a class="link" href="../../regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a>:
</p>
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_iterator_creation_helper"></a><h5>
<a name="id655928"></a>
<a name="id655985"></a>
<a class="link" href="mfc_iter.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_iterator_creation_helper">regex_iterator
creation helper</a>
</h5>
@ -68,7 +68,7 @@
<span class="special">}</span>
</pre>
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_token_iterator_creation_helpers"></a><h5>
<a name="id656677"></a>
<a name="id656734"></a>
<a class="link" href="mfc_iter.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_token_iterator_creation_helpers">regex_token_iterator
creation helpers</a>
</h5>

View File

@ -165,7 +165,7 @@
<a name="regcomp"></a><p>
</p>
<a name="boost_regex.ref.posix.regcomp"></a><h5>
<a name="id659594"></a>
<a name="id659651"></a>
<a class="link" href="posix.html#boost_regex.ref.posix.regcomp">regcomp</a>
</h5>
<p>
@ -379,7 +379,7 @@
<a name="regerror"></a><p>
</p>
<a name="boost_regex.ref.posix.regerror"></a><h5>
<a name="id660238"></a>
<a name="id660295"></a>
<a class="link" href="posix.html#boost_regex.ref.posix.regerror">regerror</a>
</h5>
<p>
@ -467,7 +467,7 @@
<a name="regexec"></a><p>
</p>
<a name="boost_regex.ref.posix.regexec"></a><h5>
<a name="id660421"></a>
<a name="id660478"></a>
<a class="link" href="posix.html#boost_regex.ref.posix.regexec">regexec</a>
</h5>
<p>
@ -537,7 +537,7 @@
<a name="regfree"></a><p>
</p>
<a name="boost_regex.ref.posix.regfree"></a><h5>
<a name="id660563"></a>
<a name="id660619"></a>
<a class="link" href="posix.html#boost_regex.ref.posix.regfree">regfree</a>
</h5>
<p>

View File

@ -46,7 +46,7 @@
<span class="special">}</span> <span class="comment">// namespace boost
</span></pre>
<a name="boost_regex.ref.regex_traits.description"></a><h5>
<a name="id641773"></a>
<a name="id641830"></a>
<a class="link" href="regex_traits.html#boost_regex.ref.regex_traits.description">Description</a>
</h5>
<p>

View File

@ -372,6 +372,23 @@
</td>
</tr>
<tr>
<td>
<p>
no_empty_expressions
</p>
</td>
<td>
<p>
No
</p>
</td>
<td>
<p>
When set then empty expressions/alternatives are prohibited.
</p>
</td>
</tr>
<tr>
<td>
<p>
save_subexpression_location

View File

@ -69,6 +69,7 @@
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">no_mod_s</span><span class="special">;</span>
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">mod_s</span><span class="special">;</span>
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">mod_x</span><span class="special">;</span>
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">no_empty_expressions</span><span class="special">;</span>
<span class="comment">// POSIX extended specific options:
</span><span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">syntax_option_type</span> <span class="identifier">no_escape_in_lists</span><span class="special">;</span>