-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patherror_handler.hpp
33 lines (25 loc) · 1.22 KB
/
error_handler.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*=============================================================================
Copyright (c) 2001-2015 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SQL_TEXT_PARSER_ERROR_HANDLER_HPP
#define SQL_TEXT_PARSER_ERROR_HANDLER_HPP
#include <boost/spirit/home/x3.hpp>
#include <boost/spirit/home/x3/support/utility/error_reporting.hpp>
namespace sql { namespace text {
struct error_handler_base {
template <typename Iterator, typename Exception, typename Context>
boost::spirit::x3::error_handler_result
on_error(Iterator& first, Iterator const& last, Exception const& x,
Context const& context) {
auto& error_handler =
boost::spirit::x3::get<boost::spirit::x3::error_handler_tag>
(context).get();
error_handler(x.where(),
"Error! Expecting: " + x.which() + " here:");
return boost::spirit::x3::error_handler_result::fail;
}
};
}}
#endif //SQL_TEXT_PARSER_ERROR_HANDLER_HPP