aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/pegtl/internal/apply0.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'MoonParser/pegtl/internal/apply0.hpp')
-rw-r--r--MoonParser/pegtl/internal/apply0.hpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/MoonParser/pegtl/internal/apply0.hpp b/MoonParser/pegtl/internal/apply0.hpp
new file mode 100644
index 0000000..c8aa7aa
--- /dev/null
+++ b/MoonParser/pegtl/internal/apply0.hpp
@@ -0,0 +1,77 @@
1// Copyright (c) 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_APPLY0_HPP
5#define TAOCPP_PEGTL_INCLUDE_INTERNAL_APPLY0_HPP
6
7#include "../config.hpp"
8
9#include "skip_control.hpp"
10#include "trivial.hpp"
11
12#include "../analysis/counted.hpp"
13
14namespace tao
15{
16 namespace TAOCPP_PEGTL_NAMESPACE
17 {
18 namespace internal
19 {
20 template< apply_mode A, typename... Actions >
21 struct apply0_impl;
22
23 template< typename... Actions >
24 struct apply0_impl< apply_mode::ACTION, Actions... >
25 {
26 template< typename... States >
27 static bool match( States&&... st )
28 {
29#ifdef __cpp_fold_expressions
30 ( Actions::apply0( st... ), ... );
31#else
32 using swallow = bool[];
33 (void)swallow{ ( Actions::apply0( st... ), true )..., true };
34#endif
35 return true;
36 }
37 };
38
39 template< typename... Actions >
40 struct apply0_impl< apply_mode::NOTHING, Actions... >
41 {
42 template< typename... States >
43 static bool match( States&&... )
44 {
45 return true;
46 }
47 };
48
49 template< typename... Actions >
50 struct apply0
51 {
52 using analyze_t = analysis::counted< analysis::rule_type::ANY, 0 >;
53
54 template< apply_mode A,
55 rewind_mode M,
56 template< typename... > class Action,
57 template< typename... > class Control,
58 typename Input,
59 typename... States >
60 static bool match( Input&, States&&... st )
61 {
62 return apply0_impl< A, Actions... >::match( st... );
63 }
64 };
65
66 template< typename... Actions >
67 struct skip_control< apply0< Actions... > > : std::true_type
68 {
69 };
70
71 } // namespace internal
72
73 } // namespace TAOCPP_PEGTL_NAMESPACE
74
75} // namespace tao
76
77#endif