Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/spirit/debug.hpp @ 47

Last change on this file since 47 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 6.3 KB
Line 
1/*=============================================================================
2    Copyright (c) 2001-2003 Joel de Guzman
3    Copyright (c) 2002-2003 Hartmut Kaiser
4    http://spirit.sourceforge.net/
5
6    Use, modification and distribution is subject to the Boost Software
7    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8    http://www.boost.org/LICENSE_1_0.txt)
9=============================================================================*/
10#if !defined(BOOST_SPIRIT_DEBUG_MAIN_HPP)
11#define BOOST_SPIRIT_DEBUG_MAIN_HPP
12
13///////////////////////////////////////////////////////////////////////////
14#if defined(BOOST_SPIRIT_DEBUG)
15
16#include <boost/spirit/version.hpp>
17
18///////////////////////////////////////////////////////////////////////////////
19//
20//  Spirit.Debug includes and defines
21//
22///////////////////////////////////////////////////////////////////////////////
23
24    #include <iostream>
25
26    ///////////////////////////////////////////////////////////////////////////
27    //
28    //  The BOOST_SPIRIT_DEBUG_OUT defines the stream object, which should be used
29    //  for debug diagnostics. This defaults to std::cout.
30    //
31    ///////////////////////////////////////////////////////////////////////////
32    #if !defined(BOOST_SPIRIT_DEBUG_OUT)
33    #define BOOST_SPIRIT_DEBUG_OUT std::cout
34    #endif
35
36    ///////////////////////////////////////////////////////////////////////////
37    //
38    //  The BOOST_SPIRIT_DEBUG_PRINT_SOME constant defines the number of characters
39    //  from the stream to be printed for diagnosis. This defaults to the first
40    //  20 characters.
41    //
42    ///////////////////////////////////////////////////////////////////////////
43    #if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME)
44    #define BOOST_SPIRIT_DEBUG_PRINT_SOME 20
45    #endif
46
47    ///////////////////////////////////////////////////////////////////////////
48    //
49    //  Additional BOOST_SPIRIT_DEBUG_FLAGS control the level of diagnostics printed
50    //  Basic constants are defined in debug/minimal.hpp.
51    //
52    ///////////////////////////////////////////////////////////////////////////
53    #define BOOST_SPIRIT_DEBUG_FLAGS_NODES        0x0001  // node diagnostics
54    #define BOOST_SPIRIT_DEBUG_FLAGS_ESCAPE_CHAR  0x0002  // escape_char_parse diagnostics
55    #define BOOST_SPIRIT_DEBUG_FLAGS_TREES        0x0004  // parse tree/ast diagnostics
56    #define BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES     0x0008  // closure diagnostics
57    #define BOOST_SPIRIT_DEBUG_FLAGS_SLEX         0x8000  // slex diagnostics
58
59    #define BOOST_SPIRIT_DEBUG_FLAGS_MAX          0xFFFF  // print maximal diagnostics
60
61    #if !defined(BOOST_SPIRIT_DEBUG_FLAGS)
62    #define BOOST_SPIRIT_DEBUG_FLAGS BOOST_SPIRIT_DEBUG_FLAGS_MAX
63    #endif
64
65    ///////////////////////////////////////////////////////////////////////////
66    //
67    //  By default all nodes are traced (even those, not registered with
68    //  BOOST_SPIRIT_DEBUG_RULE et.al. - see below). The following constant may be
69    //  used to redefine this default.
70    //
71    ///////////////////////////////////////////////////////////////////////////
72    #if !defined(BOOST_SPIRIT_DEBUG_TRACENODE)
73    #define BOOST_SPIRIT_DEBUG_TRACENODE          (true)
74    #endif // !defined(BOOST_SPIRIT_DEBUG_TRACENODE)
75
76    ///////////////////////////////////////////////////////////////////////////
77    //
78    //  Helper macros for giving rules and subrules a name accessible through
79    //  parser_name() functions (see parser_names.hpp).
80    //
81    //  Additionally, the macros BOOST_SPIRIT_DEBUG_RULE, SPIRIT_DEBUG_NODE and
82    //  BOOST_SPIRIT_DEBUG_GRAMMAR enable/disable the tracing of the
83    //  correspondingnode accordingly to the PP constant
84    //  BOOST_SPIRIT_DEBUG_TRACENODE.
85    //
86    //  The macros BOOST_SPIRIT_DEBUG_TRACE_RULE, BOOST_SPIRIT_DEBUG_TRACE_NODE
87    //  and BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR allow to specify a flag to define,
88    //  whether the corresponding node is to be traced or not.
89    //
90    ///////////////////////////////////////////////////////////////////////////
91    #if !defined(BOOST_SPIRIT_DEBUG_RULE)
92    #define BOOST_SPIRIT_DEBUG_RULE(r)    \
93        ::boost::spirit::impl::get_node_registry().register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE)
94    #endif // !defined(BOOST_SPIRIT_DEBUG_RULE)
95
96    #if !defined(BOOST_SPIRIT_DEBUG_NODE)
97    #define BOOST_SPIRIT_DEBUG_NODE(r)    \
98        ::boost::spirit::impl::get_node_registry().register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE)
99    #endif // !defined(BOOST_SPIRIT_DEBUG_NODE)
100
101    #if !defined(BOOST_SPIRIT_DEBUG_GRAMMAR)
102    #define BOOST_SPIRIT_DEBUG_GRAMMAR(r)    \
103        ::boost::spirit::impl::get_node_registry().register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE)
104    #endif // !defined(BOOST_SPIRIT_DEBUG_GRAMMAR)
105
106    #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE)
107    #define BOOST_SPIRIT_DEBUG_TRACE_RULE(r, t)    \
108        ::boost::spirit::impl::get_node_registry().register_node(&r, #r, (t))
109    #endif // !defined(BOOST_SPIRIT_TRACE_RULE)
110
111    #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE)
112    #define BOOST_SPIRIT_DEBUG_TRACE_NODE(r, t)    \
113        ::boost::spirit::impl::get_node_registry().register_node(&r, #r, (t))
114    #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE)
115
116    #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR)
117    #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR(r, t)    \
118        ::boost::spirit::impl::get_node_registry().register_node(&r, #r, (t))
119    #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR)
120
121    #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME)
122    #define BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME(r, n, t)    \
123        ::boost::spirit::impl::get_node_registry().register_node(&r, (n), (t))
124    #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME)
125
126    #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME)
127    #define BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME(r, n, t)    \
128        ::boost::spirit::impl::get_node_registry().register_node(&r, (n), (t))
129    #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME)
130
131    #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME)
132    #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(r, n, t)    \
133        ::boost::spirit::impl::get_node_registry().register_node(&r, (n), (t))
134    #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME)
135
136    //////////////////////////////////
137    #include <boost/spirit/debug/debug_node.hpp>
138
139#else
140    //////////////////////////////////
141    #include <boost/spirit/debug/minimal.hpp>
142
143#endif // BOOST_SPIRIT_DEBUG
144
145#endif
146
Note: See TracBrowser for help on using the repository browser.