aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/pegtl/internal/action_input.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--MoonParser/pegtl/internal/action_input.hpp108
1 files changed, 0 insertions, 108 deletions
diff --git a/MoonParser/pegtl/internal/action_input.hpp b/MoonParser/pegtl/internal/action_input.hpp
deleted file mode 100644
index db48950..0000000
--- a/MoonParser/pegtl/internal/action_input.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
1// Copyright (c) 2016-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_ACTION_INPUT_HPP
5#define TAOCPP_PEGTL_INCLUDE_INTERNAL_ACTION_INPUT_HPP
6
7#include <cstddef>
8#include <string>
9
10#include "iterator.hpp"
11
12#include "../config.hpp"
13#include "../position.hpp"
14
15namespace tao
16{
17 namespace TAOCPP_PEGTL_NAMESPACE
18 {
19 namespace internal
20 {
21 inline const char* begin_c_ptr( const char* p ) noexcept
22 {
23 return p;
24 }
25
26 inline const char* begin_c_ptr( const iterator& it ) noexcept
27 {
28 return it.data;
29 }
30
31 template< typename Input >
32 class action_input
33 {
34 public:
35 using input_t = Input;
36 using iterator_t = typename Input::iterator_t;
37
38 action_input( const iterator_t& in_begin, const Input& in_input ) noexcept
39 : m_begin( in_begin ),
40 m_input( in_input )
41 {
42 }
43
44 action_input( const action_input& ) = delete;
45 action_input& operator=( const action_input& ) = delete;
46
47 const iterator_t& iterator() const noexcept
48 {
49 return m_begin;
50 }
51
52 const Input& input() const noexcept
53 {
54 return m_input;
55 }
56
57 const char* begin() const noexcept
58 {
59 return begin_c_ptr( iterator() );
60 }
61
62 const char* end() const noexcept
63 {
64 return input().current();
65 }
66
67 bool empty() const noexcept
68 {
69 return begin() == end();
70 }
71
72 std::size_t size() const noexcept
73 {
74 return std::size_t( end() - begin() );
75 }
76
77 std::string string() const
78 {
79 return std::string( begin(), end() );
80 }
81
82 char peek_char( const std::size_t offset = 0 ) const noexcept
83 {
84 return begin()[ offset ];
85 }
86
87 unsigned char peek_byte( const std::size_t offset = 0 ) const noexcept
88 {
89 return static_cast< unsigned char >( peek_char( offset ) );
90 }
91
92 TAOCPP_PEGTL_NAMESPACE::position position() const noexcept
93 {
94 return input().position( iterator() ); // NOTE: Not efficient with LAZY inputs.
95 }
96
97 protected:
98 const iterator_t m_begin;
99 const Input& m_input;
100 };
101
102 } // namespace internal
103
104 } // namespace TAOCPP_PEGTL_NAMESPACE
105
106} // namespace tao
107
108#endif