1 #ifndef BOOST_METAPARSE_V1_SOURCE_POSITION_HPP
2 #define BOOST_METAPARSE_V1_SOURCE_POSITION_HPP
4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
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)
9 #include <boost/metaparse/v1/fwd/source_position.hpp>
10 #include <boost/metaparse/v1/source_position_tag.hpp>
13 #include <boost/mpl/bool.hpp>
14 #include <boost/mpl/equal_to.hpp>
15 #include <boost/mpl/less.hpp>
23 template <class Line, class Col, class PrevChar>
24 struct source_position
26 typedef source_position_tag tag;
27 typedef source_position type;
31 typedef PrevChar prev_char;
41 template <class TagA, class TagB>
46 boost::metaparse::v1::source_position_tag,
47 boost::metaparse::v1::source_position_tag
50 typedef equal_to_impl type;
52 template <class A, class B>
55 A::type::line::value == B::type::line::value
56 && A::type::col::value == B::type::col::value
57 && A::type::prev_char::value == B::type::prev_char::value
62 template <class TagA, class TagB>
63 struct not_equal_to_impl;
66 struct not_equal_to_impl<
67 boost::metaparse::v1::source_position_tag,
68 boost::metaparse::v1::source_position_tag
71 typedef not_equal_to_impl type;
73 template <class A, class B>
74 struct apply : bool_<!equal_to<A, B>::type::value> {};
77 template <class TagA, class TagB>
82 boost::metaparse::v1::source_position_tag,
83 boost::metaparse::v1::source_position_tag
86 typedef less_impl type;
88 template <class A, class B>
91 (A::type::line::value) < (B::type::line::value) || (
92 (A::type::line::value) == (B::type::line::value) && (
93 (A::type::col::value) < (B::type::col::value) || (
94 (A::type::col::value) == (B::type::col::value) &&
95 (A::type::prev_char::value) < (B::type::prev_char::value)
103 template <class TagA, class TagB>
108 boost::metaparse::v1::source_position_tag,
109 boost::metaparse::v1::source_position_tag
112 typedef greater_impl type;
114 template <class A, class B>
116 bool_<!(less<A, B>::type::value || equal_to<A, B>::type::value)>
120 template <class TagA, class TagB>
121 struct greater_equal_impl;
124 struct greater_equal_impl<
125 boost::metaparse::v1::source_position_tag,
126 boost::metaparse::v1::source_position_tag
129 typedef greater_equal_impl type;
131 template <class A, class B>
132 struct apply : bool_<!less<A, B>::type::value> {};
135 template <class TagA, class TagB>
136 struct less_equal_impl;
139 struct less_equal_impl<
140 boost::metaparse::v1::source_position_tag,
141 boost::metaparse::v1::source_position_tag
144 typedef less_equal_impl type;
146 template <class A, class B>
148 bool_<less<A, B>::type::value || equal_to<A, B>::type::value>