1 /*=============================================================================
2 Copyright (c) 2001-2011 Hartmut Kaiser
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_DETAIL_PARSE_DEC_02_2009_0411PM)
8 #define BOOST_SPIRIT_DETAIL_PARSE_DEC_02_2009_0411PM
14 #include <boost/spirit/home/qi/meta_compiler.hpp>
15 #include <boost/spirit/home/qi/skip_flag.hpp>
16 #include <boost/spirit/home/qi/skip_over.hpp>
17 #include <boost/spirit/home/support/unused.hpp>
18 #include <boost/mpl/assert.hpp>
19 #include <boost/mpl/bool.hpp>
21 namespace boost { namespace spirit { namespace qi { namespace detail
23 ///////////////////////////////////////////////////////////////////////////
24 template <typename Expr, typename Enable = void>
27 // Report invalid expression error as early as possible.
28 // If you got an error_invalid_expression error message here,
29 // then the expression (expr) is not a valid spirit qi expression.
30 // Did you intend to use the auto_ facilities while forgetting to
31 // #include <boost/spirit/include/qi_auto.hpp>?
32 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
35 template <typename Expr>
36 struct parse_impl<Expr
37 , typename enable_if<traits::matches<qi::domain, Expr> >::type>
39 template <typename Iterator>
45 return compile<qi::domain>(expr).parse(
46 first, last, unused, unused, unused);
50 ///////////////////////////////////////////////////////////////////////////
51 template <typename Expr, typename Enable = void>
52 struct phrase_parse_impl
54 // Report invalid expression error as early as possible.
55 // If you got an error_invalid_expression error message here,
56 // then the expression (expr) is not a valid spirit qi expression.
57 // Did you intend to use the auto_ facilities while forgetting to
58 // #include <boost/spirit/include/qi_auto.hpp>?
59 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
62 template <typename Expr>
63 struct phrase_parse_impl<Expr
64 , typename enable_if<traits::matches<qi::domain, Expr> >::type>
66 template <typename Iterator, typename Skipper>
71 , Skipper const& skipper
72 , BOOST_SCOPED_ENUM(skip_flag) post_skip)
74 // Report invalid expression error as early as possible.
75 // If you got an error_invalid_expression error message here,
76 // then the skipper is not a valid spirit qi expression.
77 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
80 typename result_of::compile<qi::domain, Skipper>::type
82 skipper_type const skipper_ = compile<qi::domain>(skipper);
84 if (!compile<qi::domain>(expr).parse(
85 first, last, unused, skipper_, unused))
88 if (post_skip == skip_flag::postskip)
89 qi::skip_over(first, last, skipper_);