1 // Copyright (c) 2018 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_THREE_HPP 5 #define TAO_PEGTL_INTERNAL_THREE_HPP 6 7 #include <utility> 8 9 #include "../config.hpp" 10 11 #include "bump_help.hpp" 12 #include "result_on_found.hpp" 13 #include "skip_control.hpp" 14 15 #include "../analysis/generic.hpp" 16 17 namespace tao 18 { 19 namespace TAO_PEGTL_NAMESPACE 20 { 21 namespace internal 22 { 23 template< char C > 24 struct three 25 { 26 using analyze_t = analysis::generic< analysis::rule_type::ANY >; 27 28 template< typename Input > matchtao::TAO_PEGTL_NAMESPACE::internal::three29 static bool match( Input& in ) noexcept( noexcept( in.size( 3 ) ) ) 30 { 31 if( in.size( 3 ) >= 3 ) { 32 if( ( in.peek_char( 0 ) == C ) && ( in.peek_char( 1 ) == C ) && ( in.peek_char( 2 ) == C ) ) { 33 bump_help< result_on_found::SUCCESS, Input, char, C >( in, 3 ); 34 return true; 35 } 36 } 37 return false; 38 } 39 }; 40 41 template< char C > 42 struct skip_control< three< C > > : std::true_type 43 { 44 }; 45 46 } // namespace internal 47 48 } // namespace TAO_PEGTL_NAMESPACE 49 50 } // namespace tao 51 52 #endif 53