forked from boostorg/regex
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:
@ -10,6 +10,12 @@
|
||||
|
||||
[h4 Boost 1.38]
|
||||
|
||||
* [*Breaking change]: 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].
|
||||
* Added support for Perl style ${n} expressions in format strings
|
||||
(issue [@https://svn.boost.org/trac/boost/ticket/2556 #2556]).
|
||||
* Added support for accessing the location of sub-expressions within the
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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"><</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">></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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
@ -196,7 +196,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: December 22, 2008 at 19:39:18 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: December 23, 2008 at 17:35:37 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
@ -50,6 +50,7 @@ duplicated within the scope of class template [basic_regex].
|
||||
static const syntax_option_type no_mod_s;
|
||||
static const syntax_option_type mod_s;
|
||||
static const syntax_option_type mod_x;
|
||||
static const syntax_option_type no_empty_expressions;
|
||||
|
||||
// POSIX extended specific options:
|
||||
static const syntax_option_type no_escape_in_lists;
|
||||
@ -151,6 +152,7 @@ The following options may also be set when using perl-style regular expressions:
|
||||
whether `match_not_dot_newline` is set in the match flags.]]
|
||||
[[mod_x][No][Turns on the perl x-modifier: causes unescaped whitespace
|
||||
in the expression to be ignored.]]
|
||||
[[no_empty_expressions][No][When set then empty expressions/alternatives are prohibited.]]
|
||||
[[save_subexpression_location][No][When set then the locations of individual
|
||||
sub-expressions within the ['original regular expression string] can be accessed
|
||||
via the [link boost_regex.basic_regex.subexpression `subexpression()`] member function of `basic_regex`.]]
|
||||
|
@ -109,7 +109,11 @@ void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2,
|
||||
m_position = m_base = p1;
|
||||
m_end = p2;
|
||||
// empty strings are errors:
|
||||
if(p1 == p2)
|
||||
if((p1 == p2) &&
|
||||
(
|
||||
(l_flags & regbase::main_option_type) != regbase::perl_syntax_group)
|
||||
|| (l_flags & regbase::no_empty_expressions)
|
||||
)
|
||||
{
|
||||
fail(regex_constants::error_empty, 0);
|
||||
return;
|
||||
@ -926,7 +930,15 @@ bool basic_regex_parser<charT, traits>::parse_alt()
|
||||
// error check: if there have been no previous states,
|
||||
// or if the last state was a '(' then error:
|
||||
//
|
||||
if((this->m_last_state == 0) || (this->m_last_state->type == syntax_element_startmark))
|
||||
if(
|
||||
((this->m_last_state == 0) || (this->m_last_state->type == syntax_element_startmark))
|
||||
&&
|
||||
!(
|
||||
((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group)
|
||||
&&
|
||||
((this->flags() & regbase::no_empty_expressions) == 0)
|
||||
)
|
||||
)
|
||||
{
|
||||
fail(regex_constants::error_empty, this->m_position - this->m_base);
|
||||
return false;
|
||||
@ -2075,7 +2087,14 @@ bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_st
|
||||
// alternative then that's an error:
|
||||
//
|
||||
if((this->m_alt_insert_point == static_cast<std::ptrdiff_t>(this->m_pdata->m_data.size()))
|
||||
&& m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start))
|
||||
&& m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start)
|
||||
&&
|
||||
!(
|
||||
((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group)
|
||||
&&
|
||||
((this->flags() & regbase::no_empty_expressions) == 0)
|
||||
)
|
||||
)
|
||||
{
|
||||
fail(regex_constants::error_empty, this->m_position - this->m_base);
|
||||
return false;
|
||||
|
@ -85,6 +85,7 @@ public:
|
||||
collate = 1 << 21, // use locale specific collation
|
||||
nosubs = 1 << 22, // don't mark sub-expressions
|
||||
save_subexpression_location = 1 << 23, // save subexpression locations
|
||||
no_empty_expressions = 1 << 24, // no empty expressions allowed
|
||||
optimize = 0, // not really supported
|
||||
|
||||
|
||||
@ -143,6 +144,7 @@ namespace regex_constants{
|
||||
mod_s = ::boost::regbase::mod_s,
|
||||
no_mod_s = ::boost::regbase::no_mod_s,
|
||||
save_subexpression_location = ::boost::regbase::save_subexpression_location,
|
||||
no_empty_expressions = ::boost::regbase::no_empty_expressions,
|
||||
|
||||
basic = ::boost::regbase::basic,
|
||||
extended = ::boost::regbase::extended,
|
||||
|
@ -42,7 +42,8 @@ void basic_tests()
|
||||
TEST_REGEX_SEARCH("()", perl, "zzz", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, 3, 3, 3, 3, -2, -2));
|
||||
TEST_REGEX_SEARCH("()", perl, "", match_default, make_array(0, 0, 0, 0, -2, -2));
|
||||
TEST_INVALID_REGEX("(", perl);
|
||||
TEST_INVALID_REGEX("", perl);
|
||||
TEST_INVALID_REGEX("", perl|no_empty_expressions);
|
||||
TEST_REGEX_SEARCH("", perl, "abc", match_default, make_array(0, 0, -2, 1, 1, -2, 2, 2, -2, 3, 3, -2, -2));
|
||||
TEST_INVALID_REGEX(")", perl);
|
||||
TEST_INVALID_REGEX("(aa", perl);
|
||||
TEST_INVALID_REGEX("aa)", perl);
|
||||
|
@ -33,38 +33,43 @@ int* get_array_data();
|
||||
|
||||
int error_count = 0;
|
||||
|
||||
#define RUN_TESTS(name) \
|
||||
std::cout << "Running test case \"" #name "\".\n";\
|
||||
name();
|
||||
|
||||
|
||||
void run_tests()
|
||||
{
|
||||
basic_tests();
|
||||
test_simple_repeats();
|
||||
test_alt();
|
||||
test_sets();
|
||||
test_sets2();
|
||||
test_anchors();
|
||||
test_backrefs();
|
||||
test_character_escapes();
|
||||
test_assertion_escapes();
|
||||
test_tricky_cases();
|
||||
test_grep();
|
||||
test_replace();
|
||||
test_non_greedy_repeats();
|
||||
test_non_marking_paren();
|
||||
test_partial_match();
|
||||
test_forward_lookahead_asserts();
|
||||
test_fast_repeats();
|
||||
test_fast_repeats2();
|
||||
test_independent_subs();
|
||||
test_nosubs();
|
||||
test_conditionals();
|
||||
test_options();
|
||||
test_options2();
|
||||
RUN_TESTS(basic_tests);
|
||||
RUN_TESTS(test_simple_repeats);
|
||||
RUN_TESTS(test_alt);
|
||||
RUN_TESTS(test_sets);
|
||||
RUN_TESTS(test_sets2);
|
||||
RUN_TESTS(test_anchors);
|
||||
RUN_TESTS(test_backrefs);
|
||||
RUN_TESTS(test_character_escapes);
|
||||
RUN_TESTS(test_assertion_escapes);
|
||||
RUN_TESTS(test_tricky_cases);
|
||||
RUN_TESTS(test_grep);
|
||||
RUN_TESTS(test_replace);
|
||||
RUN_TESTS(test_non_greedy_repeats);
|
||||
RUN_TESTS(test_non_marking_paren);
|
||||
RUN_TESTS(test_partial_match);
|
||||
RUN_TESTS(test_forward_lookahead_asserts);
|
||||
RUN_TESTS(test_fast_repeats);
|
||||
RUN_TESTS(test_fast_repeats2);
|
||||
RUN_TESTS(test_independent_subs);
|
||||
RUN_TESTS(test_nosubs);
|
||||
RUN_TESTS(test_conditionals);
|
||||
RUN_TESTS(test_options);
|
||||
RUN_TESTS(test_options2);
|
||||
#ifndef TEST_THREADS
|
||||
test_en_locale();
|
||||
RUN_TESTS(test_en_locale);
|
||||
#endif
|
||||
test_emacs();
|
||||
test_operators();
|
||||
test_overloads();
|
||||
test_unicode();
|
||||
RUN_TESTS(test_emacs);
|
||||
RUN_TESTS(test_operators);
|
||||
RUN_TESTS(test_overloads);
|
||||
RUN_TESTS(test_unicode);
|
||||
}
|
||||
|
||||
int cpp_main(int /*argc*/, char * /*argv*/[])
|
||||
|
@ -29,11 +29,16 @@ void test_alt()
|
||||
TEST_REGEX_SEARCH("a(b|c)", perl, "ad", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("(a|b|c)", perl, "c", match_default, make_array(0, 1, 0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("(a|(b)|.)", perl, "b", match_default, make_array(0, 1, 0, 1, 0, 1, -2, -2));
|
||||
TEST_INVALID_REGEX("|c", perl);
|
||||
TEST_INVALID_REGEX("c|", perl);
|
||||
TEST_INVALID_REGEX("(|)", perl);
|
||||
TEST_INVALID_REGEX("(a|)", perl);
|
||||
TEST_INVALID_REGEX("(|a)", perl);
|
||||
TEST_INVALID_REGEX("|c", perl|no_empty_expressions);
|
||||
TEST_REGEX_SEARCH("|c", perl, " c", match_default, make_array(0, 0, -2, 1, 1, -2, 1, 2, -2, 2, 2, -2, -2));
|
||||
TEST_INVALID_REGEX("c|", perl|no_empty_expressions);
|
||||
TEST_REGEX_SEARCH("c|", perl, " c", match_default, make_array(0, 0, -2, 1, 2, -2, 2, 2, -2, -2));
|
||||
TEST_INVALID_REGEX("(|)", perl|no_empty_expressions);
|
||||
TEST_REGEX_SEARCH("(|)", perl, " c", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, -2));
|
||||
TEST_INVALID_REGEX("(a|)", perl|no_empty_expressions);
|
||||
TEST_REGEX_SEARCH("(a|)", perl, " a", match_default, make_array(0, 0, 0, 0, -2, 1, 2, 1, 2, -2, 2, 2, 2, 2, -2, -2));
|
||||
TEST_INVALID_REGEX("(|a)", perl|no_empty_expressions);
|
||||
TEST_REGEX_SEARCH("(|a)", perl, " a", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 1, 2, 1, 2, -2, 2, 2, 2, 2, -2, -2));
|
||||
TEST_REGEX_SEARCH("a\\|", perl, "a|", match_default, make_array(0, 2, -2, -2));
|
||||
|
||||
TEST_REGEX_SEARCH("a|", basic, "a|", match_default, make_array(0, 2, -2, -2));
|
||||
|
@ -38,7 +38,7 @@ int get_posix_compile_options(boost::regex_constants::syntax_option_type opts)
|
||||
{
|
||||
case regbase::perl:
|
||||
result = (opts & regbase::no_perl_ex) ? REG_EXTENDED : REG_PERL;
|
||||
if(opts & (regbase::no_bk_refs|regbase::no_mod_m|regbase::mod_x|regbase::mod_s|regbase::no_mod_s|regbase::no_escape_in_lists))
|
||||
if(opts & (regbase::no_bk_refs|regbase::no_mod_m|regbase::mod_x|regbase::mod_s|regbase::no_mod_s|regbase::no_escape_in_lists|regbase::no_empty_expressions))
|
||||
return -1;
|
||||
break;
|
||||
case regbase::basic:
|
||||
|
Reference in New Issue
Block a user