Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/spirit/test/for_p_as_parser_tests.cpp @ 29

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

updated boost from 1_33_1 to 1_34_1

File size: 1.1 KB
Line 
1/*=============================================================================
2    Copyright (c) 2003 Martin Wille
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 <boost/spirit/core.hpp>
10#include <boost/spirit/dynamic/for.hpp>
11
12extern bool fun();
13
14struct ftor
15{
16    bool operator ()() const;
17};
18
19extern void init_fun();
20
21struct init_ftor
22{
23    void operator()() const;
24};
25
26extern void step_fun();
27
28struct step_ftor
29{
30    void operator()() const;
31};
32
33extern bool cmp_fun();
34
35struct cmp_ftor
36{
37    bool operator()() const;
38};
39
40int
41main()
42{
43    //////////////////////////////////
44    // compile time check wether as_parser<> works for for_p
45
46    ::boost::spirit::rule<> r;
47
48    r = boost::spirit::for_p(&init_fun, &cmp_fun, &step_fun)['-'];
49    r = boost::spirit::for_p(init_ftor(), cmp_ftor(), step_ftor())["-"];
50
51    r = boost::spirit::for_p(init_ftor(), r, step_ftor())[r];
52}
Note: See TracBrowser for help on using the repository browser.