|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49782 - in branches/release: . boost/xpressive boost/xpressive/detail boost/xpressive/detail/core boost/xpressive/detail/core/matcher boost/xpressive/detail/dynamic boost/xpressive/detail/static boost/xpressive/detail/static/transforms boost/xpressive/traits
From: eric_at_[hidden]
Date: 2008-11-16 03:42:38
Author: eric_niebler
Date: 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
New Revision: 49782
URL: http://svn.boost.org/trac/boost/changeset/49782
Log:
merged latest xpressive from trunk (49436,49608,49626,49649,49781)
Properties modified:
branches/release/ (props changed)
Text files modified:
branches/release/boost/xpressive/basic_regex.hpp | 28 ++-
branches/release/boost/xpressive/detail/core/access.hpp | 4
branches/release/boost/xpressive/detail/core/matcher/action_matcher.hpp | 232 +++++++++++++------------
branches/release/boost/xpressive/detail/core/matcher/end_matcher.hpp | 2
branches/release/boost/xpressive/detail/core/matcher/lookbehind_matcher.hpp | 2
branches/release/boost/xpressive/detail/core/matcher/predicate_matcher.hpp | 12
branches/release/boost/xpressive/detail/core/matcher/regex_byref_matcher.hpp | 2
branches/release/boost/xpressive/detail/core/matcher/regex_matcher.hpp | 2
branches/release/boost/xpressive/detail/detail_fwd.hpp | 10
branches/release/boost/xpressive/detail/dynamic/dynamic.hpp | 2
branches/release/boost/xpressive/detail/dynamic/matchable.hpp | 2
branches/release/boost/xpressive/detail/dynamic/parse_charset.hpp | 32 +-
branches/release/boost/xpressive/detail/dynamic/parser.hpp | 4
branches/release/boost/xpressive/detail/dynamic/parser_traits.hpp | 36 ++--
branches/release/boost/xpressive/detail/static/compile.hpp | 15 +
branches/release/boost/xpressive/detail/static/grammar.hpp | 18 +-
branches/release/boost/xpressive/detail/static/is_pure.hpp | 28 +-
branches/release/boost/xpressive/detail/static/modifier.hpp | 6
branches/release/boost/xpressive/detail/static/placeholders.hpp | 1
branches/release/boost/xpressive/detail/static/static.hpp | 2
branches/release/boost/xpressive/detail/static/transforms/as_action.hpp | 261 ++++++++++++++---------------
branches/release/boost/xpressive/detail/static/transforms/as_alternate.hpp | 94 ++++++----
branches/release/boost/xpressive/detail/static/transforms/as_independent.hpp | 189 +++++++++++----------
branches/release/boost/xpressive/detail/static/transforms/as_inverse.hpp | 2
branches/release/boost/xpressive/detail/static/transforms/as_marker.hpp | 42 ++--
branches/release/boost/xpressive/detail/static/transforms/as_matcher.hpp | 32 +-
branches/release/boost/xpressive/detail/static/transforms/as_modifier.hpp | 56 ++++--
branches/release/boost/xpressive/detail/static/transforms/as_quantifier.hpp | 349 ++++++++++++++++++++++-----------------
branches/release/boost/xpressive/detail/static/transforms/as_sequence.hpp | 42 ++--
branches/release/boost/xpressive/detail/static/transforms/as_set.hpp | 131 ++++++++------
branches/release/boost/xpressive/detail/static/visitor.hpp | 1
branches/release/boost/xpressive/detail/static/width_of.hpp | 106 ++++++++----
branches/release/boost/xpressive/match_results.hpp | 42 ++--
branches/release/boost/xpressive/regex_actions.hpp | 55 +++---
branches/release/boost/xpressive/regex_algorithms.hpp | 4
branches/release/boost/xpressive/regex_compiler.hpp | 32 +-
branches/release/boost/xpressive/regex_error.hpp | 34 ++-
branches/release/boost/xpressive/regex_primitives.hpp | 63 ++++---
branches/release/boost/xpressive/traits/cpp_regex_traits.hpp | 4
branches/release/boost/xpressive/xpressive_fwd.hpp | 4
branches/release/boost/xpressive/xpressive_typeof.hpp | 2
41 files changed, 1078 insertions(+), 907 deletions(-)
Modified: branches/release/boost/xpressive/basic_regex.hpp
==============================================================================
--- branches/release/boost/xpressive/basic_regex.hpp (original)
+++ branches/release/boost/xpressive/basic_regex.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -24,7 +24,7 @@
// Doxygen can't handle proto :-(
#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
# include <boost/xpressive/detail/static/grammar.hpp>
-# include <boost/xpressive/proto/extends.hpp>
+# include <boost/proto/extends.hpp>
#endif
#if BOOST_XPRESSIVE_HAS_MS_STACK_GUARD
@@ -35,6 +35,14 @@
namespace boost { namespace xpressive
{
+namespace detail
+{
+ inline void throw_on_stack_error(bool stack_error)
+ {
+ BOOST_XPR_ENSURE_(!stack_error, regex_constants::error_stack, "Regex stack space exhausted");
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// basic_regex
//
@@ -77,7 +85,7 @@
/// \return *this
basic_regex<BidiIter> &operator =(basic_regex<BidiIter> const &that)
{
- proto::arg(*this) = proto::arg(that);
+ proto::value(*this) = proto::value(that);
return *this;
}
@@ -115,14 +123,14 @@
///
std::size_t mark_count() const
{
- return proto::arg(*this) ? proto::arg(*this)->mark_count_ : 0;
+ return proto::value(*this) ? proto::value(*this)->mark_count_ : 0;
}
/// Returns a token which uniquely identifies this regular expression.
///
regex_id_type regex_id() const
{
- return proto::arg(*this) ? proto::arg(*this)->xpr_.get() : 0;
+ return proto::value(*this) ? proto::value(*this)->xpr_.get() : 0;
}
/// Swaps the contents of this basic_regex object with another.
@@ -137,7 +145,7 @@
/// \throw nothrow
void swap(basic_regex<BidiIter> &that) // throw()
{
- proto::arg(*this).swap(proto::arg(that));
+ proto::value(*this).swap(proto::value(that));
}
/// Factory method for building a regex object from a range of characters.
@@ -207,17 +215,17 @@
bool success = false, stack_error = false;
__try
{
- success = proto::arg(*this)->xpr_->match(state);
+ success = proto::value(*this)->xpr_->match(state);
}
__except(_exception_code() == 0xC00000FDUL)
{
stack_error = true;
_resetstkoflw();
}
- detail::ensure(!stack_error, regex_constants::error_stack, "Regex stack space exhausted");
+ detail::throw_on_stack_error(stack_error);
return success;
#else
- return proto::arg(*this)->xpr_->match(state);
+ return proto::value(*this)->xpr_->match(state);
#endif
}
@@ -225,7 +233,7 @@
/// INTERNAL ONLY
bool invalid_() const
{
- return !proto::arg(*this) || !proto::arg(*this)->xpr_;
+ return !proto::value(*this) || !proto::value(*this)->xpr_;
}
// Compiles valid static regexes into a state machine.
@@ -233,7 +241,7 @@
template<typename Expr>
void compile_(Expr const &expr, mpl::true_)
{
- detail::static_compile(expr, proto::arg(*this).get());
+ detail::static_compile(expr, proto::value(*this).get());
}
// No-op for invalid static regexes.
Modified: branches/release/boost/xpressive/detail/core/access.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/core/access.hpp (original)
+++ branches/release/boost/xpressive/detail/core/access.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -32,7 +32,7 @@
static std::size_t get_hidden_mark_count(basic_regex<BidiIter> const &rex)
{
- return proto::arg(rex)->hidden_mark_count_;
+ return proto::value(rex)->hidden_mark_count_;
}
static bool invalid(basic_regex<BidiIter> const &rex)
@@ -48,7 +48,7 @@
static shared_ptr<detail::regex_impl<BidiIter> > const &
get_regex_impl(basic_regex<BidiIter> const &rex)
{
- return proto::arg(rex).get();
+ return proto::value(rex).get();
}
static void init_sub_match_vector
Modified: branches/release/boost/xpressive/detail/core/matcher/action_matcher.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/core/matcher/action_matcher.hpp (original)
+++ branches/release/boost/xpressive/detail/core/matcher/action_matcher.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -22,18 +22,19 @@
#include <boost/assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/throw_exception.hpp>
+#include <boost/utility/result_of.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/core/quant_style.hpp>
#include <boost/xpressive/detail/core/action.hpp>
#include <boost/xpressive/detail/core/state.hpp>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/context.hpp>
+#include <boost/proto/core.hpp>
+#include <boost/proto/context.hpp>
#include <boost/xpressive/match_results.hpp> // for type_info_less
#include <boost/xpressive/detail/static/transforms/as_action.hpp> // for 'read_attr'
#if BOOST_VERSION >= 103500
-# include <boost/xpressive/proto/fusion.hpp>
+# include <boost/proto/fusion.hpp>
# include <boost/fusion/include/transform_view.hpp>
# include <boost/fusion/include/invoke.hpp>
# include <boost/fusion/include/push_front.hpp>
@@ -57,11 +58,9 @@
template<typename Expr, long N>
struct child_
- : remove_reference<typename mpl::if_<
- is_const<Expr>
- , typename proto::result_of::arg_c<Expr, N>::const_reference
- , typename proto::result_of::arg_c<Expr, N>::reference
- >::type>
+ : remove_reference<
+ typename proto::result_of::child_c<Expr &, N>::type
+ >
{};
///////////////////////////////////////////////////////////////////////////////
@@ -75,8 +74,8 @@
typedef typename child_<Expr, 1>::type right_type;
typedef
- typename proto::result_of::arg<
- typename proto::result_of::arg_c<right_type, 0>::type
+ typename proto::result_of::value<
+ typename proto::result_of::child_c<right_type, 0>::type
>::type
function_type;
@@ -97,7 +96,7 @@
result_type operator()(Expr &expr, Context &ctx) const
{
return fusion::invoke<function_type>(
- proto::arg(proto::arg_c<0>(proto::right(expr)))
+ proto::value(proto::child_c<0>(proto::right(expr)))
, evaluated_args(
fusion::push_front(fusion::pop_front(proto::right(expr)), boost::ref(proto::left(expr)))
, proto::eval_fun<Context>(ctx)
@@ -117,7 +116,7 @@
typedef typename child_<Expr, 1>::type right_type;
typedef
- typename proto::result_of::arg<right_type>::type
+ typename proto::result_of::value<right_type>::type
function_type;
typedef typename boost::result_of<
@@ -126,7 +125,7 @@
result_type operator()(Expr &expr, Context &ctx) const
{
- return proto::arg(proto::right(expr))(
+ return proto::value(proto::right(expr))(
proto::eval(proto::left(expr), ctx)
);
}
@@ -165,7 +164,7 @@
typedef Arg &result_type;
result_type operator()(Expr &expr, action_context const &) const
{
- return proto::arg(expr).get();
+ return proto::value(expr).get();
}
};
@@ -175,7 +174,7 @@
typedef Arg const &result_type;
result_type operator()(Expr &expr, action_context const &) const
{
- return proto::arg(expr);
+ return proto::value(expr);
}
};
@@ -185,17 +184,17 @@
typedef typename action_arg<Type, Int>::reference result_type;
result_type operator()(Expr &expr, action_context const &ctx) const
{
- action_args_type::const_iterator where_ = ctx.args().find(&typeid(proto::arg(expr)));
+ action_args_type::const_iterator where_ = ctx.args().find(&typeid(proto::value(expr)));
if(where_ == ctx.args().end())
{
- boost::throw_exception(
+ BOOST_THROW_EXCEPTION(
regex_error(
regex_constants::error_badarg
, "An argument to an action was unspecified"
)
);
}
- return proto::arg(expr).cast(where_->second);
+ return proto::value(expr).cast(where_->second);
}
};
@@ -207,7 +206,7 @@
template<typename Expr>
struct eval<Expr, proto::tag::terminal>
- : eval_terminal<Expr, typename proto::result_of::arg<Expr>::type>
+ : eval_terminal<Expr, typename proto::result_of::value<Expr>::type>
{};
// Evaluate attributes like a1|42
@@ -215,9 +214,9 @@
struct eval<Expr, attr_with_default_tag>
{
typedef
- typename proto::result_of::arg<
+ typename proto::result_of::value<
typename proto::result_of::left<
- typename proto::result_of::arg<
+ typename proto::result_of::child<
Expr
>::type
>::type
@@ -228,9 +227,9 @@
result_type operator ()(Expr const &expr, action_context const &ctx) const
{
- return proto::arg(proto::left(proto::arg(expr))).t_
- ? *proto::arg(proto::left(proto::arg(expr))).t_
- : proto::eval(proto::right(proto::arg(expr)), ctx);
+ return proto::value(proto::left(proto::child(expr))).t_
+ ? *proto::value(proto::left(proto::child(expr))).t_
+ : proto::eval(proto::right(proto::child(expr)), ctx);
}
};
@@ -271,49 +270,50 @@
///////////////////////////////////////////////////////////////////////////////
// subreg_transform
//
- struct subreg_transform : proto::callable
+ struct subreg_transform : proto::transform<subreg_transform>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef State unref_state;
- typedef typename proto::terminal<sub_match<typename unref_state::iterator> >::type type;
- };
+ typedef typename impl::state state_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &, State const &state, Visitor &visitor) const
- {
- sub_match<typename State::iterator> const &sub = state.sub_matches_[ visitor ];
- return proto::as_expr(sub);
- }
+ typedef
+ typename proto::terminal<sub_match<typename state_type::iterator> >::type
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ return result_type::make(state.sub_matches_[ data ]);
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
// mark_transform
//
- struct mark_transform : proto::callable
+ struct mark_transform : proto::transform<mark_transform>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef State unref_state;
+ typedef typename impl::state state_type;
typedef
- typename proto::terminal<sub_match<typename unref_state::iterator> >::type
- type;
- };
+ typename proto::terminal<sub_match<typename state_type::iterator> >::type
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &) const
- {
- sub_match<typename State::iterator> const &sub = state.sub_matches_[ proto::arg(expr).mark_number_ ];
- return proto::as_expr(sub);
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param
+ ) const
+ {
+ return result_type::make(state.sub_matches_[ proto::value(expr).mark_number_ ]);
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
@@ -331,7 +331,7 @@
operator reference() const
{
- detail::ensure(0 != this->t_, regex_constants::error_badattr, "Use of uninitialized regex attribute");
+ BOOST_XPR_ENSURE_(0 != this->t_, regex_constants::error_badattr, "Use of uninitialized regex attribute");
return *this->t_;
}
@@ -341,83 +341,89 @@
///////////////////////////////////////////////////////////////////////////////
// attr_transform
//
- struct attr_transform : proto::callable
+ struct attr_transform : proto::transform<attr_transform>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
+ typedef typename impl::expr expr_type;
+
typedef
- typename proto::result_of::as_expr<
- opt<typename Expr::proto_arg0::matcher_type::value_type::second_type>
- >::type
- type;
- };
+ typename expr_type::proto_child0::matcher_type::value_type::second_type
+ attr_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &, State const &state, Visitor &) const
- {
- typedef typename Expr::proto_arg0::matcher_type::value_type::second_type attr_type;
- int slot = typename Expr::proto_arg0::nbr_type();
- attr_type const *attr = static_cast<attr_type const *>(state.attr_context_.attr_slots_[slot-1]);
- return proto::as_expr(opt<attr_type>(attr));
- }
+ typedef
+ typename proto::terminal<opt<attr_type> >::type
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param
+ , typename impl::state_param state
+ , typename impl::data_param
+ ) const
+ {
+ int slot = typename expr_type::proto_child0::nbr_type();
+ attr_type const *attr = static_cast<attr_type const *>(state.attr_context_.attr_slots_[slot-1]);
+ return result_type::make(opt<attr_type>(attr));
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
// attr_with_default_transform
//
template<typename Grammar, typename Callable = proto::callable>
- struct attr_with_default_transform : proto::callable
+ struct attr_with_default_transform : proto::transform<attr_with_default_transform<Grammar, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
typedef
typename proto::unary_expr<
attr_with_default_tag
- , typename Grammar::template result<void(Expr, State, Visitor)>::type
+ , typename Grammar::template impl<Expr, State, Data>::result_type
>::type
- type;
- };
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &visitor) const
- {
- typename result<void(Expr, State, Visitor)>::type that = {
- Grammar()(expr, state, visitor)
- };
- return that;
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ result_type that = {
+ typename Grammar::template impl<Expr, State, Data>()(expr, state, data)
+ };
+ return that;
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
// by_ref_transform
//
- struct by_ref_transform : proto::callable
+ struct by_ref_transform : proto::transform<by_ref_transform>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
typedef
- typename proto::terminal<typename proto::result_of::arg<Expr>::const_reference>::type
- type;
- };
+ typename proto::result_of::value<typename impl::expr_param>::type
+ reference;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &) const
- {
- typedef typename result<void(Expr, State, Visitor)>::type that_type;
- return that_type::make(proto::arg(expr));
- }
+ typedef
+ typename proto::terminal<reference>::type
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param
+ ) const
+ {
+ return result_type::make(proto::value(expr));
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
@@ -457,9 +463,15 @@
bool match(match_state<BidiIter> &state, Next const &next) const
{
// Bind the arguments
- int sub = this->sub_; // BUGBUG this is a hack
- typedef typename BindActionArgs::template result<void(Actor, match_state<BidiIter>, int)>::type action_type;
- action<action_type> actor(BindActionArgs()(this->actor_, state, sub));
+ typedef
+ typename boost::result_of<BindActionArgs(
+ Actor const &
+ , match_state<BidiIter> &
+ , int const &
+ )>::type
+ action_type;
+
+ action<action_type> actor(BindActionArgs()(this->actor_, state, this->sub_));
// Put the action in the action list
actionable const **action_list_tail = state.action_list_tail_;
Modified: branches/release/boost/xpressive/detail/core/matcher/end_matcher.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/core/matcher/end_matcher.hpp (original)
+++ branches/release/boost/xpressive/detail/core/matcher/end_matcher.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -88,7 +88,7 @@
{
actor->execute(state.action_args_);
}
-
+
return true;
}
};
Modified: branches/release/boost/xpressive/detail/core/matcher/lookbehind_matcher.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/core/matcher/lookbehind_matcher.hpp (original)
+++ branches/release/boost/xpressive/detail/core/matcher/lookbehind_matcher.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -39,7 +39,7 @@
, pure_(pure)
, width_(width)
{
- detail::ensure(!is_unknown(this->width_), regex_constants::error_badlookbehind,
+ BOOST_XPR_ENSURE_(!is_unknown(this->width_), regex_constants::error_badlookbehind,
"Variable-width look-behind assertions are not supported");
}
Modified: branches/release/boost/xpressive/detail/core/matcher/predicate_matcher.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/core/matcher/predicate_matcher.hpp (original)
+++ branches/release/boost/xpressive/detail/core/matcher/predicate_matcher.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -19,7 +19,7 @@
#include <boost/xpressive/detail/core/quant_style.hpp>
#include <boost/xpressive/detail/core/matcher/action_matcher.hpp>
#include <boost/xpressive/detail/core/state.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/proto/core.hpp>
namespace boost { namespace xpressive { namespace detail
{
@@ -46,7 +46,7 @@
typedef Arg &result_type;
result_type operator()(Expr &expr, predicate_context const &) const
{
- return proto::arg(expr).get();
+ return proto::value(expr).get();
}
};
@@ -66,7 +66,7 @@
typedef sub_match<BidiIter> const &result_type;
result_type operator()(Expr &expr, predicate_context const &ctx) const
{
- return ctx.sub_matches_[proto::arg(expr).mark_number_];
+ return ctx.sub_matches_[proto::value(expr).mark_number_];
}
};
@@ -78,7 +78,7 @@
template<typename Expr>
struct eval<Expr, proto::tag::terminal>
- : eval_terminal<Expr, typename proto::result_of::arg<Expr>::type>
+ : eval_terminal<Expr, typename proto::result_of::value<Expr>::type>
{};
#if BOOST_VERSION >= 103500
@@ -131,14 +131,14 @@
bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const
{
sub_match<BidiIter> const &sub = state.sub_match(this->sub_);
- return proto::arg(proto::arg_c<1>(this->predicate_))(sub) && next.match(state);
+ return proto::value(proto::child_c<1>(this->predicate_))(sub) && next.match(state);
}
template<typename BidiIter, typename Next>
bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const
{
predicate_context<BidiIter> ctx(this->sub_, state.sub_matches_);
- return proto::eval(proto::arg_c<1>(this->predicate_), ctx) && next.match(state);
+ return proto::eval(proto::child_c<1>(this->predicate_), ctx) && next.match(state);
}
};
Modified: branches/release/boost/xpressive/detail/core/matcher/regex_byref_matcher.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/core/matcher/regex_byref_matcher.hpp (original)
+++ branches/release/boost/xpressive/detail/core/matcher/regex_byref_matcher.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -52,7 +52,7 @@
bool match(match_state<BidiIter> &state, Next const &next) const
{
BOOST_ASSERT(this->pimpl_ == this->wimpl_.lock().get());
- ensure(this->pimpl_->xpr_, regex_constants::error_badref, "bad regex reference");
+ BOOST_XPR_ENSURE_(this->pimpl_->xpr_, regex_constants::error_badref, "bad regex reference");
return push_context_match(*this->pimpl_, state, this->wrap_(next, is_static_xpression<Next>()));
}
Modified: branches/release/boost/xpressive/detail/core/matcher/regex_matcher.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/core/matcher/regex_matcher.hpp (original)
+++ branches/release/boost/xpressive/detail/core/matcher/regex_matcher.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -42,7 +42,7 @@
this->impl_.mark_count_ = impl->mark_count_;
this->impl_.hidden_mark_count_ = impl->hidden_mark_count_;
- ensure(this->impl_.xpr_, regex_constants::error_badref, "bad regex reference");
+ BOOST_XPR_ENSURE_(this->impl_.xpr_, regex_constants::error_badref, "bad regex reference");
}
template<typename Next>
Modified: branches/release/boost/xpressive/detail/detail_fwd.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/detail_fwd.hpp (original)
+++ branches/release/boost/xpressive/detail/detail_fwd.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -39,7 +39,7 @@
struct type_info_less;
typedef std::map<std::type_info const *, void *, type_info_less> action_args_type;
-
+
struct action_context;
template<typename BidiIter>
@@ -405,13 +405,15 @@
using proto::otherwise;
using proto::switch_;
using proto::make;
- using proto::_arg;
+ using proto::_child;
+ using proto::_value;
using proto::_left;
using proto::_right;
using proto::not_;
using proto::_state;
- using proto::_visitor;
+ using proto::_data;
using proto::callable;
+ using proto::transform;
using proto::fold;
using proto::reverse_fold;
using proto::fold_tree;
@@ -421,7 +423,7 @@
using proto::bitwise_or;
using proto::logical_not;
using proto::dereference;
- using proto::posit;
+ using proto::unary_plus;
using proto::negate;
using proto::complement;
using proto::comma;
Modified: branches/release/boost/xpressive/detail/dynamic/dynamic.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/dynamic/dynamic.hpp (original)
+++ branches/release/boost/xpressive/detail/dynamic/dynamic.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -113,7 +113,7 @@
{
if(quant_none == seq.quant())
{
- boost::throw_exception(
+ BOOST_THROW_EXCEPTION(
regex_error(regex_constants::error_badrepeat, "expression cannot be quantified")
);
}
Modified: branches/release/boost/xpressive/detail/dynamic/matchable.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/dynamic/matchable.hpp (original)
+++ branches/release/boost/xpressive/detail/dynamic/matchable.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -69,7 +69,7 @@
virtual void repeat(quant_spec const &, sequence<BidiIter> &) const
{
- boost::throw_exception(
+ BOOST_THROW_EXCEPTION(
regex_error(regex_constants::error_badrepeat, "expression cannot be quantified")
);
}
Modified: branches/release/boost/xpressive/detail/dynamic/parse_charset.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/dynamic/parse_charset.hpp (original)
+++ branches/release/boost/xpressive/detail/dynamic/parse_charset.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -54,7 +54,7 @@
{
if(numeric::cInRange != result)
{
- boost::throw_exception(
+ BOOST_THROW_EXCEPTION(
regex_error(
regex_constants::error_escape
, "character escape too large to fit in target character type"
@@ -81,7 +81,7 @@
BOOST_MPL_ASSERT_RELATION(sizeof(uchar_t), ==, sizeof(char_type));
typedef numeric::conversion_traits<uchar_t, int> converstion_traits;
- ensure(begin != end, error_escape, "unexpected end of pattern found");
+ BOOST_XPR_ENSURE_(begin != end, error_escape, "unexpected end of pattern found");
numeric::converter<int, uchar_t, converstion_traits, char_overflow_handler> converter;
escape_value<char_type,char_class_type> esc = { 0, 0, 0, escape_char };
bool const icase = (0 != (regex_constants::icase_ & traits.flags()));
@@ -115,8 +115,8 @@
break;
// control character
case BOOST_XPR_CHAR_(char_type, 'c'):
- ensure(++begin != end, error_escape, "unexpected end of pattern found");
- ensure
+ BOOST_XPR_ENSURE_(++begin != end, error_escape, "unexpected end of pattern found");
+ BOOST_XPR_ENSURE_
(
rxtraits.in_range(BOOST_XPR_CHAR_(char_type, 'a'), BOOST_XPR_CHAR_(char_type, 'z'), *begin)
|| rxtraits.in_range(BOOST_XPR_CHAR_(char_type, 'A'), BOOST_XPR_CHAR_(char_type, 'Z'), *begin)
@@ -154,18 +154,18 @@
break;
// hex escape sequence
case BOOST_XPR_CHAR_(char_type, 'x'):
- ensure(++begin != end, error_escape, "unexpected end of pattern found");
+ BOOST_XPR_ENSURE_(++begin != end, error_escape, "unexpected end of pattern found");
tmp = begin;
esc.ch_ = converter(toi(begin, end, rxtraits, 16, 0xff));
- ensure(2 == std::distance(tmp, begin), error_escape, "invalid hex escape : "
+ BOOST_XPR_ENSURE_(2 == std::distance(tmp, begin), error_escape, "invalid hex escape : "
"must be \\x HexDigit HexDigit");
break;
// Unicode escape sequence
case BOOST_XPR_CHAR_(char_type, 'u'):
- ensure(++begin != end, error_escape, "unexpected end of pattern found");
+ BOOST_XPR_ENSURE_(++begin != end, error_escape, "unexpected end of pattern found");
tmp = begin;
esc.ch_ = converter(toi(begin, end, rxtraits, 16, 0xffff));
- ensure(4 == std::distance(tmp, begin), error_escape, "invalid Unicode escape : "
+ BOOST_XPR_ENSURE_(4 == std::distance(tmp, begin), error_escape, "invalid Unicode escape : "
"must be \\u HexDigit HexDigit HexDigit HexDigit");
break;
// backslash
@@ -225,14 +225,14 @@
char_type ch_prev = char_type(), ch_next = char_type();
bool have_prev = false;
- ensure(begin != end, error_brack, "unexpected end of pattern found");
+ BOOST_XPR_ENSURE_(begin != end, error_brack, "unexpected end of pattern found");
// remember the current position and grab the next token
iprev = begin;
tok = traits.get_charset_token(begin, end);
do
{
- ensure(begin != end, error_brack, "unexpected end of pattern found");
+ BOOST_XPR_ENSURE_(begin != end, error_brack, "unexpected end of pattern found");
if(token_charset_hyphen == tok && have_prev)
{
@@ -248,19 +248,19 @@
begin = iprev2; // un-get these tokens and fall through
case token_literal:
ch_next = *begin++;
- detail::ensure(ch_prev <= ch_next, error_range, "invalid charset range");
+ BOOST_XPR_ENSURE_(ch_prev <= ch_next, error_range, "invalid charset range");
chset.set_range(ch_prev, ch_next, rxtraits, icase);
continue;
case token_charset_backspace:
ch_next = char_type(8); // backspace
- detail::ensure(ch_prev <= ch_next, error_range, "invalid charset range");
+ BOOST_XPR_ENSURE_(ch_prev <= ch_next, error_range, "invalid charset range");
chset.set_range(ch_prev, ch_next, rxtraits, icase);
continue;
case token_escape:
esc = parse_escape(begin, end, traits);
if(escape_char == esc.type_)
{
- detail::ensure(ch_prev <= esc.ch_, error_range, "invalid charset range");
+ BOOST_XPR_ENSURE_(ch_prev <= esc.ch_, error_range, "invalid charset range");
chset.set_range(ch_prev, esc.ch_, rxtraits, icase);
continue;
}
@@ -306,12 +306,12 @@
while(token_literal == (tok = traits.get_charset_token(begin, end)))
{
tmp = ++begin;
- ensure(begin != end, error_brack, "unexpected end of pattern found");
+ BOOST_XPR_ENSURE_(begin != end, error_brack, "unexpected end of pattern found");
}
if(token_posix_charset_end == tok)
{
char_class_type chclass = rxtraits.lookup_classname(start, tmp, icase);
- ensure(0 != chclass, error_ctype, "unknown class name");
+ BOOST_XPR_ENSURE_(0 != chclass, error_ctype, "unknown class name");
chset.set_class(chclass, invert);
continue;
}
@@ -346,7 +346,7 @@
continue;
}
}
- while(ensure((iprev = begin) != end, error_brack, "unexpected end of pattern found"),
+ while(BOOST_XPR_ENSURE_((iprev = begin) != end, error_brack, "unexpected end of pattern found"),
token_charset_end != (tok = traits.get_charset_token(begin, end)));
if(have_prev)
Modified: branches/release/boost/xpressive/detail/dynamic/parser.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/dynamic/parser.hpp (original)
+++ branches/release/boost/xpressive/detail/dynamic/parser.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -176,7 +176,7 @@
if(0 != compound.posix_yes())
{
typename Traits::char_class_type mask = compound.posix_yes();
- for(int i = 0; i <= UCHAR_MAX; ++i)
+ for(int i = 0; i <= static_cast<int>(UCHAR_MAX); ++i)
{
if(traits.isctype((Char)i, mask))
{
@@ -190,7 +190,7 @@
for(std::size_t j = 0; j < compound.posix_no().size(); ++j)
{
typename Traits::char_class_type mask = compound.posix_no()[j];
- for(int i = 0; i <= UCHAR_MAX; ++i)
+ for(int i = 0; i <= static_cast<int>(UCHAR_MAX); ++i)
{
if(!traits.isctype((Char)i, mask))
{
Modified: branches/release/boost/xpressive/detail/dynamic/parser_traits.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/dynamic/parser_traits.hpp (original)
+++ branches/release/boost/xpressive/detail/dynamic/parser_traits.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -161,7 +161,7 @@
case BOOST_XPR_CHAR_(char_type, '{'):
old_begin = this->eat_ws_(++begin, end);
spec.min_ = spec.max_ = detail::toi(begin, end, this->traits());
- detail::ensure
+ BOOST_XPR_ENSURE_
(
begin != old_begin && begin != end, error_brace, "invalid quantifier"
);
@@ -170,7 +170,7 @@
{
old_begin = this->eat_ws_(++begin, end);
spec.max_ = detail::toi(begin, end, this->traits());
- detail::ensure
+ BOOST_XPR_ENSURE_
(
begin != end && BOOST_XPR_CHAR_(char_type, '}') == *begin
, error_brace, "invalid quantifier"
@@ -182,7 +182,7 @@
}
else
{
- detail::ensure
+ BOOST_XPR_ENSURE_
(
spec.min_ <= spec.max_, error_badbrace, "invalid quantification range"
);
@@ -190,7 +190,7 @@
}
else
{
- detail::ensure
+ BOOST_XPR_ENSURE_
(
BOOST_XPR_CHAR_(char_type, '}') == *begin, error_brace, "invalid quantifier"
);
@@ -220,7 +220,7 @@
if(this->eat_ws_(begin, end) != end && BOOST_XPR_CHAR_(char_type, '?') == *begin)
{
this->eat_ws_(++begin, end);
- detail::ensure(begin != end, error_paren, "incomplete extension");
+ BOOST_XPR_ENSURE_(begin != end, error_paren, "incomplete extension");
switch(*begin)
{
@@ -232,7 +232,7 @@
case BOOST_XPR_CHAR_(char_type, 'R'): ++begin; return token_recurse;
case BOOST_XPR_CHAR_(char_type, '$'):
this->get_name_(++begin, end, name);
- detail::ensure(begin != end, error_paren, "incomplete extension");
+ BOOST_XPR_ENSURE_(begin != end, error_paren, "incomplete extension");
if(BOOST_XPR_CHAR_(char_type, '=') == *begin)
{
++begin;
@@ -242,30 +242,30 @@
case BOOST_XPR_CHAR_(char_type, '<'):
this->eat_ws_(++begin, end);
- detail::ensure(begin != end, error_paren, "incomplete extension");
+ BOOST_XPR_ENSURE_(begin != end, error_paren, "incomplete extension");
switch(*begin)
{
case BOOST_XPR_CHAR_(char_type, '='): ++begin; return token_positive_lookbehind;
case BOOST_XPR_CHAR_(char_type, '!'): ++begin; return token_negative_lookbehind;
default:
- boost::throw_exception(regex_error(error_badbrace, "unrecognized extension"));
+ BOOST_THROW_EXCEPTION(regex_error(error_badbrace, "unrecognized extension"));
}
case BOOST_XPR_CHAR_(char_type, 'P'):
this->eat_ws_(++begin, end);
- detail::ensure(begin != end, error_paren, "incomplete extension");
+ BOOST_XPR_ENSURE_(begin != end, error_paren, "incomplete extension");
switch(*begin)
{
case BOOST_XPR_CHAR_(char_type, '<'):
this->get_name_(++begin, end, name);
- detail::ensure(begin != end && BOOST_XPR_CHAR_(char_type, '>') == *begin++, error_paren, "incomplete extension");
+ BOOST_XPR_ENSURE_(begin != end && BOOST_XPR_CHAR_(char_type, '>') == *begin++, error_paren, "incomplete extension");
return token_named_mark;
case BOOST_XPR_CHAR_(char_type, '='):
this->get_name_(++begin, end, name);
- detail::ensure(begin != end, error_paren, "incomplete extension");
+ BOOST_XPR_ENSURE_(begin != end, error_paren, "incomplete extension");
return token_named_mark_ref;
default:
- boost::throw_exception(regex_error(error_badbrace, "unrecognized extension"));
+ BOOST_THROW_EXCEPTION(regex_error(error_badbrace, "unrecognized extension"));
}
case BOOST_XPR_CHAR_(char_type, 'i'):
@@ -276,7 +276,7 @@
return this->parse_mods_(begin, end);
default:
- boost::throw_exception(regex_error(error_badbrace, "unrecognized extension"));
+ BOOST_THROW_EXCEPTION(regex_error(error_badbrace, "unrecognized extension"));
}
}
@@ -301,13 +301,13 @@
FwdIter next = begin; ++next;
if(next != end)
{
- detail::ensure(
+ BOOST_XPR_ENSURE_(
*next != BOOST_XPR_CHAR_(char_type, '=')
, error_collate
, "equivalence classes are not yet supported"
);
- detail::ensure(
+ BOOST_XPR_ENSURE_(
*next != BOOST_XPR_CHAR_(char_type, '.')
, error_collate
, "collation sequences are not yet supported"
@@ -397,9 +397,9 @@
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: boost::throw_exception(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"));
+ while(BOOST_XPR_ENSURE_(++begin != end, error_paren, "incomplete extension"));
// this return is technically unreachable, but this must
// be here to work around a bug in gcc 4.0
return token_no_mark;
@@ -437,7 +437,7 @@
name.push_back(*begin);
}
this->eat_ws_(begin, end);
- detail::ensure(!name.empty(), regex_constants::error_paren, "incomplete extension");
+ BOOST_XPR_ENSURE_(!name.empty(), regex_constants::error_paren, "incomplete extension");
}
///////////////////////////////////////////////////////////////////////////////
Modified: branches/release/boost/xpressive/detail/static/compile.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/compile.hpp (original)
+++ branches/release/boost/xpressive/detail/static/compile.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -15,7 +15,7 @@
#include <boost/mpl/bool.hpp>
#include <boost/iterator/iterator_traits.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/proto/core.hpp>
#include <boost/xpressive/regex_traits.hpp>
#include <boost/xpressive/detail/core/regex_impl.hpp>
#include <boost/xpressive/detail/core/linker.hpp>
@@ -39,9 +39,14 @@
impl->traits_ = new traits_holder<Traits>(traits);
// "compile" the regex and wrap it in an xpression_adaptor.
- xpression_visitor<BidiIter, mpl::false_, Traits> visitor(traits, impl);
+ typedef xpression_visitor<BidiIter, mpl::false_, Traits> visitor_type;
+ visitor_type visitor(traits, impl);
intrusive_ptr<matchable_ex<BidiIter> const> adxpr = make_adaptor<matchable_ex<BidiIter> >(
- Grammar<char_type>()(xpr, end_xpression(), visitor)
+ typename Grammar<char_type>::template impl<Xpr const &, end_xpression, visitor_type &>()(
+ xpr
+ , end_xpression()
+ , visitor
+ )
);
// Link and optimize the regex
@@ -81,9 +86,9 @@
static_compile_impl1(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl)
{
// use specified traits
- typedef typename proto::result_of::arg<typename proto::result_of::left<Xpr>::type>::type::locale_type locale_type;
+ typedef typename proto::result_of::value<typename proto::result_of::left<Xpr>::type>::type::locale_type locale_type;
typedef typename regex_traits_type<locale_type, BidiIter>::type traits_type;
- static_compile_impl2(proto::right(xpr), impl, traits_type(proto::arg(proto::left(xpr)).getloc()));
+ static_compile_impl2(proto::right(xpr), impl, traits_type(proto::value(proto::left(xpr)).getloc()));
}
///////////////////////////////////////////////////////////////////////////////
Modified: branches/release/boost/xpressive/detail/static/grammar.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/grammar.hpp (original)
+++ branches/release/boost/xpressive/detail/static/grammar.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -16,7 +16,7 @@
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/assert.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/proto/core.hpp>
#include <boost/xpressive/detail/static/is_pure.hpp>
#include <boost/xpressive/detail/static/transforms/as_matcher.hpp>
#include <boost/xpressive/detail/static/transforms/as_alternate.hpp>
@@ -75,7 +75,7 @@
template<typename Char, typename Gram, typename Greedy>
struct as_repeat
: if_<
- make<detail::use_simple_repeat<_arg, Char> >
+ make<detail::use_simple_repeat<_child, Char> >
, as_simple_quantifier<Gram, Greedy>
, as_default_quantifier<Greedy>
>
@@ -97,8 +97,8 @@
{};
template<typename Dummy>
- struct case_<tag::posit, Dummy>
- : posit<Gram>
+ struct case_<tag::unary_plus, Dummy>
+ : unary_plus<Gram>
{};
template<typename Dummy>
@@ -210,7 +210,7 @@
struct case_<optional_tag<Greedy> , Dummy>
: when<
unary_expr<optional_tag<Greedy>, Gram>
- , in_sequence<call<as_optional<Gram, Greedy>(_arg)> >
+ , in_sequence<call<as_optional<Gram, Greedy>(_child)> >
>
{};
@@ -223,9 +223,9 @@
{};
template<typename Dummy>
- struct case_<tag::posit, Dummy>
+ struct case_<tag::unary_plus, Dummy>
: when<
- posit<Gram>
+ unary_plus<Gram>
, call<Gram(as_repeat<Char, Gram, mpl::true_>)>
>
{};
@@ -250,7 +250,7 @@
struct case_<tag::negate, Dummy>
: when<
negate<switch_<NonGreedyRepeatCases<Gram> > >
- , call<Gram(call<as_repeat<Char, Gram, mpl::false_>(_arg)>)>
+ , call<Gram(call<as_repeat<Char, Gram, mpl::false_>(_child)>)>
>
{};
@@ -258,7 +258,7 @@
struct case_<tag::complement, Dummy>
: when<
complement<switch_<InvertibleCases<Char, Gram> > >
- , in_sequence<call<as_inverse(call<switch_<InvertibleCases<Char, Gram> >(_arg)>)> >
+ , in_sequence<call<as_inverse(call<switch_<InvertibleCases<Char, Gram> >(_child)>)> >
>
{};
Modified: branches/release/boost/xpressive/detail/static/is_pure.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/is_pure.hpp (original)
+++ branches/release/boost/xpressive/detail/static/is_pure.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -63,14 +63,14 @@
template<typename Expr, typename Char>
struct use_simple_repeat_<Expr, Char, proto::tag::terminal>
- : use_simple_repeat_terminal<typename proto::result_of::arg<Expr>::type, Char>
+ : use_simple_repeat_terminal<typename proto::result_of::value<Expr>::type, Char>
{};
template<typename Expr, typename Char>
struct use_simple_repeat_<Expr, Char, proto::tag::shift_right>
: mpl::and_<
- use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
- , use_simple_repeat_<typename Expr::proto_arg1::proto_base_expr, Char>
+ use_simple_repeat_<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>
+ , use_simple_repeat_<typename remove_reference<typename Expr::proto_child1>::type::proto_base_expr, Char>
>
{};
@@ -78,8 +78,8 @@
struct use_simple_repeat_<Expr, Char, proto::tag::bitwise_or>
: mpl::and_<
mpl::not_equal_to<unknown_width, width_of<Expr, Char> >
- , use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
- , use_simple_repeat_<typename Expr::proto_arg1::proto_base_expr, Char>
+ , use_simple_repeat_<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>
+ , use_simple_repeat_<typename remove_reference<typename Expr::proto_child1>::type::proto_base_expr, Char>
>
{};
@@ -105,12 +105,16 @@
// either (s1 = ...) or (a1 = ...) or (set = ...)
template<typename Expr, typename Char>
struct use_simple_repeat_<Expr, Char, proto::tag::assign>
- : use_simple_repeat_assign<typename proto::result_of::arg<typename Expr::proto_arg0::proto_base_expr>::type>
+ : use_simple_repeat_assign<
+ typename proto::result_of::value<
+ typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr
+ >::type
+ >
{};
template<typename Expr, typename Char>
struct use_simple_repeat_<Expr, Char, modifier_tag>
- : use_simple_repeat_<typename Expr::proto_arg1::proto_base_expr, Char>
+ : use_simple_repeat_<typename remove_reference<typename Expr::proto_child1>::type::proto_base_expr, Char>
{};
template<typename Expr, typename Char>
@@ -131,7 +135,7 @@
// when complementing a set or an assertion, the purity is that of the set (true) or the assertion
template<typename Expr, typename Char>
struct use_simple_repeat_<Expr, Char, proto::tag::complement>
- : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ : use_simple_repeat_<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>
{};
// The comma is used in list-initialized sets, which are pure
@@ -154,12 +158,12 @@
template<typename Expr, typename Char>
struct use_simple_repeat_<Expr, Char, proto::tag::subscript>
- : use_simple_repeat_subscript<Expr, Char, typename Expr::proto_arg0::proto_base_expr>
+ : use_simple_repeat_subscript<Expr, Char, typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr>
{};
// Quantified expressions are variable-width and cannot use the simple quantifier
template<typename Expr, typename Char>
- struct use_simple_repeat_<Expr, Char, proto::tag::posit>
+ struct use_simple_repeat_<Expr, Char, proto::tag::unary_plus>
: mpl::false_
{};
@@ -180,12 +184,12 @@
template<typename Expr, typename Char, uint_t Count>
struct use_simple_repeat_<Expr, Char, generic_quant_tag<Count, Count> >
- : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ : use_simple_repeat_<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>
{};
template<typename Expr, typename Char>
struct use_simple_repeat_<Expr, Char, proto::tag::negate>
- : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ : use_simple_repeat_<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>
{};
///////////////////////////////////////////////////////////////////////////////
Modified: branches/release/boost/xpressive/detail/static/modifier.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/modifier.hpp (original)
+++ branches/release/boost/xpressive/detail/static/modifier.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -17,7 +17,7 @@
#endif
#include <boost/xpressive/detail/detail_fwd.hpp>
-#include <boost/xpressive/proto/traits.hpp>
+#include <boost/proto/traits.hpp>
#include <boost/xpressive/regex_constants.hpp>
namespace boost { namespace xpressive { namespace detail
@@ -36,7 +36,7 @@
typedef typename proto::binary_expr<
modifier_tag
, typename proto::terminal<Modifier>::type
- , typename proto::result_of::as_arg<Expr const>::type
+ , typename proto::result_of::as_child<Expr const>::type
>::type type;
};
@@ -44,7 +44,7 @@
typename apply<Expr>::type const
operator ()(Expr const &expr) const
{
- typename apply<Expr>::type that = {{this->mod_}, proto::as_arg(expr)};
+ typename apply<Expr>::type that = {{this->mod_}, proto::as_child(expr)};
return that;
}
Modified: branches/release/boost/xpressive/detail/static/placeholders.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/placeholders.hpp (original)
+++ branches/release/boost/xpressive/detail/static/placeholders.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -108,6 +108,7 @@
BOOST_XPR_QUANT_STYLE(quant_variable_width, unknown_width::value, false)
typedef Nbr nbr_type;
+ static Nbr nbr() { return Nbr(); }
};
}}} // namespace boost::xpressive::detail
Modified: branches/release/boost/xpressive/detail/static/static.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/static.hpp (original)
+++ branches/release/boost/xpressive/detail/static/static.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -251,7 +251,7 @@
//
inline int get_mark_number(basic_mark_tag const &mark)
{
- return proto::arg(mark).mark_number_;
+ return proto::value(mark).mark_number_;
}
}}} // namespace boost::xpressive::detail
Modified: branches/release/boost/xpressive/detail/static/transforms/as_action.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_action.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_action.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -23,8 +23,13 @@
#include <boost/xpressive/detail/core/matcher/attr_end_matcher.hpp>
#include <boost/xpressive/detail/static/static.hpp>
#include <boost/xpressive/detail/static/transforms/as_quantifier.hpp>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/transform.hpp>
+#include <boost/proto/core.hpp>
+#include <boost/proto/transform/arg.hpp>
+#include <boost/proto/transform/call.hpp>
+#include <boost/proto/transform/make.hpp>
+#include <boost/proto/transform/when.hpp>
+#include <boost/proto/transform/fold.hpp>
+#include <boost/proto/transform/fold_tree.hpp>
namespace boost { namespace xpressive { namespace detail
{
@@ -37,6 +42,7 @@
{
typedef Nbr nbr_type;
typedef Matcher matcher_type;
+ static Nbr nbr() { return Nbr(); }
};
template<typename Nbr, typename Matcher>
@@ -59,7 +65,7 @@
// Ignore nested actions, because attributes are scoped
when< subscript<_, _>, _state >
, when< terminal<_>, _state >
- , when< proto::assign<terminal<detail::attribute_placeholder<Nbr> >, _>, call<_arg(_right)> >
+ , when< proto::assign<terminal<detail::attribute_placeholder<Nbr> >, _>, call<_value(_right)> >
, otherwise< fold<_, _state, FindAttr<Nbr> > >
>
{};
@@ -69,59 +75,35 @@
// For patterns like (a1 = RHS)[ref(i) = a1], transform to
// (a1 = RHS)[ref(i) = read_attr<1, RHS>] so that when reading the attribute
// we know what type is stored in the attribute slot.
- struct as_read_attr : proto::callable
+ struct as_read_attr : proto::transform<as_read_attr>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
+ typedef typename impl::expr expr_type;
+ typedef
+ typename FindAttr<typename expr_type::proto_child0::nbr_type>::template impl<
+ State
+ , mpl::void_
+ , int
+ >::result_type
+ attr_type;
+
typedef
- typename proto::result_of::as_expr<
+ typename proto::terminal<
detail::read_attr<
- typename Expr::proto_arg0::nbr_type
- , typename FindAttr<typename Expr::proto_arg0::nbr_type>::template result<void(
- State
- , mpl::void_
- , int
- )>::type
+ typename expr_type::proto_child0::nbr_type
+ , BOOST_PROTO_UNCVREF(attr_type)
>
>::type
- type;
- };
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &, State const &, Visitor &) const
- {
- typename result<void(Expr, State, Visitor)>::type that = {{}};
- return that;
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////////
- // by_value
- // Store all terminals within an action by value to avoid dangling references.
- struct by_value : proto::callable
- {
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
- {
- typedef
- typename proto::result_of::as_expr<
- typename proto::result_of::arg<Expr>::type
- >::type
- type;
+ result_type operator ()(proto::ignore, proto::ignore, proto::ignore) const
+ {
+ result_type that = {{}};
+ return that;
+ }
};
-
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &) const
- {
- return proto::as_expr(proto::arg(expr));
- }
};
///////////////////////////////////////////////////////////////////////////////
@@ -131,7 +113,7 @@
struct DeepCopy
: or_<
when< terminal<detail::attribute_placeholder<_> >, as_read_attr>
- , when< terminal<_>, by_value >
+ , when< terminal<_>, proto::_deep_copy(_)>
, otherwise< nary_expr<_, vararg<DeepCopy> > >
>
{};
@@ -139,14 +121,13 @@
///////////////////////////////////////////////////////////////////////////////
// attr_nbr
// For an attribute placeholder, return the attribute's slot number.
- struct attr_nbr : proto::callable
+ struct attr_nbr : proto::transform<attr_nbr>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef typename Expr::proto_arg0::nbr_type::type type;
+ typedef typename impl::expr expr_type;
+ typedef typename expr_type::proto_child0::nbr_type::type result_type;
};
};
@@ -168,80 +149,91 @@
///////////////////////////////////////////////////////////////////////////////
// max_attr
// Take the maximum of the current attr slot number and the state.
- struct max_attr : proto::callable
+ struct max_attr : proto::transform<max_attr>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef typename mpl::max<State, typename MaxAttr::template result<void(Expr, State, Visitor)>::type >::type type;
+ typedef
+ typename mpl::max<
+ typename impl::state
+ , typename MaxAttr::template impl<Expr, State, Data>::result_type
+ >::type
+ result_type;
};
};
///////////////////////////////////////////////////////////////////////////////
// as_attr_matcher
// turn a1=matcher into attr_matcher<Matcher>(1)
- struct as_attr_matcher : proto::callable
+ struct as_attr_matcher : proto::transform<as_attr_matcher>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
+ typedef typename impl::expr expr_type;
+ typedef typename impl::data data_type;
typedef
detail::attr_matcher<
- typename proto::result_of::arg<typename Expr::proto_arg1>::type
- , typename Visitor::traits_type
- , typename Visitor::icase_type
+ typename proto::result_of::value<typename expr_type::proto_child1>::type
+ , typename data_type::traits_type
+ , typename data_type::icase_type
>
- type;
- };
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- return typename result<void(Expr, State, Visitor)>::type(
- Expr::proto_arg0::proto_base_expr::proto_arg0::nbr_type::value
- , proto::arg(proto::right(expr))
- , visitor.traits()
- );
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ return result_type(
+ proto::value(proto::left(expr)).nbr()
+ , proto::value(proto::right(expr))
+ , data.traits()
+ );
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
// add_attrs
// Wrap an expression in attr_begin_matcher/attr_end_matcher pair
- struct add_attrs : proto::callable
+ struct add_attrs : proto::transform<add_attrs>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
typedef
+ detail::attr_begin_matcher<
+ typename MaxAttr::template impl<Expr, mpl::int_<0>, int>::result_type
+ >
+ begin_type;
+
+ typedef typename impl::expr expr_type;
+
+ typedef
typename shift_right<
- typename terminal<
- detail::attr_begin_matcher<typename MaxAttr::template result<void(Expr, mpl::int_<0>, int)>::type >
- >::type
+ typename terminal<begin_type>::type
, typename shift_right<
Expr
, terminal<detail::attr_end_matcher>::type
>::type
>::type
- type;
- };
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &) const
- {
- detail::attr_begin_matcher<typename MaxAttr::template result<void(Expr, mpl::int_<0>, int)>::type > begin;
- detail::attr_end_matcher end;
- typename result<void(Expr, State, Visitor)>::type that = {{begin}, {expr, {end}}};
- return that;
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param
+ ) const
+ {
+ begin_type begin;
+ detail::attr_end_matcher end;
+ result_type that = {{begin}, {expr, {end}}};
+ return that;
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
@@ -262,19 +254,20 @@
// If A and B use attributes, wrap the above expression in
// a attr_begin_matcher<Count> / attr_end_matcher pair, where Count is
// the number of attribute slots used by the pattern/action.
- struct as_action : proto::callable
+ struct as_action : proto::transform<as_action>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
typedef typename proto::result_of::left<Expr>::type expr_type;
typedef typename proto::result_of::right<Expr>::type action_type;
- typedef typename DeepCopy::template result<void(action_type, expr_type, int)>::type action_copy_type;
typedef
- typename InsertMark::template result<void(expr_type, State, Visitor)>::type
+ typename DeepCopy::impl<action_type, expr_type, int>::result_type
+ action_copy_type;
+
+ typedef
+ typename InsertMark::impl<expr_type, State, Data>::result_type
marked_expr_type;
typedef
@@ -293,35 +286,35 @@
no_attr_type;
typedef
- typename InsertAttrs::template result<void(no_attr_type, State, Visitor)>::type
- type;
- };
+ typename InsertAttrs::impl<no_attr_type, State, Data>::result_type
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &visitor) const
- {
- typedef result<void(Expr, State, Visitor)> apply_type;
- typedef typename apply_type::matcher_type matcher_type;
-
- int dummy = 0;
- typename apply_type::marked_expr_type marked_expr =
- InsertMark()(proto::left(expr), state, visitor);
-
- typename apply_type::no_attr_type that =
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
{
- marked_expr
- , {
- matcher_type
- (
- DeepCopy()(proto::right(expr), proto::left(expr), dummy)
- , proto::arg(proto::left(marked_expr)).mark_number_
- )
- }
- };
-
- return InsertAttrs()(that, state, visitor);
- }
+ int dummy = 0;
+ marked_expr_type marked_expr =
+ InsertMark::impl<expr_type, State, Data>()(proto::left(expr), state, data);
+
+ no_attr_type that = {
+ marked_expr
+ , {
+ matcher_type(
+ DeepCopy::impl<action_type, expr_type, int>()(
+ proto::right(expr)
+ , proto::left(expr)
+ , dummy
+ )
+ , proto::value(proto::left(marked_expr)).mark_number_
+ )
+ }
+ };
+ return InsertAttrs::impl<no_attr_type, State, Data>()(that, state, data);
+ }
+ };
};
}}}
Modified: branches/release/boost/xpressive/detail/static/transforms/as_alternate.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_alternate.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_alternate.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -16,7 +16,7 @@
#include <boost/config.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/proto/core.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/static/static.hpp>
#include <boost/xpressive/detail/core/matcher/alternate_matcher.hpp>
@@ -61,57 +61,69 @@
{
///////////////////////////////////////////////////////////////////////////////
// in_alternate_list
- template<typename Grammar>
- struct in_alternate_list : proto::callable
+ template<typename Grammar, typename Callable = proto::callable>
+ struct in_alternate_list : proto::transform<in_alternate_list<Grammar, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef detail::alternates_list<
- typename Grammar::template result<void(Expr, detail::alternate_end_xpression, Visitor)>::type
- , State
- > type;
+ typedef
+ detail::alternates_list<
+ typename Grammar::template impl<
+ Expr
+ , detail::alternate_end_xpression
+ , Data
+ >::result_type
+ , State
+ >
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ return result_type(
+ typename Grammar::template impl<Expr, detail::alternate_end_xpression, Data>()(
+ expr
+ , detail::alternate_end_xpression()
+ , data
+ )
+ , state
+ );
+ }
};
-
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &visitor) const
- {
- return typename result<void(Expr, State, Visitor)>::type(
- Grammar()(expr, detail::alternate_end_xpression(), visitor)
- , state
- );
- }
};
///////////////////////////////////////////////////////////////////////////////
// as_alternate_matcher
- template<typename Grammar>
- struct as_alternate_matcher : proto::callable
+ template<typename Grammar, typename Callable = proto::callable>
+ struct as_alternate_matcher : proto::transform<as_alternate_matcher<Grammar, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef detail::alternate_matcher<
- typename Grammar::template result<void(Expr, State, Visitor)>::type
- , typename Visitor::traits_type
- > type;
+ typedef typename impl::data data_type;
+ typedef
+ detail::alternate_matcher<
+ typename Grammar::template impl<Expr, State, Data>::result_type
+ , typename data_type::traits_type
+ >
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ return result_type(
+ typename Grammar::template impl<Expr, State, Data>()(expr, state, data)
+ );
+ }
};
-
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &visitor) const
- {
- return typename result<void(Expr, State, Visitor)>::type(
- Grammar()(expr, state, visitor)
- );
- }
};
-
}
}}
Modified: branches/release/boost/xpressive/detail/static/transforms/as_independent.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_independent.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_independent.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -16,8 +16,11 @@
#include <boost/mpl/sizeof.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/static/static.hpp>
-#include <boost/xpressive/proto/proto.hpp>
-#include <boost/xpressive/proto/transform.hpp>
+#include <boost/proto/core.hpp>
+#include <boost/proto/transform/arg.hpp>
+#include <boost/proto/transform/when.hpp>
+#include <boost/proto/transform/fold.hpp>
+#include <boost/proto/transform/fold_tree.hpp>
namespace boost { namespace xpressive { namespace detail
{
@@ -92,109 +95,119 @@
>
{};
- template<typename Grammar>
- struct as_lookahead : proto::callable
+ template<typename Grammar, typename Callable = proto::callable>
+ struct as_lookahead : proto::transform<as_lookahead<Grammar, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef typename proto::result_of::arg<Expr>::type arg_type;
-
+ typedef typename proto::result_of::child<Expr>::type arg_type;
+
+ typedef
+ typename IndependentEndXpression::impl<arg_type, int, int>::result_type
+ end_xpr_type;
+
typedef
- typename Grammar::template result<void(
- arg_type
- , typename IndependentEndXpression::result<void(arg_type, int, int)>::type
- , Visitor
- )>::type
+ typename Grammar::template impl<arg_type, end_xpr_type, Data>::result_type
xpr_type;
- typedef detail::lookahead_matcher<xpr_type> type;
- };
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- typedef result<void(Expr, State, Visitor)> result_type;
- int i = 0;
- return typename result_type::type(
- Grammar()(
- proto::arg(expr)
- , IndependentEndXpression()(proto::arg(expr), i, i)
- , visitor
- )
- , false
- );
- }
+ typedef
+ detail::lookahead_matcher<xpr_type>
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ int i = 0;
+ return result_type(
+ typename Grammar::template impl<arg_type, end_xpr_type, Data>()(
+ proto::child(expr)
+ , IndependentEndXpression::impl<arg_type, int, int>()(proto::child(expr), i, i)
+ , data
+ )
+ , false
+ );
+ }
+ };
};
- template<typename Grammar>
- struct as_lookbehind : proto::callable
+ template<typename Grammar, typename Callable = proto::callable>
+ struct as_lookbehind : proto::transform<as_lookbehind<Grammar, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef typename proto::result_of::arg<Expr>::type arg_type;
+ typedef typename proto::result_of::child<Expr>::type arg_type;
+
typedef
- typename Grammar::template result<void(
- arg_type
- , typename IndependentEndXpression::result<void(arg_type, int, int)>::type
- , Visitor
- )>::type
+ typename IndependentEndXpression::impl<arg_type, int, int>::result_type
+ end_xpr_type;
+
+ typedef
+ typename Grammar::template impl<arg_type, end_xpr_type, Data>::result_type
xpr_type;
- typedef detail::lookbehind_matcher<xpr_type> type;
- };
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- typedef typename result<void(Expr, State, Visitor)>::xpr_type xpr_type;
- int i = 0;
- xpr_type const &expr2 = Grammar()(
- proto::arg(expr)
- , IndependentEndXpression()(proto::arg(expr), i, i)
- , visitor
- );
- std::size_t width = expr2.get_width().value();
- return detail::lookbehind_matcher<xpr_type>(expr2, width, false);
- }
+ typedef
+ detail::lookbehind_matcher<xpr_type>
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ int i = 0;
+ xpr_type expr2 = typename Grammar::template impl<arg_type, end_xpr_type, Data>()(
+ proto::child(expr)
+ , IndependentEndXpression::impl<arg_type, int, int>()(proto::child(expr), i, i)
+ , data
+ );
+ std::size_t width = expr2.get_width().value();
+ return result_type(expr2, width, false);
+ }
+ };
};
- template<typename Grammar>
- struct as_keeper : proto::callable
+ template<typename Grammar, typename Callable = proto::callable>
+ struct as_keeper : proto::transform<as_keeper<Grammar, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef typename proto::result_of::arg<Expr>::type arg_type;
- typedef detail::keeper_matcher<
- typename Grammar::template result<void(
- arg_type
- , typename IndependentEndXpression::result<void(arg_type, int, int)>::type
- , Visitor
- )>::type
- > type;
- };
+ typedef typename proto::result_of::child<Expr>::type arg_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- int i = 0;
- return typename result<void(Expr, State, Visitor)>::type(
- Grammar()(
- proto::arg(expr)
- , IndependentEndXpression()(proto::arg(expr), i, i)
- , visitor
- )
- );
- }
+ typedef
+ typename IndependentEndXpression::impl<arg_type, int, int>::result_type
+ end_xpr_type;
+
+ typedef
+ typename Grammar::template impl<arg_type, end_xpr_type, Data>::result_type
+ xpr_type;
+
+ typedef
+ detail::keeper_matcher<xpr_type>
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ int i = 0;
+ return result_type(
+ typename Grammar::template impl<arg_type, end_xpr_type, Data>()(
+ proto::child(expr)
+ , IndependentEndXpression::impl<arg_type, int, int>()(proto::child(expr), i, i)
+ , data
+ )
+ );
+ }
+ };
};
}}}
Modified: branches/release/boost/xpressive/detail/static/transforms/as_inverse.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_inverse.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_inverse.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -17,7 +17,7 @@
#include <boost/mpl/not.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/static/static.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/proto/core.hpp>
#define UNCV(x) typename remove_const<x>::type
#define UNREF(x) typename remove_reference<x>::type
Modified: branches/release/boost/xpressive/detail/static/transforms/as_marker.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_marker.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_marker.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -15,7 +15,7 @@
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/static/static.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/proto/core.hpp>
namespace boost { namespace xpressive { namespace grammar_detail
{
@@ -23,38 +23,36 @@
///////////////////////////////////////////////////////////////////////////////
// as_marker
// Insert mark tags before and after the expression
- struct as_marker : proto::callable
+ struct as_marker : proto::transform<as_marker>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
typedef
typename shift_right<
terminal<detail::mark_begin_matcher>::type
, typename shift_right<
- typename proto::result_of::right<Expr>::type
+ typename proto::result_of::right<typename impl::expr>::type
, terminal<detail::mark_end_matcher>::type
>::type
>::type
- type;
- };
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &) const
- {
- int mark_nbr = detail::get_mark_number(proto::left(expr));
- detail::mark_begin_matcher begin(mark_nbr);
- detail::mark_end_matcher end(mark_nbr);
-
- typename result<void(Expr, State, Visitor)>::type that
- = {{begin}, {proto::right(expr), {end}}};
- return that;
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param
+ ) const
+ {
+ int mark_nbr = detail::get_mark_number(proto::left(expr));
+ detail::mark_begin_matcher begin(mark_nbr);
+ detail::mark_end_matcher end(mark_nbr);
+
+ result_type that = {{begin}, {proto::right(expr), {end}}};
+ return that;
+ }
+ };
};
-
}}}
#endif
Modified: branches/release/boost/xpressive/detail/static/transforms/as_matcher.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_matcher.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_matcher.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -19,26 +19,28 @@
namespace boost { namespace xpressive { namespace grammar_detail
{
- struct as_matcher : proto::callable
+ struct as_matcher : proto::transform<as_matcher>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
+ typedef typename impl::data data_type;
+
typedef
- typename Visitor::template apply<
- typename proto::result_of::arg<Expr>::type
+ typename data_type::template apply<
+ typename proto::result_of::value<typename impl::expr>::type
>::type
- type;
- };
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- return visitor.call(proto::arg(expr));
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ return data.call(proto::value(expr));
+ }
+ };
};
}}}
Modified: branches/release/boost/xpressive/detail/static/transforms/as_modifier.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_modifier.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_modifier.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -16,7 +16,7 @@
#include <boost/mpl/sizeof.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/static/static.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/proto/core.hpp>
#define UNCV(x) typename remove_const<x>::type
#define UNREF(x) typename remove_reference<x>::type
@@ -36,28 +36,44 @@
///////////////////////////////////////////////////////////////////////////////
// as_modifier
- template<typename Grammar>
- struct as_modifier : proto::callable
+ template<typename Grammar, typename Callable = proto::callable>
+ struct as_modifier : proto::transform<as_modifier<Grammar, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef typename proto::result_of::arg<typename proto::result_of::left<Expr>::type>::type modifier_type;
- typedef typename modifier_type::BOOST_NESTED_TEMPLATE apply<Visitor>::type visitor_type;
- typedef typename Grammar::template result<void(typename proto::result_of::right<Expr>::type, State, visitor_type)>::type type;
+ typedef
+ typename proto::result_of::value<
+ typename proto::result_of::left<typename impl::expr>::type
+ >::type
+ modifier_type;
+
+ typedef
+ typename modifier_type::template apply<typename impl::data>::type
+ visitor_type;
+
+ typedef
+ typename proto::result_of::right<Expr>::type
+ expr_type;
+
+ typedef
+ typename Grammar::template impl<expr_type, State, visitor_type &>::result_type
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ visitor_type new_visitor(proto::value(proto::left(expr)).call(data));
+ return typename Grammar::template impl<expr_type, State, visitor_type &>()(
+ proto::right(expr)
+ , state
+ , new_visitor
+ );
+ }
};
-
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &visitor) const
- {
- typedef result<void(Expr, State, Visitor)> result_;
- typedef typename result_::visitor_type new_visitor_type;
- new_visitor_type new_visitor(proto::arg(proto::left(expr)).call(visitor));
- return Grammar()(proto::right(expr), state, new_visitor);
- }
};
}}}
Modified: branches/release/boost/xpressive/detail/static/transforms/as_quantifier.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_quantifier.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_quantifier.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -17,7 +17,7 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/static/static.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/proto/core.hpp>
namespace boost { namespace xpressive { namespace detail
{
@@ -41,7 +41,7 @@
struct min_type : Tag::min_type {};
template<>
- struct min_type<proto::tag::posit> : mpl::integral_c<uint_t, 1> {};
+ struct min_type<proto::tag::unary_plus> : mpl::integral_c<uint_t, 1> {};
template<>
struct min_type<proto::tag::dereference> : mpl::integral_c<uint_t, 0> {};
@@ -53,7 +53,7 @@
struct max_type : Tag::max_type {};
template<>
- struct max_type<proto::tag::posit> : mpl::integral_c<uint_t, UINT_MAX-1> {};
+ struct max_type<proto::tag::unary_plus> : mpl::integral_c<uint_t, UINT_MAX-1> {};
template<>
struct max_type<proto::tag::dereference> : mpl::integral_c<uint_t, UINT_MAX-1> {};
@@ -63,45 +63,61 @@
///////////////////////////////////////////////////////////////////////////////
// as_simple_quantifier
- template<typename Grammar, typename Greedy>
- struct as_simple_quantifier : proto::callable
+ template<typename Grammar, typename Greedy, typename Callable = proto::callable>
+ struct as_simple_quantifier : proto::transform<as_simple_quantifier<Grammar, Greedy, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef typename proto::result_of::arg<Expr>::type arg_type;
- typedef typename Grammar::template result<void(arg_type, detail::true_xpression, Visitor)>::type xpr_type;
- typedef detail::simple_repeat_matcher<xpr_type, Greedy> matcher_type;
- typedef typename proto::terminal<matcher_type>::type type;
- };
+ typedef
+ typename proto::result_of::child<Expr>::type
+ arg_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- typedef result<void(Expr, State, Visitor)> result_;
- typedef typename result_::arg_type arg_type;
- typedef typename result_::xpr_type xpr_type;
- typedef typename result_::matcher_type matcher_type;
- typedef typename Expr::proto_tag tag;
-
- xpr_type const &xpr = Grammar()(proto::arg(expr), detail::true_xpression(), visitor);
- matcher_type matcher(xpr, (uint_t)min_type<tag>(), (uint_t)max_type<tag>(), xpr.get_width().value());
- return proto::terminal<matcher_type>::type::make(matcher);
- }
+ typedef
+ typename Grammar::template impl<arg_type, detail::true_xpression, Data>::result_type
+ xpr_type;
+
+ typedef
+ detail::simple_repeat_matcher<xpr_type, Greedy>
+ matcher_type;
+
+ typedef
+ typename proto::terminal<matcher_type>::type
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ xpr_type xpr = typename Grammar::template impl<arg_type, detail::true_xpression, Data>()(
+ proto::child(expr)
+ , detail::true_xpression()
+ , data
+ );
+
+ typedef typename impl::expr expr_type;
+ matcher_type matcher(
+ xpr
+ , (uint_t)min_type<typename expr_type::proto_tag>::value
+ , (uint_t)max_type<typename expr_type::proto_tag>::value
+ , xpr.get_width().value()
+ );
+
+ return result_type::make(matcher);
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
// add_hidden_mark
- struct add_hidden_mark : proto::callable
+ struct add_hidden_mark : proto::transform<add_hidden_mark>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
+ typedef typename impl::expr expr_type;
typedef
typename shift_right<
terminal<detail::mark_begin_matcher>::type
@@ -110,22 +126,23 @@
, terminal<detail::mark_end_matcher>::type
>::type
>::type
- type;
- };
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- // we're inserting a hidden mark ... so grab the next hidden mark number.
- int mark_nbr = visitor.get_hidden_mark();
- detail::mark_begin_matcher begin(mark_nbr);
- detail::mark_end_matcher end(mark_nbr);
-
- typename result<void(Expr, State, Visitor)>::type that
- = {{begin}, {expr, {end}}};
- return that;
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ // we're inserting a hidden mark ... so grab the next hidden mark number.
+ int mark_nbr = data.get_hidden_mark();
+ detail::mark_begin_matcher begin(mark_nbr);
+ detail::mark_end_matcher end(mark_nbr);
+
+ result_type that = {{begin}, {expr, {end}}};
+ return that;
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
@@ -140,15 +157,17 @@
///////////////////////////////////////////////////////////////////////////////
// as_default_quantifier_impl
template<typename Greedy, uint_t Min, uint_t Max>
- struct as_default_quantifier_impl : proto::callable
+ struct as_default_quantifier_impl : proto::transform<as_default_quantifier_impl<Greedy, Min, Max> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
typedef
- typename InsertMark::template result<void(typename proto::result_of::arg<Expr>::type, State, Visitor)>::type
+ typename proto::result_of::child<Expr>::type
+ xpr_type;
+
+ typedef
+ typename InsertMark::impl<xpr_type, State, Data>::result_type
marked_sub_type;
typedef
@@ -159,31 +178,33 @@
, typename terminal<detail::repeat_end_matcher<Greedy> >::type
>::type
>::type
- type;
- };
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &visitor) const
- {
- // Ensure this sub-expression is book-ended with mark matchers
- typename result<void(Expr, State, Visitor)>::marked_sub_type const &
- marked_sub = InsertMark()(proto::arg(expr), state, visitor);
-
- // Get the mark_number from the begin_mark_matcher
- int mark_number = proto::arg(proto::left(marked_sub)).mark_number_;
- BOOST_ASSERT(0 != mark_number);
-
- uint_t min_ = (uint_t)min_type<typename Expr::proto_tag>();
- uint_t max_ = (uint_t)max_type<typename Expr::proto_tag>();
-
- detail::repeat_begin_matcher begin(mark_number);
- detail::repeat_end_matcher<Greedy> end(mark_number, min_, max_);
-
- typename result<void(Expr, State, Visitor)>::type that
- = {{begin}, {marked_sub, {end}}};
- return that;
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ // Ensure this sub-expression is book-ended with mark matchers
+ marked_sub_type marked_sub =
+ InsertMark::impl<xpr_type, State, Data>()(proto::child(expr), state, data);
+
+ // Get the mark_number from the begin_mark_matcher
+ int mark_number = proto::value(proto::left(marked_sub)).mark_number_;
+ BOOST_ASSERT(0 != mark_number);
+
+ typedef typename impl::expr expr_type;
+ uint_t min_ = (uint_t)min_type<typename expr_type::proto_tag>();
+ uint_t max_ = (uint_t)max_type<typename expr_type::proto_tag>();
+
+ detail::repeat_begin_matcher begin(mark_number);
+ detail::repeat_end_matcher<Greedy> end(mark_number, min_, max_);
+
+ result_type that = {{begin}, {marked_sub, {end}}};
+ return that;
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
@@ -194,56 +215,69 @@
///////////////////////////////////////////////////////////////////////////////
// as_default_optional
- template<typename Grammar, typename Greedy>
- struct as_default_optional : proto::callable
+ template<typename Grammar, typename Greedy, typename Callable = proto::callable>
+ struct as_default_optional : proto::transform<as_default_optional<Grammar, Greedy, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef detail::optional_matcher<
- typename Grammar::template result<void(Expr, detail::alternate_end_xpression, Visitor)>::type
- , Greedy
- > type;
- };
+ typedef
+ detail::alternate_end_xpression
+ end_xpr;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- return typename result<void(Expr, State, Visitor)>::type(
- Grammar()(expr, detail::alternate_end_xpression(), visitor)
- );
- }
+ typedef
+ detail::optional_matcher<
+ typename Grammar::template impl<Expr, end_xpr, Data>::result_type
+ , Greedy
+ >
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ return result_type(
+ typename Grammar::template impl<Expr, end_xpr, Data>()(expr, end_xpr(), data)
+ );
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
// as_mark_optional
- template<typename Grammar, typename Greedy>
- struct as_mark_optional : proto::callable
+ template<typename Grammar, typename Greedy, typename Callable = proto::callable>
+ struct as_mark_optional : proto::transform<as_mark_optional<Grammar, Greedy, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef detail::optional_mark_matcher<
- typename Grammar::template result<void(Expr, detail::alternate_end_xpression, Visitor)>::type
- , Greedy
- > type;
- };
+ typedef
+ detail::alternate_end_xpression
+ end_xpr;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- int mark_number = proto::arg(proto::left(expr)).mark_number_;
- return typename result<void(Expr, State, Visitor)>::type(
- Grammar()(expr, detail::alternate_end_xpression(), visitor)
- , mark_number
- );
- }
+ typedef
+ detail::optional_mark_matcher<
+ typename Grammar::template impl<Expr, end_xpr, Data>::result_type
+ , Greedy
+ >
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ int mark_number = proto::value(proto::left(expr)).mark_number_;
+
+ return result_type(
+ typename Grammar::template impl<Expr, end_xpr, Data>()(expr, end_xpr(), data)
+ , mark_number
+ );
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
@@ -267,24 +301,30 @@
///////////////////////////////////////////////////////////////////////////////
// make_optional_
- template<typename Greedy>
- struct make_optional_ : proto::callable
+ template<typename Greedy, typename Callable = proto::callable>
+ struct make_optional_ : proto::transform<make_optional_<Greedy, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef typename unary_expr<optional_tag<Greedy>, Expr>::type type;
- };
+ typedef typename impl::expr expr_type;
+ typedef
+ typename unary_expr<
+ optional_tag<Greedy>
+ , Expr
+ >::type
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename unary_expr<optional_tag<Greedy>, Expr>::type
- operator ()(Expr const &expr, State const &, Visitor &) const
- {
- typename unary_expr<optional_tag<Greedy>, Expr>::type that = {expr};
- return that;
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param
+ ) const
+ {
+ result_type that = {expr};
+ return that;
+ }
+ };
};
///////////////////////////////////////////////////////////////////////////////
@@ -298,40 +338,39 @@
// as_default_quantifier_impl
template<typename Greedy>
struct as_default_quantifier_impl<Greedy, 0, 1>
- : call<make_optional_<Greedy>(_arg)>
+ : call<make_optional_<Greedy>(_child)>
{};
///////////////////////////////////////////////////////////////////////////////
// as_default_quantifier
- template<typename Greedy>
- struct as_default_quantifier : proto::callable
+ template<typename Greedy, typename Callable = proto::callable>
+ struct as_default_quantifier : proto::transform<as_default_quantifier<Greedy, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
+ typedef typename impl::expr expr_type;
typedef
as_default_quantifier_impl<
Greedy
- , min_type<typename Expr::proto_tag>::value
- , max_type<typename Expr::proto_tag>::value
+ , min_type<typename expr_type::proto_tag>::value
+ , max_type<typename expr_type::proto_tag>::value
>
- impl;
+ other;
- typedef typename impl::template result<void(Expr, State, Visitor)>::type type;
- };
+ typedef
+ typename other::template impl<Expr, State, Data>::result_type
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &visitor) const
- {
- return as_default_quantifier_impl<
- Greedy
- , min_type<typename Expr::proto_tag>::value
- , max_type<typename Expr::proto_tag>::value
- >()(expr, state, visitor);
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ return typename other::template impl<Expr, State, Data>()(expr, state, data);
+ }
+ };
};
}}}
Modified: branches/release/boost/xpressive/detail/static/transforms/as_sequence.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_sequence.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_sequence.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -20,29 +20,31 @@
namespace boost { namespace xpressive { namespace grammar_detail
{
- template<typename Grammar>
- struct in_sequence : proto::callable
+ template<typename Grammar, typename Callable = proto::callable>
+ struct in_sequence : proto::transform<in_sequence<Grammar, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef detail::static_xpression<
- typename Grammar::template result<void(Expr, State, Visitor)>::type
- , State
- > type;
- };
+ typedef
+ detail::static_xpression<
+ typename Grammar::template impl<Expr, State, Data>::result_type
+ , State
+ >
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &visitor) const
- {
- return typename result<void(Expr, State, Visitor)>::type(
- Grammar()(expr, state, visitor)
- , state
- );
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param data
+ ) const
+ {
+ return result_type(
+ typename Grammar::template impl<Expr, State, Data>()(expr, state, data)
+ , state
+ );
+ }
+ };
};
}}}
Modified: branches/release/boost/xpressive/detail/static/transforms/as_set.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/transforms/as_set.hpp (original)
+++ branches/release/boost/xpressive/detail/static/transforms/as_set.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -14,7 +14,7 @@
#endif
#include <boost/mpl/assert.hpp>
-#include <boost/xpressive/proto/proto.hpp>
+#include <boost/proto/core.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/static/static.hpp>
#include <boost/xpressive/detail/utility/chset/chset.hpp>
@@ -64,52 +64,53 @@
void fill_list_set(Char *&buffer, Expr const &expr, Traits const &traits)
{
fill_list_set(buffer, proto::left(expr), traits);
- *buffer++ = traits.translate(detail::char_cast<Char>(proto::arg(proto::right(expr)), traits));
+ *buffer++ = traits.translate(detail::char_cast<Char>(proto::value(proto::right(expr)), traits));
}
///////////////////////////////////////////////////////////////////////////////
// as_list_set_matcher
- template<typename Char>
- struct as_list_set_matcher
+ template<typename Char, typename Callable = proto::callable>
+ struct as_list_set_matcher : proto::transform<as_list_set_matcher<Char, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef detail::set_matcher<
- typename Visitor::traits_type
- , typename ListSet<Char>::template result<void(Expr, State, Visitor)>::type
- > type;
+ typedef typename impl::data data_type;
+ typedef
+ detail::set_matcher<
+ typename data_type::traits_type
+ , typename ListSet<Char>::template impl<Expr, State, Data>::result_type
+ >
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ result_type set;
+ typedef typename impl::data data_type;
+ typename data_type::char_type *buffer = set.set_;
+ fill_list_set(buffer, expr, data.traits());
+ return set;
+ }
};
-
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- detail::set_matcher<
- typename Visitor::traits_type
- , typename ListSet<Char>::template result<void(Expr, State, Visitor)>::type
- > set;
- typename Visitor::char_type *buffer = set.set_;
- fill_list_set(buffer, expr, visitor.traits());
- return set;
- }
};
///////////////////////////////////////////////////////////////////////////////
// merge_charset
//
- template<typename Grammar, typename CharSet, typename Visitor>
+ template<typename Grammar, typename CharSet, typename Data>
struct merge_charset
{
- typedef typename Visitor::traits_type traits_type;
+ typedef typename Data::traits_type traits_type;
typedef typename CharSet::char_type char_type;
typedef typename CharSet::icase_type icase_type;
- merge_charset(CharSet &charset, Visitor &visitor)
+ merge_charset(CharSet &charset, Data &data)
: charset_(charset)
- , visitor_(visitor)
+ , visitor_(data)
{}
template<typename Expr>
@@ -124,7 +125,13 @@
template<typename Expr, typename Tag>
void call_(Expr const &expr, Tag) const
{
- this->set_(Grammar()(expr, detail::end_xpression(), this->visitor_));
+ this->set_(
+ typename Grammar::template impl<Expr const &, detail::end_xpression, Data &>()(
+ expr
+ , detail::end_xpression()
+ , this->visitor_
+ )
+ );
}
template<typename Expr>
@@ -166,46 +173,50 @@
}
CharSet &charset_;
- Visitor &visitor_;
+ Data &visitor_;
};
///////////////////////////////////////////////////////////////////////////////
//
- template<typename Grammar>
- struct as_set_matcher : proto::callable
+ template<typename Grammar, typename Callable = proto::callable>
+ struct as_set_matcher : proto::transform<as_set_matcher<Grammar, Callable> >
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
- typedef typename Visitor::char_type char_type;
+ typedef typename impl::data data_type;
+ typedef typename data_type::char_type char_type;
// if sizeof(char_type)==1, merge everything into a basic_chset
// BUGBUG this is not optimal.
- typedef typename mpl::if_<
- detail::is_narrow_char<char_type>
- , detail::basic_chset<char_type>
- , detail::compound_charset<typename Visitor::traits_type>
- >::type charset_type;
-
- typedef detail::charset_matcher<
- typename Visitor::traits_type
- , typename Visitor::icase_type
- , charset_type
- > type;
+ typedef
+ typename mpl::if_<
+ detail::is_narrow_char<char_type>
+ , detail::basic_chset<char_type>
+ , detail::compound_charset<typename data_type::traits_type>
+ >::type
+ charset_type;
+
+ typedef
+ detail::charset_matcher<
+ typename data_type::traits_type
+ , typename data_type::icase_type
+ , charset_type
+ >
+ result_type;
+
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param
+ , typename impl::data_param data
+ ) const
+ {
+ result_type matcher;
+ merge_charset<Grammar, result_type, typename impl::data> merge(matcher, data);
+ merge(expr); // Walks the tree and fills in the charset
+ return matcher;
+ }
};
-
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &, Visitor &visitor) const
- {
- typedef typename result<void(Expr, State, Visitor)>::type set_type;
- set_type matcher;
- merge_charset<Grammar, set_type, Visitor> merge(matcher, visitor);
- merge(expr); // Walks the tree and fills in the charset
- return matcher;
- }
};
}}}
Modified: branches/release/boost/xpressive/detail/static/visitor.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/visitor.hpp (original)
+++ branches/release/boost/xpressive/detail/static/visitor.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -14,7 +14,6 @@
#endif
#include <boost/ref.hpp>
-#include <boost/mpl/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/core/regex_impl.hpp>
Modified: branches/release/boost/xpressive/detail/static/width_of.hpp
==============================================================================
--- branches/release/boost/xpressive/detail/static/width_of.hpp (original)
+++ branches/release/boost/xpressive/detail/static/width_of.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -23,10 +23,49 @@
#include <boost/mpl/equal_to.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
-#include <boost/xpressive/proto/traits.hpp>
+#include <boost/proto/traits.hpp>
namespace boost { namespace xpressive { namespace detail
{
+ template<typename Expr, typename Char, typename Tag = typename Expr::proto_tag>
+ struct width_of;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // add_widths
+ //
+ template<std::size_t N, std::size_t M>
+ struct add_widths
+ : mpl::size_t<N + M>
+ {};
+
+ template<std::size_t M>
+ struct add_widths<unknown_width::value, M>
+ : unknown_width
+ {};
+
+ template<std::size_t N>
+ struct add_widths<N, unknown_width::value>
+ : unknown_width
+ {};
+
+ template<>
+ struct add_widths<unknown_width::value, unknown_width::value>
+ : unknown_width
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // or_widths
+ //
+ template<std::size_t N, std::size_t M>
+ struct or_widths
+ : unknown_width
+ {};
+
+ template<std::size_t N>
+ struct or_widths<N, N>
+ : mpl::size_t<N>
+ {};
+
///////////////////////////////////////////////////////////////////////////////
// is_char
//
@@ -86,43 +125,29 @@
///////////////////////////////////////////////////////////////////////////////
// width_of
//
- template<typename Expr, typename Char, typename Tag = typename Expr::proto_tag>
+ template<typename Expr, typename Char, typename Tag>
struct width_of
{};
template<typename Expr, typename Char>
struct width_of<Expr, Char, proto::tag::terminal>
- : width_of_terminal<typename proto::result_of::arg<Expr>::type, Char>
+ : width_of_terminal<typename proto::result_of::value<Expr>::type, Char>
{};
template<typename Expr, typename Char>
struct width_of<Expr, Char, proto::tag::shift_right>
- : mpl::if_<
- mpl::or_<
- mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg0::proto_base_expr, Char> >
- , mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg1::proto_base_expr, Char> >
- >
- , unknown_width
- , mpl::plus<
- width_of<typename Expr::proto_arg0::proto_base_expr, Char>
- , width_of<typename Expr::proto_arg1::proto_base_expr, Char>
- >
- >::type
+ : add_widths<
+ width_of<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>::value
+ , width_of<typename remove_reference<typename Expr::proto_child1>::type::proto_base_expr, Char>::value
+ >
{};
template<typename Expr, typename Char>
struct width_of<Expr, Char, proto::tag::bitwise_or>
- : mpl::if_<
- mpl::or_<
- mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg0::proto_base_expr, Char> >
- , mpl::not_equal_to<
- width_of<typename Expr::proto_arg0::proto_base_expr, Char>
- , width_of<typename Expr::proto_arg1::proto_base_expr, Char>
- >
- >
- , unknown_width
- , width_of<typename Expr::proto_arg0::proto_base_expr, Char>
- >::type
+ : or_widths<
+ width_of<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>::value
+ , width_of<typename remove_reference<typename Expr::proto_child1>::type::proto_base_expr, Char>::value
+ >
{};
template<typename Expr, typename Char, typename Left>
@@ -131,7 +156,7 @@
template<typename Expr, typename Char>
struct width_of_assign<Expr, Char, mark_placeholder>
- : width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ : width_of<typename remove_reference<typename Expr::proto_child1>::type::proto_base_expr, Char>
{};
template<typename Expr, typename Char>
@@ -147,12 +172,18 @@
// either (s1 = ...) or (a1 = ...) or (set = ...)
template<typename Expr, typename Char>
struct width_of<Expr, Char, proto::tag::assign>
- : width_of_assign<Expr, Char, typename proto::result_of::arg<typename Expr::proto_arg0::proto_base_expr>::type>
+ : width_of_assign<
+ Expr
+ , Char
+ , typename proto::result_of::value<
+ typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr
+ >::type
+ >
{};
template<typename Expr, typename Char>
struct width_of<Expr, Char, modifier_tag>
- : width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ : width_of<typename remove_reference<typename Expr::proto_child1>::type::proto_base_expr, Char>
{};
template<typename Expr, typename Char>
@@ -178,7 +209,7 @@
};
template<typename Expr, typename Char>
- struct width_of<Expr, Char, proto::tag::posit>
+ struct width_of<Expr, Char, proto::tag::unary_plus>
: unknown_width
{};
@@ -200,10 +231,10 @@
template<typename Expr, typename Char, uint_t Count>
struct width_of<Expr, Char, generic_quant_tag<Count, Count> >
: mpl::if_<
- mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg0::proto_base_expr, Char> >
+ mpl::equal_to<unknown_width, width_of<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char> >
, unknown_width
, mpl::times<
- width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ width_of<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>
, mpl::size_t<Count>
>
>::type
@@ -211,13 +242,13 @@
template<typename Expr, typename Char>
struct width_of<Expr, Char, proto::tag::negate>
- : width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ : width_of<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>
{};
// when complementing a set or an assertion, the width is that of the set (1) or the assertion (0)
template<typename Expr, typename Char>
struct width_of<Expr, Char, proto::tag::complement>
- : width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ : width_of<typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr, Char>
{};
// The comma is used in list-initialized sets, and the width of sets are 1
@@ -238,14 +269,19 @@
: mpl::size_t<1>
{
// If Left is "set" then make sure that Right has a width_of 1
- BOOST_MPL_ASSERT_RELATION(1, ==, (width_of<typename Expr::proto_arg1::proto_base_expr, Char>::value));
+ BOOST_MPL_ASSERT_RELATION(
+ 1
+ , ==
+ , (width_of<typename remove_reference<typename Expr::proto_child1>::type::proto_base_expr, Char>::value));
};
template<typename Expr, typename Char>
struct width_of<Expr, Char, proto::tag::subscript>
- : width_of_subscript<Expr, Char, typename Expr::proto_arg0::proto_base_expr>
+ : width_of_subscript<Expr, Char, typename remove_reference<typename Expr::proto_child0>::type::proto_base_expr>
{};
}}} // namespace boost::xpressive::detail
+#undef UNREF
+
#endif
Modified: branches/release/boost/xpressive/match_results.hpp
==============================================================================
--- branches/release/boost/xpressive/match_results.hpp (original)
+++ branches/release/boost/xpressive/match_results.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -57,8 +57,8 @@
#include <boost/xpressive/detail/utility/literals.hpp>
#include <boost/xpressive/detail/utility/algorithm.hpp>
#include <boost/xpressive/detail/utility/counted_base.hpp>
-#include <boost/xpressive/proto/proto_fwd.hpp>
-#include <boost/xpressive/proto/eval.hpp>
+#include <boost/proto/proto_fwd.hpp>
+#include <boost/proto/eval.hpp>
namespace boost { namespace xpressive { namespace detail
{
@@ -102,7 +102,7 @@
{
if(numeric::cInRange != result)
{
- boost::throw_exception(
+ BOOST_THROW_EXCEPTION(
regex_error(
regex_constants::error_escape
, "character escape too large to fit in target character type"
@@ -668,11 +668,11 @@
{
typedef typename proto::result_of::left<Arg>::type left_type;
typedef typename proto::result_of::right<Arg>::type right_type;
- typedef typename proto::result_of::arg<left_type>::type arg_left_type;
- typedef typename proto::result_of::arg<right_type>::type arg_right_type;
+ typedef typename proto::result_of::value<left_type>::type arg_left_type;
+ typedef typename proto::result_of::value<right_type>::type arg_right_type;
BOOST_MPL_ASSERT((proto::matches<Arg, detail::ActionArgBinding>));
BOOST_MPL_ASSERT((is_same<typename arg_left_type::type, arg_right_type>));
- this->args_[&typeid(proto::arg(proto::left(arg)))] = &proto::arg(proto::right(arg));
+ this->args_[&typeid(proto::value(proto::left(arg)))] = &proto::value(proto::right(arg));
return *this;
}
@@ -801,7 +801,7 @@
return this->sub_matches_[ this->named_marks_[i].mark_nbr_ ];
}
}
- boost::throw_exception(
+ BOOST_THROW_EXCEPTION(
regex_error(regex_constants::error_badmark, "invalid named back-reference")
);
// Should never execute, but if it does, this returns
@@ -1032,7 +1032,7 @@
{
detail::case_converting_iterator<OutputIterator, char_type> iout(out, this->traits_.get());
iout = this->format_all_impl_(cur, end, iout);
- detail::ensure(cur == end
+ BOOST_XPR_ENSURE_(cur == end
, regex_constants::error_paren, "unbalanced parentheses in format string");
return iout.base();
}
@@ -1066,16 +1066,16 @@
case BOOST_XPR_CHAR_(char_type, '('):
out = this->format_all_impl_(++cur, end, out);
- detail::ensure(BOOST_XPR_CHAR_(char_type, ')') == *(cur-1)
+ BOOST_XPR_ENSURE_(BOOST_XPR_CHAR_(char_type, ')') == *(cur-1)
, regex_constants::error_paren, "unbalanced parentheses in format string");
break;
case BOOST_XPR_CHAR_(char_type, '?'):
- detail::ensure(++cur != end
+ BOOST_XPR_ENSURE_(++cur != end
, regex_constants::error_subreg, "malformed conditional in format string");
max = static_cast<int>(this->size() - 1);
sub = detail::toi(cur, end, *this->traits_, 10, max);
- detail::ensure(0 != sub, regex_constants::error_subreg, "invalid back-reference");
+ BOOST_XPR_ENSURE_(0 != sub, regex_constants::error_subreg, "invalid back-reference");
if(this->sub_matches_[ sub ].matched)
{
out = this->format_all_impl_(cur, end, out, true);
@@ -1145,7 +1145,7 @@
{
int max = static_cast<int>(this->size() - 1);
int sub = detail::toi(cur, end, *this->traits_, 10, max);
- detail::ensure(0 != sub, regex_constants::error_subreg, "invalid back-reference");
+ BOOST_XPR_ENSURE_(0 != sub, regex_constants::error_subreg, "invalid back-reference");
if(this->sub_matches_[ sub ].matched)
out = std::copy(this->sub_matches_[ sub ].first, this->sub_matches_[ sub ].second, out);
}
@@ -1214,27 +1214,27 @@
break;
case BOOST_XPR_CHAR_(char_type, 'x'):
- detail::ensure(cur != end, error_escape, "unexpected end of format found");
+ BOOST_XPR_ENSURE_(cur != end, error_escape, "unexpected end of format found");
if(BOOST_XPR_CHAR_(char_type, '{') == *cur)
{
- detail::ensure(++cur != end, error_escape, "unexpected end of format found");
+ BOOST_XPR_ENSURE_(++cur != end, error_escape, "unexpected end of format found");
tmp = cur;
*out++ = converter(detail::toi(cur, end, *this->traits_, 16, 0xffff));
- detail::ensure(4 == std::distance(tmp, cur) && cur != end && BOOST_XPR_CHAR_(char_type, '}') == *cur++
+ BOOST_XPR_ENSURE_(4 == std::distance(tmp, cur) && cur != end && BOOST_XPR_CHAR_(char_type, '}') == *cur++
, error_escape, "invalid hex escape : must be \\x { HexDigit HexDigit HexDigit HexDigit }");
}
else
{
tmp = cur;
*out++ = converter(detail::toi(cur, end, *this->traits_, 16, 0xff));
- detail::ensure(2 == std::distance(tmp, cur), error_escape
+ BOOST_XPR_ENSURE_(2 == std::distance(tmp, cur), error_escape
, "invalid hex escape : must be \\x HexDigit HexDigit");
}
break;
case BOOST_XPR_CHAR_(char_type, 'c'):
- detail::ensure(cur != end, error_escape, "unexpected end of format found");
- detail::ensure
+ BOOST_XPR_ENSURE_(cur != end, error_escape, "unexpected end of format found");
+ BOOST_XPR_ENSURE_
(
this->traits_->in_range(BOOST_XPR_CHAR_(char_type, 'a'), BOOST_XPR_CHAR_(char_type, 'z'), *cur)
|| this->traits_->in_range(BOOST_XPR_CHAR_(char_type, 'A'), BOOST_XPR_CHAR_(char_type, 'Z'), *cur)
@@ -1310,12 +1310,12 @@
) const
{
using namespace regex_constants;
- detail::ensure(cur != end && BOOST_XPR_CHAR_(char_type, '<') == *cur++
+ BOOST_XPR_ENSURE_(cur != end && BOOST_XPR_CHAR_(char_type, '<') == *cur++
, error_badmark, "invalid named back-reference");
ForwardIterator begin = cur;
for(; cur != end && BOOST_XPR_CHAR_(char_type, '>') != *cur; ++cur)
{}
- detail::ensure(cur != begin && cur != end && BOOST_XPR_CHAR_(char_type, '>') == *cur
+ BOOST_XPR_ENSURE_(cur != begin && cur != end && BOOST_XPR_CHAR_(char_type, '>') == *cur
, error_badmark, "invalid named back-reference");
string_type name(begin, cur++);
@@ -1328,7 +1328,7 @@
}
}
- boost::throw_exception(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;
}
Modified: branches/release/boost/xpressive/regex_actions.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_actions.hpp (original)
+++ branches/release/boost/xpressive/regex_actions.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -19,7 +19,6 @@
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
#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>
@@ -41,7 +40,8 @@
// Doxygen can't handle proto :-(
#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
-# include <boost/xpressive/proto/transform.hpp>
+# include <boost/proto/transform/arg.hpp>
+# include <boost/proto/transform/when.hpp>
# include <boost/xpressive/detail/core/matcher/action_matcher.hpp>
#endif
@@ -98,10 +98,10 @@
{
typedef int result_type;
- template<typename Visitor, typename Expr>
- int operator ()(Visitor &visitor, Expr const &expr) const
+ template<typename Data, typename Expr>
+ int operator ()(Data &data, Expr const &expr) const
{
- visitor.let(expr);
+ data.let(expr);
return 0;
}
};
@@ -118,7 +118,7 @@
>
, proto::function<
proto::_state // no-op
- , proto::vararg<proto::call<BindArg(proto::_visitor, proto::_)> >
+ , proto::vararg<proto::call<BindArg(proto::_data, proto::_)> >
>
>
{};
@@ -130,14 +130,18 @@
template<typename Expr>
struct let_
{
- BOOST_PROTO_EXTENDS(Expr, let_<Expr>, let_domain)
- BOOST_PROTO_EXTENDS_FUNCTION(Expr, let_<Expr>, let_domain)
+ BOOST_PROTO_BASIC_EXTENDS(Expr, let_<Expr>, let_domain)
+ BOOST_PROTO_EXTENDS_FUNCTION()
};
template<typename Args, typename BidiIter>
void bind_args(let_<Args> const &args, match_results<BidiIter> &what)
{
- BindArgs()(args, 0, what);
+ BindArgs::impl<let_<Args> const &, int, match_results<BidiIter> &>()(
+ args
+ , 0
+ , what
+ );
}
template<typename BidiIter>
@@ -615,25 +619,25 @@
void operator()() const
{
- boost::throw_exception(Except());
+ BOOST_THROW_EXCEPTION(Except());
}
template<typename A0>
void operator()(A0 const &a0) const
{
- boost::throw_exception(Except(a0));
+ BOOST_THROW_EXCEPTION(Except(a0));
}
template<typename A0, typename A1>
void operator()(A0 const &a0, A1 const &a1) const
{
- boost::throw_exception(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
{
- boost::throw_exception(Except(a0, a1, a2));
+ BOOST_THROW_EXCEPTION(Except(a0, a1, a2));
}
};
}
@@ -679,12 +683,12 @@
T &get()
{
- return proto::arg(*this);
+ return proto::value(*this);
}
T const &get() const
{
- return proto::arg(*this);
+ return proto::value(*this);
}
};
@@ -702,27 +706,24 @@
T &get() const
{
- return proto::arg(*this).get();
+ return proto::value(*this).get();
}
};
template<typename T>
struct local
- : private noncopyable
- , detail::value_wrapper<T>
+ : detail::value_wrapper<T>
, proto::terminal<reference_wrapper<T> >::type
{
typedef typename proto::terminal<reference_wrapper<T> >::type base_type;
local()
- : noncopyable()
- , detail::value_wrapper<T>()
+ : detail::value_wrapper<T>()
, base_type(base_type::make(boost::ref(detail::value_wrapper<T>::value)))
{}
explicit local(T const &t)
- : noncopyable()
- , detail::value_wrapper<T>(t)
+ : detail::value_wrapper<T>(t)
, base_type(base_type::make(boost::ref(detail::value_wrapper<T>::value)))
{}
@@ -730,13 +731,16 @@
T &get()
{
- return proto::arg(*this);
+ return proto::value(*this);
}
T const &get() const
{
- return proto::arg(*this);
+ return proto::value(*this);
}
+
+ private:
+ local(local const &);
};
/// as (a.k.a., lexical_cast)
@@ -821,9 +825,6 @@
typedef typename proto::terminal<detail::action_arg<T, mpl::int_<I> > >::type action_arg_type;
BOOST_PROTO_EXTENDS(action_arg_type, this_type, proto::default_domain)
- BOOST_PROTO_EXTENDS_ASSIGN(action_arg_type, this_type, proto::default_domain)
- BOOST_PROTO_EXTENDS_SUBSCRIPT(action_arg_type, this_type, proto::default_domain)
- BOOST_PROTO_EXTENDS_FUNCTION(action_arg_type, this_type, proto::default_domain)
};
/// Usage: construct\<Type\>(arg1, arg2)
Modified: branches/release/boost/xpressive/regex_algorithms.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_algorithms.hpp (original)
+++ branches/release/boost/xpressive/regex_algorithms.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -51,7 +51,7 @@
/// \param end The end of the sequence.
/// \param what The \c match_results struct into which the sub_matches will be written
/// \param re The regular expression object to use
-/// \param flags Optional match flags, used to control how the expression is matched
+/// \param flags Optional match flags, used to control how the expression is matched
/// against the sequence. (See \c match_flag_type.)
/// \return \c true if a match is found, \c false otherwise
/// \throw \c regex_error on stack exhaustion
@@ -569,7 +569,7 @@
///
/// \pre Type \c BidiIter meets the requirements of a Bidirectional Iterator (24.1.4).
/// \pre Type \c OutIter meets the requirements of an Output Iterator (24.1.2).
-/// \pre Type \c Formatter models \c ForwardRange, <tt>Callable\<match_results\<BidiIter\> \></tt>,
+/// \pre Type \c Formatter models \c ForwardRange, <tt>Callable\<match_results\<BidiIter\> \></tt>,
/// <tt>Callable\<match_results\<BidiIter\>, OutIter\></tt>, or
/// <tt>Callable\<match_results\<BidiIter\>, OutIter, regex_constants::match_flag_type\></tt>;
/// or else it is a null-terminated format string, or an expression template
Modified: branches/release/boost/xpressive/regex_compiler.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_compiler.hpp (original)
+++ branches/release/boost/xpressive/regex_compiler.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -193,11 +193,11 @@
// Check if this regex is a named rule:
string_type name;
if(token_group_begin == this->traits_.get_token(tmp, end) &&
- detail::ensure(tmp != end, error_paren, "mismatched parenthesis") &&
+ BOOST_XPR_ENSURE_(tmp != end, error_paren, "mismatched parenthesis") &&
token_rule_assign == this->traits_.get_group_type(tmp, end, name))
{
begin = tmp;
- detail::ensure
+ BOOST_XPR_ENSURE_
(
begin != end && token_group_end == this->traits_.get_token(begin, end)
, error_paren
@@ -210,7 +210,7 @@
// at the top level, a regex is a sequence of alternates
detail::sequence<BidiIter> seq = this->parse_alternates(begin, end);
- detail::ensure(begin == end, error_paren, "mismatched parenthesis");
+ BOOST_XPR_ENSURE_(begin == end, error_paren, "mismatched parenthesis");
// terminate the sequence
seq += detail::make_dynamic<BidiIter>(detail::end_matcher());
@@ -338,12 +338,12 @@
break;
case token_comment:
- while(detail::ensure(begin != end, error_paren, "mismatched parenthesis"))
+ while(BOOST_XPR_ENSURE_(begin != end, error_paren, "mismatched parenthesis"))
{
switch(this->traits_.get_token(begin, end))
{
case token_group_end: return this->parse_atom(begin, end);
- case token_escape: detail::ensure(begin != end, error_escape, "incomplete escape sequence");
+ case token_escape: BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
case token_literal: ++begin;
default:;
}
@@ -351,7 +351,7 @@
break;
case token_recurse:
- detail::ensure
+ BOOST_XPR_ENSURE_
(
begin != end && token_group_end == this->traits_.get_token(begin, end)
, error_paren
@@ -360,7 +360,7 @@
return detail::make_dynamic<BidiIter>(detail::regex_byref_matcher<BidiIter>(this->self_));
case token_rule_assign:
- boost::throw_exception(
+ BOOST_THROW_EXCEPTION(
regex_error(error_badrule, "rule assignments must be at the front of the regex")
);
break;
@@ -368,7 +368,7 @@
case token_rule_ref:
{
typedef detail::core_access<BidiIter> access;
- detail::ensure
+ BOOST_XPR_ENSURE_
(
begin != end && token_group_end == this->traits_.get_token(begin, end)
, error_paren
@@ -384,7 +384,7 @@
mark_nbr = static_cast<int>(++this->mark_count_);
for(std::size_t i = 0; i < this->self_->named_marks_.size(); ++i)
{
- detail::ensure(this->self_->named_marks_[i].name_ != name, error_badmark, "named mark already exists");
+ BOOST_XPR_ENSURE_(this->self_->named_marks_[i].name_ != name, error_badmark, "named mark already exists");
}
this->self_->named_marks_.push_back(detail::named_mark<char_type>(name, this->mark_count_));
seq = detail::make_dynamic<BidiIter>(detail::mark_begin_matcher(mark_nbr));
@@ -392,7 +392,7 @@
break;
case token_named_mark_ref:
- detail::ensure
+ BOOST_XPR_ENSURE_
(
begin != end && token_group_end == this->traits_.get_token(begin, end)
, error_paren
@@ -409,7 +409,7 @@
);
}
}
- boost::throw_exception(regex_error(error_badmark, "invalid named back-reference"));
+ BOOST_THROW_EXCEPTION(regex_error(error_badmark, "invalid named back-reference"));
break;
default:
@@ -422,7 +422,7 @@
// alternates
seq += this->parse_alternates(begin, end);
seq += seq_end;
- detail::ensure
+ BOOST_XPR_ENSURE_
(
begin != end && token_group_end == this->traits_.get_token(begin, end)
, error_paren
@@ -549,7 +549,7 @@
return this->parse_charset(begin, end);
case token_invalid_quantifier:
- boost::throw_exception(regex_error(error_badrepeat, "quantifier not expected"));
+ BOOST_THROW_EXCEPTION(regex_error(error_badrepeat, "quantifier not expected"));
break;
case token_quote_meta_begin:
@@ -559,7 +559,7 @@
);
case token_quote_meta_end:
- boost::throw_exception(
+ BOOST_THROW_EXCEPTION(
regex_error(
error_escape
, "found quote-meta end without corresponding quote-meta begin"
@@ -689,7 +689,7 @@
switch(this->traits_.get_token(begin, end))
{
case token_quote_meta_end: return string_type(old_begin, old_end);
- case token_escape: detail::ensure(begin != end, error_escape, "incomplete escape sequence");
+ case token_escape: BOOST_XPR_ENSURE_(begin != end, error_escape, "incomplete escape sequence");
case token_literal: ++begin;
default:;
}
@@ -703,7 +703,7 @@
template<typename FwdIter>
escape_value parse_escape(FwdIter &begin, FwdIter end)
{
- detail::ensure(begin != end, regex_constants::error_escape, "incomplete escape sequence");
+ BOOST_XPR_ENSURE_(begin != end, regex_constants::error_escape, "incomplete escape sequence");
// first, check to see if this can be a backreference
if(0 < this->rxtraits().value(*begin, 10))
Modified: branches/release/boost/xpressive/regex_error.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_error.hpp (original)
+++ branches/release/boost/xpressive/regex_error.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -17,6 +17,7 @@
#include <string>
#include <stdexcept>
#include <boost/throw_exception.hpp>
+#include <boost/exception/exception.hpp>
#include <boost/xpressive/regex_constants.hpp>
//{{AFX_DOC_COMMENT
@@ -44,12 +45,14 @@
/// a regular expression to a finite state machine.
struct regex_error
: std::runtime_error
+ , boost::exception
{
/// Constructs an object of class regex_error.
/// \param code The error_type this regex_error represents.
/// \post code() == code
explicit regex_error(regex_constants::error_type code, char const *str = "")
: std::runtime_error(str)
+ , boost::exception()
, code_(code)
{
}
@@ -62,6 +65,11 @@
return this->code_;
}
+ /// Destructor for class regex_error
+ /// \throw nothrow
+ virtual ~regex_error() throw()
+ {}
+
private:
regex_constants::error_type code_;
@@ -69,19 +77,21 @@
namespace detail
{
-
-//////////////////////////////////////////////////////////////////////////
-// ensure
-/// INTERNAL ONLY
-inline bool ensure(bool predicate, regex_constants::error_type code, char const *str = "")
-{
- if(!predicate)
- {
- boost::throw_exception(regex_error(code, str));
- }
- return predicate;
+ // To work around a GCC warning
+ inline bool false_() { return false; }
}
-}}} // namespace boost::xpressive::detail
+#define BOOST_XPR_ENSURE_(pred, code, msg) \
+ ( \
+ (pred) \
+ ? true \
+ : ( \
+ BOOST_THROW_EXCEPTION(boost::xpressive::regex_error(code, msg)) \
+ , boost::xpressive::detail::false_() \
+ ) \
+ ) \
+ /**/
+
+}} // namespace boost::xpressive
#endif
Modified: branches/release/boost/xpressive/regex_primitives.hpp
==============================================================================
--- branches/release/boost/xpressive/regex_primitives.hpp (original)
+++ branches/release/boost/xpressive/regex_primitives.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -24,8 +24,9 @@
// Doxygen can't handle proto :-(
#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
-# include <boost/xpressive/proto/proto.hpp>
-# include <boost/xpressive/proto/transform.hpp>
+# include <boost/proto/core.hpp>
+# include <boost/proto/transform/arg.hpp>
+# include <boost/proto/transform/when.hpp>
# include <boost/xpressive/detail/core/icase.hpp>
# include <boost/xpressive/detail/static/compile.hpp>
# include <boost/xpressive/detail/static/modifier.hpp>
@@ -46,7 +47,7 @@
// Marks numbers must be integers greater than 0.
BOOST_ASSERT(mark_nbr > 0);
mark_placeholder mark = {mark_nbr};
- proto::arg(*this) = mark;
+ proto::value(*this) = mark;
}
operator basic_mark_tag const &() const
@@ -92,8 +93,8 @@
// s1 or -s1
struct SubMatch
: proto::or_<
- proto::when<basic_mark_tag, push_back(proto::_visitor, mark_number(proto::_arg)) >
- , proto::when<proto::negate<basic_mark_tag>, push_back(proto::_visitor, minus_one()) >
+ proto::when<basic_mark_tag, push_back(proto::_data, mark_number(proto::_value)) >
+ , proto::when<proto::negate<basic_mark_tag>, push_back(proto::_data, minus_one()) >
>
{};
@@ -119,12 +120,10 @@
#endif
// replace "Expr" with "keep(*State) >> Expr"
- struct skip_primitives : proto::callable
+ struct skip_primitives : proto::transform<skip_primitives>
{
- template<typename Sig> struct result {};
-
- template<typename This, typename Expr, typename State, typename Visitor>
- struct result<This(Expr, State, Visitor)>
+ template<typename Expr, typename State, typename Data>
+ struct impl : proto::transform_impl<Expr, State, Data>
{
typedef
typename proto::shift_right<
@@ -134,17 +133,18 @@
>::type
, Expr
>::type
- type;
- };
+ result_type;
- template<typename Expr, typename State, typename Visitor>
- typename result<void(Expr, State, Visitor)>::type
- operator ()(Expr const &expr, State const &state, Visitor &) const
- {
- typedef typename result<void(Expr, State, Visitor)>::type type;
- type that = {{{state}}, expr};
- return that;
- }
+ result_type operator ()(
+ typename impl::expr_param expr
+ , typename impl::state_param state
+ , typename impl::data_param
+ ) const
+ {
+ result_type that = {{{state}}, expr};
+ return that;
+ }
+ };
};
struct Primitives
@@ -185,12 +185,16 @@
struct result<This(Expr)>
{
typedef
+ SkipGrammar::impl<
+ typename proto::result_of::as_expr<Expr>::type
+ , skip_type const &
+ , mpl::void_ &
+ >
+ skip_transform;
+
+ typedef
typename proto::shift_right<
- typename SkipGrammar::result<void(
- typename proto::result_of::as_expr<Expr>::type
- , skip_type
- , mpl::void_
- )>::type
+ typename skip_transform::result_type
, typename proto::dereference<skip_type>::type
>::type
type;
@@ -201,9 +205,12 @@
operator ()(Expr const &expr) const
{
mpl::void_ ignore;
- typedef typename result<skip_directive(Expr)>::type result_type;
- result_type result = {SkipGrammar()(proto::as_expr(expr), this->skip_, ignore), {skip_}};
- return result;
+ typedef result<skip_directive(Expr)> result_fun;
+ typename result_fun::type that = {
+ typename result_fun::skip_transform()(proto::as_expr(expr), this->skip_, ignore)
+ , {skip_}
+ };
+ return that;
}
private:
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 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -258,7 +258,7 @@
{
int i = 0;
Char allchars[UCHAR_MAX + 1];
- for(i = 0; i <= UCHAR_MAX; ++i)
+ for(i = 0; i <= static_cast<int>(UCHAR_MAX); ++i)
{
allchars[i] = static_cast<Char>(i);
}
@@ -266,7 +266,7 @@
std::ctype<Char> const &ct = BOOST_USE_FACET(std::ctype<Char>, loc);
std::ctype_base::mask tmp[UCHAR_MAX + 1];
ct.is(allchars, allchars + UCHAR_MAX + 1, tmp);
- for(i = 0; i <= UCHAR_MAX; ++i)
+ for(i = 0; i <= static_cast<int>(UCHAR_MAX); ++i)
{
this->masks_[i] = static_cast<umask_t>(tmp[i]);
BOOST_ASSERT(0 == (this->masks_[i] & non_std_ctype_masks));
Modified: branches/release/boost/xpressive/xpressive_fwd.hpp
==============================================================================
--- branches/release/boost/xpressive/xpressive_fwd.hpp (original)
+++ branches/release/boost/xpressive/xpressive_fwd.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -50,8 +50,8 @@
# endif
#endif
-#include <boost/xpressive/proto/proto_fwd.hpp>
-#include <boost/xpressive/proto/traits.hpp>
+#include <boost/proto/proto_fwd.hpp>
+#include <boost/proto/traits.hpp>
namespace boost { namespace xpressive
{
Modified: branches/release/boost/xpressive/xpressive_typeof.hpp
==============================================================================
--- branches/release/boost/xpressive/xpressive_typeof.hpp (original)
+++ branches/release/boost/xpressive/xpressive_typeof.hpp 2008-11-16 03:42:34 EST (Sun, 16 Nov 2008)
@@ -19,7 +19,7 @@
#ifndef BOOST_NO_STL_LOCALE
# include <boost/typeof/std/locale.hpp>
#endif
-#include <boost/xpressive/proto/proto_typeof.hpp>
+#include <boost/proto/proto_typeof.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
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