|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86637 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2013-11-12 04:12:57
Author: danieljames
Date: 2013-11-12 04:12:57 EST (Tue, 12 Nov 2013)
New Revision: 86637
URL: http://svn.boost.org/trac/boost/changeset/86637
Log:
Make member_action and friends available in actions.
A fairly clumsy mechansim for calling member functions in parsers.
Text files modified:
trunk/tools/quickbook/src/actions.hpp | 72 ++++++++++++++++++++++++++++++++++++++++
trunk/tools/quickbook/src/main_grammar.cpp | 15 --------
trunk/tools/quickbook/src/syntax_highlight.cpp | 59 --------------------------------
3 files changed, 72 insertions(+), 74 deletions(-)
Modified: trunk/tools/quickbook/src/actions.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions.hpp Tue Nov 12 04:12:36 2013 (r86636)
+++ trunk/tools/quickbook/src/actions.hpp 2013-11-12 04:12:57 EST (Tue, 12 Nov 2013) (r86637)
@@ -250,6 +250,78 @@
std::vector<std::string> saved_anchors;
value::tag_type tag;
};
+
+ // member_action
+ //
+ // Action for calling a nullary member function.
+
+ template <typename T>
+ struct member_action
+ {
+ typedef void(T::*member_function)(parse_iterator, parse_iterator);
+
+ T& l;
+ member_function mf;
+
+ member_action(T& l, member_function mf) : l(l), mf(mf) {}
+
+ void operator()(parse_iterator first, parse_iterator last) const {
+ (l.*mf)(first, last);
+ }
+ };
+
+ // member_action1
+ //
+ // Action for calling a unary member function with given
+ // argument.
+
+ template <typename T, typename Arg1>
+ struct member_action1
+ {
+ typedef void(T::*member_function)(parse_iterator, parse_iterator, Arg1);
+
+ T& l;
+ member_function mf;
+
+ member_action1(T& l, member_function mf) : l(l), mf(mf) {}
+
+ struct impl
+ {
+ member_action1 a;
+ Arg1 value;
+
+ impl(member_action1& a, Arg1 value) :
+ a(a), value(value)
+ {}
+
+ void operator()(parse_iterator first, parse_iterator last) const {
+ (a.l.*a.mf)(first, last, value);
+ }
+ };
+
+ impl operator()(Arg1 a1) {
+ return impl(*this, a1);
+ }
+ };
+
+ // member_action_value
+ //
+ // Action for calling a nullary member function object.
+
+ template <typename T, typename Value>
+ struct member_action_value
+ {
+ typedef void(T::*member_function)(Value);
+
+ T& l;
+ member_function mf;
+
+ member_action_value(T& l, member_function mf) : l(l), mf(mf) {}
+
+ void operator()(Value v) const {
+ (l.*mf)(v);
+ }
+ };
}
#endif // BOOST_SPIRIT_QUICKBOOK_ACTIONS_HPP
Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp Tue Nov 12 04:12:36 2013 (r86636)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2013-11-12 04:12:57 EST (Tue, 12 Nov 2013) (r86637)
@@ -68,21 +68,6 @@
};
};
- template <typename T>
- struct member_action
- {
- typedef void(T::*member_function)(parse_iterator, parse_iterator);
-
- T& l;
- member_function mf;
-
- member_action(T& l, member_function mf) : l(l), mf(mf) {}
-
- void operator()(parse_iterator first, parse_iterator last) const {
- (l.*mf)(first, last);
- }
- };
-
struct main_grammar_local
{
////////////////////////////////////////////////////////////////////////
Modified: trunk/tools/quickbook/src/syntax_highlight.cpp
==============================================================================
--- trunk/tools/quickbook/src/syntax_highlight.cpp Tue Nov 12 04:12:36 2013 (r86636)
+++ trunk/tools/quickbook/src/syntax_highlight.cpp 2013-11-12 04:12:57 EST (Tue, 12 Nov 2013) (r86637)
@@ -23,65 +23,6 @@
{
namespace cl = boost::spirit::classic;
- template <typename T, typename Value>
- struct member_action_value
- {
- typedef void(T::*member_function)(Value);
-
- T& l;
- member_function mf;
-
- member_action_value(T& l, member_function mf) : l(l), mf(mf) {}
-
- void operator()(Value v) const {
- (l.*mf)(v);
- }
- };
-
- template <typename T>
- struct member_action
- {
- typedef void(T::*member_function)(parse_iterator, parse_iterator);
-
- T& l;
- member_function mf;
-
- member_action(T& l, member_function mf) : l(l), mf(mf) {}
-
- void operator()(parse_iterator first, parse_iterator last) const {
- (l.*mf)(first, last);
- }
- };
-
- template <typename T, typename Arg1>
- struct member_action1
- {
- typedef void(T::*member_function)(parse_iterator, parse_iterator, Arg1);
-
- T& l;
- member_function mf;
-
- member_action1(T& l, member_function mf) : l(l), mf(mf) {}
-
- struct impl
- {
- member_action1 a;
- Arg1 value;
-
- impl(member_action1& a, Arg1 value) :
- a(a), value(value)
- {}
-
- void operator()(parse_iterator first, parse_iterator last) const {
- (a.l.*a.mf)(first, last, value);
- }
- };
-
- impl operator()(Arg1 a1) {
- return impl(*this, a1);
- }
- };
-
// Syntax Highlight Actions
struct syntax_highlight_actions
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