Chris@16: // Copyright 2008 Christophe Henry Chris@16: // henry UNDERSCORE christophe AT hotmail DOT com Chris@16: // This is an extended version of the state machine available in the boost::mpl library Chris@16: // Distributed under the same license as the original. Chris@16: // Copyright for the original version: Chris@16: // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed Chris@16: // under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_MSM_GRAMMAR_H Chris@16: #define BOOST_MSM_GRAMMAR_H Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: Chris@16: namespace boost { namespace msm Chris@16: { Chris@16: // base grammar for all of msm's proto-based grammars Chris@16: struct basic_grammar : proto::_ Chris@16: {}; Chris@16: Chris@16: // Forward-declare an expression wrapper Chris@16: template Chris@16: struct msm_terminal; Chris@16: Chris@16: struct msm_domain Chris@16: : proto::domain< proto::generator, basic_grammar > Chris@16: {}; Chris@16: Chris@16: template Chris@16: struct msm_terminal Chris@16: : proto::extends, msm_domain> Chris@16: { Chris@16: typedef Chris@16: proto::extends, msm_domain> Chris@16: base_type; Chris@16: // Needs a constructor Chris@16: msm_terminal(Expr const &e = Expr()) Chris@16: : base_type(e) Chris@16: {} Chris@16: }; Chris@16: Chris@16: // grammar forbidding address of for terminals Chris@16: struct terminal_grammar : proto::not_ > Chris@16: {}; Chris@16: Chris@16: // Forward-declare an expression wrapper Chris@16: template Chris@16: struct euml_terminal; Chris@16: Chris@16: struct sm_domain Chris@16: : proto::domain< proto::generator, terminal_grammar, boost::msm::msm_domain > Chris@16: {}; Chris@16: Chris@16: struct state_grammar : Chris@16: proto::and_< Chris@16: proto::not_ >, Chris@16: proto::not_ >, Chris@16: proto::not_ >, Chris@16: proto::not_ > Chris@16: > Chris@16: {}; Chris@16: struct state_domain Chris@16: : proto::domain< proto::generator, boost::msm::state_grammar,boost::msm::sm_domain > Chris@16: {}; Chris@16: Chris@16: template Chris@16: struct euml_terminal Chris@16: : proto::extends, boost::msm::sm_domain> Chris@16: { Chris@16: typedef Chris@16: proto::extends, boost::msm::sm_domain> Chris@16: base_type; Chris@16: // Needs a constructor Chris@16: euml_terminal(Expr const &e = Expr()) Chris@16: : base_type(e) Chris@16: {} Chris@16: // Unhide Proto's overloaded assignment operator Chris@16: using base_type::operator=; Chris@16: }; Chris@16: Chris@16: } } // boost::msm Chris@16: #endif //BOOST_MSM_GRAMMAR_H Chris@16: