• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2019 Nikita Kniazev
3 
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 =============================================================================*/
8 
9 #include <boost/spirit/home/x3.hpp>
10 
11 // Check that `BOOST_SPIRIT_INSTANTIATE` instantiates `parse_rule` with proper
12 // types when a rule has no attribute.
13 
14 namespace unused_attr {
15 
16 namespace x3 = boost::spirit::x3;
17 
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)
22 
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)
27 
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)
32 
33 }
34 
35 // Check instantiation when rule has an attribute.
36 
37 namespace used_attr {
38 
39 namespace x3 = boost::spirit::x3;
40 
41 using skipper_type = x3::rule<class skipper_r>;
42 const skipper_type skipper;
43 BOOST_SPIRIT_DECLARE(skipper_type)
44 
45 using grammar_type = x3::rule<class grammar_r, int>;
46 const grammar_type grammar;
47 BOOST_SPIRIT_DECLARE(grammar_type)
48 
49 }
50