detail_fwd.hpp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  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. #ifndef BOOST_XPRESSIVE_DETAIL_DETAIL_FWD_HPP_EAN_10_04_2005
  8. #define BOOST_XPRESSIVE_DETAIL_DETAIL_FWD_HPP_EAN_10_04_2005
  9. // MS compatible compilers support #pragma once
  10. #if defined(_MSC_VER)
  11. # pragma once
  12. #endif
  13. #include <map>
  14. #include <string>
  15. #include <vector>
  16. #include <climits> // for INT_MAX
  17. #include <typeinfo>
  18. #include <boost/mpl/bool.hpp>
  19. #include <boost/mpl/size_t.hpp>
  20. #include <boost/shared_ptr.hpp>
  21. #include <boost/xpressive/xpressive_fwd.hpp>
  22. namespace boost { namespace xpressive { namespace detail
  23. {
  24. typedef unsigned int uint_t;
  25. template<uint_t Min, uint_t Max = Min>
  26. struct generic_quant_tag;
  27. struct modifier_tag;
  28. struct check_tag;
  29. typedef mpl::size_t<INT_MAX / 2 - 1> unknown_width;
  30. struct type_info_less;
  31. typedef std::map<std::type_info const *, void *, type_info_less> action_args_type;
  32. struct action_context;
  33. struct ReplaceAlgo;
  34. ///////////////////////////////////////////////////////////////////////////////
  35. // placeholders
  36. //
  37. struct mark_placeholder;
  38. struct posix_charset_placeholder;
  39. template<typename Cond>
  40. struct assert_word_placeholder;
  41. template<typename Char>
  42. struct range_placeholder;
  43. struct assert_bol_placeholder;
  44. struct assert_eol_placeholder;
  45. struct logical_newline_placeholder;
  46. struct self_placeholder;
  47. template<typename Nbr>
  48. struct attribute_placeholder;
  49. ///////////////////////////////////////////////////////////////////////////////
  50. // matchers
  51. //
  52. struct end_matcher;
  53. struct independent_end_matcher;
  54. struct assert_bos_matcher;
  55. struct assert_eos_matcher;
  56. template<typename Traits>
  57. struct assert_bol_matcher;
  58. template<typename Traits>
  59. struct assert_eol_matcher;
  60. template<typename Cond, typename Traits>
  61. struct assert_word_matcher;
  62. struct true_matcher;
  63. template<typename Alternates, typename Traits>
  64. struct alternate_matcher;
  65. struct alternate_end_matcher;
  66. template<typename Traits>
  67. struct posix_charset_matcher;
  68. template<typename BidiIter>
  69. struct sequence;
  70. template<typename Traits, typename ICase>
  71. struct mark_matcher;
  72. struct mark_begin_matcher;
  73. struct mark_end_matcher;
  74. template<typename BidiIter>
  75. struct regex_matcher;
  76. template<typename BidiIter>
  77. struct regex_byref_matcher;
  78. template<typename Traits>
  79. struct compound_charset;
  80. template<typename Traits, typename ICase, typename CharSet = compound_charset<Traits> >
  81. struct charset_matcher;
  82. template<typename Traits, typename ICase>
  83. struct range_matcher;
  84. template<typename Traits, typename Size>
  85. struct set_matcher;
  86. template<typename Xpr, typename Greedy>
  87. struct simple_repeat_matcher;
  88. struct repeat_begin_matcher;
  89. template<typename Greedy>
  90. struct repeat_end_matcher;
  91. template<typename Traits, typename ICase, typename Not>
  92. struct literal_matcher;
  93. template<typename Traits, typename ICase>
  94. struct string_matcher;
  95. template<typename Actor>
  96. struct action_matcher;
  97. template<typename Predicate>
  98. struct predicate_matcher;
  99. template<typename Xpr, typename Greedy>
  100. struct optional_matcher;
  101. template<typename Xpr, typename Greedy>
  102. struct optional_mark_matcher;
  103. template<typename Matcher, typename Traits, typename ICase>
  104. struct attr_matcher;
  105. template<typename Nbr>
  106. struct attr_begin_matcher;
  107. struct attr_end_matcher;
  108. template<typename Xpr>
  109. struct is_modifiable;
  110. template<typename Head, typename Tail>
  111. struct alternates_list;
  112. template<typename Modifier>
  113. struct modifier_op;
  114. struct icase_modifier;
  115. template<typename BidiIter, typename ICase, typename Traits>
  116. struct xpression_visitor;
  117. template<typename BidiIter>
  118. struct regex_impl;
  119. struct epsilon_matcher;
  120. template<typename BidiIter>
  121. struct nested_results;
  122. template<typename BidiIter>
  123. struct regex_id_filter_predicate;
  124. template<typename Xpr>
  125. struct keeper_matcher;
  126. template<typename Xpr>
  127. struct lookahead_matcher;
  128. template<typename Xpr>
  129. struct lookbehind_matcher;
  130. template<typename IsBoundary>
  131. struct word_boundary;
  132. template<typename BidiIter, typename Matcher>
  133. sequence<BidiIter> make_dynamic(Matcher const &matcher);
  134. template<typename Char>
  135. struct xpression_linker;
  136. template<typename Char>
  137. struct xpression_peeker;
  138. struct any_matcher;
  139. template<typename Traits>
  140. struct logical_newline_matcher;
  141. typedef proto::expr<proto::tag::terminal, proto::term<logical_newline_placeholder>, 0> logical_newline_xpression;
  142. struct set_initializer;
  143. typedef proto::expr<proto::tag::terminal, proto::term<set_initializer>, 0> set_initializer_type;
  144. struct lookahead_tag;
  145. struct lookbehind_tag;
  146. struct keeper_tag;
  147. template<typename Locale>
  148. struct locale_modifier;
  149. template<typename Matcher>
  150. struct matcher_wrapper;
  151. template<typename Locale, typename BidiIter>
  152. struct regex_traits_type;
  153. template<typename Expr>
  154. struct let_;
  155. template<typename Args, typename BidiIter>
  156. void bind_args(let_<Args> const &, match_results<BidiIter> &);
  157. ///////////////////////////////////////////////////////////////////////////////
  158. // Misc.
  159. struct no_next;
  160. template<typename BidiIter>
  161. struct core_access;
  162. template<typename BidiIter>
  163. struct match_state;
  164. template<typename BidiIter>
  165. struct matchable;
  166. template<typename BidiIter>
  167. struct matchable_ex;
  168. template<typename Matcher, typename BidiIter>
  169. struct dynamic_xpression;
  170. template<typename BidiIter>
  171. struct shared_matchable;
  172. template<typename BidiIter>
  173. struct alternates_vector;
  174. template<typename Matcher, typename Next>
  175. struct static_xpression;
  176. typedef static_xpression<end_matcher, no_next> end_xpression;
  177. typedef static_xpression<alternate_end_matcher, no_next> alternate_end_xpression;
  178. typedef static_xpression<independent_end_matcher, no_next> independent_end_xpression;
  179. typedef static_xpression<true_matcher, no_next> true_xpression;
  180. template<typename Matcher, typename Next = end_xpression>
  181. struct static_xpression;
  182. template<typename Top, typename Next>
  183. struct stacked_xpression;
  184. template<typename Xpr>
  185. struct is_static_xpression;
  186. template<typename BidiIter>
  187. struct sub_match_impl;
  188. template<typename T>
  189. struct list;
  190. template<typename BidiIter>
  191. struct results_cache;
  192. template<typename T>
  193. struct sequence_stack;
  194. template<typename BidiIter>
  195. struct results_extras;
  196. template<typename BidiIter>
  197. struct match_context;
  198. template<typename BidiIter>
  199. struct sub_match_vector;
  200. template<typename T, typename U>
  201. struct action_arg;
  202. struct actionable;
  203. template<typename Char>
  204. struct traits;
  205. template<typename Traits, typename BidiIter>
  206. Traits const &traits_cast(match_state<BidiIter> const &state);
  207. template<typename Char>
  208. struct basic_chset;
  209. template<typename Char>
  210. struct named_mark;
  211. template<typename BidiIter>
  212. struct memento;
  213. template<typename Char, typename Traits>
  214. void set_char(compound_charset<Traits> &chset, Char ch, Traits const &tr, bool icase);
  215. template<typename Char, typename Traits>
  216. void set_range(compound_charset<Traits> &chset, Char from, Char to, Traits const &tr, bool icase);
  217. template<typename Traits>
  218. void set_class(compound_charset<Traits> &chset, typename Traits::char_class_type char_class, bool no, Traits const &tr);
  219. template<typename Char, typename Traits>
  220. void set_char(basic_chset<Char> &chset, Char ch, Traits const &tr, bool icase);
  221. template<typename Char, typename Traits>
  222. void set_range(basic_chset<Char> &chset, Char from, Char to, Traits const &tr, bool icase);
  223. template<typename Char, typename Traits>
  224. void set_class(basic_chset<Char> &chset, typename Traits::char_class_type char_class, bool no, Traits const &tr);
  225. template<typename Matcher>
  226. static_xpression<Matcher> const
  227. make_static(Matcher const &matcher);
  228. template<typename Matcher, typename Next>
  229. static_xpression<Matcher, Next> const
  230. make_static(Matcher const &matcher, Next const &next);
  231. int get_mark_number(basic_mark_tag const &);
  232. template<typename Xpr, typename BidiIter>
  233. void static_compile(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl);
  234. struct quant_spec;
  235. template<typename BidiIter, typename Xpr>
  236. void make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq, Xpr const &xpr);
  237. template<typename BidiIter>
  238. void make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq);
  239. template<typename BidiIter>
  240. void make_repeat(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr);
  241. template<typename BidiIter>
  242. void make_repeat(quant_spec const &spec, sequence<BidiIter> &seq);
  243. template<typename BidiIter>
  244. void make_optional(quant_spec const &spec, sequence<BidiIter> &seq);
  245. template<typename BidiIter>
  246. void make_optional(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr);
  247. template<typename Char>
  248. struct string_type
  249. {
  250. typedef std::vector<Char> type;
  251. };
  252. template<>
  253. struct string_type<char>
  254. {
  255. typedef std::string type;
  256. };
  257. #ifndef BOOST_XPRESSIVE_NO_WREGEX
  258. template<>
  259. struct string_type<wchar_t>
  260. {
  261. typedef std::wstring type;
  262. };
  263. #endif
  264. }}} // namespace boost::xpressive::detail
  265. namespace boost { namespace xpressive { namespace grammar_detail
  266. {
  267. using proto::_;
  268. using proto::or_;
  269. using proto::if_;
  270. using proto::call;
  271. using proto::when;
  272. using proto::otherwise;
  273. using proto::switch_;
  274. using proto::make;
  275. using proto::_child;
  276. using proto::_value;
  277. using proto::_left;
  278. using proto::_right;
  279. using proto::not_;
  280. using proto::_state;
  281. using proto::_data;
  282. using proto::callable;
  283. using proto::transform;
  284. using proto::fold;
  285. using proto::reverse_fold;
  286. using proto::fold_tree;
  287. using proto::reverse_fold_tree;
  288. using proto::terminal;
  289. using proto::shift_right;
  290. using proto::bitwise_or;
  291. using proto::logical_not;
  292. using proto::dereference;
  293. using proto::unary_plus;
  294. using proto::negate;
  295. using proto::complement;
  296. using proto::comma;
  297. using proto::assign;
  298. using proto::subscript;
  299. using proto::nary_expr;
  300. using proto::unary_expr;
  301. using proto::binary_expr;
  302. using proto::_deep_copy;
  303. using proto::vararg;
  304. namespace tag = proto::tag;
  305. }}}
  306. namespace boost { namespace xpressive { namespace op
  307. {
  308. struct push;
  309. struct push_back;
  310. struct pop;
  311. struct push_front;
  312. struct pop_back;
  313. struct pop_front;
  314. struct back;
  315. struct front;
  316. struct top;
  317. struct first;
  318. struct second;
  319. struct matched;
  320. struct length;
  321. struct str;
  322. struct insert;
  323. struct make_pair;
  324. template<typename T>
  325. struct as;
  326. template<typename T>
  327. struct static_cast_;
  328. template<typename T>
  329. struct dynamic_cast_;
  330. template<typename T>
  331. struct const_cast_;
  332. template<typename T>
  333. struct construct;
  334. template<typename T>
  335. struct throw_;
  336. }}} // namespace boost::xpressive::op
  337. /// INTERNAL ONLY
  338. namespace boost { namespace xpressive
  339. {
  340. /// INTERNAL ONLY
  341. template<typename Traits, std::size_t N>
  342. typename Traits::char_class_type
  343. lookup_classname(Traits const &traits, char const (&cname)[N], bool icase = false);
  344. }} // namespace boost::xpressive
  345. #endif