1 /*=============================================================================
2 Copyright (c) 2019 Nikita Kniazev
4 Use, modification and distribution is subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
9 #include <boost/spirit/home/x3.hpp>
11 // Check that `BOOST_SPIRIT_INSTANTIATE` instantiates `parse_rule` with proper
12 // types when a rule has no attribute.
14 namespace unused_attr {
16 namespace x3 = boost::spirit::x3;
18 // skipper must has no attribute, checks `parse` and `skip_over`
19 using skipper_type = x3::rule<class skipper_r>;
20 const skipper_type skipper;
21 BOOST_SPIRIT_DECLARE(skipper_type)
23 // the `unused_type const` must have the same effect as no attribute
24 using skipper2_type = x3::rule<class skipper2_r, x3::unused_type const>;
25 const skipper2_type skipper2;
26 BOOST_SPIRIT_DECLARE(skipper2_type)
28 // grammar must has no attribute, checks `parse` and `phrase_parse`
29 using grammar_type = x3::rule<class grammar_r>;
30 const grammar_type grammar;
31 BOOST_SPIRIT_DECLARE(grammar_type)
35 // Check instantiation when rule has an attribute.
39 namespace x3 = boost::spirit::x3;
41 using skipper_type = x3::rule<class skipper_r>;
42 const skipper_type skipper;
43 BOOST_SPIRIT_DECLARE(skipper_type)
45 using grammar_type = x3::rule<class grammar_r, int, true>;
46 const grammar_type grammar;
47 BOOST_SPIRIT_DECLARE(grammar_type)