Ticket #2488: spirit.patch
File spirit.patch, 78.1 KB (added by , 14 years ago) |
---|
-
home/lex/lexer/meta_grammar.hpp
94 94 // semantic actions for tokens 95 95 meta_grammar::binary_rule< 96 96 lex::domain, proto::tag::subscript, action, 97 token_def_meta_grammar, proto::when<proto::_, proto::_ arg>97 token_def_meta_grammar, proto::when<proto::_, proto::_child> 98 98 >, 99 99 meta_grammar::binary_rule< 100 100 lex::domain, proto::tag::subscript, action, 101 action_lexer_meta_grammar, proto::when<proto::_, proto::_ arg>101 action_lexer_meta_grammar, proto::when<proto::_, proto::_child> 102 102 > 103 103 > 104 104 { -
home/lex/lexer/terminal_holder.hpp
7 7 #if !defined(BOOST_SPIRIT_LEX_TERMINAL_HOLDER_MAR_22_2007_0217PM) 8 8 #define BOOST_SPIRIT_LEX_TERMINAL_HOLDER_MAR_22_2007_0217PM 9 9 10 #include <boost/ xpressive/proto/proto.hpp>10 #include <boost/proto/core.hpp> 11 11 12 12 namespace boost { namespace spirit { namespace lex 13 13 { -
home/lex/set_state.hpp
10 10 #pragma once // MS compatible compilers support #pragma once 11 11 #endif 12 12 13 #include <boost/ xpressive/proto/proto.hpp>13 #include <boost/proto/core.hpp> 14 14 15 15 /////////////////////////////////////////////////////////////////////////////// 16 16 namespace boost { namespace spirit -
home/lex/qi/state/in_state.hpp
10 10 #pragma once // MS compatible compilers support #pragma once 11 11 #endif 12 12 13 #include <boost/ xpressive/proto/proto.hpp>13 #include <boost/proto/core.hpp> 14 14 15 15 /////////////////////////////////////////////////////////////////////////////// 16 16 namespace boost { namespace spirit { namespace qi -
home/lex/qi/state/state_switcher.hpp
142 142 143 143 // the state has to be reset at exit in any case 144 144 detail::reset_state_on_exit<Iterator> guard( 145 first, proto:: arg_c<0>(argument1(component)).name);145 first, proto::child_c<0>(argument1(component)).name); 146 146 147 147 return director::parse(spirit::subject(component), first, 148 148 last, context, skipper, attr); … … 153 153 { 154 154 std::string result("in_state(\""); 155 155 result += spirit::detail::to_narrow_string( 156 proto:: arg_c<0>(argument1(component)).name);156 proto::child_c<0>(argument1(component)).name); 157 157 result += "\")["; 158 158 159 159 typedef typename -
home/lex/qi/utility/plain_token.hpp
11 11 #endif 12 12 13 13 #include <boost/lexical_cast.hpp> 14 #include <boost/ xpressive/proto/proto.hpp>14 #include <boost/proto/core.hpp> 15 15 #include <boost/range/iterator_range.hpp> 16 16 17 17 namespace boost { namespace spirit { namespace qi -
home/qi/binary/meta_grammar.hpp
197 197 struct int_binary_meta_grammar 198 198 : meta_grammar::compose_empty< 199 199 proto::if_< 200 is_int_lit_tag<proto::_ arg, qi::domain>()200 is_int_lit_tag<proto::_child, qi::domain>() 201 201 >, 202 202 qi::domain, 203 203 mpl::identity<extract_literal_bin_director<mpl::_> > … … 209 209 : proto::or_< 210 210 meta_grammar::compose_empty< 211 211 proto::if_< 212 is_binary_tag<proto::_ arg, qi::domain>()212 is_binary_tag<proto::_child, qi::domain>() 213 213 >, 214 214 qi::domain, 215 215 mpl::identity<extract_binary_director<mpl::_> > … … 217 217 meta_grammar::compose_function1_eval< 218 218 proto::function< 219 219 proto::if_< 220 is_binary_tag<proto::_ arg, qi::domain>()220 is_binary_tag<proto::_child, qi::domain>() 221 221 >, 222 222 int_binary_meta_grammar 223 223 >, -
home/qi/nonterminal/nonterminal.hpp
11 11 #include <boost/spirit/home/support/nonterminal/locals.hpp> 12 12 #include <boost/spirit/home/support/argument.hpp> 13 13 14 #include <boost/ xpressive/proto/proto.hpp>14 #include <boost/proto/core.hpp> 15 15 #include <boost/function_types/result_type.hpp> 16 16 #include <boost/function_types/parameter_types.hpp> 17 17 #include <boost/function_types/is_function.hpp> -
home/qi/stream/meta_grammar.hpp
95 95 // stream, wstream 96 96 meta_grammar::compose_empty< 97 97 proto::if_< 98 is_stream_tag<proto::_ arg, qi::domain>()98 is_stream_tag<proto::_child, qi::domain>() 99 99 >, 100 100 qi::domain, 101 101 mpl::identity<extract_stream_director<mpl::_> > -
home/qi/operator/meta_grammar.hpp
99 99 > 100 100 // +a 101 101 , meta_grammar::unary_rule< 102 qi::domain, proto::tag:: posit, plus102 qi::domain, proto::tag::unary_plus, plus 103 103 , main_meta_grammar 104 104 > 105 105 // &a -
home/qi/numeric/meta_grammar.hpp
271 271 /////////////////////////////////////////////////////////////////////////// 272 272 struct int_meta_grammar 273 273 : meta_grammar::compose_empty< 274 proto::if_<is_int_tag<proto::_ arg, qi::domain>()>274 proto::if_<is_int_tag<proto::_child, qi::domain>()> 275 275 , qi::domain 276 276 , mpl::identity<extract_int_director<mpl::_> > 277 277 > … … 279 279 280 280 struct real_meta_grammar 281 281 : meta_grammar::compose_single< 282 proto::if_<is_real_tag<proto::_ arg, qi::domain>()>282 proto::if_<is_real_tag<proto::_child, qi::domain>()> 283 283 , qi::domain 284 284 , mpl::identity<extract_real_director<mpl::_> > 285 285 > -
home/qi/string/meta_grammar.hpp
159 159 , meta_grammar::compose_function1_eval< 160 160 proto::function< 161 161 proto::if_< 162 is_lit_tag<proto::_ arg, qi::domain>()>162 is_lit_tag<proto::_child, qi::domain>()> 163 163 , proto::or_<basic_string_literal_meta_grammar, basic_std_string_meta_grammar> 164 164 > 165 165 , qi::domain … … 170 170 , tag::lit 171 171 , lazy_string 172 172 , proto::if_< 173 detail::is_not_convertible_to_int<proto::_ arg>() >173 detail::is_not_convertible_to_int<proto::_child >() > 174 174 > 175 175 , meta_grammar::terminal_rule< 176 176 qi::domain -
home/qi/string/symbols.hpp
13 13 #include <boost/spirit/home/support/modifier.hpp> 14 14 #include <boost/spirit/home/qi/detail/assign_to.hpp> 15 15 #include <boost/fusion/include/at.hpp> 16 #include <boost/ xpressive/proto/proto.hpp>16 #include <boost/proto/core.hpp> 17 17 #include <boost/shared_ptr.hpp> 18 18 #include <boost/range.hpp> 19 19 #include <boost/type_traits/add_reference.hpp> … … 92 92 : add(*this) 93 93 , remove(*this) 94 94 { 95 proto:: arg(*this).lookup = ptr_type(new Lookup());95 proto::child(*this).lookup = ptr_type(new Lookup()); 96 96 } 97 97 98 98 template <typename Symbols> … … 100 100 : add(*this) 101 101 , remove(*this) 102 102 { 103 proto:: arg(*this).lookup = ptr_type(new Lookup());103 proto::child(*this).lookup = ptr_type(new Lookup()); 104 104 typename range_const_iterator<Symbols>::type si = boost::begin(syms); 105 105 while (si != boost::end(syms)) 106 106 add(*si++); … … 111 111 : add(*this) 112 112 , remove(*this) 113 113 { 114 proto:: arg(*this).lookup = ptr_type(new Lookup());114 proto::child(*this).lookup = ptr_type(new Lookup()); 115 115 typename range_const_iterator<Symbols>::type si = boost::begin(syms); 116 116 typename range_const_iterator<Data>::type di = boost::begin(data); 117 117 while (si != boost::end(syms)) … … 121 121 symbols& 122 122 operator=(symbols const& rhs) 123 123 { 124 proto:: arg(*this) = proto::arg(rhs);124 proto::child(*this) = proto::child(rhs); 125 125 return *this; 126 126 } 127 127 … … 154 154 155 155 ptr_type lookup() const 156 156 { 157 return proto:: arg(*this).lookup;157 return proto::child(*this).lookup; 158 158 } 159 159 160 160 template <typename F> -
home/qi/auxiliary/confix.hpp
82 82 // parse the prefix 83 83 parse_helper(first, last, context, skipper, 84 84 spirit::detail::confix_extractor::prefix( 85 proto:: arg_c<0>(spirit::argument1(component))));85 proto::child_c<0>(spirit::argument1(component)))); 86 86 87 87 // generate the embedded items 88 88 typedef typename … … 94 94 // append the suffix 95 95 parse_helper(first, last, context, skipper, 96 96 spirit::detail::confix_extractor::suffix( 97 proto:: arg_c<0>(spirit::argument1(component))));97 proto::child_c<0>(spirit::argument1(component)))); 98 98 99 99 return result; 100 100 } … … 105 105 std::string result = "confix("; 106 106 107 107 result += what_helper(spirit::detail::confix_extractor::prefix( 108 proto:: arg_c<0>(spirit::argument1(component))), ctx);108 proto::child_c<0>(spirit::argument1(component))), ctx); 109 109 result += ", "; 110 110 111 111 result += what_helper(spirit::detail::confix_extractor::suffix( 112 proto:: arg_c<0>(spirit::argument1(component))), ctx);112 proto::child_c<0>(spirit::argument1(component))), ctx); 113 113 result += ")["; 114 114 115 115 typedef typename -
home/qi/action/meta_grammar.hpp
31 31 struct action_meta_grammar : 32 32 meta_grammar::binary_rule< 33 33 qi::domain, proto::tag::subscript, action 34 , main_meta_grammar, proto::when<proto::_, proto::_ arg>34 , main_meta_grammar, proto::when<proto::_, proto::_child> 35 35 > 36 36 { 37 37 }; -
home/qi/char/meta_grammar.hpp
263 263 // char_, wchar --> any_char 264 264 meta_grammar::compose_empty< 265 265 proto::if_< 266 is_char_tag<proto::_ arg, qi::domain>()266 is_char_tag<proto::_child, qi::domain>() 267 267 > 268 268 , qi::domain 269 269 , mpl::identity<extract_any_char_director<mpl::_> > … … 272 272 , meta_grammar::compose_function1_eval< 273 273 proto::function< 274 274 proto::if_< 275 is_char_tag<proto::_ arg, qi::domain>()275 is_char_tag<proto::_child, qi::domain>() 276 276 > 277 277 , single_char_literal_meta_grammar 278 278 > … … 283 283 , meta_grammar::compose_function1_eval< 284 284 proto::function< 285 285 proto::if_< 286 is_lit_tag<proto::_ arg, qi::domain>()286 is_lit_tag<proto::_child, qi::domain>() 287 287 > 288 288 , basic_char_literal_meta_grammar 289 289 > … … 294 294 , meta_grammar::compose_function1_eval< 295 295 proto::function< 296 296 proto::if_< 297 is_char_tag<proto::_ arg, qi::domain>()>297 is_char_tag<proto::_child, qi::domain>()> 298 298 , proto::or_<basic_string_literal_meta_grammar, basic_std_string_meta_grammar> 299 299 > 300 300 , qi::domain … … 310 310 , meta_grammar::compose_function2_eval< 311 311 proto::function< 312 312 proto::if_< 313 is_char_tag<proto::_ arg, qi::domain>()313 is_char_tag<proto::_child, qi::domain>() 314 314 > 315 315 , basic_char_literal_meta_grammar 316 316 , basic_char_literal_meta_grammar -
home/karma/binary/meta_grammar.hpp
199 199 struct int_binary_meta_grammar 200 200 : meta_grammar::compose_empty< 201 201 proto::if_< 202 is_int_lit_tag<proto::_ arg, karma::domain>()202 is_int_lit_tag<proto::_child, karma::domain>() 203 203 >, 204 204 karma::domain, 205 205 mpl::identity<extract_literal_bin_director<mpl::_> > … … 211 211 : proto::or_< 212 212 meta_grammar::compose_empty< 213 213 proto::if_< 214 is_binary_tag<proto::_ arg, karma::domain>()214 is_binary_tag<proto::_child, karma::domain>() 215 215 >, 216 216 karma::domain, 217 217 mpl::identity<extract_binary_director<mpl::_> > … … 219 219 meta_grammar::compose_function1_eval< 220 220 proto::function< 221 221 proto::if_< 222 is_binary_tag<proto::_ arg, karma::domain>()222 is_binary_tag<proto::_child, karma::domain>() 223 223 >, 224 224 int_binary_meta_grammar 225 225 >, -
home/karma/nonterminal/nonterminal.hpp
15 15 #include <boost/spirit/home/support/nonterminal/locals.hpp> 16 16 #include <boost/spirit/home/support/argument.hpp> 17 17 18 #include <boost/ xpressive/proto/proto.hpp>18 #include <boost/proto/core.hpp> 19 19 #include <boost/function_types/result_type.hpp> 20 20 #include <boost/function_types/parameter_types.hpp> 21 21 #include <boost/function_types/is_function.hpp> -
home/karma/stream/meta_grammar.hpp
75 75 // stream, wstream 76 76 meta_grammar::compose_empty< 77 77 proto::if_< 78 is_stream_tag<proto::_ arg, karma::domain>()78 is_stream_tag<proto::_child, karma::domain>() 79 79 >, 80 80 karma::domain, 81 81 mpl::identity<extract_any_stream_director<mpl::_> > … … 84 84 meta_grammar::compose_function1_eval< 85 85 proto::function< 86 86 proto::if_< 87 is_stream_tag<proto::_ arg, karma::domain>()87 is_stream_tag<proto::_child, karma::domain>() 88 88 >, 89 89 proto::_ 90 90 >, -
home/karma/operator/meta_grammar.hpp
70 70 main_meta_grammar 71 71 >, 72 72 meta_grammar::unary_rule< 73 karma::domain, proto::tag:: posit, plus,73 karma::domain, proto::tag::unary_plus, plus, 74 74 main_meta_grammar 75 75 >, 76 76 meta_grammar::binary_rule< -
home/karma/numeric/meta_grammar.hpp
359 359 struct int_literal_meta_grammar 360 360 : meta_grammar::compose_empty< 361 361 proto::if_< 362 is_int_lit_tag<proto::_ arg, karma::domain>()362 is_int_lit_tag<proto::_child, karma::domain>() 363 363 >, 364 364 karma::domain, 365 365 mpl::identity<extract_literal_int_director<mpl::_> > … … 372 372 : proto::or_< 373 373 meta_grammar::compose_empty< 374 374 proto::if_< 375 is_int_tag<proto::_ arg, karma::domain>()375 is_int_tag<proto::_child, karma::domain>() 376 376 >, 377 377 karma::domain, 378 378 mpl::identity<extract_int_director_plain<mpl::_> > … … 380 380 meta_grammar::compose_function1_eval< 381 381 proto::function< 382 382 proto::if_< 383 is_int_tag<proto::_ arg, karma::domain>()383 is_int_tag<proto::_child, karma::domain>() 384 384 >, 385 385 int_literal_meta_grammar 386 386 >, … … 394 394 struct real_literal_meta_grammar 395 395 : meta_grammar::compose_empty< 396 396 proto::if_< 397 is_real_lit_tag<proto::_ arg, karma::domain>()397 is_real_lit_tag<proto::_child, karma::domain>() 398 398 >, 399 399 karma::domain, 400 400 mpl::identity<extract_literal_real_director<mpl::_> > … … 405 405 : proto::or_< 406 406 meta_grammar::compose_single< 407 407 proto::if_< 408 is_real_tag<proto::_ arg, karma::domain>()408 is_real_tag<proto::_child, karma::domain>() 409 409 >, 410 410 karma::domain, 411 411 mpl::identity<extract_real_director_plain<mpl::_> > … … 413 413 meta_grammar::compose_function1_full< 414 414 proto::function< 415 415 proto::if_< 416 is_real_tag<proto::_ arg, karma::domain>()416 is_real_tag<proto::_child, karma::domain>() 417 417 >, 418 418 real_literal_meta_grammar 419 419 >, -
home/karma/string/meta_grammar.hpp
185 185 std_string_meta_grammar, 186 186 meta_grammar::compose_empty< 187 187 proto::if_< 188 is_lit_tag<proto::_ arg, karma::domain>()188 is_lit_tag<proto::_child, karma::domain>() 189 189 >, 190 190 karma::domain, 191 191 mpl::identity<extract_lit_director_plain<mpl::_> > … … 193 193 meta_grammar::compose_function1_eval< 194 194 proto::function< 195 195 proto::if_< 196 is_lit_tag<proto::_ arg, karma::domain>()196 is_lit_tag<proto::_child, karma::domain>() 197 197 >, 198 198 proto::or_< 199 199 basic_string_literal_meta_grammar, … … 206 206 meta_grammar::function1_rule< 207 207 karma::domain, tag::lit, lazy_string, 208 208 proto::if_< 209 detail::is_not_convertible_to_int<proto::_ arg>()209 detail::is_not_convertible_to_int<proto::_child>() 210 210 > 211 211 > 212 212 > -
home/karma/auxiliary/confix.hpp
76 76 // generate the prefix 77 77 generate_helper(sink, ctx, d, 78 78 spirit::detail::confix_extractor::prefix( 79 proto:: arg_c<0>(spirit::argument1(component))));79 proto::child_c<0>(spirit::argument1(component)))); 80 80 81 81 // generate the embedded items 82 82 typedef typename … … 88 88 // append the suffix 89 89 generate_helper(sink, ctx, d, 90 90 spirit::detail::confix_extractor::suffix( 91 proto:: arg_c<0>(spirit::argument1(component))));91 proto::child_c<0>(spirit::argument1(component)))); 92 92 93 93 return result; 94 94 } … … 99 99 std::string result = "confix("; 100 100 101 101 result += what_helper(spirit::detail::confix_extractor::prefix( 102 proto:: arg_c<0>(spirit::argument1(component))), ctx);102 proto::child_c<0>(spirit::argument1(component))), ctx); 103 103 result += ", "; 104 104 105 105 result += what_helper(spirit::detail::confix_extractor::suffix( 106 proto:: arg_c<0>(spirit::argument1(component))), ctx);106 proto::child_c<0>(spirit::argument1(component))), ctx); 107 107 result += ")["; 108 108 109 109 typedef typename -
home/karma/action/meta_grammar.hpp
35 35 struct action_meta_grammar : 36 36 meta_grammar::binary_rule< 37 37 karma::domain, proto::tag::subscript, action, 38 main_meta_grammar, proto::when<proto::_, proto::_ arg>38 main_meta_grammar, proto::when<proto::_, proto::_child> 39 39 > 40 40 { 41 41 }; -
home/karma/char/meta_grammar.hpp
163 163 // char_, wchar, space 164 164 meta_grammar::compose_empty< 165 165 proto::if_< 166 is_char_tag<proto::_ arg, karma::domain>()166 is_char_tag<proto::_child, karma::domain>() 167 167 >, 168 168 karma::domain, 169 169 mpl::identity<extract_any_char_director<mpl::_> > … … 172 172 meta_grammar::compose_function1_eval< 173 173 proto::function< 174 174 proto::if_< 175 is_char_tag<proto::_ arg, karma::domain>()175 is_char_tag<proto::_child, karma::domain>() 176 176 >, 177 177 basic_char_literal_meta_grammar 178 178 >, … … 183 183 meta_grammar::compose_function1_eval< 184 184 proto::function< 185 185 proto::if_< 186 is_lit_tag<proto::_ arg, karma::domain>()186 is_lit_tag<proto::_child, karma::domain>() 187 187 >, 188 188 basic_char_literal_meta_grammar 189 189 >, -
home/karma/directive/right_alignment.hpp
96 96 Context& ctx, Delimiter const& d, Parameter const& param) 97 97 { 98 98 return detail::right_align_generate(sink, ctx, d, param, 99 subject(component), proto:: arg_c<0>(argument1(component)), ' ');99 subject(component), proto::child_c<0>(argument1(component)), ' '); 100 100 } 101 101 102 102 template <typename Component, typename Context> … … 105 105 std::string result = "right_align("; 106 106 107 107 result += boost::lexical_cast<std::string>( 108 proto:: arg_c<0>(argument1(component)));108 proto::child_c<0>(argument1(component))); 109 109 result += ")["; 110 110 111 111 typedef typename … … 194 194 Context& ctx, Delimiter const& d, Parameter const& param) 195 195 { 196 196 return detail::right_align_generate(sink, ctx, d, param, 197 subject(component), proto:: arg_c<0>(argument1(component)),197 subject(component), proto::child_c<0>(argument1(component)), 198 198 argument2(component)); 199 199 } 200 200 … … 204 204 std::string result = "right_align("; 205 205 206 206 result += boost::lexical_cast<std::string>( 207 proto:: arg_c<0>(argument1(component)));207 proto::child_c<0>(argument1(component))); 208 208 result += ", "; 209 209 210 210 typedef typename -
home/karma/directive/center_alignment.hpp
96 96 Context& ctx, Delimiter const& d, Parameter const& param) 97 97 { 98 98 return detail::center_generate(sink, ctx, d, param, 99 subject(component), proto:: arg_c<0>(argument1(component)), ' ');99 subject(component), proto::child_c<0>(argument1(component)), ' '); 100 100 } 101 101 102 102 template <typename Component, typename Context> … … 105 105 std::string result = "center("; 106 106 107 107 result += boost::lexical_cast<std::string>( 108 proto:: arg_c<0>(argument1(component)));108 proto::child_c<0>(argument1(component))); 109 109 result += ")["; 110 110 111 111 typedef typename … … 194 194 Context& ctx, Delimiter const& d, Parameter const& param) 195 195 { 196 196 return detail::center_generate(sink, ctx, d, param, 197 subject(component), proto:: arg_c<0>(argument1(component)),197 subject(component), proto::child_c<0>(argument1(component)), 198 198 argument2(component)); 199 199 } 200 200 … … 204 204 std::string result = "center("; 205 205 206 206 result += boost::lexical_cast<std::string>( 207 proto:: arg_c<0>(argument1(component)));207 proto::child_c<0>(argument1(component))); 208 208 result += ", "; 209 209 210 210 typedef typename -
home/karma/directive/left_alignment.hpp
95 95 Context& ctx, Delimiter const& d, Parameter const& param) 96 96 { 97 97 return detail::left_align_generate(sink, ctx, d, param, 98 subject(component), proto:: arg_c<0>(argument1(component)), ' ');98 subject(component), proto::child_c<0>(argument1(component)), ' '); 99 99 } 100 100 101 101 template <typename Component, typename Context> … … 104 104 std::string result = "left_align("; 105 105 106 106 result += boost::lexical_cast<std::string>( 107 proto:: arg_c<0>(argument1(component)));107 proto::child_c<0>(argument1(component))); 108 108 result += ")["; 109 109 110 110 typedef typename … … 193 193 Context& ctx, Delimiter const& d, Parameter const& param) 194 194 { 195 195 return detail::left_align_generate(sink, ctx, d, param, 196 subject(component), proto:: arg_c<0>(argument1(component)),196 subject(component), proto::child_c<0>(argument1(component)), 197 197 argument2(component)); 198 198 } 199 199 … … 203 203 std::string result = "left_align("; 204 204 205 205 result += boost::lexical_cast<std::string>( 206 proto:: arg_c<0>(argument1(component)));206 proto::child_c<0>(argument1(component))); 207 207 result += ", "; 208 208 209 209 typedef typename -
home/support/standard.hpp
8 8 #define SPIRIT_STANDARD_JAN_31_2006_0529PM 9 9 10 10 #include <boost/spirit/home/support/char_class.hpp> 11 #include <boost/ xpressive/proto/proto.hpp>11 #include <boost/proto/core.hpp> 12 12 13 13 namespace boost { namespace spirit { namespace standard 14 14 { -
home/support/nonterminal/nonterminal.hpp
7 7 #if !defined(BOOST_SPIRIT_NONTERMINAL_MAR_06_2007_0236PM) 8 8 #define BOOST_SPIRIT_NONTERMINAL_MAR_06_2007_0236PM 9 9 10 #include <boost/ xpressive/proto/proto.hpp>10 #include <boost/proto/core.hpp> 11 11 #include <boost/function_types/result_type.hpp> 12 12 #include <boost/function_types/parameter_types.hpp> 13 13 #include <boost/fusion/include/as_vector.hpp> -
home/support/component.hpp
9 9 10 10 #include <boost/spirit/home/support/unused.hpp> 11 11 #include <boost/spirit/home/support/meta_grammar/grammar.hpp> 12 #include <boost/ xpressive/proto/proto.hpp>12 #include <boost/proto/core.hpp> 13 13 #include <boost/fusion/include/at.hpp> 14 14 #include <boost/fusion/include/value_at.hpp> 15 15 #include <boost/mpl/void.hpp> … … 198 198 { 199 199 typedef typename meta_grammar::grammar<Domain>::type grammar; 200 200 typedef typename proto::result_of::as_expr<Expr>::type proto_xpr; 201 202 typedef typename 203 grammar::template result< 204 void(proto_xpr, State, Visitor) 205 >::type 206 type; 201 typedef typename grammar::template impl<proto_xpr, State, Visitor> callable; 202 typedef typename callable::result_type type; 207 203 }; 208 204 209 205 // special case for arrays … … 214 210 { 215 211 typedef typename meta_grammar::grammar<Domain>::type grammar; 216 212 typedef typename proto::result_of::as_expr<T const*>::type proto_xpr; 217 218 typedef typename 219 grammar::template result< 220 void(proto_xpr, State, Visitor) 221 >::type 222 type; 213 typedef typename grammar::template impl<proto_xpr, State, Visitor> callable; 214 typedef typename callable::result_type type; 223 215 }; 224 216 225 217 // special case for components … … 229 221 { 230 222 }; 231 223 } 224 225 namespace detail 226 { 227 template<typename T> 228 T &decay(T &t) 229 { 230 return t; 231 } 232 232 233 template<typename T, int N> 234 T *decay(T (&t)[N]) 235 { 236 return t; 237 } 238 } 239 233 240 template <typename Domain, typename Expr> 234 241 inline typename result_of::as_component<Domain, Expr>::type 235 242 as_component(Domain, Expr const& xpr) 236 243 { 237 unused_type unused; 238 typedef typename result_of::as_component<Domain, Expr>::grammar grammar; 239 return grammar()(proto::as_expr(xpr), unused, unused); 244 typedef typename result_of::as_component<Domain, Expr>::callable callable; 245 return callable()(proto::as_expr(detail::decay(xpr)), unused_type(), unused_type()); 240 246 } 241 247 242 248 template <typename Domain, typename Expr, typename State, typename Visitor> 243 249 inline typename result_of::as_component<Domain, Expr>::type 244 250 as_component(Domain, Expr const& xpr, State const& state, Visitor& visitor) 245 251 { 246 typedef typename 247 result_of::as_component<Domain, Expr, State, Visitor>::grammar 248 grammar; 249 return grammar()(proto::as_expr(xpr), state, visitor); 252 typedef typename result_of::as_component<Domain, Expr, State, Visitor>::callable callable; 253 return callable()(proto::as_expr(detail::decay(xpr)), state, visitor); 250 254 } 251 255 252 256 template <typename Domain, typename Director, typename Elements> -
home/support/placeholders.hpp
8 8 #if !defined(BOOST_SPIRIT_PLACEHOLDERS_NOV_18_2006_0326PM) 9 9 #define BOOST_SPIRIT_PLACEHOLDERS_NOV_18_2006_0326PM 10 10 11 #include <boost/ xpressive/proto/proto.hpp>11 #include <boost/proto/core.hpp> 12 12 #include <boost/mpl/bool.hpp> 13 13 #include <boost/type_traits/is_enum.hpp> 14 14 -
home/support/meta_grammar/basic_rules.hpp
11 11 #include <boost/spirit/home/support/meta_grammar/basic_transforms.hpp> 12 12 #include <boost/spirit/home/support/component.hpp> 13 13 #include <boost/fusion/include/cons.hpp> 14 #include <boost/ xpressive/proto/proto.hpp>15 #include <boost/ xpressive/proto/transform.hpp>14 #include <boost/proto/core.hpp> 15 #include <boost/proto/transform.hpp> 16 16 #include <boost/mpl/identity.hpp> 17 17 18 18 namespace boost { namespace spirit { namespace meta_grammar -
home/support/meta_grammar/basic_transforms.hpp
12 12 #include <boost/spirit/home/support/component.hpp> 13 13 #include <boost/spirit/home/support/modifier.hpp> 14 14 15 #include <boost/ xpressive/proto/proto.hpp>16 #include <boost/ xpressive/proto/transform.hpp>15 #include <boost/proto/core.hpp> 16 #include <boost/proto/transform.hpp> 17 17 18 18 #include <boost/fusion/include/cons.hpp> 19 19 #include <boost/fusion/include/list.hpp> … … 25 25 namespace boost { namespace spirit { namespace meta_grammar 26 26 { 27 27 /////////////////////////////////////////////////////////////////////////// 28 // Invoke the specified grammar in the "Proto v2" way, dropping top 29 // level const and reference on the three parameters 30 //template<typename Grammar, typename Expr, typename State, typename Data> 31 //typename Grammar::template impl<Expr, State, Data>::result_type 32 //invoke_grammar(Expr const &expr, State const &state, Data &data) 33 //{ 34 // return typename Grammar::template impl<Expr, State, Data>()(expr, state, data); 35 //} 36 37 template<typename Grammar, typename Expr, typename State, typename Data> 38 struct invoke_grammar 39 : Grammar::template impl<Expr, State, Data> 40 {}; 41 42 /////////////////////////////////////////////////////////////////////////// 28 43 // A proto transform for creating empty component meta descriptions 29 44 // (proto expressions) usable for defining meta grammars. Additionally, 30 45 // this is used to make the corresponding spirit component. … … 37 52 // domain (i.e.: any_char) 38 53 /////////////////////////////////////////////////////////////////////////// 39 54 template <typename Grammar, typename Domain, typename DirectorF> 40 struct compose_empty : Grammar55 struct compose_empty : proto::transform<compose_empty<Grammar, Domain, DirectorF> >, Grammar 41 56 { 42 template<typename Sig> 43 struct result; 44 45 template <typename This, typename Expr, typename State, typename Visitor> 46 struct result<This(Expr, State, Visitor)> 57 template<typename Expr, typename State, typename Data> 58 struct impl : proto::transform_impl<Expr, State, Data> 47 59 { 48 typedef typename proto::result_of:: arg<Expr>::type arg_type;60 typedef typename proto::result_of::child<Expr>::type arg_type; 49 61 50 62 typedef 51 63 traits::make_component< 52 64 Domain 53 65 , typename mpl::apply1<DirectorF, arg_type>::type 54 66 , fusion::nil 55 , Visitor67 , Data 56 68 > 57 69 make_component; 58 70 59 typedef typename make_component::type type; 60 }; 71 typedef typename make_component::type result_type; 61 72 62 template<typename Expr, typename State, typename Visitor> 63 typename result<void(Expr, State, Visitor)>::type 64 operator ()(Expr const&, State const&, Visitor&) const 65 { 66 typedef typename result<void(Expr, State, Visitor)>::make_component result; 67 return result::call(fusion::nil()); 68 } 73 result_type operator ()( 74 typename impl::expr_param 75 , typename impl::state_param 76 , typename impl::data_param 77 ) const 78 { 79 return make_component::call(fusion::nil()); 80 } 81 }; 69 82 }; 70 83 71 84 /////////////////////////////////////////////////////////////////////////// … … 80 93 // domain (i.e.: negated_char_parser<...>) 81 94 /////////////////////////////////////////////////////////////////////////// 82 95 template <typename Grammar, typename Domain, typename DirectorF> 83 struct compose_single : Grammar96 struct compose_single : proto::transform<compose_single<Grammar, Domain, DirectorF> >, Grammar 84 97 { 85 template<typename Sig> 86 struct result; 87 88 template <typename This, typename Expr, typename State, typename Visitor> 89 struct result<This(Expr, State, Visitor)> 98 template<typename Expr, typename State, typename Data> 99 struct impl : proto::transform_impl<Expr, State, Data> 90 100 { 91 101 typedef typename 92 proto::result_of:: arg<93 typename Grammar::template result<void(Expr, State, Visitor)>::type102 proto::result_of::child< 103 typename Grammar::template impl<Expr, State, Data>::result_type 94 104 >::type 95 105 arg_type; 96 106 97 107 typedef 98 108 traits::make_component< 99 109 Domain 100 110 , typename mpl::apply1<DirectorF, arg_type>::type 101 111 , typename fusion::result_of::make_cons<arg_type>::type 102 , Visitor112 , Data 103 113 > 104 114 make_component; 105 115 106 typedef typename make_component::type type; 107 }; 116 typedef typename make_component::type result_type; 108 117 109 template<typename Expr, typename State, typename Visitor> 110 typename result<void(Expr, State, Visitor)>::type 111 operator ()(Expr const& expr, State const& state, Visitor& visitor) const 112 { 113 typedef typename result<void(Expr, State, Visitor)>::make_component result; 114 return result::call( 115 fusion::make_cons( 116 proto::arg(Grammar()(expr, state, visitor)) 117 ) 118 ); 119 } 118 result_type operator ()( 119 typename impl::expr_param expr 120 , typename impl::state_param state 121 , typename impl::data_param data 122 ) const 123 { 124 return make_component::call( 125 fusion::make_cons( 126 proto::child(invoke_grammar<Grammar, Expr, State, Data>()(expr, state, data)) 127 ) 128 ); 129 } 130 }; 120 131 }; 121 132 122 133 /////////////////////////////////////////////////////////////////////////// … … 131 142 // domain (i.e.: difference) 132 143 /////////////////////////////////////////////////////////////////////////// 133 144 template <typename Grammar, typename Domain, typename DirectorF> 134 struct compose_double : Grammar145 struct compose_double : proto::transform<compose_double<Grammar, Domain, DirectorF> >, Grammar 135 146 { 136 template<typename Sig> 137 struct result; 138 139 template <typename This, typename Expr, typename State, typename Visitor> 140 struct result<This(Expr, State, Visitor)> 147 template<typename Expr, typename State, typename Data> 148 struct impl : proto::transform_impl<Expr, State, Data> 141 149 { 142 150 typedef typename 143 Grammar::template result<void(Expr, State, Visitor)>::type151 Grammar::template impl<Expr, State, Data>::result_type 144 152 trans; 145 153 146 154 typedef typename proto::result_of::left<trans>::type left_type; … … 154 162 Domain 155 163 , typename mpl::apply1<DirectorF, list_type>::type 156 164 , list_type 157 , Visitor165 , Data 158 166 > 159 167 make_component; 160 168 161 typedef typename make_component::type type; 162 }; 169 typedef typename make_component::type result_type; 163 170 164 template<typename Expr, typename State, typename Visitor> 165 typename result<void(Expr, State, Visitor)>::type 166 operator ()(Expr const& expr, State const& state, Visitor& visitor) const 167 { 168 typedef result<void(Expr, State, Visitor)> apply; 169 typedef typename apply::make_component result; 170 typedef typename apply::list_type list_type; 171 172 typename apply::trans trans = Grammar()(expr, state, visitor); 173 return result::call( 174 fusion::make_list(proto::left(trans), proto::right(trans)) 175 ); 176 } 171 result_type operator ()( 172 typename impl::expr_param expr 173 , typename impl::state_param state 174 , typename impl::data_param data 175 ) const 176 { 177 trans t = invoke_grammar<Grammar, Expr, State, Data>()(expr, state, data); 178 return make_component::call( 179 fusion::make_list(proto::left(t), proto::right(t)) 180 ); 181 } 182 }; 177 183 }; 178 184 179 185 /////////////////////////////////////////////////////////////////////////// … … 189 195 /////////////////////////////////////////////////////////////////////////// 190 196 191 197 template <typename Grammar, typename Domain, typename DirectorF> 192 struct compose_triple : Grammar198 struct compose_triple : proto::transform<compose_triple<Grammar, Domain, DirectorF> >, Grammar 193 199 { 194 template<typename Sig> 195 struct result; 196 197 template <typename This, typename Expr, typename State, typename Visitor> 198 struct result<This(Expr, State, Visitor)> 200 template<typename Expr, typename State, typename Data> 201 struct impl : proto::transform_impl<Expr, State, Data> 199 202 { 200 203 typedef typename 201 Grammar::template result<void(Expr, State, Visitor)>::type204 Grammar::template impl<Expr, State, Data>::result_type 202 205 trans; 203 206 204 typedef typename proto::result_of:: arg_c<trans, 0>::type arg0_type;205 typedef typename proto::result_of:: arg_c<trans, 1>::type arg1_type;206 typedef typename proto::result_of:: arg_c<trans, 2>::type arg2_type;207 typedef typename proto::result_of::child_c<trans, 0>::type arg0_type; 208 typedef typename proto::result_of::child_c<trans, 1>::type arg1_type; 209 typedef typename proto::result_of::child_c<trans, 2>::type arg2_type; 207 210 208 211 typedef typename 209 212 fusion::result_of::make_list<arg0_type, arg1_type, arg2_type>::type … … 214 217 Domain 215 218 , typename mpl::apply1<DirectorF, list_type>::type 216 219 , list_type 217 , Visitor220 , Data 218 221 > 219 222 make_component; 220 223 221 typedef typename make_component::type type; 222 }; 224 typedef typename make_component::type result_type; 223 225 224 template<typename Expr, typename State, typename Visitor> 225 typename result<void(Expr, State, Visitor)>::type 226 operator ()(Expr const& expr, State const& state, Visitor& visitor) const 227 { 228 typedef result<void(Expr, State, Visitor)> apply; 229 typedef typename apply::make_component result; 230 typedef typename apply::list_type list_type; 231 232 typename apply::trans trans = Grammar()(expr, state, visitor); 233 return result::call( 234 fusion::make_list(proto::arg_c<0>(trans), proto::arg_c<1>(trans), proto::arg_c<2>(trans)) 235 ); 236 } 226 result_type operator ()( 227 typename impl::expr_param expr 228 , typename impl::state_param state 229 , typename impl::data_param data 230 ) const 231 { 232 trans t = invoke_grammar<Grammar, Expr, State, Data>()(expr, state, data); 233 return make_component::call( 234 fusion::make_list(proto::child_c<0>(t), proto::child_c<1>(t), proto::child_c<2>(t)) 235 ); 236 } 237 }; 237 238 }; 238 239 239 240 /////////////////////////////////////////////////////////////////////////// … … 249 250 // domain (i.e.: difference) 250 251 /////////////////////////////////////////////////////////////////////////// 251 252 template <typename Grammar, typename Domain, typename DirectorF> 252 struct compose_right : Grammar253 struct compose_right : proto::transform<compose_right<Grammar, Domain, DirectorF> >, Grammar 253 254 { 254 template<typename Sig> 255 struct result; 256 257 template <typename This, typename Expr, typename State, typename Visitor> 258 struct result<This(Expr, State, Visitor)> 255 template<typename Expr, typename State, typename Data> 256 struct impl : proto::transform_impl<Expr, State, Data> 259 257 { 260 258 typedef typename 261 Grammar::template result<void(Expr, State, Visitor)>::type259 Grammar::template impl<Expr, State, Data>::result_type 262 260 trans; 263 261 264 262 typedef typename proto::result_of::right<trans>::type right_type; … … 271 269 Domain 272 270 , typename mpl::apply1<DirectorF, list_type>::type 273 271 , list_type 274 , Visitor272 , Data 275 273 > 276 274 make_component; 277 275 278 typedef typename make_component::type type; 279 }; 276 typedef typename make_component::type result_type; 280 277 281 template<typename Expr, typename State, typename Visitor> 282 typename result<void(Expr, State, Visitor)>::type 283 operator ()(Expr const& expr, State const& state, Visitor& visitor) const 284 { 285 typedef result<void(Expr, State, Visitor)> apply; 286 typedef typename apply::make_component result; 287 typedef typename apply::list_type list_type; 288 289 typename apply::trans trans = Grammar()(expr, state, visitor); 290 return result::call( 291 fusion::make_list(proto::right(trans)) 292 ); 293 } 278 result_type operator ()( 279 typename impl::expr_param expr 280 , typename impl::state_param state 281 , typename impl::data_param data 282 ) const 283 { 284 trans t = invoke_grammar<Grammar, Expr, State, Data>()(expr, state, data); 285 return make_component::call( 286 fusion::make_list(proto::right(t)) 287 ); 288 } 289 }; 294 290 }; 295 291 296 292 /////////////////////////////////////////////////////////////////////////// … … 299 295 /////////////////////////////////////////////////////////////////////////// 300 296 template <typename Pred, typename TransformF> 301 297 struct if_transform 302 : proto::when<proto::if_<Pred>, proto:: bind<TransformF> >298 : proto::when<proto::if_<Pred>, proto::lazy<TransformF> > 303 299 { 304 300 }; 305 301 … … 307 303 // A proto transform that composes components from a fusion::list 308 304 /////////////////////////////////////////////////////////////////////////// 309 305 template <typename Grammar, typename Domain, typename Director> 310 struct compose_list : Grammar306 struct compose_list : proto::transform<compose_list<Grammar, Domain, Director> >, Grammar 311 307 { 312 template<typename Sig> 313 struct result; 314 315 template <typename This, typename Expr, typename State, typename Visitor> 316 struct result<This(Expr, State, Visitor)> 308 template<typename Expr, typename State, typename Data> 309 struct impl : proto::transform_impl<Expr, State, Data> 317 310 { 318 311 typedef 319 312 traits::make_component< 320 313 Domain, Director 321 , typename Grammar::template 322 result<void(Expr, State, Visitor)>::type 323 , Visitor 314 , typename Grammar::template impl<Expr, State, Data>::result_type 315 , Data 324 316 > 325 317 make_component; 326 318 327 typedef typename make_component::type type; 328 }; 319 typedef typename make_component::type result_type; 329 320 330 template<typename Expr, typename State, typename Visitor> 331 typename result<void(Expr, State, Visitor)>::type 332 operator ()(Expr const& expr, State const& state, Visitor& visitor) const 333 { 334 typedef typename result<void(Expr, State, Visitor)>::make_component result; 335 return result::call(Grammar()(expr, state, visitor)); 336 } 321 result_type operator ()( 322 typename impl::expr_param expr 323 , typename impl::state_param state 324 , typename impl::data_param data 325 ) const 326 { 327 return make_component::call(invoke_grammar<Grammar, Expr, State, Data>()(expr, state, data)); 328 } 329 }; 337 330 }; 338 331 339 332 /////////////////////////////////////////////////////////////////////////// … … 341 334 // from a 1-arity proto function expression (e.g. f(x)) 342 335 /////////////////////////////////////////////////////////////////////////// 343 336 template <typename Grammar, typename Domain, typename Director> 344 struct compose_function1 : Grammar337 struct compose_function1 : proto::transform<compose_function1<Grammar, Domain, Director> >, Grammar 345 338 { 346 template<typename Sig> 347 struct result; 348 349 template <typename This, typename Expr, typename State, typename Visitor> 350 struct result<This(Expr, State, Visitor)> 339 template<typename Expr, typename State, typename Data> 340 struct impl : proto::transform_impl<Expr, State, Data> 351 341 { 352 342 typedef typename 353 proto::result_of:: arg<354 typename proto::result_of:: arg_c<Expr, 1>::type343 proto::result_of::child< 344 typename proto::result_of::child_c<Expr, 1>::type 355 345 >::type 356 346 arg1; 357 347 … … 359 349 traits::make_component< 360 350 Domain, Director 361 351 , typename fusion::result_of::make_cons<arg1>::type 362 , Visitor352 , Data 363 353 > 364 354 make_component; 365 355 366 typedef typename make_component::type type; 367 }; 356 typedef typename make_component::type result_type; 368 357 369 template<typename Expr, typename State, typename Visitor> 370 typename result<void(Expr, State, Visitor)>::type 371 operator ()(Expr const& expr, State const&, Visitor&) const 372 { 373 typedef typename result<void(Expr, State, Visitor)>::make_component result; 374 return result::call(fusion::make_cons(proto::arg(proto::arg_c<1>(expr)))); 375 } 358 result_type operator ()( 359 typename impl::expr_param expr 360 , typename impl::state_param state 361 , typename impl::data_param data 362 ) const 363 { 364 return make_component::call(fusion::make_cons(proto::child(proto::child_c<1>(expr)))); 365 } 366 }; 376 367 }; 377 368 378 369 // Same as compose_function1, except that DirectorF is a meta-function to 379 370 // be evaluated to get the director 380 371 template <typename Grammar, typename Domain, typename DirectorF> 381 struct compose_function1_eval : Grammar372 struct compose_function1_eval : proto::transform<compose_function1_eval<Grammar, Domain, DirectorF> >, Grammar 382 373 { 383 template<typename Sig> 384 struct result; 385 386 template <typename This, typename Expr, typename State, typename Visitor> 387 struct result<This(Expr, State, Visitor)> 374 template<typename Expr, typename State, typename Data> 375 struct impl : proto::transform_impl<Expr, State, Data> 388 376 { 389 377 typedef typename 390 proto::result_of:: arg<391 typename proto::result_of:: arg_c<Expr, 0>::type378 proto::result_of::child< 379 typename proto::result_of::child_c<Expr, 0>::type 392 380 >::type 393 381 function; 394 382 typedef typename 395 proto::result_of:: arg<396 typename proto::result_of:: arg_c<Expr, 1>::type383 proto::result_of::child< 384 typename proto::result_of::child_c<Expr, 1>::type 397 385 >::type 398 386 arg1; 399 387 … … 402 390 Domain 403 391 , typename mpl::apply2<DirectorF, function, arg1>::type 404 392 , typename fusion::result_of::make_cons<arg1>::type 405 , Visitor393 , Data 406 394 > 407 395 make_component; 408 396 409 typedef typename make_component::type type; 410 }; 397 typedef typename make_component::type result_type; 411 398 412 template<typename Expr, typename State, typename Visitor> 413 typename result<void(Expr, State, Visitor)>::type 414 operator ()(Expr const& expr, State const&, Visitor&) const 415 { 416 typedef typename result<void(Expr, State, Visitor)>::make_component result; 417 return result::call( 418 fusion::make_cons(proto::arg(proto::arg_c<1>(expr)))); 419 } 399 result_type operator ()( 400 typename impl::expr_param expr 401 , typename impl::state_param state 402 , typename impl::data_param data 403 ) const 404 { 405 return make_component::call( 406 fusion::make_cons(proto::child(proto::child_c<1>(expr)))); 407 } 408 }; 420 409 }; 421 410 422 411 // Same as compose_function1, except that the generated component holds 423 412 // not only the function argument, but the function tag as well 424 413 template <typename Grammar, typename Domain, typename DirectorF> 425 struct compose_function1_full : Grammar414 struct compose_function1_full : proto::transform<compose_function1_full<Grammar, Domain, DirectorF> >, Grammar 426 415 { 427 template<typename Sig> 428 struct result; 429 430 template <typename This, typename Expr, typename State, typename Visitor> 431 struct result<This(Expr, State, Visitor)> 416 template<typename Expr, typename State, typename Data> 417 struct impl : proto::transform_impl<Expr, State, Data> 432 418 { 433 419 typedef typename 434 proto::result_of:: arg<435 typename proto::result_of:: arg_c<Expr, 0>::type420 proto::result_of::child< 421 typename proto::result_of::child_c<Expr, 0>::type 436 422 >::type 437 423 function; 424 438 425 typedef typename 439 proto::result_of:: arg<440 typename proto::result_of:: arg_c<Expr, 1>::type426 proto::result_of::child< 427 typename proto::result_of::child_c<Expr, 1>::type 441 428 >::type 442 429 arg1; 443 430 … … 446 433 Domain 447 434 , typename mpl::apply2<DirectorF, function, arg1>::type 448 435 , typename fusion::result_of::make_list<function, arg1>::type 449 , Visitor436 , Data 450 437 > 451 438 make_component; 452 439 453 typedef typename make_component::type type; 454 }; 440 typedef typename make_component::type result_type; 455 441 456 template<typename Expr, typename State, typename Visitor> 457 typename result<void(Expr, State, Visitor)>::type 458 operator ()(Expr const& expr, State const& /*state*/, Visitor& /*visitor*/) const 459 { 460 typedef typename result<void(Expr, State, Visitor)>::make_component result; 461 return result::call(fusion::make_list( 462 proto::arg(proto::arg_c<0>(expr)), 463 proto::arg(proto::arg_c<1>(expr)) 464 )); 465 } 442 result_type operator ()( 443 typename impl::expr_param expr 444 , typename impl::state_param 445 , typename impl::data_param 446 ) const 447 { 448 return make_component::call(fusion::make_list( 449 proto::child(proto::child_c<0>(expr)), 450 proto::child(proto::child_c<1>(expr)) 451 )); 452 } 453 }; 466 454 }; 467 455 468 456 /////////////////////////////////////////////////////////////////////////// … … 470 458 // from a 2-arity proto function expression (e.g. f(x, y)) 471 459 /////////////////////////////////////////////////////////////////////////// 472 460 template <typename Grammar, typename Domain, typename Director> 473 struct compose_function2 : Grammar461 struct compose_function2 : proto::transform<compose_function2<Grammar, Domain, Director> >, Grammar 474 462 { 475 template<typename Sig> 476 struct result; 477 478 template <typename This, typename Expr, typename State, typename Visitor> 479 struct result<This(Expr, State, Visitor)> 463 template<typename Expr, typename State, typename Data> 464 struct impl : proto::transform_impl<Expr, State, Data> 480 465 { 481 466 typedef typename 482 proto::result_of:: arg<483 typename proto::result_of:: arg_c<Expr, 1>::type467 proto::result_of::child< 468 typename proto::result_of::child_c<Expr, 1>::type 484 469 >::type 485 470 arg1; 486 471 487 472 typedef typename 488 proto::result_of:: arg<489 typename proto::result_of:: arg_c<Expr, 2>::type473 proto::result_of::child< 474 typename proto::result_of::child_c<Expr, 2>::type 490 475 >::type 491 476 arg2; 492 477 … … 494 479 traits::make_component< 495 480 Domain, Director 496 481 , typename fusion::result_of::make_list<arg1, arg2>::type 497 , Visitor482 , Data 498 483 > 499 484 make_component; 500 485 501 typedef typename make_component::type type; 502 }; 486 typedef typename make_component::type result_type; 503 487 504 template<typename Expr, typename State, typename Visitor> 505 typename result<void(Expr, State, Visitor)>::type 506 operator ()(Expr const& expr, State const& /*state*/, Visitor& /*visitor*/) const 507 { 508 typedef typename result<void(Expr, State, Visitor)>::make_component result; 509 return result::call(fusion::make_list( 510 proto::arg(proto::arg_c<1>(expr)) 511 , proto::arg(proto::arg_c<2>(expr)) 512 )); 513 } 488 result_type operator ()( 489 typename impl::expr_param expr 490 , typename impl::state_param 491 , typename impl::data_param 492 ) const 493 { 494 return make_component::call(fusion::make_list( 495 proto::child(proto::child_c<1>(expr)) 496 , proto::child(proto::child_c<2>(expr)) 497 )); 498 } 499 }; 514 500 }; 515 501 516 502 // Same as compose_function2, except that DirectorF is a meta-function to 517 503 // be evaluated to get the director 518 504 template <typename Grammar, typename Domain, typename DirectorF> 519 struct compose_function2_eval : Grammar505 struct compose_function2_eval : proto::transform<compose_function2_eval<Grammar, Domain, DirectorF> >, Grammar 520 506 { 521 template<typename Sig> 522 struct result; 523 524 template <typename This, typename Expr, typename State, typename Visitor> 525 struct result<This(Expr, State, Visitor)> 507 template<typename Expr, typename State, typename Data> 508 struct impl : proto::transform_impl<Expr, State, Data> 526 509 { 527 510 typedef typename 528 proto::result_of:: arg<529 typename proto::result_of:: arg_c<Expr, 0>::type511 proto::result_of::child< 512 typename proto::result_of::child_c<Expr, 0>::type 530 513 >::type 531 514 function; 515 532 516 typedef typename 533 proto::result_of:: arg<534 typename proto::result_of:: arg_c<Expr, 1>::type517 proto::result_of::child< 518 typename proto::result_of::child_c<Expr, 1>::type 535 519 >::type 536 520 arg1; 521 537 522 typedef typename 538 proto::result_of:: arg<539 typename proto::result_of:: arg_c<Expr, 2>::type523 proto::result_of::child< 524 typename proto::result_of::child_c<Expr, 2>::type 540 525 >::type 541 526 arg2; 542 527 … … 545 530 Domain 546 531 , typename mpl::apply2<DirectorF, function, arg1>::type 547 532 , typename fusion::result_of::make_list<arg1, arg2>::type 548 , Visitor533 , Data 549 534 > 550 535 make_component; 551 536 552 typedef typename make_component::type type; 553 }; 537 typedef typename make_component::type result_type; 554 538 555 template<typename Expr, typename State, typename Visitor> 556 typename result<void(Expr, State, Visitor)>::type 557 operator ()(Expr const& expr, State const& /*state*/, Visitor& /*visitor*/) const 558 { 559 typedef typename result<void(Expr, State, Visitor)>::make_component result; 560 return result::call(fusion::make_list( 561 proto::arg(proto::arg_c<1>(expr)) 562 , proto::arg(proto::arg_c<2>(expr)) 563 )); 564 } 539 result_type operator ()( 540 typename impl::expr_param expr 541 , typename impl::state_param 542 , typename impl::data_param 543 ) const 544 { 545 return make_component::call(fusion::make_list( 546 proto::child(proto::child_c<1>(expr)) 547 , proto::child(proto::child_c<2>(expr)) 548 )); 549 } 550 }; 565 551 }; 566 552 567 553 /////////////////////////////////////////////////////////////////////////// 568 554 // A proto transform for directives. The directive (terminal) tag 569 // is pushed into the modifier state (the Visitor).555 // is pushed into the modifier state (the Data). 570 556 /////////////////////////////////////////////////////////////////////////// 571 557 template <typename Grammar> 572 struct compose_deep_directive : Grammar558 struct compose_deep_directive : proto::transform<compose_deep_directive<Grammar> >, Grammar 573 559 { 574 template<typename Sig> 575 struct result; 576 577 template <typename This, typename Expr, typename State, typename Visitor> 578 struct result<This(Expr, State, Visitor)> 560 template<typename Expr, typename State, typename Data> 561 struct impl : proto::transform_impl<Expr, State, Data> 579 562 { 580 563 typedef typename 581 564 add_modifier< 582 Visitor583 , typename proto::result_of:: arg<584 typename proto::result_of:: arg_c<Expr, 0>::type565 Data 566 , typename proto::result_of::child< 567 typename proto::result_of::child_c<Expr, 0>::type 585 568 >::type 586 569 >::type 587 570 modifier_type; 588 571 589 572 typedef typename 590 Grammar::template result<void(Expr, State, modifier_type)>::type 591 type; 592 }; 573 Grammar::template impl<Expr, State, modifier_type>::result_type 574 result_type; 593 575 594 template<typename Expr, typename State, typename Visitor> 595 typename result<void(Expr, State, Visitor)>::type 596 operator ()(Expr const& expr, State const& state, Visitor&) const 597 { 598 typename add_modifier< 599 Visitor 600 , typename proto::result_of::arg< 601 typename proto::result_of::arg_c<Expr, 0>::type 602 >::type 603 >::type 604 modifier; 605 return Grammar()(expr, state, modifier); 606 } 576 result_type operator ()( 577 typename impl::expr_param expr 578 , typename impl::state_param state 579 , typename impl::data_param 580 ) const 581 { 582 modifier_type modifier; 583 return invoke_grammar<Grammar, Expr, State, modifier_type>()(expr, state, modifier); 584 } 585 }; 607 586 }; 608 587 609 588 /////////////////////////////////////////////////////////////////////////// … … 615 594 // 616 595 /////////////////////////////////////////////////////////////////////////// 617 596 template <typename Grammar, typename Domain, typename Director> 618 struct compose_subscript : Grammar597 struct compose_subscript : proto::transform<compose_subscript<Grammar, Domain, Director> >, Grammar 619 598 { 620 template<typename Sig> 621 struct result; 622 623 template <typename This, typename Expr, typename State, typename Visitor> 624 struct result<This(Expr, State, Visitor)> 599 template<typename Expr, typename State, typename Data> 600 struct impl : proto::transform_impl<Expr, State, Data> 625 601 { 626 602 // apply all grammar transformations mandated for the whole 627 603 // expression 628 604 typedef typename 629 Grammar::template result<void(Expr, State, Visitor)>::type605 Grammar::template impl<Expr, State, Data>::result_type 630 606 trans; 631 607 632 608 // this calculates the type of the directive 633 typedef typename proto::result_of:: arg_c<trans, 0>::type directive;609 typedef typename proto::result_of::child_c<trans, 0>::type directive; 634 610 635 611 // this calculates the type of the embedded expression 636 typedef typename proto::result_of:: arg_c<trans, 1>::type embedded;612 typedef typename proto::result_of::child_c<trans, 1>::type embedded; 637 613 638 614 // this is the type of the contained data 639 615 typedef fusion::list<embedded, directive> list_type; 640 616 641 617 typedef 642 traits::make_component<Domain, Director, list_type, Visitor>618 traits::make_component<Domain, Director, list_type, Data> 643 619 make_component; 644 620 645 typedef typename make_component::type type; 646 }; 621 typedef typename make_component::type result_type; 647 622 648 template<typename Expr, typename State, typename Visitor> 649 typename result<void(Expr, State, Visitor)>::type 650 operator ()(Expr const& expr, State const& state, Visitor& visitor) const 651 { 652 typedef result<void(Expr, State, Visitor)> apply; 653 typedef typename apply::make_component result; 654 typedef typename apply::list_type list_type; 655 typename apply::trans trans = Grammar()(expr, state, visitor); 656 657 return result::call( 658 list_type(proto::arg_c<1>(trans), proto::arg_c<0>(trans))); 659 } 623 result_type operator ()( 624 typename impl::expr_param expr 625 , typename impl::state_param state 626 , typename impl::data_param data 627 ) const 628 { 629 trans t = invoke_grammar<Grammar, Expr, State, Data>()(expr, state, data); 630 return make_component::call( 631 list_type(proto::child_c<1>(t), proto::child_c<0>(t))); 632 } 633 }; 660 634 }; 661 635 662 636 /////////////////////////////////////////////////////////////////////////// … … 668 642 // 669 643 /////////////////////////////////////////////////////////////////////////// 670 644 template <typename Grammar, typename Domain, typename Director> 671 struct compose_subscript_function1 : Grammar645 struct compose_subscript_function1 : proto::transform<compose_subscript_function1<Grammar, Domain, Director> >, Grammar 672 646 { 673 template<typename Sig> 674 struct result; 675 676 template <typename This, typename Expr, typename State, typename Visitor> 677 struct result<This(Expr, State, Visitor)> 647 template<typename Expr, typename State, typename Data> 648 struct impl : proto::transform_impl<Expr, State, Data> 678 649 { 679 650 // apply all grammar transformations mandated for the whole 680 651 // expression 681 652 typedef typename 682 Grammar::template result<void(Expr, State, Visitor)>::type653 Grammar::template impl<Expr, State, Data>::result_type 683 654 trans; 684 655 685 656 // this calculates the type of the embedded expression 686 typedef typename proto::result_of:: arg_c<trans, 1>::type embedded;657 typedef typename proto::result_of::child_c<trans, 1>::type embedded; 687 658 688 659 // this calculates the type of the argument of the function 689 660 typedef typename 690 proto::result_of:: arg_c<691 typename proto::result_of:: arg_c<trans, 0>::type, 1661 proto::result_of::child_c< 662 typename proto::result_of::child_c<trans, 0>::type, 1 692 663 >::type 693 664 arg1; 694 665 … … 699 670 traits::make_component< 700 671 Domain, Director, 701 672 list_type, 702 Visitor673 Data 703 674 > 704 675 make_component; 705 676 706 typedef typename make_component::type type; 707 }; 677 typedef typename make_component::type result_type; 708 678 709 template<typename Expr, typename State, typename Visitor> 710 typename result<void(Expr, State, Visitor)>::type 711 operator ()(Expr const& expr, State const& state, Visitor& visitor) const 712 { 713 typedef result<void(Expr, State, Visitor)> apply; 714 typedef typename apply::make_component result; 715 typedef typename apply::list_type list_type; 716 typename apply::trans trans = Grammar()(expr, state, visitor); 679 result_type operator ()( 680 typename impl::expr_param expr 681 , typename impl::state_param state 682 , typename impl::data_param data 683 ) const 684 { 685 trans t = invoke_grammar<Grammar, Expr, State, Data>()(expr, state, data); 717 686 718 return result::call(list_type( 719 proto::arg_c<1>(trans), 720 proto::arg_c<1>(proto::arg_c<0>(trans)))); 721 } 687 return make_component::call(list_type( 688 proto::child_c<1>(t), 689 proto::child_c<1>(proto::child_c<0>(t)))); 690 } 691 }; 722 692 }; 723 693 724 694 /////////////////////////////////////////////////////////////////////////// … … 730 700 // 731 701 /////////////////////////////////////////////////////////////////////////// 732 702 template <typename Grammar, typename Domain, typename Director> 733 struct compose_subscript_function2 : Grammar703 struct compose_subscript_function2 : proto::transform<compose_subscript_function2<Grammar, Domain, Director> >, Grammar 734 704 { 735 template<typename Sig> 736 struct result; 737 738 template <typename This, typename Expr, typename State, typename Visitor> 739 struct result<This(Expr, State, Visitor)> 705 template<typename Expr, typename State, typename Data> 706 struct impl : proto::transform_impl<Expr, State, Data> 740 707 { 741 708 // apply all grammar transformations mandated for the whole 742 709 // expression 743 710 typedef typename 744 Grammar::template result<void(Expr, State, Visitor)>::type711 Grammar::template impl<Expr, State, Data>::result_type 745 712 trans; 746 713 747 714 // this calculates the types of the arguments of the function 748 typedef typename proto::result_of:: arg_c<trans, 0>::type arg0;749 typedef typename proto::result_of:: arg_c<arg0, 1>::type arg1;750 typedef typename proto::result_of:: arg_c<arg0, 2>::type arg2;715 typedef typename proto::result_of::child_c<trans, 0>::type arg0; 716 typedef typename proto::result_of::child_c<arg0, 1>::type arg1; 717 typedef typename proto::result_of::child_c<arg0, 2>::type arg2; 751 718 752 719 // this calculates the type of the embedded expression 753 typedef typename proto::result_of:: arg_c<trans, 1>::type embedded;720 typedef typename proto::result_of::child_c<trans, 1>::type embedded; 754 721 typedef fusion::list<embedded, arg1, arg2> list_type; 755 722 756 723 typedef 757 724 traits::make_component< 758 725 Domain, Director, 759 726 list_type, 760 Visitor727 Data 761 728 > 762 729 make_component; 763 730 764 typedef typename make_component::type type; 765 }; 731 typedef typename make_component::type result_type; 766 732 767 template<typename Expr, typename State, typename Visitor> 768 typename result<void(Expr, State, Visitor)>::type 769 operator ()(Expr const& expr, State const& state, Visitor& visitor) const 770 { 771 typedef result<void(Expr, State, Visitor)> apply; 772 typedef typename apply::make_component result; 773 typedef typename apply::list_type list_type; 774 typename apply::trans trans = Grammar()(expr, state, visitor); 775 typename apply::arg0 arg0 = proto::arg_c<0>(trans); 733 result_type operator ()( 734 typename impl::expr_param expr 735 , typename impl::state_param state 736 , typename impl::data_param data 737 ) const 738 { 739 trans t = invoke_grammar<Grammar, Expr, State, Data>()(expr, state, data); 740 arg0 a0 = proto::child_c<0>(t); 776 741 777 return result::call(list_type( 778 proto::arg_c<1>(trans), proto::arg_c<1>(arg0), 779 proto::arg_c<2>(arg0))); 780 } 742 return make_component::call(list_type( 743 proto::child_c<1>(t), proto::child_c<1>(a0), 744 proto::child_c<2>(a0))); 745 } 746 }; 781 747 }; 782 748 783 749 }}} -
home/support/iso8859_1.hpp
8 8 #define SPIRIT_ISO8859_1_JAN_31_2006_0529PM 9 9 10 10 #include <boost/spirit/home/support/char_class.hpp> 11 #include <boost/ xpressive/proto/proto.hpp>11 #include <boost/proto/core.hpp> 12 12 13 13 namespace boost { namespace spirit { namespace iso8859_1 14 14 { -
home/support/standard_wide.hpp
8 8 #define SPIRIT_STANDARD_WIDE_JAN_31_2006_0529PM 9 9 10 10 #include <boost/spirit/home/support/char_class.hpp> 11 #include <boost/ xpressive/proto/proto.hpp>11 #include <boost/proto/core.hpp> 12 12 13 13 namespace boost { namespace spirit { namespace standard_wide 14 14 { -
home/support/auxiliary/functor_holder.hpp
10 10 #pragma once // MS compatible compilers support #pragma once 11 11 #endif 12 12 13 #include <boost/ xpressive/proto/proto.hpp>13 #include <boost/proto/core.hpp> 14 14 15 15 namespace boost { namespace spirit 16 16 { -
home/support/ascii.hpp
8 8 #define SPIRIT_ASCII_JAN_31_2006_0529PM 9 9 10 10 #include <boost/spirit/home/support/char_class.hpp> 11 #include <boost/ xpressive/proto/proto.hpp>11 #include <boost/proto/core.hpp> 12 12 13 13 namespace boost { namespace spirit { namespace ascii 14 14 {