|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80581 - in branches/release: . boost boost/xpressive boost/xpressive/detail/utility boost/xpressive/traits libs libs/xpressive/doc
From: eric_at_[hidden]
Date: 2012-09-18 13:53:59
Author: eric_niebler
Date: 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
New Revision: 80581
URL: http://svn.boost.org/trac/boost/changeset/80581
Log:
xpressive: merge [80300], [80312], [80357] from trunk
Properties modified:
branches/release/ (props changed)
branches/release/boost/ (props changed)
branches/release/boost/xpressive/ (props changed)
branches/release/libs/ (props changed)
Text files modified:
branches/release/boost/xpressive/detail/utility/literals.hpp | 8 +-
branches/release/boost/xpressive/regex_actions.hpp | 26 +++++------
branches/release/boost/xpressive/regex_error.hpp | 1
branches/release/boost/xpressive/regex_primitives.hpp | 2
branches/release/boost/xpressive/regex_token_iterator.hpp | 2
branches/release/boost/xpressive/sub_match.hpp | 89 +++++++++++++++++++++++++++++++++++----
branches/release/boost/xpressive/traits/c_regex_traits.hpp | 8 +-
branches/release/boost/xpressive/traits/cpp_regex_traits.hpp | 12 ++--
branches/release/libs/xpressive/doc/Jamfile.v2 | 5 +
9 files changed, 113 insertions(+), 40 deletions(-)
Modified: branches/release/boost/xpressive/detail/utility/literals.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/utility/literals.hpp (original)
+++ branches/release/boost/xpressive/detail/utility/literals.hpp 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
@@ -43,12 +43,12 @@
template<>
struct string_literal<char>
{
- static char const *pick(char const *cstr, wchar_t const *)
+ static BOOST_CONSTEXPR char const *pick(char const *cstr, wchar_t const *)
{
return cstr;
}
- static char pick(char ch, wchar_t)
+ static BOOST_CONSTEXPR char pick(char ch, wchar_t)
{
return ch;
}
@@ -57,12 +57,12 @@
template<>
struct string_literal<wchar_t>
{
- static wchar_t const *pick(char const *, wchar_t const *cstr)
+ static BOOST_CONSTEXPR wchar_t const *pick(char const *, wchar_t const *cstr)
{
return cstr;
}
- static wchar_t pick(char, wchar_t ch)
+ static BOOST_CONSTEXPR wchar_t pick(char, wchar_t ch)
{
return ch;
}
Modified: branches/release/boost/xpressive/regex_actions.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_actions.hpp (original)
+++ branches/release/boost/xpressive/regex_actions.hpp 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
@@ -105,7 +105,7 @@
{
BOOST_PROTO_CALLABLE()
template<typename Sig>
- struct result;
+ struct result {};
template<typename This, typename MatchResults, typename Expr>
struct result<This(MatchResults, Expr)>
@@ -163,7 +163,7 @@
{
BOOST_PROTO_CALLABLE()
template<typename Sig>
- struct result;
+ struct result {};
template<typename This, typename Cont, typename Idx>
struct result<This(Cont, Idx)>
@@ -173,14 +173,12 @@
template<typename This, typename Cont, typename Idx>
struct result<This(Cont &, Idx)>
+ : mpl::if_c<
+ is_const<Cont>::value
+ , typename Cont::const_reference
+ , typename Cont::reference
+ >
{
- typedef typename Cont::reference type;
- };
-
- template<typename This, typename Cont, typename Idx>
- struct result<This(Cont const &, Idx)>
- {
- typedef typename Cont::const_reference type;
};
template<typename Cont, typename Idx>
@@ -505,7 +503,7 @@
typedef UNREF(Cont) &type;
};
- /// operator()
+ /// \brief operator()
///
template<typename Cont, typename A0>
typename result<insert(Cont &, A0 const &)>::type
@@ -714,7 +712,7 @@
{
BOOST_PROTO_CALLABLE()
template<typename Sig>
- struct result;
+ struct result {};
template<typename This, typename Ref>
struct result<This(Ref)>
@@ -775,7 +773,7 @@
: base_type(base_type::proto_base_expr::make(t))
{}
- using base_type::operator =;
+ using base_type::operator=;
T &get()
{
@@ -798,7 +796,7 @@
: base_type(base_type::proto_base_expr::make(boost::ref(t)))
{}
- using base_type::operator =;
+ using base_type::operator=;
T &get() const
{
@@ -823,7 +821,7 @@
, base_type(base_type::make(boost::ref(detail::value_wrapper<T>::value)))
{}
- using base_type::operator =;
+ using base_type::operator=;
T &get()
{
Modified: branches/release/boost/xpressive/regex_error.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_error.hpp (original)
+++ branches/release/boost/xpressive/regex_error.hpp 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
@@ -51,6 +51,7 @@
{
/// Constructs an object of class regex_error.
/// \param code The error_type this regex_error represents.
+ /// \param str The message string of this regex_error.
/// \post code() == code
explicit regex_error(regex_constants::error_type code, char const *str = "")
: std::runtime_error(str)
Modified: branches/release/boost/xpressive/regex_primitives.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_primitives.hpp (original)
+++ branches/release/boost/xpressive/regex_primitives.hpp 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
@@ -161,7 +161,7 @@
{}
template<typename Sig>
- struct result;
+ struct result {};
template<typename This, typename Expr>
struct result<This(Expr)>
Modified: branches/release/boost/xpressive/regex_token_iterator.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_token_iterator.hpp (original)
+++ branches/release/boost/xpressive/regex_token_iterator.hpp 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
@@ -194,6 +194,7 @@
/// \param begin The beginning of the character range to search.
/// \param end The end of the character range to search.
/// \param rex The regex pattern to search for.
+ /// \param subs A range of integers designating sub-matches to be treated as tokens.
/// \param flags Optional match flags, used to control how the expression is matched against the sequence. (See match_flag_type.)
/// \pre \c [begin,end) is a valid range.
/// \pre \c subs is either an integer greater or equal to -1,
@@ -219,6 +220,7 @@
/// \param begin The beginning of the character range to search.
/// \param end The end of the character range to search.
/// \param rex The regex pattern to search for.
+ /// \param subs A range of integers designating sub-matches to be treated as tokens.
/// \param args A let() expression with argument bindings for semantic actions.
/// \param flags Optional match flags, used to control how the expression is matched against the sequence. (See match_flag_type.)
/// \pre \c [begin,end) is a valid range.
Modified: branches/release/boost/xpressive/sub_match.hpp
==============================================================================
--- branches/release/boost/xpressive/sub_match.hpp (original)
+++ branches/release/boost/xpressive/sub_match.hpp 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
@@ -45,17 +45,18 @@
///////////////////////////////////////////////////////////////////////////////
// sub_match
//
-/// \brief Class template sub_match denotes the sequence of characters matched by a particular marked sub-expression.
+/// \brief Class template \c sub_match denotes the sequence of characters matched by a particular
+/// marked sub-expression.
///
-/// When the marked sub-expression denoted by an object of type sub_match\<\> participated in a
-/// regular expression match then member matched evaluates to true, and members first and second
-/// denote the range of characters [first,second) which formed that match. Otherwise matched is false,
-/// and members first and second contained undefined values.
+/// When the marked sub-expression denoted by an object of type \c sub_match\<\> participated in a
+/// regular expression match then member \c matched evaluates to \c true, and members \c first and \c second
+/// denote the range of characters <tt>[first,second)</tt> which formed that match. Otherwise \c matched is \c false,
+/// and members \c first and \c second contained undefined values.
///
-/// If an object of type sub_match\<\> represents sub-expression 0 - that is to say the whole match -
-/// then member matched is always true, unless a partial match was obtained as a result of the flag
-/// match_partial being passed to a regular expression algorithm, in which case member matched is
-/// false, and members first and second represent the character range that formed the partial match.
+/// If an object of type \c sub_match\<\> represents sub-expression 0 - that is to say the whole match -
+/// then member \c matched is always \c true, unless a partial match was obtained as a result of the flag
+/// \c match_partial being passed to a regular expression algorithm, in which case member \c matched is
+/// \c false, and members \c first and \c second represent the character range that formed the partial match.
template<typename BidiIter>
struct sub_match
: std::pair<BidiIter, BidiIter>
@@ -111,7 +112,7 @@
/// \brief Performs a lexicographic string comparison
/// \param str the string against which to compare
- /// \return the results of (*this).str().compare(str)
+ /// \return the results of <tt>(*this).str().compare(str)</tt>
int compare(string_type const &str) const
{
return this->str().compare(str);
@@ -136,6 +137,44 @@
};
///////////////////////////////////////////////////////////////////////////////
+/// \brief \c range_begin() to make \c sub_match\<\> a valid range
+/// \param sub the \c sub_match\<\> object denoting the range
+/// \return \c sub.first
+/// \pre \c sub.first is not singular
+template<typename BidiIter>
+inline BidiIter range_begin(sub_match<BidiIter> &sub)
+{
+ return sub.first;
+}
+
+/// \overload
+///
+template<typename BidiIter>
+inline BidiIter range_begin(sub_match<BidiIter> const &sub)
+{
+ return sub.first;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief \c range_end() to make \c sub_match\<\> a valid range
+/// \param sub the \c sub_match\<\> object denoting the range
+/// \return \c sub.second
+/// \pre \c sub.second is not singular
+template<typename BidiIter>
+inline BidiIter range_end(sub_match<BidiIter> &sub)
+{
+ return sub.second;
+}
+
+/// \overload
+///
+template<typename BidiIter>
+inline BidiIter range_end(sub_match<BidiIter> const &sub)
+{
+ return sub.second;
+}
+
+///////////////////////////////////////////////////////////////////////////////
/// \brief insertion operator for sending sub-matches to ostreams
/// \param sout output stream.
/// \param sub sub_match object to be written to the stream.
@@ -396,4 +435,34 @@
}} // namespace boost::xpressive
+// Hook the Boost.Range customization points to make sub_match a valid range.
+namespace boost
+{
+ /// INTERNAL ONLY
+ ///
+ template<typename Range>
+ struct range_mutable_iterator;
+
+ /// INTERNAL ONLY
+ ///
+ template<typename BidiIter>
+ struct range_mutable_iterator<xpressive::sub_match<BidiIter> >
+ {
+ typedef BidiIter type;
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Range>
+ struct range_const_iterator;
+
+ /// INTERNAL ONLY
+ ///
+ template<typename BidiIter>
+ struct range_const_iterator<xpressive::sub_match<BidiIter> >
+ {
+ typedef BidiIter type;
+ };
+}
+
#endif
Modified: branches/release/boost/xpressive/traits/c_regex_traits.hpp
==============================================================================
--- branches/release/boost/xpressive/traits/c_regex_traits.hpp (original)
+++ branches/release/boost/xpressive/traits/c_regex_traits.hpp 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
@@ -113,7 +113,7 @@
// c_regex_traits
//
/// \brief Encapsaulates the standard C locale functions for use by the
-/// basic_regex\<\> class template.
+/// \c basic_regex\<\> class template.
template<typename Char>
struct c_regex_traits
: detail::c_regex_traits_base<Char>
@@ -200,12 +200,12 @@
return detail::c_toupper(ch);
}
- /// Returns a string_type containing all the characters that compare equal
+ /// Returns a \c string_type containing all the characters that compare equal
/// disregrarding case to the one passed in. This function can only be called
- /// if has_fold_case<c_regex_traits<Char> >::value is true.
+ /// if <tt>has_fold_case\<c_regex_traits\<Char\> \>::value</tt> is \c true.
///
/// \param ch The source character.
- /// \return string_type containing all chars which are equal to ch when disregarding
+ /// \return \c string_type containing all chars which are equal to \c ch when disregarding
/// case
//typedef array<char_type, 2> fold_case_type;
string_type fold_case(char_type ch) const
Modified: branches/release/boost/xpressive/traits/cpp_regex_traits.hpp
==============================================================================
--- branches/release/boost/xpressive/traits/cpp_regex_traits.hpp (original)
+++ branches/release/boost/xpressive/traits/cpp_regex_traits.hpp 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
@@ -311,8 +311,8 @@
///////////////////////////////////////////////////////////////////////////////
// cpp_regex_traits
//
-/// \brief Encapsaulates a std::locale for use by the
-/// basic_regex\<\> class template.
+/// \brief Encapsaulates a \c std::locale for use by the
+/// \c basic_regex\<\> class template.
template<typename Char>
struct cpp_regex_traits
: detail::cpp_regex_traits_base<Char>
@@ -404,12 +404,12 @@
return this->ctype_->toupper(ch);
}
- /// Returns a string_type containing all the characters that compare equal
+ /// Returns a \c string_type containing all the characters that compare equal
/// disregrarding case to the one passed in. This function can only be called
- /// if has_fold_case\<cpp_regex_traits\<Char\> \>::value is true.
+ /// if <tt>has_fold_case\<cpp_regex_traits\<Char\> \>::value</tt> is \c true.
///
/// \param ch The source character.
- /// \return string_type containing all chars which are equal to ch when disregarding
+ /// \return \c string_type containing all chars which are equal to \c ch when disregarding
/// case
string_type fold_case(char_type ch) const
{
@@ -607,7 +607,7 @@
/// INTERNAL ONLY
static char_class_pair const &char_class(std::size_t j)
{
- static char_class_pair const s_char_class_map[] =
+ static BOOST_CONSTEXPR_OR_CONST char_class_pair s_char_class_map[] =
{
{ BOOST_XPR_CSTR_(char_type, "alnum"), detail::std_ctype_alnum }
, { BOOST_XPR_CSTR_(char_type, "alpha"), detail::std_ctype_alpha }
Modified: branches/release/libs/xpressive/doc/Jamfile.v2
==============================================================================
--- branches/release/libs/xpressive/doc/Jamfile.v2 (original)
+++ branches/release/libs/xpressive/doc/Jamfile.v2 2012-09-18 13:53:58 EDT (Tue, 18 Sep 2012)
@@ -15,7 +15,10 @@
\"BOOST_DEDUCED_TYPENAME=typename\" \\
\"BOOST_XPRESSIVE_GLOBAL_MARK_TAG(x,y)=mark_tag const x(y)\" \\
\"BOOST_STATIC_CONSTANT(x,y)=static x const y\" \\
- \"BOOST_XPR_NONDEDUCED_TYPE_(X)=X\""
+ \"BOOST_XPR_NONDEDUCED_TYPE_(X)=X\" \\
+ \"UNREF(X)=typename remove_reference<X>::type\" \\
+ \"UNCV(X)=typename remove_const<X>::type\" \\
+ \"UNCVREF(X)=typename remove_const<typename remove_reference<X>::type>::type\""
<doxygen:param>HIDE_UNDOC_MEMBERS=NO
<doxygen:param>EXTRACT_PRIVATE=NO
<doxygen:param>ENABLE_PREPROCESSING=YES
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk