Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003     Copyright (c) 2009 Francois Barel
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 ==============================================================================*/
0008 #if !defined(BOOST_SPIRIT_PARAMETERIZED_AUGUST_09_2009_0539AM)
0009 #define BOOST_SPIRIT_PARAMETERIZED_AUGUST_09_2009_0539AM
0010 
0011 #if defined(_MSC_VER)
0012 #pragma once
0013 #endif
0014 
0015 #include <boost/ref.hpp>
0016 
0017 #include <boost/spirit/home/support/handles_container.hpp>
0018 #include <boost/spirit/home/qi/parser.hpp>
0019 
0020 namespace boost { namespace spirit { namespace qi
0021 {
0022     ///////////////////////////////////////////////////////////////////////////
0023     // parameterized_nonterminal: parser representing the invocation of a
0024     // nonterminal, passing inherited attributes
0025     ///////////////////////////////////////////////////////////////////////////
0026     template <typename Subject, typename Params>
0027     struct parameterized_nonterminal
0028       : parser<parameterized_nonterminal<Subject, Params> >
0029     {
0030         parameterized_nonterminal(Subject const& subject, Params const& params_)
0031           : ref(subject), params(params_)
0032         {
0033         }
0034 
0035         template <typename Context, typename Iterator>
0036         struct attribute
0037             // Forward to subject.
0038           : Subject::template attribute<Context, Iterator> {};
0039 
0040         template <typename Iterator, typename Context
0041           , typename Skipper, typename Attribute>
0042         bool parse(Iterator& first, Iterator const& last
0043           , Context& context, Skipper const& skipper
0044           , Attribute& attr_) const
0045         {
0046             // Forward to subject, passing the additional
0047             // params argument to parse.
0048             return ref.get().parse(first, last, context, skipper, attr_, params);
0049         }
0050 
0051         template <typename Context>
0052         info what(Context& context) const
0053         {
0054             // Forward to subject.
0055             return ref.get().what(context);
0056         }
0057 
0058         boost::reference_wrapper<Subject const> ref;
0059         Params params;
0060     };
0061 }}}
0062 
0063 namespace boost { namespace spirit { namespace traits
0064 {
0065     ///////////////////////////////////////////////////////////////////////////
0066     template <typename Subject, typename Params, typename Attribute
0067       , typename Context, typename Iterator>
0068     struct handles_container<qi::parameterized_nonterminal<Subject, Params>
0069           , Attribute, Context, Iterator>
0070       : handles_container<typename remove_const<Subject>::type
0071         , Attribute, Context, Iterator> 
0072     {};
0073 }}}
0074 
0075 #endif