1 /////////////////////////////////////////////////////////////////////////////// 2 // detail_fwd.hpp 3 // 4 // Copyright 2008 Eric Niebler. Distributed under the Boost 5 // Software License, Version 1.0. (See accompanying file 6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 8 #ifndef BOOST_XPRESSIVE_DETAIL_DETAIL_FWD_HPP_EAN_10_04_2005 9 #define BOOST_XPRESSIVE_DETAIL_DETAIL_FWD_HPP_EAN_10_04_2005 10 11 // MS compatible compilers support #pragma once 12 #if defined(_MSC_VER) 13 # pragma once 14 #endif 15 16 #include <map> 17 #include <string> 18 #include <vector> 19 #include <climits> // for INT_MAX 20 #include <typeinfo> 21 #include <boost/mpl/bool.hpp> 22 #include <boost/mpl/size_t.hpp> 23 #include <boost/shared_ptr.hpp> 24 #include <boost/xpressive/xpressive_fwd.hpp> 25 26 namespace boost { namespace xpressive { namespace detail 27 { 28 typedef unsigned int uint_t; 29 30 template<uint_t Min, uint_t Max = Min> 31 struct generic_quant_tag; 32 33 struct modifier_tag; 34 35 struct check_tag; 36 37 typedef mpl::size_t<INT_MAX / 2 - 1> unknown_width; 38 39 struct type_info_less; 40 41 typedef std::map<std::type_info const *, void *, type_info_less> action_args_type; 42 43 struct action_context; 44 45 struct ReplaceAlgo; 46 47 /////////////////////////////////////////////////////////////////////////////// 48 // placeholders 49 // 50 struct mark_placeholder; 51 52 struct posix_charset_placeholder; 53 54 template<typename Cond> 55 struct assert_word_placeholder; 56 57 template<typename Char> 58 struct range_placeholder; 59 60 struct assert_bol_placeholder; 61 62 struct assert_eol_placeholder; 63 64 struct logical_newline_placeholder; 65 66 struct self_placeholder; 67 68 template<typename Nbr> 69 struct attribute_placeholder; 70 71 /////////////////////////////////////////////////////////////////////////////// 72 // matchers 73 // 74 struct end_matcher; 75 76 struct independent_end_matcher; 77 78 struct assert_bos_matcher; 79 80 struct assert_eos_matcher; 81 82 template<typename Traits> 83 struct assert_bol_matcher; 84 85 template<typename Traits> 86 struct assert_eol_matcher; 87 88 template<typename Cond, typename Traits> 89 struct assert_word_matcher; 90 91 struct true_matcher; 92 93 template<typename Alternates, typename Traits> 94 struct alternate_matcher; 95 96 struct alternate_end_matcher; 97 98 template<typename Traits> 99 struct posix_charset_matcher; 100 101 template<typename BidiIter> 102 struct sequence; 103 104 template<typename Traits, typename ICase> 105 struct mark_matcher; 106 107 struct mark_begin_matcher; 108 109 struct mark_end_matcher; 110 111 template<typename BidiIter> 112 struct regex_matcher; 113 114 template<typename BidiIter> 115 struct regex_byref_matcher; 116 117 template<typename Traits> 118 struct compound_charset; 119 120 template<typename Traits, typename ICase, typename CharSet = compound_charset<Traits> > 121 struct charset_matcher; 122 123 template<typename Traits, typename ICase> 124 struct range_matcher; 125 126 template<typename Traits, typename Size> 127 struct set_matcher; 128 129 template<typename Xpr, typename Greedy> 130 struct simple_repeat_matcher; 131 132 struct repeat_begin_matcher; 133 134 template<typename Greedy> 135 struct repeat_end_matcher; 136 137 template<typename Traits, typename ICase, typename Not> 138 struct literal_matcher; 139 140 template<typename Traits, typename ICase> 141 struct string_matcher; 142 143 template<typename Actor> 144 struct action_matcher; 145 146 template<typename Predicate> 147 struct predicate_matcher; 148 149 template<typename Xpr, typename Greedy> 150 struct optional_matcher; 151 152 template<typename Xpr, typename Greedy> 153 struct optional_mark_matcher; 154 155 template<typename Matcher, typename Traits, typename ICase> 156 struct attr_matcher; 157 158 template<typename Nbr> 159 struct attr_begin_matcher; 160 161 struct attr_end_matcher; 162 163 template<typename Xpr> 164 struct is_modifiable; 165 166 template<typename Head, typename Tail> 167 struct alternates_list; 168 169 template<typename Modifier> 170 struct modifier_op; 171 172 struct icase_modifier; 173 174 template<typename BidiIter, typename ICase, typename Traits> 175 struct xpression_visitor; 176 177 template<typename BidiIter> 178 struct regex_impl; 179 180 struct epsilon_matcher; 181 182 template<typename BidiIter> 183 struct nested_results; 184 185 template<typename BidiIter> 186 struct regex_id_filter_predicate; 187 188 template<typename Xpr> 189 struct keeper_matcher; 190 191 template<typename Xpr> 192 struct lookahead_matcher; 193 194 template<typename Xpr> 195 struct lookbehind_matcher; 196 197 template<typename IsBoundary> 198 struct word_boundary; 199 200 template<typename BidiIter, typename Matcher> 201 sequence<BidiIter> make_dynamic(Matcher const &matcher); 202 203 template<typename Char> 204 struct xpression_linker; 205 206 template<typename Char> 207 struct xpression_peeker; 208 209 struct any_matcher; 210 211 template<typename Traits> 212 struct logical_newline_matcher; 213 214 typedef proto::expr<proto::tag::terminal, proto::term<logical_newline_placeholder>, 0> logical_newline_xpression; 215 216 struct set_initializer; 217 218 typedef proto::expr<proto::tag::terminal, proto::term<set_initializer>, 0> set_initializer_type; 219 220 struct lookahead_tag; 221 222 struct lookbehind_tag; 223 224 struct keeper_tag; 225 226 template<typename Locale> 227 struct locale_modifier; 228 229 template<typename Matcher> 230 struct matcher_wrapper; 231 232 template<typename Locale, typename BidiIter> 233 struct regex_traits_type; 234 235 template<typename Expr> 236 struct let_; 237 238 template<typename Args, typename BidiIter> 239 void bind_args(let_<Args> const &, match_results<BidiIter> &); 240 241 /////////////////////////////////////////////////////////////////////////////// 242 // Misc. 243 struct no_next; 244 245 template<typename BidiIter> 246 struct core_access; 247 248 template<typename BidiIter> 249 struct match_state; 250 251 template<typename BidiIter> 252 struct matchable; 253 254 template<typename BidiIter> 255 struct matchable_ex; 256 257 template<typename Matcher, typename BidiIter> 258 struct dynamic_xpression; 259 260 template<typename BidiIter> 261 struct shared_matchable; 262 263 template<typename BidiIter> 264 struct alternates_vector; 265 266 template<typename Matcher, typename Next> 267 struct static_xpression; 268 269 typedef static_xpression<end_matcher, no_next> end_xpression; 270 271 typedef static_xpression<alternate_end_matcher, no_next> alternate_end_xpression; 272 273 typedef static_xpression<independent_end_matcher, no_next> independent_end_xpression; 274 275 typedef static_xpression<true_matcher, no_next> true_xpression; 276 277 template<typename Matcher, typename Next = end_xpression> 278 struct static_xpression; 279 280 template<typename Top, typename Next> 281 struct stacked_xpression; 282 283 template<typename Xpr> 284 struct is_static_xpression; 285 286 template<typename BidiIter> 287 struct sub_match_impl; 288 289 template<typename T> 290 struct list; 291 292 template<typename BidiIter> 293 struct results_cache; 294 295 template<typename T> 296 struct sequence_stack; 297 298 template<typename BidiIter> 299 struct results_extras; 300 301 template<typename BidiIter> 302 struct match_context; 303 304 template<typename BidiIter> 305 struct sub_match_vector; 306 307 template<typename T, typename U> 308 struct action_arg; 309 310 struct actionable; 311 312 template<typename Char> 313 struct traits; 314 315 template<typename Traits, typename BidiIter> 316 Traits const &traits_cast(match_state<BidiIter> const &state); 317 318 template<typename Char> 319 struct basic_chset; 320 321 template<typename Char> 322 struct named_mark; 323 324 template<typename BidiIter> 325 struct memento; 326 327 template<typename Char, typename Traits> 328 void set_char(compound_charset<Traits> &chset, Char ch, Traits const &tr, bool icase); 329 330 template<typename Char, typename Traits> 331 void set_range(compound_charset<Traits> &chset, Char from, Char to, Traits const &tr, bool icase); 332 333 template<typename Traits> 334 void set_class(compound_charset<Traits> &chset, typename Traits::char_class_type char_class, bool no, Traits const &tr); 335 336 template<typename Char, typename Traits> 337 void set_char(basic_chset<Char> &chset, Char ch, Traits const &tr, bool icase); 338 339 template<typename Char, typename Traits> 340 void set_range(basic_chset<Char> &chset, Char from, Char to, Traits const &tr, bool icase); 341 342 template<typename Char, typename Traits> 343 void set_class(basic_chset<Char> &chset, typename Traits::char_class_type char_class, bool no, Traits const &tr); 344 345 template<typename Matcher> 346 static_xpression<Matcher> const 347 make_static(Matcher const &matcher); 348 349 template<typename Matcher, typename Next> 350 static_xpression<Matcher, Next> const 351 make_static(Matcher const &matcher, Next const &next); 352 353 int get_mark_number(basic_mark_tag const &); 354 355 template<typename Xpr, typename BidiIter> 356 void static_compile(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl); 357 358 struct quant_spec; 359 360 template<typename BidiIter, typename Xpr> 361 void make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq, Xpr const &xpr); 362 363 template<typename BidiIter> 364 void make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq); 365 366 template<typename BidiIter> 367 void make_repeat(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr); 368 369 template<typename BidiIter> 370 void make_repeat(quant_spec const &spec, sequence<BidiIter> &seq); 371 372 template<typename BidiIter> 373 void make_optional(quant_spec const &spec, sequence<BidiIter> &seq); 374 375 template<typename BidiIter> 376 void make_optional(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr); 377 378 template<typename Char> 379 struct string_type 380 { 381 typedef std::vector<Char> type; 382 }; 383 384 template<> 385 struct string_type<char> 386 { 387 typedef std::string type; 388 }; 389 390 #ifndef BOOST_XPRESSIVE_NO_WREGEX 391 template<> 392 struct string_type<wchar_t> 393 { 394 typedef std::wstring type; 395 }; 396 #endif 397 398 }}} // namespace boost::xpressive::detail 399 400 namespace boost { namespace xpressive { namespace grammar_detail 401 { 402 using proto::_; 403 using proto::or_; 404 using proto::if_; 405 using proto::call; 406 using proto::when; 407 using proto::otherwise; 408 using proto::switch_; 409 using proto::make; 410 using proto::_child; 411 using proto::_value; 412 using proto::_left; 413 using proto::_right; 414 using proto::not_; 415 using proto::_state; 416 using proto::_data; 417 using proto::callable; 418 using proto::transform; 419 using proto::fold; 420 using proto::reverse_fold; 421 using proto::fold_tree; 422 using proto::reverse_fold_tree; 423 using proto::terminal; 424 using proto::shift_right; 425 using proto::bitwise_or; 426 using proto::logical_not; 427 using proto::dereference; 428 using proto::unary_plus; 429 using proto::negate; 430 using proto::complement; 431 using proto::comma; 432 using proto::assign; 433 using proto::subscript; 434 using proto::nary_expr; 435 using proto::unary_expr; 436 using proto::binary_expr; 437 using proto::_deep_copy; 438 using proto::vararg; 439 namespace tag = proto::tag; 440 }}} 441 442 namespace boost { namespace xpressive { namespace op 443 { 444 struct push; 445 struct push_back; 446 struct pop; 447 struct push_front; 448 struct pop_back; 449 struct pop_front; 450 struct back; 451 struct front; 452 struct top; 453 struct first; 454 struct second; 455 struct matched; 456 struct length; 457 struct str; 458 struct insert; 459 struct make_pair; 460 461 template<typename T> 462 struct as; 463 template<typename T> 464 struct static_cast_; 465 template<typename T> 466 struct dynamic_cast_; 467 template<typename T> 468 struct const_cast_; 469 template<typename T> 470 struct construct; 471 template<typename T> 472 struct throw_; 473 }}} // namespace boost::xpressive::op 474 475 /// INTERNAL ONLY 476 namespace boost { namespace xpressive 477 { 478 479 /// INTERNAL ONLY 480 template<typename Traits, std::size_t N> 481 typename Traits::char_class_type 482 lookup_classname(Traits const &traits, char const (&cname)[N], bool icase = false); 483 484 }} // namespace boost::xpressive 485 486 #endif 487