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/include/classic_core.hpp>
10 #include <boost/spirit/include/classic_while.hpp>
11 
12 extern bool fun();
13 
14 struct ftor
15 {
16     bool operator()() const;
17 };
18 
19 int
main()20 main()
21 {
22     //////////////////////////////////
23     // compile time check wether as_parser<> works for while_p
24 
25     ::BOOST_SPIRIT_CLASSIC_NS::rule<> r;
26 
27     r = ::BOOST_SPIRIT_CLASSIC_NS::while_p('-')['-'];
28     r = ::BOOST_SPIRIT_CLASSIC_NS::while_p("-")["-"];
29 
30     r = ::BOOST_SPIRIT_CLASSIC_NS::while_p(&fun)["foo"];
31     r = ::BOOST_SPIRIT_CLASSIC_NS::while_p(ftor())["foo"];
32 
33     r = ::BOOST_SPIRIT_CLASSIC_NS::while_p(r)[r];
34 
35     r = ::BOOST_SPIRIT_CLASSIC_NS::do_p['-'].while_p('-');
36     r = ::BOOST_SPIRIT_CLASSIC_NS::do_p["-"].while_p("-");
37 
38     r = ::BOOST_SPIRIT_CLASSIC_NS::do_p["foo"].while_p(&fun);
39     r = ::BOOST_SPIRIT_CLASSIC_NS::do_p["foo"].while_p(ftor());
40 
41     r = ::BOOST_SPIRIT_CLASSIC_NS::do_p[r].while_p(r);
42 }
43