]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/include/boost/spirit/repository/home/qi/primitive/iter_pos.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / spirit / include / boost / spirit / repository / home / qi / primitive / iter_pos.hpp
1 // Copyright (c) 2001-2011 Hartmut Kaiser
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #if !defined(BOOST_SPIRIT_REPOSITORY_QI_ITER_POS_NOV_20_2009_1245PM)
7 #define BOOST_SPIRIT_REPOSITORY_QI_ITER_POS_NOV_20_2009_1245PM
8
9 #include <boost/spirit/include/qi_parse.hpp>
10
11 ///////////////////////////////////////////////////////////////////////////////
12 // definition the place holder
13 namespace boost { namespace spirit { namespace repository { namespace qi
14 {
15 BOOST_SPIRIT_TERMINAL(iter_pos);
16 }}}}
17
18 ///////////////////////////////////////////////////////////////////////////////
19 // implementation the enabler
20 namespace boost { namespace spirit
21 {
22 // We want custom_parser::iter_pos to be usable as a terminal only,
23 // and only for parser expressions (qi::domain).
24 template <>
25 struct use_terminal<qi::domain, repository::qi::tag::iter_pos>
26 : mpl::true_
27 {};
28 }}
29
30 ///////////////////////////////////////////////////////////////////////////////
31 // implementation of the parser
32 namespace boost { namespace spirit { namespace repository { namespace qi
33 {
34 struct iter_pos_parser
35 : boost::spirit::qi::primitive_parser<iter_pos_parser>
36 {
37 // Define the attribute type exposed by this parser component
38 template <typename Context, typename Iterator>
39 struct attribute
40 {
41 typedef Iterator type;
42 };
43
44 // This function is called during the actual parsing process
45 template <typename Iterator, typename Context
46 , typename Skipper, typename Attribute>
47 bool parse(Iterator& first, Iterator const& last
48 , Context&, Skipper const& skipper, Attribute& attr) const
49 {
50 boost::spirit::qi::skip_over(first, last, skipper);
51 boost::spirit::traits::assign_to(first, attr);
52 return true;
53 }
54
55 // This function is called during error handling to create
56 // a human readable string for the error context.
57 template <typename Context>
58 boost::spirit::info what(Context&) const
59 {
60 return boost::spirit::info("iter_pos");
61 }
62 };
63 }}}}
64
65 ///////////////////////////////////////////////////////////////////////////////
66 // instantiation of the parser
67 namespace boost { namespace spirit { namespace qi
68 {
69 // This is the factory function object invoked in order to create
70 // an instance of our iter_pos_parser.
71 template <typename Modifiers>
72 struct make_primitive<repository::qi::tag::iter_pos, Modifiers>
73 {
74 typedef repository::qi::iter_pos_parser result_type;
75
76 result_type operator()(unused_type, unused_type) const
77 {
78 return result_type();
79 }
80 };
81 }}}
82
83 #endif