Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:02:35

0001 /*=============================================================================
0002     Copyright (c) 2001-2014 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(BOOST_SPIRIT_X3_PROXY_FEBRUARY_1_2013_0211PM)
0008 #define BOOST_SPIRIT_X3_PROXY_FEBRUARY_1_2013_0211PM
0009 
0010 #include <boost/spirit/home/x3/core/parser.hpp>
0011 #include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
0012 #include <boost/spirit/home/x3/support/traits/attribute_category.hpp>
0013 
0014 namespace boost { namespace spirit { namespace x3
0015 {
0016     template <typename Subject, typename Derived>
0017     struct proxy : unary_parser<Subject, Derived>
0018     {
0019         static bool const is_pass_through_unary = true;
0020 
0021         constexpr proxy(Subject const& subject)
0022           : unary_parser<Subject, Derived>(subject) {}
0023 
0024         // Overload this when appropriate. The proxy parser will pick up
0025         // the most derived overload.
0026         template <typename Iterator, typename Context
0027           , typename RuleContext, typename Attribute, typename Category>
0028         bool parse_subject(Iterator& first, Iterator const& last
0029           , Context const& context, RuleContext& rcontext, Attribute& attr, Category) const
0030         {
0031             this->subject.parse(first, last, context, rcontext, attr);
0032             return true;
0033         }
0034 
0035         // Main entry point.
0036         template <typename Iterator, typename Context
0037           , typename RuleContext, typename Attribute>
0038         bool parse(Iterator& first, Iterator const& last
0039           , Context const& context, RuleContext& rcontext, Attribute& attr) const
0040         {
0041             return this->derived().parse_subject(first, last, context, rcontext, attr
0042                 , typename traits::attribute_category<Attribute>::type());
0043         }
0044     };
0045 
0046 }}}
0047 
0048 #endif