Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //  Copyright (c) 2001-2011 Hartmut Kaiser
0002 //
0003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
0004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #if !defined(BOOST_SPIRIT_QI_AUTO_NOV_29_2009_0336PM)
0007 #define BOOST_SPIRIT_QI_AUTO_NOV_29_2009_0336PM
0008 
0009 #if defined(_MSC_VER)
0010 #pragma once
0011 #endif
0012 
0013 #include <boost/spirit/home/support/common_terminals.hpp>
0014 #include <boost/spirit/home/support/info.hpp>
0015 #include <boost/spirit/home/support/container.hpp>
0016 #include <boost/spirit/home/support/detail/hold_any.hpp>
0017 #include <boost/spirit/home/qi/domain.hpp>
0018 #include <boost/spirit/home/qi/meta_compiler.hpp>
0019 #include <boost/spirit/home/qi/skip_over.hpp>
0020 #include <boost/spirit/home/qi/parser.hpp>
0021 #include <boost/spirit/home/qi/auto/create_parser.hpp>
0022 #include <boost/mpl/bool.hpp>
0023 
0024 ///////////////////////////////////////////////////////////////////////////////
0025 namespace boost { namespace spirit
0026 {
0027     ///////////////////////////////////////////////////////////////////////////
0028     // Enablers
0029     ///////////////////////////////////////////////////////////////////////////
0030     template <>
0031     struct use_terminal<qi::domain, tag::auto_>     // enables auto_
0032       : mpl::true_ {};
0033 }}
0034 
0035 ///////////////////////////////////////////////////////////////////////////////
0036 namespace boost { namespace spirit { namespace qi
0037 {
0038 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0039     using spirit::auto_;
0040 #endif
0041     using spirit::auto_type;
0042 
0043     ///////////////////////////////////////////////////////////////////////////
0044     template <typename Modifiers>
0045     struct auto_parser
0046       : parser<auto_parser<Modifiers> >
0047     {
0048         template <typename Context, typename Iterator>
0049         struct attribute
0050         {
0051             typedef spirit::hold_any type;
0052         };
0053 
0054         auto_parser(Modifiers const& modifiers)
0055           : modifiers_(modifiers) {}
0056 
0057         template <typename Iterator, typename Context, typename Skipper
0058           , typename Attribute>
0059         bool parse(Iterator& first, Iterator const& last
0060           , Context& context, Skipper const& skipper, Attribute& attr) const
0061         {
0062             return compile<qi::domain>(create_parser<Attribute>(), modifiers_)
0063                       .parse(first, last, context, skipper, attr);
0064         }
0065 
0066         template <typename Context>
0067         info what(Context& /*context*/) const
0068         {
0069             return info("auto_");
0070         }
0071 
0072         Modifiers modifiers_;
0073     };
0074 
0075     ///////////////////////////////////////////////////////////////////////////
0076     // Generator generators: make_xxx function (objects)
0077     ///////////////////////////////////////////////////////////////////////////
0078     template <typename Modifiers>
0079     struct make_primitive<tag::auto_, Modifiers>
0080     {
0081         typedef auto_parser<Modifiers> result_type;
0082 
0083         result_type operator()(unused_type, Modifiers const& modifiers) const
0084         {
0085             return result_type(modifiers);
0086         }
0087     };
0088 }}}
0089 
0090 #endif