1 // Copyright 2008 Christophe Henry
2 // henry UNDERSCORE christophe AT hotmail DOT com
3 // This is an extended version of the state machine available in the boost::mpl library
4 // Distributed under the same license as the original.
5 // Copyright for the original version:
6 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
7 // under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_MSM_GRAMMAR_H
12 #define BOOST_MSM_GRAMMAR_H
14 #include <boost/proto/core.hpp>
15 #include <boost/msm/common.hpp>
18 namespace boost { namespace msm
20 // base grammar for all of msm's proto-based grammars
21 struct basic_grammar : proto::_
24 // Forward-declare an expression wrapper
25 template<typename Expr>
29 : proto::domain< proto::generator<msm_terminal>, basic_grammar >
32 template<typename Expr>
34 : proto::extends<Expr, msm_terminal<Expr>, msm_domain>
37 proto::extends<Expr, msm_terminal<Expr>, msm_domain>
39 // Needs a constructor
40 msm_terminal(Expr const &e = Expr())
45 // grammar forbidding address of for terminals
46 struct terminal_grammar : proto::not_<proto::address_of<proto::_> >
49 // Forward-declare an expression wrapper
50 template<typename Expr>
54 : proto::domain< proto::generator<euml_terminal>, terminal_grammar, boost::msm::msm_domain >
57 struct state_grammar :
59 proto::not_<proto::address_of<proto::_> >,
60 proto::not_<proto::shift_right<proto::_,proto::_> >,
61 proto::not_<proto::shift_left<proto::_,proto::_> >,
62 proto::not_<proto::bitwise_and<proto::_,proto::_> >
66 : proto::domain< proto::generator<euml_terminal>, boost::msm::state_grammar,boost::msm::sm_domain >
69 template<typename Expr>
71 : proto::extends<Expr, euml_terminal<Expr>, boost::msm::sm_domain>
74 proto::extends<Expr, euml_terminal<Expr>, boost::msm::sm_domain>
76 // Needs a constructor
77 euml_terminal(Expr const &e = Expr())
80 // Unhide Proto's overloaded assignment operator
81 using base_type::operator=;
85 #endif //BOOST_MSM_GRAMMAR_H