Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/spirit/test/grammar_multi_instance_tst.cpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.0 KB
Line 
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/core.hpp>
12
13using namespace boost::spirit;
14using namespace std;
15
16int g_count = 0;
17
18struct g : public grammar<g>
19{
20    template <typename ScannerT>
21    struct definition
22    {
23        definition(g const& self)
24        {
25            g_count++;
26        }
27
28        rule<ScannerT> r;
29        rule<ScannerT> const& start() const { return r; }
30    };
31};
32
33void
34grammar_tests()
35{
36    g my_g;
37    parse("", my_g);
38}
39
40int
41main()
42{
43    grammar_tests();
44    grammar_tests();
45    grammar_tests();
46    BOOST_TEST(g_count == 3);
47
48    return boost::report_errors();
49}
50
Note: See TracBrowser for help on using the repository browser.