aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/pegtl/internal/istring.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'MoonParser/pegtl/internal/istring.hpp')
-rw-r--r--MoonParser/pegtl/internal/istring.hpp107
1 files changed, 0 insertions, 107 deletions
diff --git a/MoonParser/pegtl/internal/istring.hpp b/MoonParser/pegtl/internal/istring.hpp
deleted file mode 100644
index 3ed2835..0000000
--- a/MoonParser/pegtl/internal/istring.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
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_ISTRING_HPP
5#define TAOCPP_PEGTL_INCLUDE_INTERNAL_ISTRING_HPP
6
7#include <type_traits>
8
9#include "../config.hpp"
10
11#include "bump_help.hpp"
12#include "result_on_found.hpp"
13#include "skip_control.hpp"
14#include "trivial.hpp"
15
16#include "../analysis/counted.hpp"
17
18namespace tao
19{
20 namespace TAOCPP_PEGTL_NAMESPACE
21 {
22 namespace internal
23 {
24 template< char C >
25 using is_alpha = std::integral_constant< bool, ( ( 'a' <= C ) && ( C <= 'z' ) ) || ( ( 'A' <= C ) && ( C <= 'Z' ) ) >;
26
27 template< char C, bool A = is_alpha< C >::value >
28 struct ichar_equal;
29
30 template< char C >
31 struct ichar_equal< C, true >
32 {
33 static bool match( const char c ) noexcept
34 {
35 return ( C | 0x20 ) == ( c | 0x20 );
36 }
37 };
38
39 template< char C >
40 struct ichar_equal< C, false >
41 {
42 static bool match( const char c ) noexcept
43 {
44 return c == C;
45 }
46 };
47
48 template< char... Cs >
49 struct istring_equal;
50
51 template<>
52 struct istring_equal<>
53 {
54 static bool match( const char* ) noexcept
55 {
56 return true;
57 }
58 };
59
60 template< char C, char... Cs >
61 struct istring_equal< C, Cs... >
62 {
63 static bool match( const char* r ) noexcept
64 {
65 return ichar_equal< C >::match( *r ) && istring_equal< Cs... >::match( r + 1 );
66 }
67 };
68
69 template< char... Cs >
70 struct istring;
71
72 template<>
73 struct istring<>
74 : trivial< true >
75 {
76 };
77
78 template< char... Cs >
79 struct istring
80 {
81 using analyze_t = analysis::counted< analysis::rule_type::ANY, sizeof...( Cs ) >;
82
83 template< typename Input >
84 static bool match( Input& in )
85 {
86 if( in.size( sizeof...( Cs ) ) >= sizeof...( Cs ) ) {
87 if( istring_equal< Cs... >::match( in.current() ) ) {
88 bump_help< result_on_found::SUCCESS, Input, char, Cs... >( in, sizeof...( Cs ) );
89 return true;
90 }
91 }
92 return false;
93 }
94 };
95
96 template< char... Cs >
97 struct skip_control< istring< Cs... > > : std::true_type
98 {
99 };
100
101 } // namespace internal
102
103 } // namespace TAOCPP_PEGTL_NAMESPACE
104
105} // namespace tao
106
107#endif