1 ///////////////////////////////////////////////////////////////////////////////
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)
8 #ifndef BOOST_XPRESSIVE_DETAIL_DETAIL_FWD_HPP_EAN_10_04_2005
9 #define BOOST_XPRESSIVE_DETAIL_DETAIL_FWD_HPP_EAN_10_04_2005
11 // MS compatible compilers support #pragma once
19 #include <climits> // for INT_MAX
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>
26 namespace boost { namespace xpressive { namespace detail
28 typedef unsigned int uint_t;
30 template<uint_t Min, uint_t Max = Min>
31 struct generic_quant_tag;
37 typedef mpl::size_t<INT_MAX / 2 - 1> unknown_width;
39 struct type_info_less;
41 typedef std::map<std::type_info const *, void *, type_info_less> action_args_type;
43 struct action_context;
47 ///////////////////////////////////////////////////////////////////////////////
50 struct mark_placeholder;
52 struct posix_charset_placeholder;
54 template<typename Cond>
55 struct assert_word_placeholder;
57 template<typename Char>
58 struct range_placeholder;
60 struct assert_bol_placeholder;
62 struct assert_eol_placeholder;
64 struct logical_newline_placeholder;
66 struct self_placeholder;
68 template<typename Nbr>
69 struct attribute_placeholder;
71 ///////////////////////////////////////////////////////////////////////////////
76 struct independent_end_matcher;
78 struct assert_bos_matcher;
80 struct assert_eos_matcher;
82 template<typename Traits>
83 struct assert_bol_matcher;
85 template<typename Traits>
86 struct assert_eol_matcher;
88 template<typename Cond, typename Traits>
89 struct assert_word_matcher;
93 template<typename Alternates, typename Traits>
94 struct alternate_matcher;
96 struct alternate_end_matcher;
98 template<typename Traits>
99 struct posix_charset_matcher;
101 template<typename BidiIter>
104 template<typename Traits, typename ICase>
107 struct mark_begin_matcher;
109 struct mark_end_matcher;
111 template<typename BidiIter>
112 struct regex_matcher;
114 template<typename BidiIter>
115 struct regex_byref_matcher;
117 template<typename Traits>
118 struct compound_charset;
120 template<typename Traits, typename ICase, typename CharSet = compound_charset<Traits> >
121 struct charset_matcher;
123 template<typename Traits, typename ICase>
124 struct range_matcher;
126 template<typename Traits, typename Size>
129 template<typename Xpr, typename Greedy>
130 struct simple_repeat_matcher;
132 struct repeat_begin_matcher;
134 template<typename Greedy>
135 struct repeat_end_matcher;
137 template<typename Traits, typename ICase, typename Not>
138 struct literal_matcher;
140 template<typename Traits, typename ICase>
141 struct string_matcher;
143 template<typename Actor>
144 struct action_matcher;
146 template<typename Predicate>
147 struct predicate_matcher;
149 template<typename Xpr, typename Greedy>
150 struct optional_matcher;
152 template<typename Xpr, typename Greedy>
153 struct optional_mark_matcher;
155 template<typename Matcher, typename Traits, typename ICase>
158 template<typename Nbr>
159 struct attr_begin_matcher;
161 struct attr_end_matcher;
163 template<typename Xpr>
164 struct is_modifiable;
166 template<typename Head, typename Tail>
167 struct alternates_list;
169 template<typename Modifier>
172 struct icase_modifier;
174 template<typename BidiIter, typename ICase, typename Traits>
175 struct xpression_visitor;
177 template<typename BidiIter>
180 struct epsilon_matcher;
182 template<typename BidiIter>
183 struct nested_results;
185 template<typename BidiIter>
186 struct regex_id_filter_predicate;
188 template<typename Xpr>
189 struct keeper_matcher;
191 template<typename Xpr>
192 struct lookahead_matcher;
194 template<typename Xpr>
195 struct lookbehind_matcher;
197 template<typename IsBoundary>
198 struct word_boundary;
200 template<typename BidiIter, typename Matcher>
201 sequence<BidiIter> make_dynamic(Matcher const &matcher);
203 template<typename Char>
204 struct xpression_linker;
206 template<typename Char>
207 struct xpression_peeker;
211 template<typename Traits>
212 struct logical_newline_matcher;
214 typedef proto::expr<proto::tag::terminal, proto::term<logical_newline_placeholder>, 0> logical_newline_xpression;
216 struct set_initializer;
218 typedef proto::expr<proto::tag::terminal, proto::term<set_initializer>, 0> set_initializer_type;
220 struct lookahead_tag;
222 struct lookbehind_tag;
226 template<typename Locale>
227 struct locale_modifier;
229 template<typename Matcher>
230 struct matcher_wrapper;
232 template<typename Locale, typename BidiIter>
233 struct regex_traits_type;
235 template<typename Expr>
238 template<typename Args, typename BidiIter>
239 void bind_args(let_<Args> const &, match_results<BidiIter> &);
241 ///////////////////////////////////////////////////////////////////////////////
245 template<typename BidiIter>
248 template<typename BidiIter>
251 template<typename BidiIter>
254 template<typename BidiIter>
257 template<typename Matcher, typename BidiIter>
258 struct dynamic_xpression;
260 template<typename BidiIter>
261 struct shared_matchable;
263 template<typename BidiIter>
264 struct alternates_vector;
266 template<typename Matcher, typename Next>
267 struct static_xpression;
269 typedef static_xpression<end_matcher, no_next> end_xpression;
271 typedef static_xpression<alternate_end_matcher, no_next> alternate_end_xpression;
273 typedef static_xpression<independent_end_matcher, no_next> independent_end_xpression;
275 typedef static_xpression<true_matcher, no_next> true_xpression;
277 template<typename Matcher, typename Next = end_xpression>
278 struct static_xpression;
280 template<typename Top, typename Next>
281 struct stacked_xpression;
283 template<typename Xpr>
284 struct is_static_xpression;
286 template<typename BidiIter>
287 struct sub_match_impl;
292 template<typename BidiIter>
293 struct results_cache;
296 struct sequence_stack;
298 template<typename BidiIter>
299 struct results_extras;
301 template<typename BidiIter>
302 struct match_context;
304 template<typename BidiIter>
305 struct sub_match_vector;
307 template<typename T, typename U>
312 template<typename Char>
315 template<typename Traits, typename BidiIter>
316 Traits const &traits_cast(match_state<BidiIter> const &state);
318 template<typename Char>
321 template<typename Char>
324 template<typename BidiIter>
327 template<typename Char, typename Traits>
328 void set_char(compound_charset<Traits> &chset, Char ch, Traits const &tr, bool icase);
330 template<typename Char, typename Traits>
331 void set_range(compound_charset<Traits> &chset, Char from, Char to, Traits const &tr, bool icase);
333 template<typename Traits>
334 void set_class(compound_charset<Traits> &chset, typename Traits::char_class_type char_class, bool no, Traits const &tr);
336 template<typename Char, typename Traits>
337 void set_char(basic_chset<Char> &chset, Char ch, Traits const &tr, bool icase);
339 template<typename Char, typename Traits>
340 void set_range(basic_chset<Char> &chset, Char from, Char to, Traits const &tr, bool icase);
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);
345 template<typename Matcher>
346 static_xpression<Matcher> const
347 make_static(Matcher const &matcher);
349 template<typename Matcher, typename Next>
350 static_xpression<Matcher, Next> const
351 make_static(Matcher const &matcher, Next const &next);
353 int get_mark_number(basic_mark_tag const &);
355 template<typename Xpr, typename BidiIter>
356 void static_compile(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl);
360 template<typename BidiIter, typename Xpr>
361 void make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq, Xpr const &xpr);
363 template<typename BidiIter>
364 void make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq);
366 template<typename BidiIter>
367 void make_repeat(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr);
369 template<typename BidiIter>
370 void make_repeat(quant_spec const &spec, sequence<BidiIter> &seq);
372 template<typename BidiIter>
373 void make_optional(quant_spec const &spec, sequence<BidiIter> &seq);
375 template<typename BidiIter>
376 void make_optional(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr);
378 template<typename Char>
381 typedef std::vector<Char> type;
385 struct string_type<char>
387 typedef std::string type;
390 #ifndef BOOST_XPRESSIVE_NO_WREGEX
392 struct string_type<wchar_t>
394 typedef std::wstring type;
398 }}} // namespace boost::xpressive::detail
400 namespace boost { namespace xpressive { namespace grammar_detail
407 using proto::otherwise;
408 using proto::switch_;
417 using proto::callable;
418 using proto::transform;
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;
430 using proto::complement;
433 using proto::subscript;
434 using proto::nary_expr;
435 using proto::unary_expr;
436 using proto::binary_expr;
437 using proto::_deep_copy;
439 namespace tag = proto::tag;
442 namespace boost { namespace xpressive { namespace op
466 struct dynamic_cast_;
473 }}} // namespace boost::xpressive::op
476 namespace boost { namespace xpressive
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);
484 }} // namespace boost::xpressive