Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:05

0001 // Copyright 2008 Christophe Henry
0002 // henry UNDERSCORE christophe AT hotmail DOT com
0003 // This is an extended version of the state machine available in the boost::mpl library
0004 // Distributed under the same license as the original.
0005 // Copyright for the original version:
0006 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
0007 // under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_MSM_GRAMMAR_H
0012 #define BOOST_MSM_GRAMMAR_H
0013 
0014 #include <boost/proto/core.hpp>
0015 #include <boost/msm/common.hpp>
0016 
0017 
0018 namespace boost { namespace msm
0019 {
0020 // base grammar for all of msm's proto-based grammars
0021 struct basic_grammar : proto::_
0022 {};
0023 
0024 // Forward-declare an expression wrapper
0025 template<typename Expr>
0026 struct msm_terminal;
0027 
0028 struct msm_domain
0029     : proto::domain< proto::generator<msm_terminal>, basic_grammar >
0030 {};
0031 
0032 template<typename Expr>
0033 struct msm_terminal
0034     : proto::extends<Expr, msm_terminal<Expr>, msm_domain>
0035 {
0036     typedef
0037         proto::extends<Expr, msm_terminal<Expr>, msm_domain>
0038         base_type;
0039     // Needs a constructor
0040     msm_terminal(Expr const &e = Expr())
0041         : base_type(e)
0042     {}
0043 };
0044 
0045 // grammar forbidding address of for terminals
0046 struct terminal_grammar : proto::not_<proto::address_of<proto::_> >
0047 {};
0048 
0049 // Forward-declare an expression wrapper
0050 template<typename Expr>
0051 struct euml_terminal;
0052 
0053 struct sm_domain
0054     : proto::domain< proto::generator<euml_terminal>, terminal_grammar, boost::msm::msm_domain >
0055 {};
0056 
0057 struct state_grammar : 
0058     proto::and_<
0059         proto::not_<proto::address_of<proto::_> >,
0060         proto::not_<proto::shift_right<proto::_,proto::_> >,
0061         proto::not_<proto::shift_left<proto::_,proto::_> >,
0062         proto::not_<proto::bitwise_and<proto::_,proto::_> >
0063     >
0064 {};
0065 struct state_domain
0066     : proto::domain< proto::generator<euml_terminal>, boost::msm::state_grammar,boost::msm::sm_domain >
0067 {};
0068 
0069 template<typename Expr>
0070 struct euml_terminal
0071     : proto::extends<Expr, euml_terminal<Expr>, boost::msm::sm_domain>
0072 {
0073     typedef
0074         proto::extends<Expr, euml_terminal<Expr>, boost::msm::sm_domain>
0075         base_type;
0076     // Needs a constructor
0077     euml_terminal(Expr const &e = Expr())
0078         : base_type(e)
0079     {}
0080     // Unhide Proto's overloaded assignment operator
0081     using base_type::operator=;
0082 };
0083 
0084 } } // boost::msm
0085 #endif //BOOST_MSM_GRAMMAR_H
0086