Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:31:34

0001 /*=============================================================================
0002     Copyright (c) 2001-2003 Joel de Guzman
0003     Copyright (c) 2002-2003 Hartmut Kaiser
0004     http://spirit.sourceforge.net/
0005 
0006   Distributed under the Boost Software License, Version 1.0. (See accompanying
0007   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 =============================================================================*/
0009 #if !defined(BOOST_SPIRIT_DEBUG_MAIN_HPP)
0010 #define BOOST_SPIRIT_DEBUG_MAIN_HPP
0011 
0012 ///////////////////////////////////////////////////////////////////////////
0013 #if defined(BOOST_SPIRIT_DEBUG)
0014 
0015 #include <boost/spirit/home/classic/version.hpp>
0016 
0017 ///////////////////////////////////////////////////////////////////////////////
0018 //
0019 //  Spirit.Debug includes and defines
0020 //
0021 ///////////////////////////////////////////////////////////////////////////////
0022 
0023     #include <iostream>
0024 
0025     ///////////////////////////////////////////////////////////////////////////
0026     //
0027     //  The BOOST_SPIRIT_DEBUG_OUT defines the stream object, which should be used
0028     //  for debug diagnostics. This defaults to std::cout.
0029     //
0030     ///////////////////////////////////////////////////////////////////////////
0031     #if !defined(BOOST_SPIRIT_DEBUG_OUT)
0032     #define BOOST_SPIRIT_DEBUG_OUT std::cout
0033     #endif
0034 
0035     ///////////////////////////////////////////////////////////////////////////
0036     //
0037     //  The BOOST_SPIRIT_DEBUG_PRINT_SOME constant defines the number of characters
0038     //  from the stream to be printed for diagnosis. This defaults to the first
0039     //  20 characters.
0040     //
0041     ///////////////////////////////////////////////////////////////////////////
0042     #if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME)
0043     #define BOOST_SPIRIT_DEBUG_PRINT_SOME 20
0044     #endif
0045 
0046     ///////////////////////////////////////////////////////////////////////////
0047     //
0048     //  Additional BOOST_SPIRIT_DEBUG_FLAGS control the level of diagnostics printed
0049     //  Basic constants are defined in debug/minimal.hpp.
0050     //
0051     ///////////////////////////////////////////////////////////////////////////
0052     #define BOOST_SPIRIT_DEBUG_FLAGS_NODES        0x0001  // node diagnostics
0053     #define BOOST_SPIRIT_DEBUG_FLAGS_ESCAPE_CHAR  0x0002  // escape_char_parse diagnostics
0054     #define BOOST_SPIRIT_DEBUG_FLAGS_TREES        0x0004  // parse tree/ast diagnostics
0055     #define BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES     0x0008  // closure diagnostics
0056     #define BOOST_SPIRIT_DEBUG_FLAGS_SLEX         0x8000  // slex diagnostics
0057 
0058     #define BOOST_SPIRIT_DEBUG_FLAGS_MAX          0xFFFF  // print maximal diagnostics
0059 
0060     #if !defined(BOOST_SPIRIT_DEBUG_FLAGS)
0061     #define BOOST_SPIRIT_DEBUG_FLAGS BOOST_SPIRIT_DEBUG_FLAGS_MAX
0062     #endif
0063 
0064     ///////////////////////////////////////////////////////////////////////////
0065     //
0066     //  By default all nodes are traced (even those, not registered with
0067     //  BOOST_SPIRIT_DEBUG_RULE et.al. - see below). The following constant may be
0068     //  used to redefine this default.
0069     //
0070     ///////////////////////////////////////////////////////////////////////////
0071     #if !defined(BOOST_SPIRIT_DEBUG_TRACENODE)
0072     #define BOOST_SPIRIT_DEBUG_TRACENODE          (true)
0073     #endif // !defined(BOOST_SPIRIT_DEBUG_TRACENODE)
0074 
0075     ///////////////////////////////////////////////////////////////////////////
0076     //
0077     //  Helper macros for giving rules and subrules a name accessible through
0078     //  parser_name() functions (see parser_names.hpp).
0079     //
0080     //  Additionally, the macros BOOST_SPIRIT_DEBUG_RULE, SPIRIT_DEBUG_NODE and
0081     //  BOOST_SPIRIT_DEBUG_GRAMMAR enable/disable the tracing of the 
0082     //  correspondingnode accordingly to the PP constant 
0083     //  BOOST_SPIRIT_DEBUG_TRACENODE.
0084     //
0085     //  The macros BOOST_SPIRIT_DEBUG_TRACE_RULE, BOOST_SPIRIT_DEBUG_TRACE_NODE 
0086     //  and BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR allow to specify a flag to define, 
0087     //  whether the corresponding node is to be traced or not.
0088     //
0089     ///////////////////////////////////////////////////////////////////////////
0090     #if !defined(BOOST_SPIRIT_DEBUG_RULE)
0091     #define BOOST_SPIRIT_DEBUG_RULE(r)    \
0092         ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
0093             register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE)
0094     #endif // !defined(BOOST_SPIRIT_DEBUG_RULE)
0095 
0096     #if !defined(BOOST_SPIRIT_DEBUG_NODE)
0097     #define BOOST_SPIRIT_DEBUG_NODE(r)    \
0098         ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
0099             register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE)
0100     #endif // !defined(BOOST_SPIRIT_DEBUG_NODE)
0101 
0102     #if !defined(BOOST_SPIRIT_DEBUG_GRAMMAR)
0103     #define BOOST_SPIRIT_DEBUG_GRAMMAR(r)    \
0104         ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
0105             register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE)
0106     #endif // !defined(BOOST_SPIRIT_DEBUG_GRAMMAR)
0107 
0108     #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE)
0109     #define BOOST_SPIRIT_DEBUG_TRACE_RULE(r, t)    \
0110         ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
0111             register_node(&r, #r, (t))
0112     #endif // !defined(BOOST_SPIRIT_TRACE_RULE)
0113 
0114     #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE)
0115     #define BOOST_SPIRIT_DEBUG_TRACE_NODE(r, t)    \
0116         ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
0117             register_node(&r, #r, (t))
0118     #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE)
0119 
0120     #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR)
0121     #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR(r, t)    \
0122         ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
0123             register_node(&r, #r, (t))
0124     #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR)
0125 
0126     #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME)
0127     #define BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME(r, n, t)    \
0128         ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
0129             register_node(&r, (n), (t))
0130     #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME)
0131 
0132     #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME)
0133     #define BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME(r, n, t)    \
0134         ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
0135             register_node(&r, (n), (t))
0136     #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME)
0137 
0138     #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME)
0139     #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(r, n, t)    \
0140         ::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
0141             register_node(&r, (n), (t))
0142     #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME)
0143 
0144     //////////////////////////////////
0145     #include <boost/spirit/home/classic/debug/debug_node.hpp>
0146 
0147 #else
0148     //////////////////////////////////
0149     #include <boost/spirit/home/classic/debug/minimal.hpp>
0150 
0151 #endif // BOOST_SPIRIT_DEBUG
0152 
0153 #endif
0154