aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/pegtl/internal/any.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'MoonParser/pegtl/internal/any.hpp')
-rw-r--r--MoonParser/pegtl/internal/any.hpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/MoonParser/pegtl/internal/any.hpp b/MoonParser/pegtl/internal/any.hpp
new file mode 100644
index 0000000..aebe239
--- /dev/null
+++ b/MoonParser/pegtl/internal/any.hpp
@@ -0,0 +1,68 @@
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_ANY_HPP
5#define TAOCPP_PEGTL_INCLUDE_INTERNAL_ANY_HPP
6
7#include "../config.hpp"
8
9#include "peek_char.hpp"
10#include "skip_control.hpp"
11
12#include "../analysis/generic.hpp"
13
14namespace tao
15{
16 namespace TAOCPP_PEGTL_NAMESPACE
17 {
18 namespace internal
19 {
20 template< typename Peek >
21 struct any;
22
23 template<>
24 struct any< peek_char >
25 {
26 using analyze_t = analysis::generic< analysis::rule_type::ANY >;
27
28 template< typename Input >
29 static bool match( Input& in )
30 {
31 if( !in.empty() ) {
32 in.bump();
33 return true;
34 }
35 return false;
36 }
37 };
38
39 template< typename Peek >
40 struct any
41 {
42 using analyze_t = analysis::generic< analysis::rule_type::ANY >;
43
44 template< typename Input >
45 static bool match( Input& in )
46 {
47 if( !in.empty() ) {
48 if( const auto t = Peek::peek( in ) ) {
49 in.bump( t.size );
50 return true;
51 }
52 }
53 return false;
54 }
55 };
56
57 template< typename Peek >
58 struct skip_control< any< Peek > > : std::true_type
59 {
60 };
61
62 } // namespace internal
63
64 } // namespace TAOCPP_PEGTL_NAMESPACE
65
66} // namespace tao
67
68#endif