Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/spirit/home/qi/stream/match_manip.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 Copyright (c) 2001-2011 Joel de Guzman | |
4 | |
5 Distributed under the Boost Software License, Version 1.0. (See accompanying | |
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 ==============================================================================*/ | |
8 #if !defined(BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1202PM) | |
9 #define BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1202PM | |
10 | |
11 #if defined(_MSC_VER) | |
12 #pragma once | |
13 #endif | |
14 | |
15 #include <boost/spirit/home/qi/parse.hpp> | |
16 #include <boost/spirit/home/qi/parser.hpp> | |
17 #include <boost/spirit/home/support/unused.hpp> | |
18 #include <boost/spirit/home/qi/stream/detail/match_manip.hpp> | |
19 | |
20 /////////////////////////////////////////////////////////////////////////////// | |
21 namespace boost { namespace spirit { namespace qi | |
22 { | |
23 /////////////////////////////////////////////////////////////////////////// | |
24 template <typename Expr> | |
25 inline typename detail::match<Expr>::type | |
26 match( | |
27 Expr const& expr) | |
28 { | |
29 return detail::match<Expr>::call(expr); | |
30 } | |
31 | |
32 template <typename Expr, typename Attribute> | |
33 inline detail::match_manip< | |
34 Expr, mpl::false_, mpl::false_, unused_type, Attribute | |
35 > | |
36 match( | |
37 Expr const& xpr | |
38 , Attribute& p) | |
39 { | |
40 using qi::detail::match_manip; | |
41 | |
42 // Report invalid expression error as early as possible. | |
43 // If you got an error_invalid_expression error message here, | |
44 // then the expression (expr) is not a valid spirit qi expression. | |
45 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); | |
46 return match_manip<Expr, mpl::false_, mpl::false_, unused_type, Attribute>( | |
47 xpr, unused, p); | |
48 } | |
49 | |
50 /////////////////////////////////////////////////////////////////////////// | |
51 template <typename Expr, typename Skipper> | |
52 inline typename detail::phrase_match<Expr, Skipper>::type | |
53 phrase_match( | |
54 Expr const& expr | |
55 , Skipper const& s | |
56 , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip) | |
57 { | |
58 return detail::phrase_match<Expr, Skipper>::call(expr, s, post_skip); | |
59 } | |
60 | |
61 template <typename Expr, typename Skipper, typename Attribute> | |
62 inline detail::match_manip< | |
63 Expr, mpl::false_, mpl::false_, Skipper, Attribute | |
64 > | |
65 phrase_match( | |
66 Expr const& xpr | |
67 , Skipper const& s | |
68 , BOOST_SCOPED_ENUM(skip_flag) post_skip | |
69 , Attribute& p) | |
70 { | |
71 using qi::detail::match_manip; | |
72 | |
73 // Report invalid expression error as early as possible. | |
74 // If you got an error_invalid_expression error message here, | |
75 // then either the expression (expr) or skipper is not a valid | |
76 // spirit qi expression. | |
77 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); | |
78 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper); | |
79 return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>( | |
80 xpr, s, post_skip, p); | |
81 } | |
82 | |
83 template <typename Expr, typename Skipper, typename Attribute> | |
84 inline detail::match_manip< | |
85 Expr, mpl::false_, mpl::false_, Skipper, Attribute | |
86 > | |
87 phrase_match( | |
88 Expr const& xpr | |
89 , Skipper const& s | |
90 , Attribute& p) | |
91 { | |
92 using qi::detail::match_manip; | |
93 | |
94 // Report invalid expression error as early as possible. | |
95 // If you got an error_invalid_expression error message here, | |
96 // then either the expression (expr) or skipper is not a valid | |
97 // spirit qi expression. | |
98 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr); | |
99 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper); | |
100 return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>( | |
101 xpr, s, p); | |
102 } | |
103 | |
104 /////////////////////////////////////////////////////////////////////////// | |
105 template<typename Char, typename Traits, typename Derived> | |
106 inline std::basic_istream<Char, Traits>& | |
107 operator>>(std::basic_istream<Char, Traits>& is, parser<Derived> const& p) | |
108 { | |
109 typedef spirit::basic_istream_iterator<Char, Traits> input_iterator; | |
110 | |
111 input_iterator f(is); | |
112 input_iterator l; | |
113 if (!p.derived().parse(f, l, unused, unused, unused)) | |
114 { | |
115 is.setstate(std::ios_base::failbit); | |
116 } | |
117 return is; | |
118 } | |
119 | |
120 }}} | |
121 | |
122 #endif | |
123 |