| 1 | #define BOOST_SPIRIT_USE_PHOENIX_V3
|
|---|
| 2 | #include "boost/version.hpp"
|
|---|
| 3 | #if ( BOOST_VERSION < 105100 )
|
|---|
| 4 | #define BOOST_NO_SCOPED_ENUMS
|
|---|
| 5 | #else
|
|---|
| 6 | #define BOOST_NO_CXX11_SCOPED_ENUMS
|
|---|
| 7 | #endif
|
|---|
| 8 |
|
|---|
| 9 | #include "boost/filesystem.hpp"
|
|---|
| 10 | #include <boost/filesystem/path.hpp>
|
|---|
| 11 | #include <boost/filesystem/operations.hpp>
|
|---|
| 12 |
|
|---|
| 13 | //#include "boost/assign.hpp"
|
|---|
| 14 | #include <boost/assign/list_of.hpp>
|
|---|
| 15 | #include <boost/assign/ptr_map_inserter.hpp>
|
|---|
| 16 |
|
|---|
| 17 | #include "boost/format.hpp"
|
|---|
| 18 | #include <boost/tokenizer.hpp>
|
|---|
| 19 | #include "boost/regex.hpp"
|
|---|
| 20 | #include "boost/lexical_cast.hpp"
|
|---|
| 21 | #include <boost/algorithm/string.hpp>
|
|---|
| 22 | #include "boost/date_time.hpp"
|
|---|
| 23 |
|
|---|
| 24 | #include "boost/concept_check.hpp"
|
|---|
| 25 | #include "boost/utility.hpp"
|
|---|
| 26 |
|
|---|
| 27 | #include "boost/ptr_container/ptr_vector.hpp"
|
|---|
| 28 | #include "boost/ptr_container/ptr_map.hpp"
|
|---|
| 29 |
|
|---|
| 30 | #include "boost/shared_ptr.hpp"
|
|---|
| 31 |
|
|---|
| 32 | #include "boost/foreach.hpp"
|
|---|
| 33 |
|
|---|
| 34 | #include <boost/graph/graph_concepts.hpp>
|
|---|
| 35 | #include <boost/graph/buffer_concepts.hpp>
|
|---|
| 36 |
|
|---|
| 37 | #include <boost/fusion/include/std_pair.hpp>
|
|---|
| 38 | #include "boost/tuple/tuple.hpp"
|
|---|
| 39 | #include "boost/fusion/tuple.hpp"
|
|---|
| 40 | #include "boost/variant.hpp"
|
|---|
| 41 | #include "boost/variant/recursive_variant.hpp"
|
|---|
| 42 | #include <boost/fusion/adapted/boost_tuple.hpp>
|
|---|
| 43 | #include <boost/fusion/adapted.hpp>
|
|---|
| 44 |
|
|---|
| 45 | #include "boost/thread.hpp"
|
|---|
| 46 |
|
|---|
| 47 | #include <boost/fusion/adapted.hpp>
|
|---|
| 48 | #include <boost/phoenix/fusion.hpp>
|
|---|
| 49 | #include <boost/spirit/include/phoenix.hpp>
|
|---|
| 50 | #include <boost/phoenix/function.hpp>
|
|---|
| 51 | #include <boost/spirit/include/qi.hpp>
|
|---|
| 52 | namespace qi = boost::spirit::qi;
|
|---|
| 53 | //namespace repo = boost::spirit::repository;
|
|---|
| 54 | namespace phx = boost::phoenix;
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 | typedef boost::fusion::vector3<double,double,double> MyList;
|
|---|
| 58 |
|
|---|
| 59 | class TestClass
|
|---|
| 60 | {
|
|---|
| 61 | public:
|
|---|
| 62 | TestClass
|
|---|
| 63 | (
|
|---|
| 64 | double a,
|
|---|
| 65 | double b,
|
|---|
| 66 | int p3, double p4,
|
|---|
| 67 | MyList ap,
|
|---|
| 68 | MyList bp
|
|---|
| 69 | )
|
|---|
| 70 | {}
|
|---|
| 71 | };
|
|---|
| 72 |
|
|---|
| 73 | typedef boost::shared_ptr<TestClass> Result;
|
|---|
| 74 |
|
|---|
| 75 | int main(int argc, char* argv[])
|
|---|
| 76 | {
|
|---|
| 77 |
|
|---|
| 78 | qi::rule<std::string::iterator, Result(), qi::space_type> testrule;
|
|---|
| 79 | // testrule = qi::double_ >> ( qi::int_ | qi::attr(1) );
|
|---|
| 80 | testrule = ( '('
|
|---|
| 81 | >> qi::double_ >> qi::hold[ ( (( qi::lit("ext") >> qi::double_ ) | qi::attr((0.0)))
|
|---|
| 82 | >> (( qi::lit("vmiter") >> qi::double_ ) | qi::attr((0.0)))
|
|---|
| 83 | >> (( qi::lit("hmiter") >> qi::double_ ) | qi::attr((0.0))) ) ]
|
|---|
| 84 | >> ','
|
|---|
| 85 | >> qi::double_ >> qi::hold[ ( (( qi::lit("ext") >> qi::double_ ) | qi::attr((0.0)))
|
|---|
| 86 | >> (( qi::lit("vmiter") >> qi::double_ ) | qi::attr((0.0)))
|
|---|
| 87 | >> (( qi::lit("hmiter") >> qi::double_ ) | qi::attr((0.0))) ) ]
|
|---|
| 88 | >> ','
|
|---|
| 89 | >> qi::int_ >> ','
|
|---|
| 90 | >> qi::double_
|
|---|
| 91 | >>')' )
|
|---|
| 92 | [ qi::_val = phx::construct<Result>(phx::new_<TestClass>(qi::_1, qi::_3,
|
|---|
| 93 | qi::_5, qi::_6,
|
|---|
| 94 | qi::_2, qi::_4)) ]
|
|---|
| 95 | ;
|
|---|
| 96 | return 0;
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|