Skip to content

Commit

Permalink
Rename rewind function.
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinH committed Nov 12, 2023
1 parent 2eb45f8 commit d291081
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion include/tao/pegtl/buffer_input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
4 changes: 2 additions & 2 deletions include/tao/pegtl/contrib/raw_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
Expand Down Expand Up @@ -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 ) ) {
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/at.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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... );
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/if_apply.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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... ) && ... ) );
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/if_then_else.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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... ) ) {
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/missing_apply.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/not_at.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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... );
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/rematch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/rep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/rep_min_max.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/seq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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... ) && ... ) );
}
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/star_strict.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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... ) ) {
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/strict.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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... ) ) {
Expand Down
4 changes: 2 additions & 2 deletions include/tao/pegtl/internal/try_catch_raise_nested.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions include/tao/pegtl/internal/try_catch_return_false.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions include/tao/pegtl/internal/until.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
Expand Down Expand Up @@ -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... ) ) {
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/match.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/memory_input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
2 changes: 1 addition & 1 deletion src/example/pegtl/random_order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) || ... ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/example/pegtl/token_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down

0 comments on commit d291081

Please sign in to comment.