PEGTL/PEGTL-compiler-warning.patch
Petr Šabata fe5302c2b4 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/PEGTL#d47d50334acea2d2c3083096d26ee7f82947447f
2020-10-14 21:27:29 +02:00

33 lines
1.1 KiB
Diff

diff --git a/include/tao/pegtl/contrib/rep_one_min_max.hpp b/include/tao/pegtl/contrib/rep_one_min_max.hpp
index 9173ad4a..2c9c25e6 100644
--- a/include/tao/pegtl/contrib/rep_one_min_max.hpp
+++ b/include/tao/pegtl/contrib/rep_one_min_max.hpp
@@ -45,6 +45,27 @@ namespace tao
}
};
+ 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;
+ }
+ };
+
template< unsigned Min, unsigned Max, char C >
struct skip_control< rep_one_min_max< Min, Max, C > > : std::true_type
{