Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/spirit/home/qi/detail/parse.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
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_DETAIL_PARSE_DEC_02_2009_0411PM) | |
8 #define BOOST_SPIRIT_DETAIL_PARSE_DEC_02_2009_0411PM | |
9 | |
10 #if defined(_MSC_VER) | |
11 #pragma once | |
12 #endif | |
13 | |
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> | |
20 | |
21 namespace boost { namespace spirit { namespace qi { namespace detail | |
22 { | |
23 /////////////////////////////////////////////////////////////////////////// | |
24 template <typename Expr, typename Enable = void> | |
25 struct parse_impl | |
26 { | |
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); | |
33 }; | |
34 | |
35 template <typename Expr> | |
36 struct parse_impl<Expr | |
37 , typename enable_if<traits::matches<qi::domain, Expr> >::type> | |
38 { | |
39 template <typename Iterator> | |
40 static bool call( | |
41 Iterator& first | |
42 , Iterator last | |
43 , Expr const& expr) | |
44 { | |
45 return compile<qi::domain>(expr).parse( | |
46 first, last, unused, unused, unused); | |
47 } | |
48 }; | |
49 | |
50 /////////////////////////////////////////////////////////////////////////// | |
51 template <typename Expr, typename Enable = void> | |
52 struct phrase_parse_impl | |
53 { | |
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); | |
60 }; | |
61 | |
62 template <typename Expr> | |
63 struct phrase_parse_impl<Expr | |
64 , typename enable_if<traits::matches<qi::domain, Expr> >::type> | |
65 { | |
66 template <typename Iterator, typename Skipper> | |
67 static bool call( | |
68 Iterator& first | |
69 , Iterator last | |
70 , Expr const& expr | |
71 , Skipper const& skipper | |
72 , BOOST_SCOPED_ENUM(skip_flag) post_skip) | |
73 { | |
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); | |
78 | |
79 typedef | |
80 typename result_of::compile<qi::domain, Skipper>::type | |
81 skipper_type; | |
82 skipper_type const skipper_ = compile<qi::domain>(skipper); | |
83 | |
84 if (!compile<qi::domain>(expr).parse( | |
85 first, last, unused, skipper_, unused)) | |
86 return false; | |
87 | |
88 if (post_skip == skip_flag::postskip) | |
89 qi::skip_over(first, last, skipper_); | |
90 return true; | |
91 } | |
92 }; | |
93 | |
94 }}}} | |
95 | |
96 #endif | |
97 |