File indexing completed on 2025-01-18 09:40:50
0001 #ifndef BOOST_METAPARSE_V1_SOURCE_POSITION_HPP
0002 #define BOOST_METAPARSE_V1_SOURCE_POSITION_HPP
0003
0004
0005
0006
0007
0008
0009 #include <boost/metaparse/v1/fwd/source_position.hpp>
0010 #include <boost/metaparse/v1/source_position_tag.hpp>
0011
0012
0013 #include <boost/mpl/bool.hpp>
0014 #include <boost/mpl/equal_to.hpp>
0015 #include <boost/mpl/less.hpp>
0016
0017 namespace boost
0018 {
0019 namespace metaparse
0020 {
0021 namespace v1
0022 {
0023 template <class Line, class Col, class PrevChar>
0024 struct source_position
0025 {
0026 typedef source_position_tag tag;
0027 typedef source_position type;
0028
0029 typedef Line line;
0030 typedef Col col;
0031 typedef PrevChar prev_char;
0032 };
0033 }
0034 }
0035 }
0036
0037 namespace boost
0038 {
0039 namespace mpl
0040 {
0041 template <class TagA, class TagB>
0042 struct equal_to_impl;
0043
0044 template <>
0045 struct equal_to_impl<
0046 boost::metaparse::v1::source_position_tag,
0047 boost::metaparse::v1::source_position_tag
0048 >
0049 {
0050 typedef equal_to_impl type;
0051
0052 template <class A, class B>
0053 struct apply :
0054 bool_<
0055 A::type::line::value == B::type::line::value
0056 && A::type::col::value == B::type::col::value
0057 && A::type::prev_char::value == B::type::prev_char::value
0058 >
0059 {};
0060 };
0061
0062 template <class TagA, class TagB>
0063 struct not_equal_to_impl;
0064
0065 template <>
0066 struct not_equal_to_impl<
0067 boost::metaparse::v1::source_position_tag,
0068 boost::metaparse::v1::source_position_tag
0069 >
0070 {
0071 typedef not_equal_to_impl type;
0072
0073 template <class A, class B>
0074 struct apply : bool_<!equal_to<A, B>::type::value> {};
0075 };
0076
0077 template <class TagA, class TagB>
0078 struct less_impl;
0079
0080 template <>
0081 struct less_impl<
0082 boost::metaparse::v1::source_position_tag,
0083 boost::metaparse::v1::source_position_tag
0084 >
0085 {
0086 typedef less_impl type;
0087
0088 template <class A, class B>
0089 struct apply :
0090 bool_<(
0091 (A::type::line::value) < (B::type::line::value) || (
0092 (A::type::line::value) == (B::type::line::value) && (
0093 (A::type::col::value) < (B::type::col::value) || (
0094 (A::type::col::value) == (B::type::col::value) &&
0095 (A::type::prev_char::value) < (B::type::prev_char::value)
0096 )
0097 )
0098 )
0099 )>
0100 {};
0101 };
0102
0103 template <class TagA, class TagB>
0104 struct greater_impl;
0105
0106 template <>
0107 struct greater_impl<
0108 boost::metaparse::v1::source_position_tag,
0109 boost::metaparse::v1::source_position_tag
0110 >
0111 {
0112 typedef greater_impl type;
0113
0114 template <class A, class B>
0115 struct apply :
0116 bool_<!(less<A, B>::type::value || equal_to<A, B>::type::value)>
0117 {};
0118 };
0119
0120 template <class TagA, class TagB>
0121 struct greater_equal_impl;
0122
0123 template <>
0124 struct greater_equal_impl<
0125 boost::metaparse::v1::source_position_tag,
0126 boost::metaparse::v1::source_position_tag
0127 >
0128 {
0129 typedef greater_equal_impl type;
0130
0131 template <class A, class B>
0132 struct apply : bool_<!less<A, B>::type::value> {};
0133 };
0134
0135 template <class TagA, class TagB>
0136 struct less_equal_impl;
0137
0138 template <>
0139 struct less_equal_impl<
0140 boost::metaparse::v1::source_position_tag,
0141 boost::metaparse::v1::source_position_tag
0142 >
0143 {
0144 typedef less_equal_impl type;
0145
0146 template <class A, class B>
0147 struct apply :
0148 bool_<less<A, B>::type::value || equal_to<A, B>::type::value>
0149 {};
0150 };
0151
0152 }
0153 }
0154
0155 #endif
0156