summaryrefslogtreecommitdiff
path: root/boost/msm/msm_grammar.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/msm/msm_grammar.hpp')
-rw-r--r--boost/msm/msm_grammar.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/boost/msm/msm_grammar.hpp b/boost/msm/msm_grammar.hpp
index 27f885468d..8f95e98684 100644
--- a/boost/msm/msm_grammar.hpp
+++ b/boost/msm/msm_grammar.hpp
@@ -11,6 +11,7 @@
#ifndef BOOST_MSM_GRAMMAR_H
#define BOOST_MSM_GRAMMAR_H
+#include <boost/proto/core.hpp>
#include <boost/msm/common.hpp>
@@ -41,6 +42,45 @@ struct msm_terminal
{}
};
+// grammar forbidding address of for terminals
+struct terminal_grammar : proto::not_<proto::address_of<proto::_> >
+{};
+
+// Forward-declare an expression wrapper
+template<typename Expr>
+struct euml_terminal;
+
+struct sm_domain
+ : proto::domain< proto::generator<euml_terminal>, terminal_grammar, boost::msm::msm_domain >
+{};
+
+struct state_grammar :
+ proto::and_<
+ proto::not_<proto::address_of<proto::_> >,
+ proto::not_<proto::shift_right<proto::_,proto::_> >,
+ proto::not_<proto::shift_left<proto::_,proto::_> >,
+ proto::not_<proto::bitwise_and<proto::_,proto::_> >
+ >
+{};
+struct state_domain
+ : proto::domain< proto::generator<euml_terminal>, boost::msm::state_grammar,boost::msm::sm_domain >
+{};
+
+template<typename Expr>
+struct euml_terminal
+ : proto::extends<Expr, euml_terminal<Expr>, boost::msm::sm_domain>
+{
+ typedef
+ proto::extends<Expr, euml_terminal<Expr>, boost::msm::sm_domain>
+ base_type;
+ // Needs a constructor
+ euml_terminal(Expr const &e = Expr())
+ : base_type(e)
+ {}
+ // Unhide Proto's overloaded assignment operator
+ using base_type::operator=;
+};
+
} } // boost::msm
#endif //BOOST_MSM_GRAMMAR_H