1 /*============================================================================= 2 Copyright (c) 2001-2003 Joel de Guzman 3 Copyright (c) 2002-2003 Hartmut Kaiser 4 http://spirit.sourceforge.net/ 5 6 Distributed under the Boost Software License, Version 1.0. (See accompanying 7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 =============================================================================*/ 9 #if !defined(BOOST_SPIRIT_PARSER_NAMES_HPP) 10 #define BOOST_SPIRIT_PARSER_NAMES_HPP 11 12 #if defined(BOOST_SPIRIT_DEBUG) 13 14 ////////////////////////////////// 15 #include <boost/spirit/home/classic/namespace.hpp> 16 #include <boost/spirit/home/classic/core.hpp> 17 18 namespace boost { namespace spirit { 19 20 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN 21 22 /////////////////////////////////////////////////////////////////////////////// 23 // 24 // Declaration of helper functions, which return the name of a concrete 25 // parser instance. The functions are specialized on the parser types. The 26 // functions declared in this file are for the predefined parser types from 27 // the Spirit core library only, so additional functions might be provided as 28 // needed. 29 // 30 /////////////////////////////////////////////////////////////////////////////// 31 32 /////////////////////////////////////////////////////////////////////////////// 33 // from actions.hpp 34 template <typename ParserT, typename ActionT> 35 std::string 36 parser_name(action<ParserT, ActionT> const& p); 37 38 /////////////////////////////////////////////////////////////////////////////// 39 // from directives.hpp 40 template <typename ParserT> 41 std::string 42 parser_name(contiguous<ParserT> const& p); 43 44 template <typename ParserT> 45 std::string 46 parser_name(inhibit_case<ParserT> const& p); 47 48 template <typename A, typename B> 49 std::string 50 parser_name(longest_alternative<A, B> const& p); 51 52 template <typename A, typename B> 53 std::string 54 parser_name(shortest_alternative<A, B> const& p); 55 56 /////////////////////////////////////////////////////////////////////////////// 57 // from grammar.hpp 58 template <typename DerivedT, typename ContextT> 59 std::string 60 parser_name(grammar<DerivedT, ContextT> const& p); 61 62 /////////////////////////////////////////////////////////////////////////////// 63 // from numerics.hpp 64 template <typename T, int Radix, unsigned MinDigits, int MaxDigits> 65 std::string 66 parser_name(uint_parser<T, Radix, MinDigits, MaxDigits> const& p); 67 68 template <typename T, int Radix, unsigned MinDigits, int MaxDigits> 69 std::string 70 parser_name(int_parser<T, Radix, MinDigits, MaxDigits> const& p); 71 72 template <typename T, typename RealPoliciesT> 73 std::string 74 parser_name(real_parser<T, RealPoliciesT> const& p); 75 76 /////////////////////////////////////////////////////////////////////////////// 77 // from operators.hpp 78 template <typename A, typename B> 79 std::string 80 parser_name(sequence<A, B> const& p); 81 82 template <typename A, typename B> 83 std::string 84 parser_name(sequential_or<A, B> const& p); 85 86 template <typename A, typename B> 87 std::string 88 parser_name(alternative<A, B> const& p); 89 90 template <typename A, typename B> 91 std::string 92 parser_name(intersection<A, B> const& p); 93 94 template <typename A, typename B> 95 std::string 96 parser_name(difference<A, B> const& p); 97 98 template <typename A, typename B> 99 std::string 100 parser_name(exclusive_or<A, B> const& p); 101 102 template <typename S> 103 std::string 104 parser_name(optional<S> const& p); 105 106 template <typename S> 107 std::string 108 parser_name(kleene_star<S> const& p); 109 110 template <typename S> 111 std::string 112 parser_name(positive<S> const& p); 113 114 /////////////////////////////////////////////////////////////////////////////// 115 // from parser.hpp 116 template <typename DerivedT> 117 std::string 118 parser_name(parser<DerivedT> const& p); 119 120 /////////////////////////////////////////////////////////////////////////////// 121 // from primitives.hpp 122 template <typename DerivedT> 123 std::string 124 parser_name(char_parser<DerivedT> const &p); 125 126 template <typename CharT> 127 std::string 128 parser_name(chlit<CharT> const &p); 129 130 template <typename CharT> 131 std::string 132 parser_name(range<CharT> const &p); 133 134 template <typename IteratorT> 135 std::string 136 parser_name(chseq<IteratorT> const &p); 137 138 template <typename IteratorT> 139 std::string 140 parser_name(strlit<IteratorT> const &p); 141 142 std::string 143 parser_name(nothing_parser const &p); 144 145 std::string 146 parser_name(epsilon_parser const &p); 147 148 std::string 149 parser_name(anychar_parser const &p); 150 151 std::string 152 parser_name(alnum_parser const &p); 153 154 std::string 155 parser_name(alpha_parser const &p); 156 157 std::string 158 parser_name(cntrl_parser const &p); 159 160 std::string 161 parser_name(digit_parser const &p); 162 163 std::string 164 parser_name(graph_parser const &p); 165 166 std::string 167 parser_name(lower_parser const &p); 168 169 std::string 170 parser_name(print_parser const &p); 171 172 std::string 173 parser_name(punct_parser const &p); 174 175 std::string 176 parser_name(blank_parser const &p); 177 178 std::string 179 parser_name(space_parser const &p); 180 181 std::string 182 parser_name(upper_parser const &p); 183 184 std::string 185 parser_name(xdigit_parser const &p); 186 187 std::string 188 parser_name(eol_parser const &p); 189 190 std::string 191 parser_name(end_parser const &p); 192 193 /////////////////////////////////////////////////////////////////////////////// 194 // from rule.hpp 195 template<typename T0, typename T1, typename T2> 196 std::string 197 parser_name(rule<T0, T1, T2> const& p); 198 199 /////////////////////////////////////////////////////////////////////////////// 200 // from subrule.hpp 201 template <typename FirstT, typename RestT> 202 std::string 203 parser_name(subrule_list<FirstT, RestT> const &p); 204 205 template <int ID, typename DefT, typename ContextT> 206 std::string 207 parser_name(subrule_parser<ID, DefT, ContextT> const &p); 208 209 template <int ID, typename ContextT> 210 std::string 211 parser_name(subrule<ID, ContextT> const &p); 212 213 /////////////////////////////////////////////////////////////////////////////// 214 // from chset.hpp 215 216 /////////////////////////////////////////////////////////////////////////////// 217 // 218 // Decide, if a node is to be traced or not 219 // 220 /////////////////////////////////////////////////////////////////////////////// 221 template< 222 typename DerivedT, typename EmbedT, 223 typename T0, typename T1, typename T2 224 > 225 bool 226 trace_parser(impl::rule_base<DerivedT, EmbedT, T0, T1, T2> 227 const& p); 228 229 template <typename DerivedT, typename ContextT> 230 bool 231 trace_parser(grammar<DerivedT, ContextT> const& p); 232 233 template <int ID, typename ContextT> 234 bool 235 trace_parser(subrule<ID, ContextT> const& p); 236 237 template <typename ParserT, typename ActorTupleT> 238 struct init_closure_parser; 239 240 template <typename ParserT, typename ActorTupleT> 241 bool 242 trace_parser(init_closure_parser<ParserT, ActorTupleT> const& p); 243 244 /////////////////////////////////////////////////////////////////////////////// 245 BOOST_SPIRIT_CLASSIC_NAMESPACE_END 246 247 }} // namespace BOOST_SPIRIT_CLASSIC_NS 248 249 ////////////////////////////////// 250 #include <boost/spirit/home/classic/debug/impl/parser_names.ipp> 251 252 #endif // defined(BOOST_SPIRIT_DEBUG) 253 254 #endif // !defined(BOOST_SPIRIT_PARSER_NAMES_HPP) 255