]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_METAPARSE_V1_SOURCE_POSITION_TAG_HPP |
2 | #define BOOST_METAPARSE_V1_SOURCE_POSITION_TAG_HPP | |
3 | ||
4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. | |
5 | // Distributed under the Boost Software License, Version 1.0. | |
6 | // (See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | #include <boost/metaparse/v1/fwd/source_position.hpp> | |
10 | #include <boost/metaparse/v1/fwd/get_prev_char.hpp> | |
11 | #include <boost/metaparse/v1/fwd/next_line.hpp> | |
12 | #include <boost/metaparse/v1/fwd/next_char.hpp> | |
13 | #include <boost/metaparse/v1/get_col.hpp> | |
14 | #include <boost/metaparse/v1/get_line.hpp> | |
15 | ||
16 | ||
17 | #include <boost/mpl/int.hpp> | |
18 | ||
19 | namespace boost | |
20 | { | |
21 | namespace metaparse | |
22 | { | |
23 | namespace v1 | |
24 | { | |
25 | struct source_position_tag { typedef source_position_tag type; }; | |
26 | ||
27 | template <> | |
28 | struct get_col_impl<source_position_tag> | |
29 | { | |
30 | template <class P> | |
31 | struct apply : P::col {}; | |
32 | }; | |
33 | ||
34 | template <> | |
35 | struct get_line_impl<source_position_tag> | |
36 | { | |
37 | template <class P> | |
38 | struct apply : P::line {}; | |
39 | }; | |
40 | ||
41 | ||
42 | template <> | |
43 | struct get_prev_char_impl<source_position_tag> | |
44 | { | |
45 | template <class P> | |
46 | struct apply : P::prev_char {}; | |
47 | }; | |
48 | ||
49 | ||
50 | template <> | |
51 | struct next_char_impl<source_position_tag> | |
52 | { | |
53 | template <class P, class Ch> | |
54 | struct apply : | |
55 | source_position< | |
56 | typename get_line<P>::type, | |
57 | boost::mpl::int_<get_col<P>::type::value + 1>, | |
58 | Ch | |
59 | > | |
60 | {}; | |
61 | }; | |
62 | ||
63 | template <> | |
64 | struct next_line_impl<source_position_tag> | |
65 | { | |
66 | template <class P, class Ch> | |
67 | struct apply : | |
68 | source_position< | |
69 | boost::mpl::int_<get_line<P>::type::value + 1>, | |
70 | boost::mpl::int_<1>, | |
71 | Ch | |
72 | > | |
73 | {}; | |
74 | }; | |
75 | } | |
76 | } | |
77 | } | |
78 | ||
79 | #endif | |
80 |