/src/Fast-DDS/thirdparty/taocpp-pegtl/pegtl/internal/any.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_ANY_HPP |
5 | | #define TAO_PEGTL_INTERNAL_ANY_HPP |
6 | | |
7 | | #include "../config.hpp" |
8 | | |
9 | | #include "peek_char.hpp" |
10 | | #include "skip_control.hpp" |
11 | | |
12 | | #include "../analysis/generic.hpp" |
13 | | |
14 | | namespace tao |
15 | | { |
16 | | namespace TAO_PEGTL_NAMESPACE |
17 | | { |
18 | | namespace internal |
19 | | { |
20 | | template< typename Peek > |
21 | | struct any; |
22 | | |
23 | | template<> |
24 | | struct any< peek_char > |
25 | | { |
26 | | using analyze_t = analysis::generic< analysis::rule_type::any >; |
27 | | |
28 | | template< typename Input > |
29 | | static bool match( Input& in ) noexcept( noexcept( in.empty() ) ) |
30 | 0 | { |
31 | 0 | if( !in.empty() ) { |
32 | 0 | in.bump(); |
33 | 0 | return true; |
34 | 0 | } |
35 | 0 | return false; |
36 | 0 | } |
37 | | }; |
38 | | |
39 | | template< typename Peek > |
40 | | struct any |
41 | | { |
42 | | using analyze_t = analysis::generic< analysis::rule_type::any >; |
43 | | |
44 | | template< typename Input > |
45 | | static bool match( Input& in ) noexcept( noexcept( Peek::peek( in ) ) ) |
46 | 0 | { |
47 | 0 | if( const auto t = Peek::peek( in ) ) { |
48 | 0 | in.bump( t.size ); |
49 | 0 | return true; |
50 | 0 | } |
51 | 0 | return false; |
52 | 0 | } |
53 | | }; |
54 | | |
55 | | template< typename Peek > |
56 | | struct skip_control< any< Peek > > : std::true_type |
57 | | { |
58 | | }; |
59 | | |
60 | | } // namespace internal |
61 | | |
62 | | } // namespace TAO_PEGTL_NAMESPACE |
63 | | |
64 | | } // namespace tao |
65 | | |
66 | | #endif |