/src/Fast-DDS/thirdparty/taocpp-pegtl/pegtl/internal/ranges.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2014-2020 Dr. Colin Hirsch and Daniel Frey |
2 | | // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ |
3 | | |
4 | | #ifndef TAO_PEGTL_INTERNAL_RANGES_HPP |
5 | | #define TAO_PEGTL_INTERNAL_RANGES_HPP |
6 | | |
7 | | #include "../config.hpp" |
8 | | |
9 | | #include "bump_help.hpp" |
10 | | #include "range.hpp" |
11 | | #include "skip_control.hpp" |
12 | | |
13 | | #include "../analysis/generic.hpp" |
14 | | |
15 | | namespace tao |
16 | | { |
17 | | namespace TAO_PEGTL_NAMESPACE |
18 | | { |
19 | | namespace internal |
20 | | { |
21 | | template< int Eol, typename Char, Char... Cs > |
22 | | struct ranges_impl; |
23 | | |
24 | | template< int Eol, typename Char > |
25 | | struct ranges_impl< Eol, Char > |
26 | | { |
27 | | static constexpr bool can_match_eol = false; |
28 | | |
29 | | static bool match( const Char /*unused*/ ) noexcept |
30 | 0 | { |
31 | 0 | return false; |
32 | 0 | } |
33 | | }; |
34 | | |
35 | | template< int Eol, typename Char, Char Eq > |
36 | | struct ranges_impl< Eol, Char, Eq > |
37 | | { |
38 | | static constexpr bool can_match_eol = ( Eq == Eol ); |
39 | | |
40 | | static bool match( const Char c ) noexcept |
41 | 0 | { |
42 | 0 | return c == Eq; |
43 | 0 | } |
44 | | }; |
45 | | |
46 | | template< int Eol, typename Char, Char Lo, Char Hi, Char... Cs > |
47 | | struct ranges_impl< Eol, Char, Lo, Hi, Cs... > |
48 | | { |
49 | | static_assert( Lo <= Hi, "invalid range detected" ); |
50 | | |
51 | | static constexpr bool can_match_eol = ( ( ( Lo <= Eol ) && ( Eol <= Hi ) ) || ranges_impl< Eol, Char, Cs... >::can_match_eol ); |
52 | | |
53 | | static bool match( const Char c ) noexcept |
54 | 0 | { |
55 | 0 | return ( ( Lo <= c ) && ( c <= Hi ) ) || ranges_impl< Eol, Char, Cs... >::match( c ); |
56 | 0 | } Unexecuted instantiation: tao::pegtl::internal::ranges_impl<10, char, (char)97, (char)122, (char)65, (char)90, (char)48, (char)57, (char)95>::match(char) Unexecuted instantiation: tao::pegtl::internal::ranges_impl<10, char, (char)65, (char)90, (char)48, (char)57, (char)95>::match(char) Unexecuted instantiation: tao::pegtl::internal::ranges_impl<10, char, (char)48, (char)57, (char)95>::match(char) Unexecuted instantiation: tao::pegtl::internal::ranges_impl<10, char, (char)48, (char)57, (char)97, (char)102, (char)65, (char)70>::match(char) Unexecuted instantiation: tao::pegtl::internal::ranges_impl<10, char, (char)97, (char)102, (char)65, (char)70>::match(char) Unexecuted instantiation: tao::pegtl::internal::ranges_impl<10, char, (char)65, (char)70>::match(char) Unexecuted instantiation: tao::pegtl::internal::ranges_impl<10, char, (char)97, (char)122, (char)65, (char)90, (char)95>::match(char) Unexecuted instantiation: tao::pegtl::internal::ranges_impl<10, char, (char)65, (char)90, (char)95>::match(char) |
57 | | }; |
58 | | |
59 | | template< typename Peek, typename Peek::data_t... Cs > |
60 | | struct ranges |
61 | | { |
62 | | using analyze_t = analysis::generic< analysis::rule_type::any >; |
63 | | |
64 | | template< int Eol > |
65 | | struct can_match_eol |
66 | | { |
67 | | static constexpr bool value = ranges_impl< Eol, typename Peek::data_t, Cs... >::can_match_eol; |
68 | | }; |
69 | | |
70 | | template< typename Input > |
71 | | static bool match( Input& in ) noexcept( noexcept( Peek::peek( in ) ) ) |
72 | 0 | { |
73 | 0 | if( const auto t = Peek::peek( in ) ) { |
74 | 0 | if( ranges_impl< Input::eol_t::ch, typename Peek::data_t, Cs... >::match( t.data ) ) { |
75 | 0 | bump_impl< can_match_eol< Input::eol_t::ch >::value >::bump( in, t.size ); |
76 | 0 | return true; |
77 | 0 | } |
78 | 0 | } |
79 | 0 | return false; |
80 | 0 | } Unexecuted instantiation: bool tao::pegtl::internal::ranges<tao::pegtl::internal::peek_char, (char)97, (char)122, (char)65, (char)90, (char)48, (char)57, (char)95>::match<tao::pegtl::memory_input<(tao::pegtl::tracking_mode)0, tao::pegtl::ascii::eol::lf_crlf, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(tao::pegtl::memory_input<(tao::pegtl::tracking_mode)0, tao::pegtl::ascii::eol::lf_crlf, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&) Unexecuted instantiation: bool tao::pegtl::internal::ranges<tao::pegtl::internal::peek_char, (char)48, (char)57, (char)97, (char)102, (char)65, (char)70>::match<tao::pegtl::memory_input<(tao::pegtl::tracking_mode)0, tao::pegtl::ascii::eol::lf_crlf, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(tao::pegtl::memory_input<(tao::pegtl::tracking_mode)0, tao::pegtl::ascii::eol::lf_crlf, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&) Unexecuted instantiation: bool tao::pegtl::internal::ranges<tao::pegtl::internal::peek_char, (char)97, (char)122, (char)65, (char)90, (char)95>::match<tao::pegtl::memory_input<(tao::pegtl::tracking_mode)0, tao::pegtl::ascii::eol::lf_crlf, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(tao::pegtl::memory_input<(tao::pegtl::tracking_mode)0, tao::pegtl::ascii::eol::lf_crlf, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&) |
81 | | }; |
82 | | |
83 | | template< typename Peek, typename Peek::data_t Lo, typename Peek::data_t Hi > |
84 | | struct ranges< Peek, Lo, Hi > |
85 | | : range< result_on_found::success, Peek, Lo, Hi > |
86 | | { |
87 | | }; |
88 | | |
89 | | template< typename Peek, typename Peek::data_t... Cs > |
90 | | struct skip_control< ranges< Peek, Cs... > > : std::true_type |
91 | | { |
92 | | }; |
93 | | |
94 | | } // namespace internal |
95 | | |
96 | | } // namespace TAO_PEGTL_NAMESPACE |
97 | | |
98 | | } // namespace tao |
99 | | |
100 | | #endif |