/*============================================================================= Copyright (c) 2001-2014 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) =============================================================================*/ #if !defined(BOOST_SPIRIT_X3_CALC9_ERROR_HANDLER_HPP) #define BOOST_SPIRIT_X3_CALC9_ERROR_HANDLER_HPP #include #include #include #include "expression.hpp" #include "statement.hpp" namespace client { namespace parser { namespace x3 = boost::spirit::x3; //////////////////////////////////////////////////////////////////////////// // Our error handler //////////////////////////////////////////////////////////////////////////// template using error_handler = x3::error_handler; // tag used to get our error handler from the context using error_handler_tag = x3::error_handler_tag; struct error_handler_base { template x3::error_handler_result on_error( Iterator& first, Iterator const& last , Exception const& x, Context const& context) { std::string message = "Error! Expecting: " + x.which() + " here:"; auto& error_handler = x3::get(context).get(); error_handler(x.where(), message); return x3::error_handler_result::fail; } }; }} #endif