From d291081d7f7e3860f1a6265e0504e421d2e3893a Mon Sep 17 00:00:00 2001 From: "Dr. Colin Hirsch" Date: Sun, 12 Nov 2023 10:56:54 +0100 Subject: [PATCH] Rename rewind function. --- include/tao/pegtl/buffer_input.hpp | 2 +- include/tao/pegtl/contrib/raw_string.hpp | 4 ++-- include/tao/pegtl/internal/at.hpp | 2 +- include/tao/pegtl/internal/if_apply.hpp | 2 +- include/tao/pegtl/internal/if_then_else.hpp | 2 +- include/tao/pegtl/internal/missing_apply.hpp | 2 +- include/tao/pegtl/internal/not_at.hpp | 2 +- include/tao/pegtl/internal/rematch.hpp | 2 +- include/tao/pegtl/internal/rep.hpp | 2 +- include/tao/pegtl/internal/rep_min_max.hpp | 2 +- include/tao/pegtl/internal/seq.hpp | 2 +- include/tao/pegtl/internal/star_strict.hpp | 2 +- include/tao/pegtl/internal/strict.hpp | 2 +- include/tao/pegtl/internal/try_catch_raise_nested.hpp | 4 ++-- include/tao/pegtl/internal/try_catch_return_false.hpp | 4 ++-- include/tao/pegtl/internal/until.hpp | 4 ++-- include/tao/pegtl/match.hpp | 2 +- include/tao/pegtl/memory_input.hpp | 2 +- src/example/pegtl/random_order.cpp | 2 +- src/example/pegtl/token_input.cpp | 2 +- 20 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/tao/pegtl/buffer_input.hpp b/include/tao/pegtl/buffer_input.hpp index e95f46b91..adc202b60 100644 --- a/include/tao/pegtl/buffer_input.hpp +++ b/include/tao/pegtl/buffer_input.hpp @@ -165,7 +165,7 @@ namespace TAO_PEGTL_NAMESPACE } template< rewind_mode M > - [[nodiscard]] internal::rewind_guard< M, buffer_input > auto_rewind() noexcept + [[nodiscard]] internal::rewind_guard< M, buffer_input > make_rewind_guard() noexcept { return internal::rewind_guard< M, buffer_input >( this ); } diff --git a/include/tao/pegtl/contrib/raw_string.hpp b/include/tao/pegtl/contrib/raw_string.hpp index e7c5a3328..4b42a0dd0 100644 --- a/include/tao/pegtl/contrib/raw_string.hpp +++ b/include/tao/pegtl/contrib/raw_string.hpp @@ -115,7 +115,7 @@ namespace TAO_PEGTL_NAMESPACE typename... States > [[nodiscard]] static bool match( ParseInput& in, const std::size_t& marker_size, States&&... /*unused*/ ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, marker_size ) ) { if( in.empty() ) { @@ -143,7 +143,7 @@ namespace TAO_PEGTL_NAMESPACE typename... States > [[nodiscard]] static bool match( ParseInput& in, const std::size_t& marker_size, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, marker_size ) ) { diff --git a/include/tao/pegtl/internal/at.hpp b/include/tao/pegtl/internal/at.hpp index b1eaf5bdd..c0dc0e9d8 100644 --- a/include/tao/pegtl/internal/at.hpp +++ b/include/tao/pegtl/internal/at.hpp @@ -42,7 +42,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - const auto m = in.template auto_rewind< rewind_mode::required >(); + const auto m = in.template make_rewind_guard< rewind_mode::required >(); return Control< Rule >::template match< apply_mode::nothing, rewind_mode::optional, Action, Control >( in, st... ); } }; diff --git a/include/tao/pegtl/internal/if_apply.hpp b/include/tao/pegtl/internal/if_apply.hpp index b7b6ccb7c..d709e0925 100644 --- a/include/tao/pegtl/internal/if_apply.hpp +++ b/include/tao/pegtl/internal/if_apply.hpp @@ -33,7 +33,7 @@ namespace TAO_PEGTL_NAMESPACE::internal { if constexpr( ( A == apply_mode::action ) && ( sizeof...( Actions ) != 0 ) ) { using action_t = typename ParseInput::action_t; - auto m = in.template auto_rewind< rewind_mode::required >(); + auto m = in.template make_rewind_guard< rewind_mode::required >(); if( Control< Rule >::template match< apply_mode::action, rewind_mode::optional, Action, Control >( in, st... ) ) { const action_t i2( m.inputerator(), in ); return m( ( apply_single< Actions >::match( i2, st... ) && ... ) ); diff --git a/include/tao/pegtl/internal/if_then_else.hpp b/include/tao/pegtl/internal/if_then_else.hpp index 95125b995..20d9ceb79 100644 --- a/include/tao/pegtl/internal/if_then_else.hpp +++ b/include/tao/pegtl/internal/if_then_else.hpp @@ -33,7 +33,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); if( Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { diff --git a/include/tao/pegtl/internal/missing_apply.hpp b/include/tao/pegtl/internal/missing_apply.hpp index 8e1c51ef3..906d9daec 100644 --- a/include/tao/pegtl/internal/missing_apply.hpp +++ b/include/tao/pegtl/internal/missing_apply.hpp @@ -19,7 +19,7 @@ namespace TAO_PEGTL_NAMESPACE::internal { // This function only exists for better error messages, which means that it is only called when we know that it won't compile. // LCOV_EXCL_START - auto m = in.template auto_rewind< rewind_mode::required >(); + auto m = in.template make_rewind_guard< rewind_mode::required >(); (void)Control::template apply< Action >( m.inputerator(), in, st... ); // LCOV_EXCL_STOP } diff --git a/include/tao/pegtl/internal/not_at.hpp b/include/tao/pegtl/internal/not_at.hpp index 7fd803eca..799c90947 100644 --- a/include/tao/pegtl/internal/not_at.hpp +++ b/include/tao/pegtl/internal/not_at.hpp @@ -42,7 +42,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - const auto m = in.template auto_rewind< rewind_mode::required >(); + const auto m = in.template make_rewind_guard< rewind_mode::required >(); return !Control< Rule >::template match< apply_mode::nothing, rewind_mode::optional, Action, Control >( in, st... ); } }; diff --git a/include/tao/pegtl/internal/rematch.hpp b/include/tao/pegtl/internal/rematch.hpp index 063cd32ec..9fc6821de 100644 --- a/include/tao/pegtl/internal/rematch.hpp +++ b/include/tao/pegtl/internal/rematch.hpp @@ -54,7 +54,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< rewind_mode::required >(); + auto m = in.template make_rewind_guard< rewind_mode::required >(); if( Control< Head >::template match< A, rewind_mode::optional, Action, Control >( in, st... ) ) { memory_input< ParseInput::tracking_mode_v, typename ParseInput::eol_t, typename ParseInput::source_t > i2( m.inputerator(), in.current(), in.source() ); diff --git a/include/tao/pegtl/internal/rep.hpp b/include/tao/pegtl/internal/rep.hpp index 8a16fec0d..3600ecb62 100644 --- a/include/tao/pegtl/internal/rep.hpp +++ b/include/tao/pegtl/internal/rep.hpp @@ -47,7 +47,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); for( unsigned i = 0; i != Cnt; ++i ) { diff --git a/include/tao/pegtl/internal/rep_min_max.hpp b/include/tao/pegtl/internal/rep_min_max.hpp index 562bccd26..76f713f42 100644 --- a/include/tao/pegtl/internal/rep_min_max.hpp +++ b/include/tao/pegtl/internal/rep_min_max.hpp @@ -56,7 +56,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); for( unsigned i = 0; i != Min; ++i ) { diff --git a/include/tao/pegtl/internal/seq.hpp b/include/tao/pegtl/internal/seq.hpp index 277b6d9bb..4da09d8c8 100644 --- a/include/tao/pegtl/internal/seq.hpp +++ b/include/tao/pegtl/internal/seq.hpp @@ -43,7 +43,7 @@ namespace TAO_PEGTL_NAMESPACE::internal return Control< Rules... >::template match< A, M, Action, Control >( in, st... ); } else { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); return m( ( Control< Rules >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) && ... ) ); } diff --git a/include/tao/pegtl/internal/star_strict.hpp b/include/tao/pegtl/internal/star_strict.hpp index 633104ed6..23ada8fd6 100644 --- a/include/tao/pegtl/internal/star_strict.hpp +++ b/include/tao/pegtl/internal/star_strict.hpp @@ -31,7 +31,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); while( Control< Rule >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { diff --git a/include/tao/pegtl/internal/strict.hpp b/include/tao/pegtl/internal/strict.hpp index a4c0ba44f..022ea78ec 100644 --- a/include/tao/pegtl/internal/strict.hpp +++ b/include/tao/pegtl/internal/strict.hpp @@ -31,7 +31,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); if( Control< Rule >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { diff --git a/include/tao/pegtl/internal/try_catch_raise_nested.hpp b/include/tao/pegtl/internal/try_catch_raise_nested.hpp index b3512b918..5330f1c9a 100644 --- a/include/tao/pegtl/internal/try_catch_raise_nested.hpp +++ b/include/tao/pegtl/internal/try_catch_raise_nested.hpp @@ -48,7 +48,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< rewind_mode::required >(); + auto m = in.template make_rewind_guard< rewind_mode::required >(); using m_t = decltype( m ); try { @@ -76,7 +76,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< rewind_mode::required >(); + auto m = in.template make_rewind_guard< rewind_mode::required >(); using m_t = decltype( m ); try { diff --git a/include/tao/pegtl/internal/try_catch_return_false.hpp b/include/tao/pegtl/internal/try_catch_return_false.hpp index 0d46fdf45..5bbd4cf6d 100644 --- a/include/tao/pegtl/internal/try_catch_return_false.hpp +++ b/include/tao/pegtl/internal/try_catch_return_false.hpp @@ -48,7 +48,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); try { @@ -76,7 +76,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); try { diff --git a/include/tao/pegtl/internal/until.hpp b/include/tao/pegtl/internal/until.hpp index f2b9a7882..d241b3f74 100644 --- a/include/tao/pegtl/internal/until.hpp +++ b/include/tao/pegtl/internal/until.hpp @@ -40,7 +40,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { if( in.empty() ) { @@ -68,7 +68,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { diff --git a/include/tao/pegtl/match.hpp b/include/tao/pegtl/match.hpp index 311fd603a..933790fbe 100644 --- a/include/tao/pegtl/match.hpp +++ b/include/tao/pegtl/match.hpp @@ -137,7 +137,7 @@ namespace TAO_PEGTL_NAMESPACE constexpr bool use_guard = has_apply || has_apply0_bool; - auto m = in.template auto_rewind< ( use_guard ? rewind_mode::required : rewind_mode::optional ) >(); + auto m = in.template make_rewind_guard< ( use_guard ? rewind_mode::required : rewind_mode::optional ) >(); Control< Rule >::start( static_cast< const ParseInput& >( in ), st... ); auto result = internal::match_control_unwind< Rule, A, ( use_guard ? rewind_mode::optional : M ), Action, Control >( in, st... ); if( result ) { diff --git a/include/tao/pegtl/memory_input.hpp b/include/tao/pegtl/memory_input.hpp index 52f73898f..a7a637c15 100644 --- a/include/tao/pegtl/memory_input.hpp +++ b/include/tao/pegtl/memory_input.hpp @@ -340,7 +340,7 @@ namespace TAO_PEGTL_NAMESPACE void require( const std::size_t /*unused*/ ) const noexcept {} template< rewind_mode M > - [[nodiscard]] internal::rewind_guard< M, memory_input > auto_rewind() noexcept + [[nodiscard]] internal::rewind_guard< M, memory_input > make_rewind_guard() noexcept { return internal::rewind_guard< M, memory_input >( this ); } diff --git a/src/example/pegtl/random_order.cpp b/src/example/pegtl/random_order.cpp index e9842291c..18f95fcd4 100644 --- a/src/example/pegtl/random_order.cpp +++ b/src/example/pegtl/random_order.cpp @@ -40,7 +40,7 @@ namespace TAO_PEGTL_NAMESPACE [[nodiscard]] static bool match( std::index_sequence< Indices... > /*unused*/, ParseInput& in, States&&... st ) { std::bitset< rule_count > b; - auto m = in.template auto_rewind< M >(); + auto m = in.template make_rewind_guard< M >(); using m_t = decltype( m ); for( std::size_t i = 0; i < rule_count; ++i ) { if( !( ( ( b.test( Indices ) == false ) && ( Control< Rules >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) ) && ( b.set( Indices ), true ) ) || ... ) ) { diff --git a/src/example/pegtl/token_input.cpp b/src/example/pegtl/token_input.cpp index 0f67f336c..eff330fd4 100644 --- a/src/example/pegtl/token_input.cpp +++ b/src/example/pegtl/token_input.cpp @@ -130,7 +130,7 @@ namespace TAO_PEGTL_NAMESPACE } template< rewind_mode M > - [[nodiscard]] internal::rewind_guard< M, token_parse_input > auto_rewind() noexcept + [[nodiscard]] internal::rewind_guard< M, token_parse_input > make_rewind_guard() noexcept { return internal::rewind_guard< M, token_parse_input >( this ); }