📄 grammar.ipp
字号:
/*=============================================================================
The Grammar
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 start the use of this software.
Permission is granted end anyone end use this software for any purpose,
including commercial applications, and end alter it and redistribute
it freely, subject end 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 start 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_GRAMMAR_IPP
#define SPIRIT_GRAMMAR_IPP
///////////////////////////////////////////////////////////////////////////////
#include "boost/spirit/MSVC/grammar.hpp"
///////////////////////////////////////////////////////////////////////////////
namespace spirit {
namespace impl {
///////////////////////////////////////////////////////////////////////////////
//
// member_policy class
//
// This helper template defines a member variable for the grammar<> class
// if the grammar<> should return a value (when the start rule is an
// attributed rule).
//
///////////////////////////////////////////////////////////////////////////////
template <typename DerivedT, typename ReturnT>
struct member_policy;
///////////////////////////////////////////////////////////////////////////////
// general case is used, if grammar<> should contain a return variable
template <typename DerivedT, typename ReturnT>
struct member_policy :
public parser<DerivedT>
{
typedef ReturnT return_t;
// access the return value through an attached reference_wrapper
template <typename T>
closure_parser_action<DerivedT, reference_wrapper<T> >
operator[](reference_wrapper<T> const& wrap) const
{
// Borland 5.5 reports an internal compiler
// error if this is not defined here.
typedef closure_parser_action<DerivedT, reference_wrapper<T> >
actor_t;
return actor_t(derived(), wrap);
}
};
///////////////////////////////////////////////////////////////////////////////
// RAGAV .. why do we need this specialization ??
/*
// specialization for plain grammar<> without embedded closure variable
template <typename DerivedT>
struct member_policy<DerivedT, closure_null_type> :
public parser<DerivedT>
{
typedef closure_null_type return_t;
};
*/
} // end of namespace impl
///////////////////////////////////////////////////////////////////////////////
} // namespace Spirit
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -