]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2004 Joel de Guzman | |
3 | http://spirit.sourceforge.net/ | |
4 | ||
5 | Use, modification and distribution is subject to the Boost Software | |
6 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
7 | http://www.boost.org/LICENSE_1_0.txt) | |
8 | =============================================================================*/ | |
9 | #include <iostream> | |
10 | #include <boost/detail/lightweight_test.hpp> | |
11 | #include <boost/spirit/include/classic_core.hpp> | |
12 | ||
13 | using namespace BOOST_SPIRIT_CLASSIC_NS; | |
14 | using namespace std; | |
15 | ||
16 | int g_count = 0; | |
17 | ||
18 | struct g : public grammar<g> | |
19 | { | |
20 | template <typename ScannerT> | |
21 | struct definition | |
22 | { | |
11fdf7f2 | 23 | definition(g const& /*self*/) |
7c673cae FG |
24 | { |
25 | g_count++; | |
26 | } | |
27 | ||
28 | rule<ScannerT> r; | |
29 | rule<ScannerT> const& start() const { return r; } | |
30 | }; | |
31 | }; | |
32 | ||
33 | void | |
34 | grammar_tests() | |
35 | { | |
36 | g my_g; | |
37 | parse("", my_g); | |
38 | } | |
39 | ||
40 | int | |
41 | main() | |
42 | { | |
43 | grammar_tests(); | |
44 | grammar_tests(); | |
45 | grammar_tests(); | |
46 | BOOST_TEST(g_count == 3); | |
47 | ||
48 | return boost::report_errors(); | |
49 | } | |
50 |