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_for.hpp> 11 12 extern bool fun(); 13 14 struct ftor 15 { 16 bool operator ()() const; 17 }; 18 19 extern void init_fun(); 20 21 struct init_ftor 22 { 23 void operator()() const; 24 }; 25 26 extern void step_fun(); 27 28 struct step_ftor 29 { 30 void operator()() const; 31 }; 32 33 extern bool cmp_fun(); 34 35 struct cmp_ftor 36 { 37 bool operator()() const; 38 }; 39 40 int main()41main() 42 { 43 ////////////////////////////////// 44 // compile time check wether as_parser<> works for for_p 45 46 ::BOOST_SPIRIT_CLASSIC_NS::rule<> r; 47 48 r = BOOST_SPIRIT_CLASSIC_NS::for_p(&init_fun, &cmp_fun, &step_fun)['-']; 49 r = BOOST_SPIRIT_CLASSIC_NS::for_p(init_ftor(), cmp_ftor(), step_ftor())["-"]; 50 51 r = BOOST_SPIRIT_CLASSIC_NS::for_p(init_ftor(), r, step_ftor())[r]; 52 } 53