Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-10-24 19:37:41


Author: eric_niebler
Date: 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
New Revision: 40445
URL: http://svn.boost.org/trac/boost/changeset/40445

Log:
replace all throw statements with boost::throw_exception
Text files modified:
   trunk/boost/xpressive/detail/core/matcher/action_matcher.hpp | 8 +++++++-
   trunk/boost/xpressive/detail/dynamic/dynamic.hpp | 5 ++++-
   trunk/boost/xpressive/detail/dynamic/matchable.hpp | 5 ++++-
   trunk/boost/xpressive/detail/dynamic/parse_charset.hpp | 11 ++++++++---
   trunk/boost/xpressive/detail/dynamic/parser_traits.hpp | 9 +++++----
   trunk/boost/xpressive/match_results.hpp | 20 ++++++++++++++++----
   trunk/boost/xpressive/regex_actions.hpp | 9 +++++----
   trunk/boost/xpressive/regex_compiler.hpp | 22 +++++++++++++++-------
   trunk/boost/xpressive/regex_error.hpp | 5 +++--
   9 files changed, 67 insertions(+), 27 deletions(-)

Modified: trunk/boost/xpressive/detail/core/matcher/action_matcher.hpp
==============================================================================
--- trunk/boost/xpressive/detail/core/matcher/action_matcher.hpp (original)
+++ trunk/boost/xpressive/detail/core/matcher/action_matcher.hpp 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
@@ -20,6 +20,7 @@
 #include <boost/ref.hpp>
 #include <boost/assert.hpp>
 #include <boost/mpl/if.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/type_traits/is_const.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
@@ -177,7 +178,12 @@
                 action_args_type::const_iterator where_ = ctx.args().find(&typeid(proto::arg(expr)));
                 if(where_ == ctx.args().end())
                 {
- throw regex_error(regex_constants::error_badarg, "An argument to an action was unspecified");
+ boost::throw_exception(
+ regex_error(
+ regex_constants::error_badarg
+ , "An argument to an action was unspecified"
+ )
+ );
                 }
                 return proto::arg(expr).cast(where_->second);
             }

Modified: trunk/boost/xpressive/detail/dynamic/dynamic.hpp
==============================================================================
--- trunk/boost/xpressive/detail/dynamic/dynamic.hpp (original)
+++ trunk/boost/xpressive/detail/dynamic/dynamic.hpp 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
@@ -19,6 +19,7 @@
 #include <boost/assert.hpp>
 #include <boost/mpl/int.hpp>
 #include <boost/mpl/assert.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
 #include <boost/xpressive/detail/core/quant_style.hpp>
@@ -112,7 +113,9 @@
     {
         if(quant_none == seq.quant())
         {
- throw regex_error(regex_constants::error_badrepeat, "expression cannot be quantified");
+ boost::throw_exception(
+ regex_error(regex_constants::error_badrepeat, "expression cannot be quantified")
+ );
         }
         else
         {

Modified: trunk/boost/xpressive/detail/dynamic/matchable.hpp
==============================================================================
--- trunk/boost/xpressive/detail/dynamic/matchable.hpp (original)
+++ trunk/boost/xpressive/detail/dynamic/matchable.hpp 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
@@ -16,6 +16,7 @@
 #include <boost/assert.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/intrusive_ptr.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/xpressive/detail/core/quant_style.hpp>
 #include <boost/xpressive/detail/utility/counted_base.hpp>
@@ -67,7 +68,9 @@
 
     virtual void repeat(quant_spec const &, sequence<BidiIter> &) const
     {
- throw regex_error(regex_constants::error_badrepeat, "expression cannot be quantified");
+ boost::throw_exception(
+ regex_error(regex_constants::error_badrepeat, "expression cannot be quantified")
+ );
     }
 
     ///////////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/boost/xpressive/detail/dynamic/parse_charset.hpp
==============================================================================
--- trunk/boost/xpressive/detail/dynamic/parse_charset.hpp (original)
+++ trunk/boost/xpressive/detail/dynamic/parse_charset.hpp 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
@@ -13,8 +13,9 @@
 # pragma once
 #endif
 
-#include <boost/mpl/bool.hpp>
 #include <boost/integer.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/numeric/conversion/converter.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
 #include <boost/xpressive/detail/dynamic/parser_enum.hpp>
@@ -53,8 +54,12 @@
     {
         if(numeric::cInRange != result)
         {
- throw regex_error(regex_constants::error_escape,
- "character escape too large to fit in target character type");
+ boost::throw_exception(
+ regex_error(
+ regex_constants::error_escape
+ , "character escape too large to fit in target character type"
+ )
+ );
         }
     }
 };

Modified: trunk/boost/xpressive/detail/dynamic/parser_traits.hpp
==============================================================================
--- trunk/boost/xpressive/detail/dynamic/parser_traits.hpp (original)
+++ trunk/boost/xpressive/detail/dynamic/parser_traits.hpp 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
@@ -16,6 +16,7 @@
 #include <string>
 #include <climits>
 #include <boost/assert.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/xpressive/regex_error.hpp>
 #include <boost/xpressive/regex_traits.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
@@ -247,7 +248,7 @@
                 case BOOST_XPR_CHAR_(char_type, '='): ++begin; return token_positive_lookbehind;
                 case BOOST_XPR_CHAR_(char_type, '!'): ++begin; return token_negative_lookbehind;
                 default:
- throw regex_error(error_badbrace, "unrecognized extension");
+ boost::throw_exception(regex_error(error_badbrace, "unrecognized extension"));
                 }
 
             case BOOST_XPR_CHAR_(char_type, 'P'):
@@ -264,7 +265,7 @@
                     detail::ensure(begin != end, error_paren, "incomplete extension");
                     return token_named_mark_ref;
                 default:
- throw regex_error(error_badbrace, "unrecognized extension");
+ boost::throw_exception(regex_error(error_badbrace, "unrecognized extension"));
                 }
 
             case BOOST_XPR_CHAR_(char_type, 'i'):
@@ -275,7 +276,7 @@
                 return this->parse_mods_(begin, end);
 
             default:
- throw regex_error(error_badbrace, "unrecognized extension");
+ boost::throw_exception(regex_error(error_badbrace, "unrecognized extension"));
             }
         }
 
@@ -381,7 +382,7 @@
         case BOOST_XPR_CHAR_(char_type, ':'): ++begin; // fall-through
         case BOOST_XPR_CHAR_(char_type, ')'): return token_no_mark;
         case BOOST_XPR_CHAR_(char_type, '-'): if(false == (set = !set)) break; // else fall-through
- default: throw regex_error(error_paren, "unknown pattern modifier");
+ default: boost::throw_exception(regex_error(error_paren, "unknown pattern modifier"));
         }
         while(detail::ensure(++begin != end, error_paren, "incomplete extension"));
         // this return is technically unreachable, but this must

Modified: trunk/boost/xpressive/match_results.hpp
==============================================================================
--- trunk/boost/xpressive/match_results.hpp (original)
+++ trunk/boost/xpressive/match_results.hpp 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
@@ -31,6 +31,7 @@
 #include <boost/integer.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/intrusive_ptr.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/iterator_adaptors.hpp>
 #include <boost/numeric/conversion/converter.hpp>
 #if BOOST_ITERATOR_ADAPTORS_VERSION >= 0x0200
@@ -88,8 +89,12 @@
     {
         if(numeric::cInRange != result)
         {
- throw regex_error(regex_constants::error_escape,
- "character escape too large to fit in target character type");
+ boost::throw_exception(
+ regex_error(
+ regex_constants::error_escape
+ , "character escape too large to fit in target character type"
+ )
+ );
         }
     }
 };
@@ -633,7 +638,12 @@
                 return this->sub_matches_[ this->named_marks_[i].mark_nbr_ ];
             }
         }
- throw regex_error(regex_constants::error_badmark, "invalid named back-reference");
+ boost::throw_exception(
+ regex_error(regex_constants::error_badmark, "invalid named back-reference")
+ );
+ // Should never execute, but if it does, this returns
+ // a "null" sub_match.
+ return this->sub_matches_[this->sub_matches_.size()];
     }
 
     /// INTERNAL ONLY
@@ -1030,7 +1040,9 @@
             }
         }
 
- throw regex_error(error_badmark, "invalid named back-reference");
+ boost::throw_exception(regex_error(error_badmark, "invalid named back-reference"));
+ // Should never get here
+ return out;
     }
 
     regex_id_type regex_id_;

Modified: trunk/boost/xpressive/regex_actions.hpp
==============================================================================
--- trunk/boost/xpressive/regex_actions.hpp (original)
+++ trunk/boost/xpressive/regex_actions.hpp 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
@@ -20,6 +20,7 @@
 #include <boost/mpl/int.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/lexical_cast.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_const.hpp>
 #include <boost/type_traits/is_integral.hpp>
@@ -559,25 +560,25 @@
 
             void operator()() const
             {
- throw Except();
+ boost::throw_exception(Except());
             }
 
             template<typename A0>
             void operator()(A0 const &a0) const
             {
- throw Except(a0);
+ boost::throw_exception(Except(a0));
             }
 
             template<typename A0, typename A1>
             void operator()(A0 const &a0, A1 const &a1) const
             {
- throw Except(a0, a1);
+ boost::throw_exception(Except(a0, a1));
             }
 
             template<typename A0, typename A1, typename A2>
             void operator()(A0 const &a0, A1 const &a1, A2 const &a2) const
             {
- throw Except(a0, a1, a2);
+ boost::throw_exception(Except(a0, a1, a2));
             }
         };
     }

Modified: trunk/boost/xpressive/regex_compiler.hpp
==============================================================================
--- trunk/boost/xpressive/regex_compiler.hpp (original)
+++ trunk/boost/xpressive/regex_compiler.hpp 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
@@ -21,6 +21,7 @@
 #include <boost/range/begin.hpp>
 #include <boost/range/end.hpp>
 #include <boost/mpl/assert.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/iterator/iterator_traits.hpp>
 #include <boost/xpressive/basic_regex.hpp>
@@ -357,7 +358,10 @@
             return detail::make_dynamic<BidiIter>(detail::regex_byref_matcher<BidiIter>(this->self_));
 
         case token_rule_assign:
- throw regex_error(error_badrule, "rule assignments must be at the front of the regex");
+ boost::throw_exception(
+ regex_error(error_badrule, "rule assignments must be at the front of the regex")
+ );
+ break;
 
         case token_rule_ref:
             {
@@ -403,7 +407,8 @@
                     );
                 }
             }
- throw regex_error(error_badmark, "invalid named back-reference");
+ boost::throw_exception(regex_error(error_badmark, "invalid named back-reference"));
+ break;
 
         default:
             mark_nbr = static_cast<int>(++this->mark_count_);
@@ -539,7 +544,8 @@
             return this->parse_charset(begin, end);
 
         case token_invalid_quantifier:
- throw regex_error(error_badrepeat, "quantifier not expected");
+ boost::throw_exception(regex_error(error_badrepeat, "quantifier not expected"));
+ break;
 
         case token_quote_meta_begin:
             return detail::make_literal_xpression<BidiIter>
@@ -548,11 +554,13 @@
             );
 
         case token_quote_meta_end:
- throw regex_error
- (
- error_escape
- , "found quote-meta end without corresponding quote-meta begin"
+ boost::throw_exception(
+ regex_error(
+ error_escape
+ , "found quote-meta end without corresponding quote-meta begin"
+ )
             );
+ break;
 
         case token_end_of_pattern:
             break;

Modified: trunk/boost/xpressive/regex_error.hpp
==============================================================================
--- trunk/boost/xpressive/regex_error.hpp (original)
+++ trunk/boost/xpressive/regex_error.hpp 2007-10-24 19:37:40 EDT (Wed, 24 Oct 2007)
@@ -16,6 +16,7 @@
 
 #include <string>
 #include <stdexcept>
+#include <boost/throw_exception.hpp>
 #include <boost/xpressive/regex_constants.hpp>
 
 //{{AFX_DOC_COMMENT
@@ -76,9 +77,9 @@
 {
     if(!predicate)
     {
- throw regex_error(code, str);
+ boost::throw_exception(regex_error(code, str));
     }
- return true;
+ return predicate;
 }
 
 }}} // namespace boost::xpressive::detail


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