Update of /cvsroot/boost/boost/boost/xpressive/detail/core
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20098/detail/core
Modified Files:
access.hpp action.hpp matchers.hpp state.hpp
Removed Files:
action_state.hpp
Log Message:
experimental xpressive actions
Index: access.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/access.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- access.hpp 18 Mar 2007 00:29:11 -0000 1.6
+++ access.hpp 22 Mar 2007 17:37:16 -0000 1.7
@@ -102,10 +102,10 @@
return what.nested_results_;
}
- static action_state &get_action_state(match_results<BidiIter> &what)
- {
- return what.action_state_;
- }
+ //static action_state &get_action_state(match_results<BidiIter> &what)
+ //{
+ // return what.action_state_;
+ //}
static void set_prefix_suffix(match_results<BidiIter> &what, BidiIter
begin, BidiIter end)
{
Index: action.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/action.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- action.hpp 26 Nov 2005 17:12:25 -0000 1.2
+++ action.hpp 22 Mar 2007 17:37:16 -0000 1.3
@@ -13,57 +13,26 @@
# pragma once
#endif
-#include <typeinfo>
-#include <stdexcept>
-#include <boost/xpressive/detail/detail_fwd.hpp>
-#include <boost/xpressive/detail/core/quant_style.hpp>
-#include <boost/xpressive/detail/core/action_state.hpp>
-#include <boost/xpressive/detail/core/matcher/action_matcher.hpp>
-
-namespace boost { namespace xpressive
-{
-
-///////////////////////////////////////////////////////////////////////////////
-// action
-//
-template<typename Action, typename Saved>
-struct action
- : detail::action_matcher<Action>
+namespace boost { namespace xpressive { namespace detail
{
- typedef Action action_type;
- typedef Saved saved_type;
-
- Saved &save()
- {
- return *static_cast<Saved *>(this);
- }
+
///////////////////////////////////////////////////////////////////////////////
+ // actionable
+ //
template<typename BidiIter>
- bool operator ()(match_results<BidiIter> const &match, BidiIter cur)
- {
- return true;
- }
-
- void restore(Saved const &saved)
+ struct actionable
{
- this->action_() = saved;
- }
-};
+ virtual ~actionable() {}
+ virtual void execute() const {}
-template<typename Action>
-struct action<Action, void>
- : action<Action, int>
-{
- int save()
- {
- return 0;
- }
+ actionable()
+ : next(0)
+ {
+ }
- void restore(int)
- {
- }
-};
+ actionable<BidiIter> const *next;
+ };
-}} // namespace boost::xpressive
+}}} // namespace boost::xpressive::detail
#endif
Index: matchers.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/matchers.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- matchers.hpp 17 Apr 2006 19:36:52 -0000 1.2
+++ matchers.hpp 22 Mar 2007 17:37:16 -0000 1.3
@@ -13,7 +13,6 @@
# pragma once
#endif
-#include <boost/xpressive/detail/core/matcher/action_matcher.hpp>
#include <boost/xpressive/detail/core/matcher/alternate_end_matcher.hpp>
#include <boost/xpressive/detail/core/matcher/alternate_matcher.hpp>
#include <boost/xpressive/detail/core/matcher/any_matcher.hpp>
Index: state.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/state.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- state.hpp 18 Mar 2007 00:29:11 -0000 1.10
+++ state.hpp 22 Mar 2007 17:37:16 -0000 1.11
@@ -16,7 +16,7 @@
#include <boost/noncopyable.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/core/access.hpp>
-#include <boost/xpressive/detail/core/action_state.hpp>
+#include <boost/xpressive/detail/core/action.hpp>
#include <boost/xpressive/detail/core/sub_match_vector.hpp>
#include <boost/xpressive/detail/utility/sequence_stack.hpp>
#include <boost/xpressive/detail/core/regex_impl.hpp>
@@ -90,6 +90,7 @@
struct state_type
: noncopyable
{
+ typedef BidiIter iterator;
typedef core_access<BidiIter> access;
typedef match_context<BidiIter> match_context;
typedef results_extras<BidiIter> results_extras;
@@ -97,6 +98,7 @@
typedef matchable<BidiIter> matchable;
typedef match_results<BidiIter> match_results;
typedef sub_match_impl<BidiIter> sub_match_impl;
+ typedef actionable<BidiIter> actionable;
BidiIter cur_;
sub_match_impl *sub_matches_;
@@ -109,7 +111,8 @@
match_context context_;
results_extras &extras_;
- action_state action_state_;
+ actionable action_list_;
+ actionable const **action_list_tail_;
///////////////////////////////////////////////////////////////////////////////
//
@@ -130,7 +133,8 @@
, found_partial_match_(false)
, context_() // zero-initializes the fields of context_
, extras_(core_access<BidiIter>::get_extras(what))
- , action_state_(core_access<BidiIter>::get_action_state(what))
+ , action_list_()
+ , action_list_tail_(&action_list_.next)
{
// reclaim any cached memory in the match_results struct
this->extras_.sub_match_stack_.unwind();
@@ -290,6 +294,7 @@
{
sub_match_impl<BidiIter> *old_sub_matches_;
std::size_t nested_results_count_;
+ actionable<BidiIter> const **action_list_tail_;
};
///////////////////////////////////////////////////////////////////////////////
@@ -302,6 +307,7 @@
{
state.extras_.sub_match_stack_.push_sequence(state.mark_count_,
no_fill)
, state.context_.results_ptr_->nested_results().size()
+ , state.action_list_tail_
};
std::copy(state.sub_matches_, state.sub_matches_ + state.mark_count_,
mem.old_sub_matches_);
return mem;
@@ -319,13 +325,15 @@
state.extras_.results_cache_.reclaim_last_n(nested, count);
std::copy(mem.old_sub_matches_, mem.old_sub_matches_ + state.mark_count_,
state.sub_matches_);
state.extras_.sub_match_stack_.unwind_to(mem.old_sub_matches_);
+ state.action_list_tail_ = mem.action_list_tail_;
+ *state.action_list_tail_ = 0;
}
///////////////////////////////////////////////////////////////////////////////
// reclaim_sub_matches
//
template<typename BidiIter>
-inline void reclaim_sub_matches(memento<BidiIter> const &mem,
state_type<BidiIter> &state)
+inline void reclaim_sub_matches(memento<BidiIter> const &mem,
state_type<BidiIter> &state, bool success)
{
std::size_t count = state.context_.results_ptr_->nested_results().size() -
mem.nested_results_count_;
if(count == 0)
@@ -334,6 +342,12 @@
}
// else we have we must orphan this block of backrefs because we are using
the stack
// space above it.
+
+ if(!success)
+ {
+ state.action_list_tail_ = mem.action_list_tail_;
+ *state.action_list_tail_ = 0;
+ }
}
///////////////////////////////////////////////////////////////////////////////
--- action_state.hpp DELETED ---
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs