aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/pegtl/parse_error.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'MoonParser/pegtl/parse_error.hpp')
-rw-r--r--MoonParser/pegtl/parse_error.hpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/MoonParser/pegtl/parse_error.hpp b/MoonParser/pegtl/parse_error.hpp
new file mode 100644
index 0000000..e015efb
--- /dev/null
+++ b/MoonParser/pegtl/parse_error.hpp
@@ -0,0 +1,45 @@
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_PARSE_ERROR_HPP
5#define TAOCPP_PEGTL_INCLUDE_PARSE_ERROR_HPP
6
7#include <stdexcept>
8#include <vector>
9
10#include "config.hpp"
11#include "position.hpp"
12
13namespace tao
14{
15 namespace TAOCPP_PEGTL_NAMESPACE
16 {
17 struct parse_error
18 : public std::runtime_error
19 {
20 parse_error( const std::string& msg, std::vector< position >&& in_positions )
21 : std::runtime_error( msg ),
22 positions( std::move( in_positions ) )
23 {
24 }
25
26 template< typename Input >
27 parse_error( const std::string& msg, const Input& in )
28 : parse_error( msg, in.position() )
29 {
30 }
31
32 parse_error( const std::string& msg, const position& pos )
33 : std::runtime_error( to_string( pos ) + ": " + msg ),
34 positions( 1, pos )
35 {
36 }
37
38 std::vector< position > positions;
39 };
40
41 } // namespace TAOCPP_PEGTL_NAMESPACE
42
43} // namespace tao
44
45#endif