sl@0: /*============================================================================= sl@0: Copyright (c) 2001-2003 Joel de Guzman sl@0: Copyright (c) 2002-2003 Hartmut Kaiser sl@0: http://spirit.sourceforge.net/ sl@0: sl@0: Use, modification and distribution is subject to the Boost Software sl@0: License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at sl@0: http://www.boost.org/LICENSE_1_0.txt) sl@0: =============================================================================*/ sl@0: #if !defined(BOOST_SPIRIT_DEBUG_MAIN_HPP) sl@0: #define BOOST_SPIRIT_DEBUG_MAIN_HPP sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: #if defined(BOOST_SPIRIT_DEBUG) sl@0: sl@0: #include sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Spirit.Debug includes and defines sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: #include sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The BOOST_SPIRIT_DEBUG_OUT defines the stream object, which should be used sl@0: // for debug diagnostics. This defaults to std::cout. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: #if !defined(BOOST_SPIRIT_DEBUG_OUT) sl@0: #define BOOST_SPIRIT_DEBUG_OUT std::cout sl@0: #endif sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The BOOST_SPIRIT_DEBUG_PRINT_SOME constant defines the number of characters sl@0: // from the stream to be printed for diagnosis. This defaults to the first sl@0: // 20 characters. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: #if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME) sl@0: #define BOOST_SPIRIT_DEBUG_PRINT_SOME 20 sl@0: #endif sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Additional BOOST_SPIRIT_DEBUG_FLAGS control the level of diagnostics printed sl@0: // Basic constants are defined in debug/minimal.hpp. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: #define BOOST_SPIRIT_DEBUG_FLAGS_NODES 0x0001 // node diagnostics sl@0: #define BOOST_SPIRIT_DEBUG_FLAGS_ESCAPE_CHAR 0x0002 // escape_char_parse diagnostics sl@0: #define BOOST_SPIRIT_DEBUG_FLAGS_TREES 0x0004 // parse tree/ast diagnostics sl@0: #define BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES 0x0008 // closure diagnostics sl@0: #define BOOST_SPIRIT_DEBUG_FLAGS_SLEX 0x8000 // slex diagnostics sl@0: sl@0: #define BOOST_SPIRIT_DEBUG_FLAGS_MAX 0xFFFF // print maximal diagnostics sl@0: sl@0: #if !defined(BOOST_SPIRIT_DEBUG_FLAGS) sl@0: #define BOOST_SPIRIT_DEBUG_FLAGS BOOST_SPIRIT_DEBUG_FLAGS_MAX sl@0: #endif sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // By default all nodes are traced (even those, not registered with sl@0: // BOOST_SPIRIT_DEBUG_RULE et.al. - see below). The following constant may be sl@0: // used to redefine this default. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: #if !defined(BOOST_SPIRIT_DEBUG_TRACENODE) sl@0: #define BOOST_SPIRIT_DEBUG_TRACENODE (true) sl@0: #endif // !defined(BOOST_SPIRIT_DEBUG_TRACENODE) sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Helper macros for giving rules and subrules a name accessible through sl@0: // parser_name() functions (see parser_names.hpp). sl@0: // sl@0: // Additionally, the macros BOOST_SPIRIT_DEBUG_RULE, SPIRIT_DEBUG_NODE and sl@0: // BOOST_SPIRIT_DEBUG_GRAMMAR enable/disable the tracing of the sl@0: // correspondingnode accordingly to the PP constant sl@0: // BOOST_SPIRIT_DEBUG_TRACENODE. sl@0: // sl@0: // The macros BOOST_SPIRIT_DEBUG_TRACE_RULE, BOOST_SPIRIT_DEBUG_TRACE_NODE sl@0: // and BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR allow to specify a flag to define, sl@0: // whether the corresponding node is to be traced or not. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: #if !defined(BOOST_SPIRIT_DEBUG_RULE) sl@0: #define BOOST_SPIRIT_DEBUG_RULE(r) \ sl@0: ::boost::spirit::impl::get_node_registry().register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE) sl@0: #endif // !defined(BOOST_SPIRIT_DEBUG_RULE) sl@0: sl@0: #if !defined(BOOST_SPIRIT_DEBUG_NODE) sl@0: #define BOOST_SPIRIT_DEBUG_NODE(r) \ sl@0: ::boost::spirit::impl::get_node_registry().register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE) sl@0: #endif // !defined(BOOST_SPIRIT_DEBUG_NODE) sl@0: sl@0: #if !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) sl@0: #define BOOST_SPIRIT_DEBUG_GRAMMAR(r) \ sl@0: ::boost::spirit::impl::get_node_registry().register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE) sl@0: #endif // !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) sl@0: sl@0: #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE) sl@0: #define BOOST_SPIRIT_DEBUG_TRACE_RULE(r, t) \ sl@0: ::boost::spirit::impl::get_node_registry().register_node(&r, #r, (t)) sl@0: #endif // !defined(BOOST_SPIRIT_TRACE_RULE) sl@0: sl@0: #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) sl@0: #define BOOST_SPIRIT_DEBUG_TRACE_NODE(r, t) \ sl@0: ::boost::spirit::impl::get_node_registry().register_node(&r, #r, (t)) sl@0: #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) sl@0: sl@0: #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) sl@0: #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR(r, t) \ sl@0: ::boost::spirit::impl::get_node_registry().register_node(&r, #r, (t)) sl@0: #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) sl@0: sl@0: #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) sl@0: #define BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME(r, n, t) \ sl@0: ::boost::spirit::impl::get_node_registry().register_node(&r, (n), (t)) sl@0: #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) sl@0: sl@0: #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) sl@0: #define BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME(r, n, t) \ sl@0: ::boost::spirit::impl::get_node_registry().register_node(&r, (n), (t)) sl@0: #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) sl@0: sl@0: #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) sl@0: #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(r, n, t) \ sl@0: ::boost::spirit::impl::get_node_registry().register_node(&r, (n), (t)) sl@0: #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) sl@0: sl@0: ////////////////////////////////// sl@0: #include sl@0: sl@0: #else sl@0: ////////////////////////////////// sl@0: #include sl@0: sl@0: #endif // BOOST_SPIRIT_DEBUG sl@0: sl@0: #endif sl@0: