Sha256: 09d79ea2b4bdb61bd30ac41aab3724ece909c5af81b958769937a289c64333ad

Contents?: true

Size: 1.84 KB

Versions: 24

Compression:

Stored size: 1.84 KB

Contents

// Copyright (c) 2019-2020 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/

#ifndef TAO_JSON_PEGTL_CHANGE_STATES_HPP
#define TAO_JSON_PEGTL_CHANGE_STATES_HPP

#include <tuple>
#include <utility>

#include "apply_mode.hpp"
#include "config.hpp"
#include "match.hpp"
#include "nothing.hpp"
#include "rewind_mode.hpp"

namespace TAO_JSON_PEGTL_NAMESPACE
{
   template< typename... NewStates >
   struct change_states
      : maybe_nothing
   {
      template< typename Rule,
                apply_mode A,
                rewind_mode M,
                template< typename... >
                class Action,
                template< typename... >
                class Control,
                std::size_t... Ns,
                typename Input,
                typename... States >
      [[nodiscard]] static bool match( std::index_sequence< Ns... > /*unused*/, Input& in, States&&... st )
      {
         auto t = std::tie( st... );
         if( TAO_JSON_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, std::get< Ns >( t )... ) ) {
            if constexpr( A == apply_mode::action ) {
               Action< Rule >::success( static_cast< const Input& >( in ), st... );
            }
            return true;
         }
         return false;
      }

      template< typename Rule,
                apply_mode A,
                rewind_mode M,
                template< typename... >
                class Action,
                template< typename... >
                class Control,
                typename Input,
                typename... States >
      [[nodiscard]] static bool match( Input& in, States&&... st )
      {
         return match< Rule, A, M, Action, Control >( std::index_sequence_for< NewStates... >(), in, NewStates()..., st... );
      }
   };

}  // namespace TAO_JSON_PEGTL_NAMESPACE

#endif

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
couchbase-3.0.0.alpha.1-x86_64-linux ext/third_party/json/include/tao/json/external/pegtl/change_states.hpp
couchbase-3.0.0.alpha.1-x86_64-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/change_states.hpp
couchbase-3.0.0.alpha.1-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/change_states.hpp
couchbase-3.0.0.alpha.1 ext/third_party/json/include/tao/json/external/pegtl/change_states.hpp