Skip to content

Commit

Permalink
Update embedded PEGTL
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Sep 3, 2019
1 parent 0411b42 commit 6bdd4c4
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions include/tao/json/external/pegtl/internal/one.hpp
Expand Up @@ -4,8 +4,7 @@
#ifndef TAO_JSON_PEGTL_INTERNAL_ONE_HPP
#define TAO_JSON_PEGTL_INTERNAL_ONE_HPP

#include <algorithm>
#include <utility>
#include <cstddef>

#include "../config.hpp"

Expand All @@ -17,12 +16,6 @@

namespace TAO_JSON_PEGTL_NAMESPACE::internal
{
template< typename Char >
[[nodiscard]] bool contains( const Char c, const std::initializer_list< Char >& l ) noexcept
{
return std::find( l.begin(), l.end(), c ) != l.end();
}

template< result_on_found R, typename Peek, typename Peek::data_t... Cs >
struct one
{
Expand All @@ -33,7 +26,7 @@ namespace TAO_JSON_PEGTL_NAMESPACE::internal
{
if( const std::size_t s = in.size( Peek::max_input_size ); s >= Peek::min_input_size ) {
if( const auto t = Peek::peek( in, s ) ) {
if( contains( t.data, { Cs... } ) == bool( R ) ) {
if( ( ( t.data == Cs ) || ... ) == bool( R ) ) {
bump_help< R, Input, typename Peek::data_t, Cs... >( in, t.size );
return true;
}
Expand All @@ -43,26 +36,6 @@ namespace TAO_JSON_PEGTL_NAMESPACE::internal
}
};

template< result_on_found R, typename Peek, typename Peek::data_t C >
struct one< R, Peek, C >
{
using analyze_t = analysis::generic< analysis::rule_type::any >;

template< typename Input >
[[nodiscard]] static bool match( Input& in ) noexcept( noexcept( in.size( Peek::max_input_size ) ) )
{
if( const std::size_t s = in.size( Peek::max_input_size ); s >= Peek::min_input_size ) {
if( const auto t = Peek::peek( in, s ) ) {
if( ( t.data == C ) == bool( R ) ) {
bump_help< R, Input, typename Peek::data_t, C >( in, t.size );
return true;
}
}
}
return false;
}
};

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

Expand Down

0 comments on commit 6bdd4c4

Please sign in to comment.