1 /*=============================================================================
2 Copyright (c) 2001-2014 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(BOOST_SPIRIT_X3_PROXY_FEBRUARY_1_2013_0211PM)
8 #define BOOST_SPIRIT_X3_PROXY_FEBRUARY_1_2013_0211PM
10 #include <boost/spirit/home/x3/core/parser.hpp>
11 #include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
12 #include <boost/spirit/home/x3/support/traits/attribute_category.hpp>
14 namespace boost { namespace spirit { namespace x3
16 template <typename Subject, typename Derived>
17 struct proxy : unary_parser<Subject, Derived>
19 static bool const is_pass_through_unary = true;
21 proxy(Subject const& subject)
22 : unary_parser<Subject, Derived>(subject) {}
24 // Overload this when appropriate. The proxy parser will pick up
25 // the most derived overload.
26 template <typename Iterator, typename Context
27 , typename RuleContext, typename Attribute, typename Category>
28 bool parse_subject(Iterator& first, Iterator const& last
29 , Context const& context, RuleContext& rcontext, Attribute& attr, Category) const
31 this->subject.parse(first, last, context, rcontext, attr);
36 template <typename Iterator, typename Context
37 , typename RuleContext, typename Attribute>
38 bool parse(Iterator& first, Iterator const& last
39 , Context const& context, RuleContext& rcontext, Attribute& attr) const
41 return this->derived().parse_subject(first, last, context, rcontext, attr
42 , typename traits::attribute_category<Attribute>::type());