Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:44

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 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 #ifndef BOOST_SPIRIT_QI_DIRECTIVE_OMIT_HPP
0008 #define BOOST_SPIRIT_QI_DIRECTIVE_OMIT_HPP
0009 
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013 
0014 #include <boost/spirit/home/qi/meta_compiler.hpp>
0015 #include <boost/spirit/home/qi/skip_over.hpp>
0016 #include <boost/spirit/home/qi/parser.hpp>
0017 #include <boost/spirit/home/support/unused.hpp>
0018 #include <boost/spirit/home/support/info.hpp>
0019 #include <boost/spirit/home/support/common_terminals.hpp>
0020 #include <boost/spirit/home/support/has_semantic_action.hpp>
0021 #include <boost/spirit/home/support/handles_container.hpp>
0022 
0023 namespace boost { namespace spirit
0024 {
0025     ///////////////////////////////////////////////////////////////////////////
0026     // Enablers
0027     ///////////////////////////////////////////////////////////////////////////
0028     template <>
0029     struct use_directive<qi::domain, tag::omit> // enables omit
0030       : mpl::true_ {};
0031 }}
0032 
0033 namespace boost { namespace spirit { namespace qi
0034 {
0035 #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
0036     using spirit::omit;
0037 #endif
0038     using spirit::omit_type;
0039 
0040     ///////////////////////////////////////////////////////////////////////////
0041     // omit_directive forces the attribute of subject parser
0042     // to be unused_type
0043     ///////////////////////////////////////////////////////////////////////////
0044     template <typename Subject>
0045     struct omit_directive : unary_parser<omit_directive<Subject> >
0046     {
0047         typedef Subject subject_type;
0048         omit_directive(Subject const& subject_)
0049           : subject(subject_) {}
0050 
0051         template <typename Context, typename Iterator>
0052         struct attribute
0053         {
0054             typedef unused_type type;
0055         };
0056 
0057         template <typename Iterator, typename Context
0058           , typename Skipper, typename Attribute>
0059         bool parse(Iterator& first, Iterator const& last
0060           , Context& context, Skipper const& skipper, Attribute& attr_) const
0061         {
0062             return subject.parse(first, last, context, skipper, attr_);
0063         }
0064 
0065         template <typename Context>
0066         info what(Context& context) const
0067         {
0068             return info("omit", subject.what(context));
0069         }
0070 
0071         Subject subject;
0072     };
0073 
0074     ///////////////////////////////////////////////////////////////////////////
0075     // Parser generators: make_xxx function (objects)
0076     ///////////////////////////////////////////////////////////////////////////
0077     template <typename Subject, typename Modifiers>
0078     struct make_directive<tag::omit, Subject, Modifiers>
0079     {
0080         typedef omit_directive<Subject> result_type;
0081         result_type operator()(unused_type, Subject const& subject, unused_type) const
0082         {
0083             return result_type(subject);
0084         }
0085     };
0086 }}}
0087 
0088 namespace boost { namespace spirit { namespace traits
0089 {
0090     ///////////////////////////////////////////////////////////////////////////
0091     template <typename Subject>
0092     struct has_semantic_action<qi::omit_directive<Subject> >
0093       : mpl::false_ {};
0094 
0095     ///////////////////////////////////////////////////////////////////////////
0096     template <typename Subject, typename Attribute, typename Context
0097         , typename Iterator>
0098     struct handles_container<qi::omit_directive<Subject>, Attribute
0099         , Context, Iterator>
0100       : unary_handles_container<Subject, Attribute, Context, Iterator> {};
0101 }}}
0102 
0103 #endif