1 /*============================================================================= 2 Copyright (c) 2001-2011 Hartmut Kaiser 3 4 Distributed under the Boost Software License, Version 1.0. (See accompanying 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 ==============================================================================*/ 7 #if !defined(BOOST_SPIRIT_MATCH_MANIP_AUTO_DEC_02_2009_0813PM) 8 #define BOOST_SPIRIT_MATCH_MANIP_AUTO_DEC_02_2009_0813PM 9 10 #if defined(_MSC_VER) 11 #pragma once 12 #endif 13 14 #include <boost/spirit/home/qi/stream/detail/match_manip.hpp> 15 #include <boost/spirit/home/qi/auto/create_parser.hpp> 16 #include <boost/utility/enable_if.hpp> 17 18 /////////////////////////////////////////////////////////////////////////////// 19 namespace boost { namespace spirit { namespace qi { namespace detail 20 { 21 /////////////////////////////////////////////////////////////////////////// 22 template <typename Expr> 23 struct match<Expr 24 , typename enable_if<traits::meta_create_exists<qi::domain, Expr> >::type> 25 { 26 typedef typename result_of::create_parser<Expr>::type expr_type; 27 typedef match_manip< 28 expr_type, mpl::true_, mpl::false_, unused_type, Expr 29 > type; 30 callboost::spirit::qi::detail::match31 static type call(Expr const& expr) 32 { 33 return type(create_parser<Expr>(), unused, const_cast<Expr&>(expr)); 34 } 35 }; 36 37 /////////////////////////////////////////////////////////////////////////// 38 template <typename Expr, typename Skipper> 39 struct phrase_match<Expr, Skipper 40 , typename enable_if<traits::meta_create_exists<qi::domain, Expr> >::type> 41 { 42 typedef typename result_of::create_parser<Expr>::type expr_type; 43 typedef match_manip< 44 expr_type, mpl::true_, mpl::false_, Skipper, Expr 45 > type; 46 callboost::spirit::qi::detail::phrase_match47 static type call( 48 Expr const& expr 49 , Skipper const& skipper 50 , BOOST_SCOPED_ENUM(skip_flag) post_skip) 51 { 52 // Report invalid expression error as early as possible. 53 // If you got an error_invalid_expression error message here, 54 // then the delimiter is not a valid spirit karma expression. 55 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper); 56 return type(create_parser<Expr>(), skipper, post_skip 57 , const_cast<Expr&>(expr)); 58 } 59 }; 60 61 }}}} 62 63 #endif 64