1 /*=============================================================================
2 Copyright (c) 2001-2011 Hartmut Kaiser
3 Copyright (c) 2011 Bryce Lelbach
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(BOOST_SPIRIT_TEST_QI_BOOL)
9 #define BOOST_SPIRIT_TEST_QI_BOOL
11 #include <boost/spirit/home/x3.hpp>
14 ///////////////////////////////////////////////////////////////////////////////
15 struct backwards_bool_policies : boost::spirit::x3::bool_policies<>
17 // we want to interpret a 'true' spelled backwards as 'false'
18 template <typename Iterator, typename Attribute, typename CaseCompare>
20 parse_false(Iterator& first, Iterator const& last, Attribute& attr, CaseCompare const& case_compare)
22 namespace spirit = boost::spirit;
23 namespace x3 = boost::spirit::x3;
24 if (x3::detail::string_parse("eurt", first, last, x3::unused, case_compare))
26 x3::traits::move_to(false, attr); // result is false
33 ///////////////////////////////////////////////////////////////////////////////
36 test_bool_type(bool b = false) : b(b) {} // provide conversion