Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:52:54

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