blob: 577870e49c84b3dd380afd61759b5665f3b1d943 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright (c) 2015-2017 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/
#ifndef TAOCPP_PEGTL_INCLUDE_INTERNAL_BUMP_UTIL_HPP
#define TAOCPP_PEGTL_INCLUDE_INTERNAL_BUMP_UTIL_HPP
#include <cstddef>
#include <type_traits>
#include "../config.hpp"
#include "result_on_found.hpp"
namespace tao
{
namespace TAOCPP_PEGTL_NAMESPACE
{
namespace internal
{
template< bool >
struct bump_impl;
template<>
struct bump_impl< true >
{
template< typename Input >
static void bump( Input& in, const std::size_t count ) noexcept
{
in.bump( count );
}
};
template<>
struct bump_impl< false >
{
template< typename Input >
static void bump( Input& in, const std::size_t count ) noexcept
{
in.bump_in_this_line( count );
}
};
template< bool... >
struct bool_list
{
};
template< bool... Bs >
using bool_and = std::is_same< bool_list< Bs..., true >, bool_list< true, Bs... > >;
template< result_on_found R, typename Input, typename Char, Char... Cs >
void bump_help( Input& in, const std::size_t count ) noexcept
{
using eol_t = typename Input::eol_t;
bump_impl< bool_and< ( Cs != eol_t::ch )... >::value != bool( R ) >::bump( in, count );
}
} // namespace internal
} // namespace TAOCPP_PEGTL_NAMESPACE
} // namespace tao
#endif
|