/src/Fast-DDS/thirdparty/taocpp-pegtl/pegtl/parse_error.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2014-2020 Dr. Colin Hirsch and Daniel Frey |
2 | | // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ |
3 | | |
4 | | #ifndef TAO_PEGTL_PARSE_ERROR_HPP |
5 | | #define TAO_PEGTL_PARSE_ERROR_HPP |
6 | | |
7 | | #include <stdexcept> |
8 | | #include <vector> |
9 | | |
10 | | #include "config.hpp" |
11 | | #include "position.hpp" |
12 | | |
13 | | namespace tao |
14 | | { |
15 | | namespace TAO_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 | 0 | { |
24 | 0 | } |
25 | | |
26 | | template< typename Input > |
27 | | parse_error( const std::string& msg, const Input& in ) |
28 | 0 | : parse_error( msg, in.position() ) |
29 | 0 | { |
30 | 0 | } |
31 | | |
32 | | parse_error( const std::string& msg, const position& pos ) |
33 | 0 | : std::runtime_error( to_string( pos ) + ": " + msg ), |
34 | 0 | positions( 1, pos ) |
35 | 0 | { |
36 | 0 | } |
37 | | |
38 | | parse_error( const std::string& msg, position&& pos ) |
39 | 0 | : std::runtime_error( to_string( pos ) + ": " + msg ) |
40 | 0 | { |
41 | 0 | positions.emplace_back( std::move( pos ) ); |
42 | 0 | } |
43 | | |
44 | | std::vector< position > positions; |
45 | | }; |
46 | | |
47 | | } // namespace TAO_PEGTL_NAMESPACE |
48 | | |
49 | | } // namespace tao |
50 | | |
51 | | #endif |