aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/pegtl/internal/range.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'MoonParser/pegtl/internal/range.hpp')
-rw-r--r--MoonParser/pegtl/internal/range.hpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/MoonParser/pegtl/internal/range.hpp b/MoonParser/pegtl/internal/range.hpp
new file mode 100644
index 0000000..227595f
--- /dev/null
+++ b/MoonParser/pegtl/internal/range.hpp
@@ -0,0 +1,60 @@
1// Copyright (c) 2014-2017 Dr. Colin Hirsch and Daniel Frey
2// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/
3
4#ifndef TAOCPP_PEGTL_INCLUDE_INTERNAL_RANGE_HPP
5#define TAOCPP_PEGTL_INCLUDE_INTERNAL_RANGE_HPP
6
7#include "../config.hpp"
8
9#include "bump_help.hpp"
10#include "result_on_found.hpp"
11#include "skip_control.hpp"
12
13#include "../analysis/generic.hpp"
14
15namespace tao
16{
17 namespace TAOCPP_PEGTL_NAMESPACE
18 {
19 namespace internal
20 {
21 template< result_on_found R, typename Peek, typename Peek::data_t Lo, typename Peek::data_t Hi >
22 struct range
23 {
24 using analyze_t = analysis::generic< analysis::rule_type::ANY >;
25
26 template< int Eol >
27 struct can_match_eol
28 {
29 static constexpr bool value = ( ( ( Lo <= Eol ) && ( Eol <= Hi ) ) == bool( R ) );
30 };
31
32 template< typename Input >
33 static bool match( Input& in )
34 {
35 using eol_t = typename Input::eol_t;
36
37 if( !in.empty() ) {
38 if( const auto t = Peek::peek( in ) ) {
39 if( ( ( Lo <= t.data ) && ( t.data <= Hi ) ) == bool( R ) ) {
40 bump_impl< can_match_eol< eol_t::ch >::value >::bump( in, t.size );
41 return true;
42 }
43 }
44 }
45 return false;
46 }
47 };
48
49 template< result_on_found R, typename Peek, typename Peek::data_t Lo, typename Peek::data_t Hi >
50 struct skip_control< range< R, Peek, Lo, Hi > > : std::true_type
51 {
52 };
53
54 } // namespace internal
55
56 } // namespace TAOCPP_PEGTL_NAMESPACE
57
58} // namespace tao
59
60#endif