📄 debug.hpp
字号:
/*=============================================================================
Debugging
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_DEBUG_HPP
#define SPIRIT_DEBUG_HPP
///////////////////////////////////////////////////////////////////////////////
//
// Debugging tools
//
///////////////////////////////////////////////////////////////////////////////
#ifdef SPIRIT_DEBUG
#include <string>
#define SPIRIT_DEBUG_RULE(r) r.debug.name(#r)
#ifndef SPIRIT_DEBUG_OUT
#define SPIRIT_DEBUG_OUT std::cout
#endif
///////////////////////////////////////////////////////////////////////////////
//
// SPIRIT_DEBUG_LEVEL controls the level of diagnostics printed
//
#define SPIRIT_DEBUG_LEVEL_NONE 0 // not diagnostics at all
#define SPIRIT_DEBUG_LEVEL_LEVEL1 1 // tbd
#define SPIRIT_DEBUG_LEVEL_LEVEL2 2 // only parser trace printed
#define SPIRIT_DEBUG_LEVEL_LEVEL3 3 // tbd
#define SPIRIT_DEBUG_LEVEL_MAX 4 // maximal diagnostics prints
#ifndef SPIRIT_DEBUG_LEVEL
#define SPIRIT_DEBUG_LEVEL SPIRIT_DEBUG_LEVEL_MAX
#endif
///////////////////////////////////////////////////////////////////////////////
// Base class for all parsers contains minimal debug support functionality
struct debug_support
{
void
name(char const* name_);
void
name(std::string const &name_);
std::string const &
name() const;
static int level;
private:
std::string parser_name;
};
int debug_support::level = 0;
#else
#define SPIRIT_DEBUG_RULE(r)
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -