Update contrib.
1 /*=============================================================================
2 Copyright (c) 2001-2003 Joel de Guzman
3 Copyright (c) 2002-2003 Hartmut Kaiser
4 http://spirit.sourceforge.net/
6 Use, modification and distribution is subject to the Boost Software
7 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 http://www.boost.org/LICENSE_1_0.txt)
9 =============================================================================*/
10 #ifndef BOOST_SPIRIT_CLOSURE_HPP
11 #define BOOST_SPIRIT_CLOSURE_HPP
13 ///////////////////////////////////////////////////////////////////////////////
14 #include <boost/spirit/core/parser.hpp>
15 #include <boost/spirit/core/composite/composite.hpp>
16 #include <boost/spirit/core/non_terminal/parser_context.hpp>
17 #include <boost/spirit/attribute/parametric.hpp>
18 #include <boost/spirit/attribute/closure_context.hpp>
19 #include <boost/spirit/attribute/closure_fwd.hpp>
21 #include <boost/spirit/phoenix/closures.hpp>
22 #include <boost/spirit/phoenix/primitives.hpp>
23 #include <boost/spirit/phoenix/casts.hpp>
24 #include <boost/spirit/phoenix/operators.hpp>
25 #include <boost/spirit/phoenix/tuple_helpers.hpp>
27 #include <boost/static_assert.hpp>
29 ///////////////////////////////////////////////////////////////////////////////
31 // Spirit predefined maximum closure limit. This limit defines the maximum
32 // number of elements a closure can hold. This number defaults to 3. The
33 // actual maximum is rounded up in multiples of 3. Thus, if this value
34 // is 4, the actual limit is 6. The ultimate maximum limit in this
35 // implementation is 15.
37 // It should NOT be greater than PHOENIX_LIMIT!
39 ///////////////////////////////////////////////////////////////////////////////
41 #if !defined(BOOST_SPIRIT_CLOSURE_LIMIT)
42 #define BOOST_SPIRIT_CLOSURE_LIMIT PHOENIX_LIMIT
45 ///////////////////////////////////////////////////////////////////////////////
47 // ensure BOOST_SPIRIT_CLOSURE_LIMIT <= PHOENIX_LIMIT and SPIRIT_CLOSURE_LIMIT <= 15
49 ///////////////////////////////////////////////////////////////////////////////
50 BOOST_STATIC_ASSERT(BOOST_SPIRIT_CLOSURE_LIMIT <= PHOENIX_LIMIT);
51 BOOST_STATIC_ASSERT(BOOST_SPIRIT_CLOSURE_LIMIT <= 15);
53 ///////////////////////////////////////////////////////////////////////////////
54 namespace boost { namespace spirit {
56 ///////////////////////////////////////////////////////////////////////////
58 // closure_context class
60 ///////////////////////////////////////////////////////////////////////////
61 template <typename ClosureT>
62 class closure_context : public parser_context_base
66 typedef typename phoenix::tuple_element<0,
67 typename ClosureT::tuple_t>::type attr_t;
68 typedef ClosureT base_t;
69 typedef closure_context_linker<closure_context<ClosureT> >
72 closure_context(ClosureT const& clos)
77 template <typename ParserT, typename ScannerT>
78 void pre_parse(ParserT const&, ScannerT const&) {}
80 template <typename ResultT, typename ParserT, typename ScannerT>
81 ResultT& post_parse(ResultT& hit, ParserT const&, ScannerT const&)
82 { hit.value(frame[phoenix::tuple_index<0>()]); return hit; }
86 phoenix::closure_frame<typename ClosureT::phoenix_closure_t> frame;
89 ///////////////////////////////////////////////////////////////////////////
91 // init_closure_context class
93 // The init_closure_context class is a special parser context type
94 // which additionally initializes a closure contained in the derived
95 // parser with values from a given tuple. Please note, that this
96 // given tuple does not contain the required values directly, it
97 // contains phoenix::actor objects. These actors have to be
98 // dereferenced to gain the values to be used for initialization
99 // (this is done by the help of the phoenix::convert_actors<>
102 ///////////////////////////////////////////////////////////////////////////
104 template <typename ClosureT>
105 class init_closure_context : public parser_context_base
107 typedef typename ClosureT::tuple_t tuple_t;
108 typedef typename ClosureT::closure_t closure_t;
112 init_closure_context(ClosureT const& clos)
113 : frame(clos.subject(), phoenix::convert_actors<tuple_t>(clos.init)) {}
115 ~init_closure_context() {}
117 template <typename ParserT, typename ScannerT>
118 void pre_parse(ParserT const& /*p*/, ScannerT const&) {}
120 template <typename ResultT, typename ParserT, typename ScannerT>
121 ResultT& post_parse(ResultT& hit, ParserT const&, ScannerT const&)
122 { hit.value(frame[phoenix::tuple_index<0>()]); return hit; }
126 phoenix::closure_frame<closure_t> frame;
129 ///////////////////////////////////////////////////////////////////////////
131 // init_closure_parser class
133 ///////////////////////////////////////////////////////////////////////////
134 template <typename ParserT, typename ActorTupleT>
135 struct init_closure_parser
136 : public unary<ParserT, parser<init_closure_parser<ParserT, ActorTupleT> > >
138 typedef init_closure_parser<ParserT, ActorTupleT> self_t;
139 typedef unary<ParserT, parser<self_t> > base_t;
140 typedef typename ParserT::phoenix_closure_t closure_t;
141 typedef typename ParserT::tuple_t tuple_t;
142 typedef typename phoenix::tuple_element<0, tuple_t>::type attr_t;
144 template <typename ScannerT>
147 typedef typename match_result<ScannerT, attr_t>::type type;
150 init_closure_parser(ParserT const& p, ActorTupleT const& init_)
151 : base_t(p), init(init_) {}
153 template <typename ScannerT>
154 typename parser_result<self_t, ScannerT>::type
155 parse_main(ScannerT const& scan) const
157 return this->subject().parse_main(scan);
160 template <typename ScannerT>
161 typename parser_result<self_t, ScannerT>::type
162 parse(ScannerT const& scan) const
164 typedef init_closure_context<self_t> init_context_t;
165 typedef parser_scanner_linker<ScannerT> scanner_t;
166 typedef closure_context_linker<init_context_t> context_t;
167 typedef typename parser_result<self_t, ScannerT>::type result_t;
168 BOOST_SPIRIT_CONTEXT_PARSE(
169 scan, *this, scanner_t, context_t, result_t);
175 ///////////////////////////////////////////////////////////////////////////
179 ///////////////////////////////////////////////////////////////////////////
186 #if BOOST_SPIRIT_CLOSURE_LIMIT > 3
191 #if BOOST_SPIRIT_CLOSURE_LIMIT > 6
196 #if BOOST_SPIRIT_CLOSURE_LIMIT > 9
201 #if BOOST_SPIRIT_CLOSURE_LIMIT > 12
211 public phoenix::closure<
213 #if BOOST_SPIRIT_CLOSURE_LIMIT > 3
215 #if BOOST_SPIRIT_CLOSURE_LIMIT > 6
217 #if BOOST_SPIRIT_CLOSURE_LIMIT > 9
219 #if BOOST_SPIRIT_CLOSURE_LIMIT > 12
227 typedef phoenix::closure<
229 #if BOOST_SPIRIT_CLOSURE_LIMIT > 3
231 #if BOOST_SPIRIT_CLOSURE_LIMIT > 6
233 #if BOOST_SPIRIT_CLOSURE_LIMIT > 9
235 #if BOOST_SPIRIT_CLOSURE_LIMIT > 12
243 typedef closure_context<DerivedT> context_t;
245 template <typename DerivedT2>
248 DerivedT2& aux_derived()
249 { return *static_cast<DerivedT2*>(this); }
251 DerivedT2 const& aux_derived() const
252 { return *static_cast<DerivedT2 const*>(this); }
254 // initialization functions
255 template <typename A>
259 typename phoenix::as_actor<A>::type
262 operator()(A const &a) const
264 typedef typename phoenix::as_actor<A>::type a_t;
265 typedef phoenix::tuple<a_t> actor_tuple_t;
267 return init_closure_parser<DerivedT2, actor_tuple_t>(
270 phoenix::as_actor<A>::convert(a)
275 template <typename A, typename B>
279 typename phoenix::as_actor<A>::type,
280 typename phoenix::as_actor<B>::type
283 operator()(A const &a, B const &b) const
285 typedef typename phoenix::as_actor<A>::type a_t;
286 typedef typename phoenix::as_actor<B>::type b_t;
287 typedef phoenix::tuple<a_t, b_t> actor_tuple_t;
289 return init_closure_parser<DerivedT2, actor_tuple_t>(
292 phoenix::as_actor<A>::convert(a),
293 phoenix::as_actor<B>::convert(b)
298 template <typename A, typename B, typename C>
302 typename phoenix::as_actor<A>::type,
303 typename phoenix::as_actor<B>::type,
304 typename phoenix::as_actor<C>::type
307 operator()(A const &a, B const &b, C const &c) const
309 typedef typename phoenix::as_actor<A>::type a_t;
310 typedef typename phoenix::as_actor<B>::type b_t;
311 typedef typename phoenix::as_actor<C>::type c_t;
312 typedef phoenix::tuple<a_t, b_t, c_t> actor_tuple_t;
314 return init_closure_parser<DerivedT2, actor_tuple_t>(
317 phoenix::as_actor<A>::convert(a),
318 phoenix::as_actor<B>::convert(b),
319 phoenix::as_actor<C>::convert(c)
324 #if BOOST_SPIRIT_CLOSURE_LIMIT > 3
327 typename A, typename B, typename C, typename D
332 typename phoenix::as_actor<A>::type,
333 typename phoenix::as_actor<B>::type,
334 typename phoenix::as_actor<C>::type,
335 typename phoenix::as_actor<D>::type
339 A const &a, B const &b, C const &c, D const &d
342 typedef typename phoenix::as_actor<A>::type a_t;
343 typedef typename phoenix::as_actor<B>::type b_t;
344 typedef typename phoenix::as_actor<C>::type c_t;
345 typedef typename phoenix::as_actor<D>::type d_t;
346 typedef phoenix::tuple<
350 return init_closure_parser<DerivedT2, actor_tuple_t>(
353 phoenix::as_actor<A>::convert(a),
354 phoenix::as_actor<B>::convert(b),
355 phoenix::as_actor<C>::convert(c),
356 phoenix::as_actor<D>::convert(d)
362 typename A, typename B, typename C, typename D, typename E
367 typename phoenix::as_actor<A>::type,
368 typename phoenix::as_actor<B>::type,
369 typename phoenix::as_actor<C>::type,
370 typename phoenix::as_actor<D>::type,
371 typename phoenix::as_actor<E>::type
375 A const &a, B const &b, C const &c, D const &d, E const &e
378 typedef typename phoenix::as_actor<A>::type a_t;
379 typedef typename phoenix::as_actor<B>::type b_t;
380 typedef typename phoenix::as_actor<C>::type c_t;
381 typedef typename phoenix::as_actor<D>::type d_t;
382 typedef typename phoenix::as_actor<E>::type e_t;
383 typedef phoenix::tuple<
384 a_t, b_t, c_t, d_t, e_t
387 return init_closure_parser<DerivedT2, actor_tuple_t>(
390 phoenix::as_actor<A>::convert(a),
391 phoenix::as_actor<B>::convert(b),
392 phoenix::as_actor<C>::convert(c),
393 phoenix::as_actor<D>::convert(d),
394 phoenix::as_actor<E>::convert(e)
400 typename A, typename B, typename C, typename D, typename E,
406 typename phoenix::as_actor<A>::type,
407 typename phoenix::as_actor<B>::type,
408 typename phoenix::as_actor<C>::type,
409 typename phoenix::as_actor<D>::type,
410 typename phoenix::as_actor<E>::type,
411 typename phoenix::as_actor<F>::type
415 A const &a, B const &b, C const &c, D const &d, E const &e,
419 typedef typename phoenix::as_actor<A>::type a_t;
420 typedef typename phoenix::as_actor<B>::type b_t;
421 typedef typename phoenix::as_actor<C>::type c_t;
422 typedef typename phoenix::as_actor<D>::type d_t;
423 typedef typename phoenix::as_actor<E>::type e_t;
424 typedef typename phoenix::as_actor<F>::type f_t;
425 typedef phoenix::tuple<
426 a_t, b_t, c_t, d_t, e_t, f_t
429 return init_closure_parser<DerivedT2, actor_tuple_t>(
432 phoenix::as_actor<A>::convert(a),
433 phoenix::as_actor<B>::convert(b),
434 phoenix::as_actor<C>::convert(c),
435 phoenix::as_actor<D>::convert(d),
436 phoenix::as_actor<E>::convert(e),
437 phoenix::as_actor<F>::convert(f)
442 #if BOOST_SPIRIT_CLOSURE_LIMIT > 6
445 typename A, typename B, typename C, typename D, typename E,
446 typename F, typename G
451 typename phoenix::as_actor<A>::type,
452 typename phoenix::as_actor<B>::type,
453 typename phoenix::as_actor<C>::type,
454 typename phoenix::as_actor<D>::type,
455 typename phoenix::as_actor<E>::type,
456 typename phoenix::as_actor<F>::type,
457 typename phoenix::as_actor<G>::type
461 A const &a, B const &b, C const &c, D const &d, E const &e,
462 F const &f, G const &g
465 typedef typename phoenix::as_actor<A>::type a_t;
466 typedef typename phoenix::as_actor<B>::type b_t;
467 typedef typename phoenix::as_actor<C>::type c_t;
468 typedef typename phoenix::as_actor<D>::type d_t;
469 typedef typename phoenix::as_actor<E>::type e_t;
470 typedef typename phoenix::as_actor<F>::type f_t;
471 typedef typename phoenix::as_actor<G>::type g_t;
472 typedef phoenix::tuple<
473 a_t, b_t, c_t, d_t, e_t, f_t, g_t
476 return init_closure_parser<DerivedT2, actor_tuple_t>(
479 phoenix::as_actor<A>::convert(a),
480 phoenix::as_actor<B>::convert(b),
481 phoenix::as_actor<C>::convert(c),
482 phoenix::as_actor<D>::convert(d),
483 phoenix::as_actor<E>::convert(e),
484 phoenix::as_actor<F>::convert(f),
485 phoenix::as_actor<G>::convert(g)
491 typename A, typename B, typename C, typename D, typename E,
492 typename F, typename G, typename H
497 typename phoenix::as_actor<A>::type,
498 typename phoenix::as_actor<B>::type,
499 typename phoenix::as_actor<C>::type,
500 typename phoenix::as_actor<D>::type,
501 typename phoenix::as_actor<E>::type,
502 typename phoenix::as_actor<F>::type,
503 typename phoenix::as_actor<G>::type,
504 typename phoenix::as_actor<H>::type
508 A const &a, B const &b, C const &c, D const &d, E const &e,
509 F const &f, G const &g, H const &h
512 typedef typename phoenix::as_actor<A>::type a_t;
513 typedef typename phoenix::as_actor<B>::type b_t;
514 typedef typename phoenix::as_actor<C>::type c_t;
515 typedef typename phoenix::as_actor<D>::type d_t;
516 typedef typename phoenix::as_actor<E>::type e_t;
517 typedef typename phoenix::as_actor<F>::type f_t;
518 typedef typename phoenix::as_actor<G>::type g_t;
519 typedef typename phoenix::as_actor<H>::type h_t;
520 typedef phoenix::tuple<
521 a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t
524 return init_closure_parser<DerivedT2, actor_tuple_t>(
527 phoenix::as_actor<A>::convert(a),
528 phoenix::as_actor<B>::convert(b),
529 phoenix::as_actor<C>::convert(c),
530 phoenix::as_actor<D>::convert(d),
531 phoenix::as_actor<E>::convert(e),
532 phoenix::as_actor<F>::convert(f),
533 phoenix::as_actor<G>::convert(g),
534 phoenix::as_actor<H>::convert(h)
540 typename A, typename B, typename C, typename D, typename E,
541 typename F, typename G, typename H, typename I
546 typename phoenix::as_actor<A>::type,
547 typename phoenix::as_actor<B>::type,
548 typename phoenix::as_actor<C>::type,
549 typename phoenix::as_actor<D>::type,
550 typename phoenix::as_actor<E>::type,
551 typename phoenix::as_actor<F>::type,
552 typename phoenix::as_actor<G>::type,
553 typename phoenix::as_actor<H>::type,
554 typename phoenix::as_actor<I>::type
558 A const &a, B const &b, C const &c, D const &d, E const &e,
559 F const &f, G const &g, H const &h, I const &i
562 typedef typename phoenix::as_actor<A>::type a_t;
563 typedef typename phoenix::as_actor<B>::type b_t;
564 typedef typename phoenix::as_actor<C>::type c_t;
565 typedef typename phoenix::as_actor<D>::type d_t;
566 typedef typename phoenix::as_actor<E>::type e_t;
567 typedef typename phoenix::as_actor<F>::type f_t;
568 typedef typename phoenix::as_actor<G>::type g_t;
569 typedef typename phoenix::as_actor<H>::type h_t;
570 typedef typename phoenix::as_actor<I>::type i_t;
571 typedef phoenix::tuple<
572 a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t
575 return init_closure_parser<DerivedT2, actor_tuple_t>(
578 phoenix::as_actor<A>::convert(a),
579 phoenix::as_actor<B>::convert(b),
580 phoenix::as_actor<C>::convert(c),
581 phoenix::as_actor<D>::convert(d),
582 phoenix::as_actor<E>::convert(e),
583 phoenix::as_actor<F>::convert(f),
584 phoenix::as_actor<G>::convert(g),
585 phoenix::as_actor<H>::convert(h),
586 phoenix::as_actor<I>::convert(i)
591 #if BOOST_SPIRIT_CLOSURE_LIMIT > 9
594 typename A, typename B, typename C, typename D, typename E,
595 typename F, typename G, typename H, typename I, typename J
600 typename phoenix::as_actor<A>::type,
601 typename phoenix::as_actor<B>::type,
602 typename phoenix::as_actor<C>::type,
603 typename phoenix::as_actor<D>::type,
604 typename phoenix::as_actor<E>::type,
605 typename phoenix::as_actor<F>::type,
606 typename phoenix::as_actor<G>::type,
607 typename phoenix::as_actor<H>::type,
608 typename phoenix::as_actor<I>::type,
609 typename phoenix::as_actor<J>::type
613 A const &a, B const &b, C const &c, D const &d, E const &e,
614 F const &f, G const &g, H const &h, I const &i, J const &j
617 typedef typename phoenix::as_actor<A>::type a_t;
618 typedef typename phoenix::as_actor<B>::type b_t;
619 typedef typename phoenix::as_actor<C>::type c_t;
620 typedef typename phoenix::as_actor<D>::type d_t;
621 typedef typename phoenix::as_actor<E>::type e_t;
622 typedef typename phoenix::as_actor<F>::type f_t;
623 typedef typename phoenix::as_actor<G>::type g_t;
624 typedef typename phoenix::as_actor<H>::type h_t;
625 typedef typename phoenix::as_actor<I>::type i_t;
626 typedef typename phoenix::as_actor<J>::type j_t;
627 typedef phoenix::tuple<
628 a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t
631 return init_closure_parser<DerivedT2, actor_tuple_t>(
634 phoenix::as_actor<A>::convert(a),
635 phoenix::as_actor<B>::convert(b),
636 phoenix::as_actor<C>::convert(c),
637 phoenix::as_actor<D>::convert(d),
638 phoenix::as_actor<E>::convert(e),
639 phoenix::as_actor<F>::convert(f),
640 phoenix::as_actor<G>::convert(g),
641 phoenix::as_actor<H>::convert(h),
642 phoenix::as_actor<I>::convert(i),
643 phoenix::as_actor<J>::convert(j)
649 typename A, typename B, typename C, typename D, typename E,
650 typename F, typename G, typename H, typename I, typename J,
656 typename phoenix::as_actor<A>::type,
657 typename phoenix::as_actor<B>::type,
658 typename phoenix::as_actor<C>::type,
659 typename phoenix::as_actor<D>::type,
660 typename phoenix::as_actor<E>::type,
661 typename phoenix::as_actor<F>::type,
662 typename phoenix::as_actor<G>::type,
663 typename phoenix::as_actor<H>::type,
664 typename phoenix::as_actor<I>::type,
665 typename phoenix::as_actor<J>::type,
666 typename phoenix::as_actor<K>::type
670 A const &a, B const &b, C const &c, D const &d, E const &e,
671 F const &f, G const &g, H const &h, I const &i, J const &j,
675 typedef typename phoenix::as_actor<A>::type a_t;
676 typedef typename phoenix::as_actor<B>::type b_t;
677 typedef typename phoenix::as_actor<C>::type c_t;
678 typedef typename phoenix::as_actor<D>::type d_t;
679 typedef typename phoenix::as_actor<E>::type e_t;
680 typedef typename phoenix::as_actor<F>::type f_t;
681 typedef typename phoenix::as_actor<G>::type g_t;
682 typedef typename phoenix::as_actor<H>::type h_t;
683 typedef typename phoenix::as_actor<I>::type i_t;
684 typedef typename phoenix::as_actor<J>::type j_t;
685 typedef typename phoenix::as_actor<K>::type k_t;
686 typedef phoenix::tuple<
687 a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t,
691 return init_closure_parser<DerivedT2, actor_tuple_t>(
694 phoenix::as_actor<A>::convert(a),
695 phoenix::as_actor<B>::convert(b),
696 phoenix::as_actor<C>::convert(c),
697 phoenix::as_actor<D>::convert(d),
698 phoenix::as_actor<E>::convert(e),
699 phoenix::as_actor<F>::convert(f),
700 phoenix::as_actor<G>::convert(g),
701 phoenix::as_actor<H>::convert(h),
702 phoenix::as_actor<I>::convert(i),
703 phoenix::as_actor<J>::convert(j),
704 phoenix::as_actor<K>::convert(k)
710 typename A, typename B, typename C, typename D, typename E,
711 typename F, typename G, typename H, typename I, typename J,
712 typename K, typename L
717 typename phoenix::as_actor<A>::type,
718 typename phoenix::as_actor<B>::type,
719 typename phoenix::as_actor<C>::type,
720 typename phoenix::as_actor<D>::type,
721 typename phoenix::as_actor<E>::type,
722 typename phoenix::as_actor<F>::type,
723 typename phoenix::as_actor<G>::type,
724 typename phoenix::as_actor<H>::type,
725 typename phoenix::as_actor<I>::type,
726 typename phoenix::as_actor<J>::type,
727 typename phoenix::as_actor<K>::type,
728 typename phoenix::as_actor<L>::type
732 A const &a, B const &b, C const &c, D const &d, E const &e,
733 F const &f, G const &g, H const &h, I const &i, J const &j,
734 K const &k, L const &l
737 typedef typename phoenix::as_actor<A>::type a_t;
738 typedef typename phoenix::as_actor<B>::type b_t;
739 typedef typename phoenix::as_actor<C>::type c_t;
740 typedef typename phoenix::as_actor<D>::type d_t;
741 typedef typename phoenix::as_actor<E>::type e_t;
742 typedef typename phoenix::as_actor<F>::type f_t;
743 typedef typename phoenix::as_actor<G>::type g_t;
744 typedef typename phoenix::as_actor<H>::type h_t;
745 typedef typename phoenix::as_actor<I>::type i_t;
746 typedef typename phoenix::as_actor<J>::type j_t;
747 typedef typename phoenix::as_actor<K>::type k_t;
748 typedef typename phoenix::as_actor<L>::type l_t;
749 typedef phoenix::tuple<
750 a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t,
754 return init_closure_parser<DerivedT2, actor_tuple_t>(
757 phoenix::as_actor<A>::convert(a),
758 phoenix::as_actor<B>::convert(b),
759 phoenix::as_actor<C>::convert(c),
760 phoenix::as_actor<D>::convert(d),
761 phoenix::as_actor<E>::convert(e),
762 phoenix::as_actor<F>::convert(f),
763 phoenix::as_actor<G>::convert(g),
764 phoenix::as_actor<H>::convert(h),
765 phoenix::as_actor<I>::convert(i),
766 phoenix::as_actor<J>::convert(j),
767 phoenix::as_actor<K>::convert(k),
768 phoenix::as_actor<L>::convert(l)
773 #if BOOST_SPIRIT_CLOSURE_LIMIT > 12
776 typename A, typename B, typename C, typename D, typename E,
777 typename F, typename G, typename H, typename I, typename J,
778 typename K, typename L, typename M
783 typename phoenix::as_actor<A>::type,
784 typename phoenix::as_actor<B>::type,
785 typename phoenix::as_actor<C>::type,
786 typename phoenix::as_actor<D>::type,
787 typename phoenix::as_actor<E>::type,
788 typename phoenix::as_actor<F>::type,
789 typename phoenix::as_actor<G>::type,
790 typename phoenix::as_actor<H>::type,
791 typename phoenix::as_actor<I>::type,
792 typename phoenix::as_actor<J>::type,
793 typename phoenix::as_actor<K>::type,
794 typename phoenix::as_actor<L>::type,
795 typename phoenix::as_actor<M>::type
799 A const &a, B const &b, C const &c, D const &d, E const &e,
800 F const &f, G const &g, H const &h, I const &i, J const &j,
801 K const &k, L const &l, M const &m
804 typedef typename phoenix::as_actor<A>::type a_t;
805 typedef typename phoenix::as_actor<B>::type b_t;
806 typedef typename phoenix::as_actor<C>::type c_t;
807 typedef typename phoenix::as_actor<D>::type d_t;
808 typedef typename phoenix::as_actor<E>::type e_t;
809 typedef typename phoenix::as_actor<F>::type f_t;
810 typedef typename phoenix::as_actor<G>::type g_t;
811 typedef typename phoenix::as_actor<H>::type h_t;
812 typedef typename phoenix::as_actor<I>::type i_t;
813 typedef typename phoenix::as_actor<J>::type j_t;
814 typedef typename phoenix::as_actor<K>::type k_t;
815 typedef typename phoenix::as_actor<L>::type l_t;
816 typedef typename phoenix::as_actor<M>::type m_t;
817 typedef phoenix::tuple<
818 a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t,
822 return init_closure_parser<DerivedT2, actor_tuple_t>(
825 phoenix::as_actor<A>::convert(a),
826 phoenix::as_actor<B>::convert(b),
827 phoenix::as_actor<C>::convert(c),
828 phoenix::as_actor<D>::convert(d),
829 phoenix::as_actor<E>::convert(e),
830 phoenix::as_actor<F>::convert(f),
831 phoenix::as_actor<G>::convert(g),
832 phoenix::as_actor<H>::convert(h),
833 phoenix::as_actor<I>::convert(i),
834 phoenix::as_actor<J>::convert(j),
835 phoenix::as_actor<K>::convert(k),
836 phoenix::as_actor<L>::convert(l),
837 phoenix::as_actor<M>::convert(m)
843 typename A, typename B, typename C, typename D, typename E,
844 typename F, typename G, typename H, typename I, typename J,
845 typename K, typename L, typename M, typename N
850 typename phoenix::as_actor<A>::type,
851 typename phoenix::as_actor<B>::type,
852 typename phoenix::as_actor<C>::type,
853 typename phoenix::as_actor<D>::type,
854 typename phoenix::as_actor<E>::type,
855 typename phoenix::as_actor<F>::type,
856 typename phoenix::as_actor<G>::type,
857 typename phoenix::as_actor<H>::type,
858 typename phoenix::as_actor<I>::type,
859 typename phoenix::as_actor<J>::type,
860 typename phoenix::as_actor<K>::type,
861 typename phoenix::as_actor<L>::type,
862 typename phoenix::as_actor<M>::type,
863 typename phoenix::as_actor<N>::type
867 A const &a, B const &b, C const &c, D const &d, E const &e,
868 F const &f, G const &g, H const &h, I const &i, J const &j,
869 K const &k, L const &l, M const &m, N const &n
872 typedef typename phoenix::as_actor<A>::type a_t;
873 typedef typename phoenix::as_actor<B>::type b_t;
874 typedef typename phoenix::as_actor<C>::type c_t;
875 typedef typename phoenix::as_actor<D>::type d_t;
876 typedef typename phoenix::as_actor<E>::type e_t;
877 typedef typename phoenix::as_actor<F>::type f_t;
878 typedef typename phoenix::as_actor<G>::type g_t;
879 typedef typename phoenix::as_actor<H>::type h_t;
880 typedef typename phoenix::as_actor<I>::type i_t;
881 typedef typename phoenix::as_actor<J>::type j_t;
882 typedef typename phoenix::as_actor<K>::type k_t;
883 typedef typename phoenix::as_actor<L>::type l_t;
884 typedef typename phoenix::as_actor<M>::type m_t;
885 typedef typename phoenix::as_actor<N>::type n_t;
886 typedef phoenix::tuple<
887 a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t,
891 return init_closure_parser<DerivedT2, actor_tuple_t>(
894 phoenix::as_actor<A>::convert(a),
895 phoenix::as_actor<B>::convert(b),
896 phoenix::as_actor<C>::convert(c),
897 phoenix::as_actor<D>::convert(d),
898 phoenix::as_actor<E>::convert(e),
899 phoenix::as_actor<F>::convert(f),
900 phoenix::as_actor<G>::convert(g),
901 phoenix::as_actor<H>::convert(h),
902 phoenix::as_actor<I>::convert(i),
903 phoenix::as_actor<J>::convert(j),
904 phoenix::as_actor<K>::convert(k),
905 phoenix::as_actor<L>::convert(l),
906 phoenix::as_actor<M>::convert(m),
907 phoenix::as_actor<N>::convert(n)
913 typename A, typename B, typename C, typename D, typename E,
914 typename F, typename G, typename H, typename I, typename J,
915 typename K, typename L, typename M, typename N, typename O
920 typename phoenix::as_actor<A>::type,
921 typename phoenix::as_actor<B>::type,
922 typename phoenix::as_actor<C>::type,
923 typename phoenix::as_actor<D>::type,
924 typename phoenix::as_actor<E>::type,
925 typename phoenix::as_actor<F>::type,
926 typename phoenix::as_actor<G>::type,
927 typename phoenix::as_actor<H>::type,
928 typename phoenix::as_actor<I>::type,
929 typename phoenix::as_actor<J>::type,
930 typename phoenix::as_actor<K>::type,
931 typename phoenix::as_actor<L>::type,
932 typename phoenix::as_actor<M>::type,
933 typename phoenix::as_actor<N>::type,
934 typename phoenix::as_actor<O>::type
938 A const &a, B const &b, C const &c, D const &d, E const &e,
939 F const &f, G const &g, H const &h, I const &i, J const &j,
940 K const &k, L const &l, M const &m, N const &n, O const &o
943 typedef typename phoenix::as_actor<A>::type a_t;
944 typedef typename phoenix::as_actor<B>::type b_t;
945 typedef typename phoenix::as_actor<C>::type c_t;
946 typedef typename phoenix::as_actor<D>::type d_t;
947 typedef typename phoenix::as_actor<E>::type e_t;
948 typedef typename phoenix::as_actor<F>::type f_t;
949 typedef typename phoenix::as_actor<G>::type g_t;
950 typedef typename phoenix::as_actor<H>::type h_t;
951 typedef typename phoenix::as_actor<I>::type i_t;
952 typedef typename phoenix::as_actor<J>::type j_t;
953 typedef typename phoenix::as_actor<K>::type k_t;
954 typedef typename phoenix::as_actor<L>::type l_t;
955 typedef typename phoenix::as_actor<M>::type m_t;
956 typedef typename phoenix::as_actor<N>::type n_t;
957 typedef typename phoenix::as_actor<O>::type o_t;
958 typedef phoenix::tuple<
959 a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t,
960 k_t, l_t, m_t, n_t, o_t
963 return init_closure_parser<DerivedT2, actor_tuple_t>(
966 phoenix::as_actor<A>::convert(a),
967 phoenix::as_actor<B>::convert(b),
968 phoenix::as_actor<C>::convert(c),
969 phoenix::as_actor<D>::convert(d),
970 phoenix::as_actor<E>::convert(e),
971 phoenix::as_actor<F>::convert(f),
972 phoenix::as_actor<G>::convert(g),
973 phoenix::as_actor<H>::convert(h),
974 phoenix::as_actor<I>::convert(i),
975 phoenix::as_actor<J>::convert(j),
976 phoenix::as_actor<K>::convert(k),
977 phoenix::as_actor<L>::convert(l),
978 phoenix::as_actor<M>::convert(m),
979 phoenix::as_actor<N>::convert(n),
980 phoenix::as_actor<O>::convert(o)
994 ///////////////////////////////////////////////////////////////////////////
996 // overloads for chseq_p and str_p taking in phoenix actors
998 ///////////////////////////////////////////////////////////////////////////
999 template <typename ActorT>
1000 struct container_begin
1002 typedef container_begin<ActorT> self_t;
1004 template <typename TupleT>
1007 typedef typename phoenix::actor_result<ActorT, TupleT>
1008 ::plain_type::iterator type;
1011 container_begin(ActorT actor_)
1014 template <typename TupleT>
1015 typename phoenix::actor_result<self_t, TupleT>::type
1016 eval(TupleT const& /*args*/) const
1017 { return actor().begin(); }
1022 template <typename ActorT>
1023 struct container_end
1025 typedef container_begin<ActorT> self_t;
1027 template <typename TupleT>
1030 typedef typename phoenix::actor_result<ActorT, TupleT>
1031 ::plain_type::iterator type;
1034 container_end(ActorT actor_)
1037 template <typename TupleT>
1038 typename phoenix::actor_result<self_t, TupleT>::type
1039 eval(TupleT const& /*args*/) const
1040 { return actor().end(); }
1045 template <typename BaseT>
1047 phoenix::actor<container_begin<phoenix::actor<BaseT> > >,
1048 phoenix::actor<container_end<phoenix::actor<BaseT> > >
1050 f_chseq_p(phoenix::actor<BaseT> const& a)
1052 typedef phoenix::actor<container_begin<phoenix::actor<BaseT> > >
1054 typedef phoenix::actor<container_end<phoenix::actor<BaseT> > >
1056 typedef f_chseq<container_begin_t, container_end_t> result_t;
1058 return result_t(container_begin_t(a), container_end_t(a));
1061 template <typename BaseT>
1063 phoenix::actor<container_begin<phoenix::actor<BaseT> > >,
1064 phoenix::actor<container_end<phoenix::actor<BaseT> > >
1066 f_str_p(phoenix::actor<BaseT> const& a)
1068 typedef phoenix::actor<container_begin<phoenix::actor<BaseT> > >
1070 typedef phoenix::actor<container_end<phoenix::actor<BaseT> > >
1072 typedef f_strlit<container_begin_t, container_end_t> result_t;
1074 return result_t(container_begin_t(a), container_end_t(a));
1077 }} // namespace boost::spirit