aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/pegtl/input_error.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'MoonParser/pegtl/input_error.hpp')
-rw-r--r--MoonParser/pegtl/input_error.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/MoonParser/pegtl/input_error.hpp b/MoonParser/pegtl/input_error.hpp
new file mode 100644
index 0000000..605ce4d
--- /dev/null
+++ b/MoonParser/pegtl/input_error.hpp
@@ -0,0 +1,41 @@
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_INPUT_ERROR_HPP
5#define TAOCPP_PEGTL_INCLUDE_INPUT_ERROR_HPP
6
7#include <cerrno>
8#include <sstream>
9#include <stdexcept>
10
11#include "config.hpp"
12
13namespace tao
14{
15 namespace TAOCPP_PEGTL_NAMESPACE
16 {
17 struct input_error
18 : std::runtime_error
19 {
20 input_error( const std::string& message, const int in_errorno )
21 : std::runtime_error( message ),
22 errorno( in_errorno )
23 {
24 }
25
26 int errorno;
27 };
28
29 } // namespace TAOCPP_PEGTL_NAMESPACE
30
31} // namespace tao
32
33#define TAOCPP_PEGTL_THROW_INPUT_ERROR( MESSAGE ) \
34 do { \
35 const int errorno = errno; \
36 std::ostringstream oss; \
37 oss << "pegtl: " << MESSAGE << " errno " << errorno; \
38 throw tao::TAOCPP_PEGTL_NAMESPACE::input_error( oss.str(), errorno ); \
39 } while( false )
40
41#endif