diff -Nur PEGTL-2.8.0/include/tao/pegtl/contrib/rep_one_min_max.hpp PEGTL-2.8.0-new/include/tao/pegtl/contrib/rep_one_min_max.hpp --- PEGTL-2.8.0/include/tao/pegtl/contrib/rep_one_min_max.hpp 2019-04-10 02:27:36.000000000 +0800 +++ PEGTL-2.8.0-new/include/tao/pegtl/contrib/rep_one_min_max.hpp 2021-08-02 10:13:41.000000000 +0800 @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2020 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_REP_ONE_MIN_MAX_HPP @@ -41,6 +41,27 @@ bump_help< result_on_found::success, Input, char, C >( in, i ); return true; } + return false; + } + }; + + template< unsigned Max, char C > + struct rep_one_min_max< 0, Max, C > + { + using analyze_t = analysis::counted< analysis::rule_type::any, 0 >; + + template< typename Input > + static bool match( Input& in ) + { + const auto size = in.size( Max + 1 ); + std::size_t i = 0; + while( ( i < size ) && ( in.peek_char( i ) == C ) ) { + ++i; + } + if( i <= Max ) { + bump_help< result_on_found::success, Input, char, C >( in, i ); + return true; + } return false; } };