⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spirit_fwd.hpp

📁 著名的Parser库Spirit在VC6上的Port
💻 HPP
字号:
/*=============================================================================
    Forward declarations

    Spirit V1.3.1
    Copyright (c) 2001, Joel de Guzman

    This software is provided 'as-is', without any express or implied
    warranty. In no event will the copyright holder be held liable for
    any damages arising from the use of this software.

    Permission is granted to anyone to use this software for any purpose,
    including commercial applications, and to alter it and redistribute
    it freely, subject to the following restrictions:

    1.  The origin of this software must not be misrepresented; you must
        not claim that you wrote the original software. If you use this
        software in a product, an acknowledgment in the product documentation
        would be appreciated but is not required.

    2.  Altered source versions must be plainly marked as such, and must
        not be misrepresented as being the original software.

    3.  This notice may not be removed or altered from any source
        distribution.

    Acknowledgements:

        Special thanks to Dan Nuffer, John (EBo) David, Chris Uzdavinis,
        and Doug Gregor. These people are most instrumental in steering
        Spirit in the right direction.

        Special thanks also to people who have contributed to the code base
        and sample code, ported Spirit to various platforms and compilers,
        gave suggestions, reported and provided bug fixes. Alexander
        Hirner, Andy Elvey, Bogdan Kushnir, Brett Calcott, Bruce Florman,
        Changzhe Han, Colin McPhail, Hakki Dogusan, Jan Bares, Joseph
        Smith, Martijn W. van der Lee, Raghavendra Satish, Remi Delcos, Tom
        Spilman, Vladimir Prus, W. Scott Dillman, David A. Greene, Bob
        Bailey, Hartmut Kaiser.

        Finally special thanks also to people who gave feedback and
        valuable comments, particularly members of Spirit's Source Forge
        mailing list and boost.org.

    URL: http://spirit.sourceforge.net/

=============================================================================*/
#ifndef SPIRIT_FWD_HPP
#define SPIRIT_FWD_HPP

#include "boost/tuple/tuple.hpp"
#include "boost/spirit/MSVC/ps_helper.hpp"

///////////////////////////////////////////////////////////////////////////////
namespace spirit {

// is this really necessary?
using boost::tuples::element;

///////////////////////////////////////////////////////////////////////////////
//
//  Forward declarations. These are needed to minimize dependencies.
//
///////////////////////////////////////////////////////////////////////////////
template <typename IteratorT = char const*, 
          typename MatchTraitsT = match_traits>
class skipper;

//////////////////////////////////

//////////////////////////////////
template <typename T, typename CharT>
class tst ;

//////////////////////////////////
template <typename T = int, typename CharT= char, typename SetT = tst<T,CharT> >
class symbols;

//////////////////////////////////
class match_traits;

//////////////////////////////////
template <
    typename IteratorT = char const*,
    typename MatchTraitsT = match_traits,
    typename SkipT = skipper<IteratorT, MatchTraitsT> >
class scanner;

//////////////////////////////////
template <typename IteratorT, typename MatchTraitsT, typename DerivedT>
class base_rule;

template <typename IteratorT = scanner<>, typename MatchTraitsT = match_traits>
class rule;

//////////////////////////////////
template <typename TupleT, int N>
class local;

//////////////////////////////////
template <
    typename T0 = boost::tuples::null_type,
    typename T1 = boost::tuples::null_type,
    typename T2 = boost::tuples::null_type,
    typename T3 = boost::tuples::null_type,
    typename T4 = boost::tuples::null_type,
    typename T5 = boost::tuples::null_type,
    typename T6 = boost::tuples::null_type,
    typename T7 = boost::tuples::null_type,
    typename T8 = boost::tuples::null_type,
    typename T9 = boost::tuples::null_type
>
class closure;

//////////////////////////////////
template <typename TupleT, typename ParserT>
class closure_parser;

//////////////////////////////////
struct closure_null_type;

template<typename DerivedT, typename ReturnT = closure_null_type>
struct grammar;

//////////////////////////////////
class match;

//////////////////////////////////
template <typename TypeT, typename BaseT = class match>
class attr_match;

//////////////////////////////////
template <
    typename ClosureT = closure<>, 
    typename IteratorT = scanner<>, 
    typename MatchTraitsT = match_traits>
struct attr_rule;

///////////////////////////////////////////////////////////////////////////////
//
//  Utility meta-programs
//
///////////////////////////////////////////////////////////////////////////////

//////////////////////////////////
/*
template <typename T> struct remove_wrap
{ typedef T type; };

template <typename TupleT, int N> struct remove_wrap<local<TupleT, N> >
{ typedef typename element<N, TupleT>::type type; };

template <typename TupleT, int N> struct remove_wrap<local<TupleT, N> const>
{ typedef typename element<N, TupleT>::type const type; };
*/

namespace impl
{

   template<int I>
   struct remove_wrap_helper 
   {
      template<typename T>
      struct inner
      {
	 typedef T type;
      };
   };

   template<>
   struct remove_wrap_helper<1> 
   {
      template<typename T>
      struct inner
      {
	 typedef typename T::type type;
      };
   };

  //RAGAV .. what should be done about const ??  	 
  template<typename TupleT, int N>  
  selector1 remove_wrap_selector( local<TupleT,N> );

  selector2 remove_wrap_selector(...);
} //namespace impl

template <typename T> struct remove_wrap
{
   static T t(); 	 
   typedef typename impl::remove_wrap_helper<(sizeof(impl::remove_wrap_selector(t())))>
	          ::template inner<T>::type type; 
};


///////////////////////////////////////////////////////////////////////////////
// 
template <typename ParserT, typename IteratorT, typename BaseT>
struct list_action_iterator;

///////////////////////////////////////////////////////////////////////////////
//
//	Helper template classes to distinguish plain parsers from parsers with an
//	attached action or parsers, injecting a closure into the parsing context
//
//      - plain parser has nothing special
//      - binary parser has subject a and b (e.g. alternative)
//      - unary parser has single subject  (e.g. kleene star)
//      - action parser is an attached action parser
//      - exception parser throws an exception under some circumstances
//      - closure parser injects a closure into the parsing context
//      - parsers with parameters initialize the members of the embedded 
//        closure parsers 
// 
///////////////////////////////////////////////////////////////////////////////

	     
struct plain_parser_category 
{
};
struct binary_parser_category : public plain_parser_category 
{
};
struct unary_parser_category : public plain_parser_category 
{
};
struct action_parser_category : public unary_parser_category 
{
}; 
struct exception_parser_category : public unary_parser_category 
{
};
struct closure_parser_category : public unary_parser_category 
{
};
struct param_parser_category : public closure_parser_category 
{
};

///////////////////////////////////////////////////////////////////////////////
}   //  namespace Spirit

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -