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