Sha256: b1295c8ff1b30bd7b7421440920e68dcfe00901077aaa2042dfd0b77de2919e4

Contents?: true

Size: 1.65 KB

Versions: 11

Compression:

Stored size: 1.65 KB

Contents

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

#ifndef TAO_PEGTL_INTERNAL_ONE_HPP
#define TAO_PEGTL_INTERNAL_ONE_HPP

#include <cstddef>

#include "../config.hpp"

#include "any.hpp"
#include "bump_help.hpp"
#include "enable_control.hpp"
#include "failure.hpp"
#include "result_on_found.hpp"

#include "../type_list.hpp"

namespace TAO_PEGTL_NAMESPACE::internal
{
   template< result_on_found R, typename Peek, typename Peek::data_t... Cs >
   struct one
   {
      using peek_t = Peek;
      using data_t = typename Peek::data_t;

      using rule_t = one;
      using subs_t = empty_list;

      [[nodiscard]] static constexpr bool test( const data_t c ) noexcept
      {
         return ( ( c == Cs ) || ... ) == bool( R );
      }

      template< int Eol >
      static constexpr bool can_match_eol = test( Eol );

      template< typename ParseInput >
      [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( Peek::peek( in ) ) )
      {
         if( const auto t = Peek::peek( in ) ) {
            if( test( t.data ) ) {
               bump_help< one >( in, t.size );
               return true;
            }
         }
         return false;
      }
   };

   template< typename Peek >
   struct one< result_on_found::success, Peek >
      : failure
   {};

   template< typename Peek >
   struct one< result_on_found::failure, Peek >
      : any< Peek >
   {};

   template< result_on_found R, typename Peek, typename Peek::data_t... Cs >
   inline constexpr bool enable_control< one< R, Peek, Cs... > > = false;

}  // namespace TAO_PEGTL_NAMESPACE::internal

#endif

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
couchbase-3.5.4 ext/cache/json/4c7c23ac69aa1d72b3a9295ac9aceac10d32d9a1/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.5.3 ext/cache/json/4c7c23ac69aa1d72b3a9295ac9aceac10d32d9a1/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.5.2 ext/cache/json/4c7c23ac69aa1d72b3a9295ac9aceac10d32d9a1/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.5.1 ext/cache/json/4c7c23ac69aa1d72b3a9295ac9aceac10d32d9a1/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.5.0 ext/cache/json/4c7c23ac69aa1d72b3a9295ac9aceac10d32d9a1/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.4.5 ext/couchbase/third_party/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.4.4 ext/couchbase/third_party/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.4.3 ext/couchbase/third_party/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.4.2 ext/couchbase/third_party/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.4.1 ext/couchbase/third_party/json/external/PEGTL/include/tao/pegtl/internal/one.hpp
couchbase-3.4.0 ext/couchbase/third_party/json/external/PEGTL/include/tao/pegtl/internal/one.hpp