/*============================================================================= Copyright (c) 2001-2010 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) =============================================================================*/ #include #include #include #include #include #include #include #include #include #include #include #include #include "test.hpp" using spirit_test::test; using spirit_test::test_attr; using boost::spirit::int_; using boost::spirit::qi::grammar; using boost::spirit::qi::rule; struct error_handler { template struct result { typedef void type; }; template void operator()(What const& what) const { std::wcout << L"What: " << what << std::endl; } }; struct parser : grammar { parser() : base_type(start) { typedef boost::phoenix::function error_handler_function; using boost::spirit::qi::_4; using boost::spirit::qi::fail; using boost::spirit::qi::on_error; start = int_; on_error(start, error_handler_function(error_handler()) (_4)); } rule start; }; int main() { { parser p; BOOST_TEST(test("123", p)); } return boost::report_errors(); }