Boost logo

Boost-Commit :

From: troy_at_[hidden]
Date: 2008-07-01 12:47:01


Author: troy
Date: 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
New Revision: 46962
URL: http://svn.boost.org/trac/boost/changeset/46962

Log:
use modularize targets, not externals to manage modularization
Added:
   branches/CMake/release/libs/xpressive/include/boost/xpressive/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/basic_regex.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/access.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/action.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/adaptor.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/finder.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/flow_control.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/icase.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/linker.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/action_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/alternate_end_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/alternate_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/any_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_bol_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_bos_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_eol_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_eos_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_line_base.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_word_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/attr_begin_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/attr_end_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/attr_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/charset_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/end_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/epsilon_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/keeper_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/literal_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/logical_newline_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/lookahead_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/lookbehind_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/mark_begin_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/mark_end_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/mark_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/optional_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/posix_charset_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/predicate_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/range_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/regex_byref_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/regex_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/repeat_begin_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/repeat_end_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/set_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/string_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/true_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matchers.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/optimize.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/peeker.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/quant_style.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/regex_impl.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/results_cache.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/state.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/sub_match_impl.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/sub_match_vector.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/detail_fwd.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/dynamic.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/matchable.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parse_charset.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parser.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parser_enum.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parser_traits.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/sequence.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/compile.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/grammar.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/is_pure.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/modifier.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/placeholders.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/static.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_action.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_alternate.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_independent.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_inverse.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_marker.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_matcher.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_modifier.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_quantifier.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_sequence.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_set.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transmogrify.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/type_traits.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/visitor.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/width_of.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/algorithm.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/any.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/boyer_moore.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/basic_chset.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/basic_chset.ipp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/chset.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/range_run.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/range_run.ipp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/cons.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/counted_base.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/dont_care.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/hash_peek_bitset.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/ignore_unused.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/literals.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/never_true.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/save_restore.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/sequence_stack.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/symbols.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/tracking_ptr.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/traits_utils.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/width.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/match_results.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/args.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/callable.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/default.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/null.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/debug.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/deep_copy.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/as_lvalue.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/dont_care.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/funop.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/ignore_unused.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/pop_front.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/prefix.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/reverse.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/suffix.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/domain.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/eval.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/expr.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/extends.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/fusion.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/generate.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/literal.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/make_expr.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/matches.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/operators.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/proto.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/proto_fwd.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/proto_typeof.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/ref.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/tags.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/traits.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/arg.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/bind.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/call.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/fold.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/fold_tree.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/make.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/pass_through.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/when.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_actions.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_algorithms.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_compiler.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_constants.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_error.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_iterator.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_primitives.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_token_iterator.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_traits.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/sub_match.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/c_regex_traits.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/cpp_regex_traits.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/detail/
   branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/detail/c_ctype.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/null_regex_traits.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_dynamic.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_fwd.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_static.hpp (contents, props changed)
   branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_typeof.hpp (contents, props changed)
Properties modified:
   branches/CMake/release/libs/xpressive/include/boost/ (props changed)

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/basic_regex.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/basic_regex.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,270 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file basic_regex.hpp
+/// Contains the definition of the basic_regex\<\> class template and its
+/// associated helper functions.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_BASIC_REGEX_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_BASIC_REGEX_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/xpressive_fwd.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+
+// Doxygen can't handle proto :-(
+#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
+# include <boost/xpressive/detail/static/grammar.hpp>
+# include <boost/xpressive/proto/extends.hpp>
+#endif
+
+#if BOOST_XPRESSIVE_HAS_MS_STACK_GUARD
+# include <excpt.h> // for _exception_code()
+# include <malloc.h> // for _resetstkoflw()
+#endif
+
+namespace boost { namespace xpressive
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// basic_regex
+//
+/// \brief Class template basic_regex\<\> is a class for holding a compiled regular expression.
+template<typename BidiIter>
+struct basic_regex
+ : proto::extends<
+ typename proto::terminal<detail::tracking_ptr<detail::regex_impl<BidiIter> > >::type
+ , basic_regex<BidiIter>
+ >
+{
+private:
+ typedef typename proto::terminal<detail::tracking_ptr<detail::regex_impl<BidiIter> > >::type pimpl_type;
+ typedef proto::extends<pimpl_type, basic_regex<BidiIter> > base_type;
+
+public:
+ typedef BidiIter iterator_type;
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef typename detail::string_type<char_type>::type string_type;
+ typedef regex_constants::syntax_option_type flag_type;
+
+ /// \post regex_id() == 0
+ /// \post mark_count() == 0
+ basic_regex()
+ : base_type()
+ {
+ }
+
+ /// \param that The basic_regex object to copy.
+ /// \post regex_id() == that.regex_id()
+ /// \post mark_count() == that.mark_count()
+ basic_regex(basic_regex<BidiIter> const &that)
+ : base_type(that)
+ {
+ }
+
+ /// \param that The basic_regex object to copy.
+ /// \post regex_id() == that.regex_id()
+ /// \post mark_count() == that.mark_count()
+ /// \return *this
+ basic_regex<BidiIter> &operator =(basic_regex<BidiIter> const &that)
+ {
+ proto::arg(*this) = proto::arg(that);
+ return *this;
+ }
+
+ /// Construct from a static regular expression.
+ ///
+ /// \param expr The static regular expression
+ /// \pre Expr is the type of a static regular expression.
+ /// \post regex_id() != 0
+ /// \post mark_count() \>= 0
+ template<typename Expr>
+ basic_regex(Expr const &expr)
+ : base_type()
+ {
+ BOOST_XPRESSIVE_CHECK_REGEX(Expr, char_type);
+ this->compile_(expr, is_valid_regex<Expr, char_type>());
+ }
+
+ /// Construct from a static regular expression.
+ ///
+ /// \param expr The static regular expression.
+ /// \pre Expr is the type of a static regular expression.
+ /// \post regex_id() != 0
+ /// \post mark_count() \>= 0
+ /// \throw std::bad_alloc on out of memory
+ /// \return *this
+ template<typename Expr>
+ basic_regex<BidiIter> &operator =(Expr const &expr)
+ {
+ BOOST_XPRESSIVE_CHECK_REGEX(Expr, char_type);
+ this->compile_(expr, is_valid_regex<Expr, char_type>());
+ return *this;
+ }
+
+ /// Returns the count of capturing sub-expressions in this regular expression
+ ///
+ std::size_t mark_count() const
+ {
+ return proto::arg(*this) ? proto::arg(*this)->mark_count_ : 0;
+ }
+
+ /// Returns a token which uniquely identifies this regular expression.
+ ///
+ regex_id_type regex_id() const
+ {
+ return proto::arg(*this) ? proto::arg(*this)->xpr_.get() : 0;
+ }
+
+ /// Swaps the contents of this basic_regex object with another.
+ ///
+ /// \param that The other basic_regex object.
+ /// \attention This is a shallow swap that does not do reference tracking.
+ /// If you embed a basic_regex object by reference in another
+ /// regular expression and then swap its contents with another
+ /// basic_regex object, the change will not be visible to the
+ /// enclosing regular expression. It is done this way to ensure
+ /// that swap() cannot throw.
+ /// \throw nothrow
+ void swap(basic_regex<BidiIter> &that) // throw()
+ {
+ proto::arg(*this).swap(proto::arg(that));
+ }
+
+ /// Factory method for building a regex object from a range of characters.
+ /// Equivalent to regex_compiler\< BidiIter \>().compile(begin, end, flags);
+ ///
+ /// \param begin The beginning of a range of characters representing the
+ /// regular expression to compile.
+ /// \param end The end of a range of characters representing the
+ /// regular expression to compile.
+ /// \param flags Optional bitmask that determines how the pat string is
+ /// interpreted. (See syntax_option_type.)
+ /// \return A basic_regex object corresponding to the regular expression
+ /// represented by the character range.
+ /// \pre [begin,end) is a valid range.
+ /// \pre The range of characters specified by [begin,end) contains a
+ /// valid string-based representation of a regular expression.
+ /// \throw regex_error when the range of characters has invalid regular
+ /// expression syntax.
+ template<typename InputIter>
+ static basic_regex<BidiIter> compile(InputIter begin, InputIter end, flag_type flags = regex_constants::ECMAScript)
+ {
+ return regex_compiler<BidiIter>().compile(begin, end, flags);
+ }
+
+ /// \overload
+ ///
+ template<typename InputRange>
+ static basic_regex<BidiIter> compile(InputRange const &pat, flag_type flags = regex_constants::ECMAScript)
+ {
+ return regex_compiler<BidiIter>().compile(pat, flags);
+ }
+
+ /// \overload
+ ///
+ static basic_regex<BidiIter> compile(char_type const *begin, flag_type flags = regex_constants::ECMAScript)
+ {
+ return regex_compiler<BidiIter>().compile(begin, flags);
+ }
+
+ /// \overload
+ ///
+ static basic_regex<BidiIter> compile(char_type const *begin, std::size_t len, flag_type flags)
+ {
+ return regex_compiler<BidiIter>().compile(begin, len, flags);
+ }
+
+private:
+ friend struct detail::core_access<BidiIter>;
+
+ // Avoid a common programming mistake. Construction from a string is
+ // ambiguous. It could mean:
+ // sregex rx = sregex::compile(str); // compile the string into a regex
+ // or
+ // sregex rx = as_xpr(str); // treat the string as a literal
+ // Since there is no easy way to disambiguate, it is disallowed. You must
+ // say what you mean.
+
+ /// INTERNAL ONLY
+ basic_regex(char_type const *);
+ /// INTERNAL ONLY
+ basic_regex(string_type const &);
+
+ /// INTERNAL ONLY
+ bool match_(detail::match_state<BidiIter> &state) const
+ {
+ #if BOOST_XPRESSIVE_HAS_MS_STACK_GUARD
+ bool success = false, stack_error = false;
+ __try
+ {
+ success = proto::arg(*this)->xpr_->match(state);
+ }
+ __except(_exception_code() == 0xC00000FDUL)
+ {
+ stack_error = true;
+ _resetstkoflw();
+ }
+ detail::ensure(!stack_error, regex_constants::error_stack, "Regex stack space exhausted");
+ return success;
+ #else
+ return proto::arg(*this)->xpr_->match(state);
+ #endif
+ }
+
+ // Returns true if this basic_regex object does not contain a valid regular expression.
+ /// INTERNAL ONLY
+ bool invalid_() const
+ {
+ return !proto::arg(*this) || !proto::arg(*this)->xpr_;
+ }
+
+ // Compiles valid static regexes into a state machine.
+ /// INTERNAL ONLY
+ template<typename Expr>
+ void compile_(Expr const &expr, mpl::true_)
+ {
+ detail::static_compile(expr, proto::arg(*this).get());
+ }
+
+ // No-op for invalid static regexes.
+ /// INTERNAL ONLY
+ template<typename Expr>
+ void compile_(Expr const &, mpl::false_)
+ {
+ }
+
+ /// INTERNAL ONLY
+ void dump_(std::ostream &sout) const;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// swap
+/// \brief Swaps the contents of two basic_regex objects.
+/// \param left The first basic_regex object.
+/// \param right The second basic_regex object.
+/// \attention This is a shallow swap that does not do reference tracking.
+/// If you embed a basic_regex object by reference in another
+/// regular expression and then swap its contents with another
+/// basic_regex object, the change will not be visible to the
+/// enclosing regular expression. It is done this way to ensure
+/// that swap() cannot throw.
+/// \throw nothrow
+template<typename BidiIter>
+inline void swap(basic_regex<BidiIter> &left, basic_regex<BidiIter> &right) // throw()
+{
+ left.swap(right);
+}
+
+}} // namespace boost::xpressive
+
+#endif // BOOST_XPRESSIVE_BASIC_REGEX_HPP_EAN_10_04_2005

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/access.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/access.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,131 @@
+///////////////////////////////////////////////////////////////////////////////
+// access.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_ACCESS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_ACCESS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/dynamic/matchable.hpp>
+#include <boost/xpressive/match_results.hpp> // for type_info_less
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// core_access
+//
+template<typename BidiIter>
+struct core_access
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
+ static std::size_t get_hidden_mark_count(basic_regex<BidiIter> const &rex)
+ {
+ return proto::arg(rex)->hidden_mark_count_;
+ }
+
+ static bool invalid(basic_regex<BidiIter> const &rex)
+ {
+ return rex.invalid_();
+ }
+
+ static bool match(basic_regex<BidiIter> const &rex, match_state<BidiIter> &state)
+ {
+ return rex.match_(state);
+ }
+
+ static shared_ptr<detail::regex_impl<BidiIter> > const &
+ get_regex_impl(basic_regex<BidiIter> const &rex)
+ {
+ return proto::arg(rex).get();
+ }
+
+ static void init_sub_match_vector
+ (
+ sub_match_vector<BidiIter> &subs_vect
+ , sub_match_impl<BidiIter> *subs_ptr
+ , std::size_t size
+ )
+ {
+ subs_vect.init_(subs_ptr, size);
+ }
+
+ static void init_sub_match_vector
+ (
+ sub_match_vector<BidiIter> &subs_vect
+ , sub_match_impl<BidiIter> *subs_ptr
+ , std::size_t size
+ , sub_match_vector<BidiIter> const &that
+ )
+ {
+ subs_vect.init_(subs_ptr, size, that);
+ }
+
+ static void init_match_results
+ (
+ match_results<BidiIter> &what
+ , regex_id_type regex_id
+ , intrusive_ptr<traits<char_type> const> const &traits
+ , sub_match_impl<BidiIter> *sub_matches
+ , std::size_t size
+ , std::vector<named_mark<char_type> > const &named_marks
+ )
+ {
+ what.init_(regex_id, traits, sub_matches, size, named_marks);
+ }
+
+ static sub_match_vector<BidiIter> &get_sub_match_vector(match_results<BidiIter> &what)
+ {
+ return what.sub_matches_;
+ }
+
+ static sub_match_impl<BidiIter> *get_sub_matches(sub_match_vector<BidiIter> &subs)
+ {
+ return subs.sub_matches_;
+ }
+
+ static results_extras<BidiIter> &get_extras(match_results<BidiIter> &what)
+ {
+ return what.get_extras_();
+ }
+
+ static nested_results<BidiIter> &get_nested_results(match_results<BidiIter> &what)
+ {
+ return what.nested_results_;
+ }
+
+ static action_args_type &get_action_args(match_results<BidiIter> &what)
+ {
+ return what.args_;
+ }
+
+ static void set_prefix_suffix(match_results<BidiIter> &what, BidiIter begin, BidiIter end)
+ {
+ what.set_prefix_suffix_(begin, end);
+ }
+
+ static void reset(match_results<BidiIter> &what)
+ {
+ what.reset_();
+ }
+
+ static void set_base(match_results<BidiIter> &what, BidiIter base)
+ {
+ what.set_base_(base);
+ }
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/action.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/action.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// action.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_ACTION_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_ACTION_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/match_results.hpp> // for type_info_less
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // actionable
+ //
+ struct actionable
+ {
+ virtual ~actionable() {}
+ virtual void execute(action_args_type *) const {}
+
+ actionable()
+ : next(0)
+ {}
+
+ actionable const *next;
+ };
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/adaptor.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/adaptor.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,75 @@
+///////////////////////////////////////////////////////////////////////////////
+// adaptor.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_ADAPTOR_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_ADAPTOR_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/ref.hpp>
+#include <boost/implicit_cast.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/dynamic/matchable.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// xpression_adaptor
+//
+// wrap a static xpression in a matchable interface so it can be stored
+// in and invoked from a basic_regex object.
+template<typename Xpr, typename Base>
+struct xpression_adaptor
+ : Base // either matchable or matchable_ex
+{
+ typedef typename Base::iterator_type iterator_type;
+ typedef typename iterator_value<iterator_type>::type char_type;
+
+ Xpr xpr_;
+
+ xpression_adaptor(Xpr const &xpr)
+ : xpr_(xpr)
+ {
+ }
+
+ virtual bool match(match_state<iterator_type> &state) const
+ {
+ typedef typename unwrap_reference<Xpr const>::type xpr_type;
+ return implicit_cast<xpr_type &>(this->xpr_).match(state);
+ }
+
+ void link(xpression_linker<char_type> &linker) const
+ {
+ this->xpr_.link(linker);
+ }
+
+ void peek(xpression_peeker<char_type> &peeker) const
+ {
+ this->xpr_.peek(peeker);
+ }
+
+private:
+ xpression_adaptor &operator =(xpression_adaptor const &);
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// make_adaptor
+//
+template<typename Base, typename Xpr>
+inline intrusive_ptr<Base const> make_adaptor(Xpr const &xpr)
+{
+ return intrusive_ptr<Base const>(new xpression_adaptor<Xpr, Base>(xpr));
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/finder.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/finder.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,221 @@
+/// Contains the definition of the basic_regex\<\> class template and its associated helper functions.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_FINDER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_FINDER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4189) // local variable is initialized but not referenced
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+#include <boost/xpressive/detail/utility/boyer_moore.hpp>
+#include <boost/xpressive/detail/utility/hash_peek_bitset.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// boyer_moore_finder
+//
+template<typename BidiIter, typename Traits>
+struct boyer_moore_finder
+ : finder<BidiIter>
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
+ boyer_moore_finder(char_type const *begin, char_type const *end, Traits const &tr, bool icase)
+ : bm_(begin, end, tr, icase)
+ {
+ }
+
+ bool ok_for_partial_matches() const
+ {
+ return false;
+ }
+
+ bool operator ()(match_state<BidiIter> &state) const
+ {
+ Traits const &traits = traits_cast<Traits>(state);
+ state.cur_ = this->bm_.find(state.cur_, state.end_, traits);
+ return state.cur_ != state.end_;
+ }
+
+private:
+ boyer_moore_finder(boyer_moore_finder const &);
+ boyer_moore_finder &operator =(boyer_moore_finder const &);
+
+ boyer_moore<BidiIter, Traits> bm_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// hash_peek_finder
+//
+template<typename BidiIter, typename Traits>
+struct hash_peek_finder
+ : finder<BidiIter>
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
+ hash_peek_finder(hash_peek_bitset<char_type> const &bset)
+ : bset_(bset)
+ {
+ }
+
+ bool operator ()(match_state<BidiIter> &state) const
+ {
+ Traits const &traits = traits_cast<Traits>(state);
+ state.cur_ = (this->bset_.icase()
+ ? this->find_(state.cur_, state.end_, traits, mpl::true_())
+ : this->find_(state.cur_, state.end_, traits, mpl::false_()));
+ return state.cur_ != state.end_;
+ }
+
+private:
+ hash_peek_finder(hash_peek_finder const &);
+ hash_peek_finder &operator =(hash_peek_finder const &);
+
+ template<typename ICase>
+ BidiIter find_(BidiIter begin, BidiIter end, Traits const &traits, ICase) const
+ {
+ for(; begin != end && !this->bset_.test(*begin, traits, ICase()); ++begin)
+ ;
+ return begin;
+ }
+
+ hash_peek_bitset<char_type> bset_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// line_start_finder
+//
+template<typename BidiIter, typename Traits, std::size_t Size = sizeof(typename iterator_value<BidiIter>::type)>
+struct line_start_finder
+ : finder<BidiIter>
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef typename iterator_difference<BidiIter>::type diff_type;
+ typedef typename Traits::char_class_type char_class_type;
+
+ line_start_finder(Traits const &traits)
+ : newline_(lookup_classname(traits, "newline"))
+ {
+ }
+
+ bool operator ()(match_state<BidiIter> &state) const
+ {
+ if(state.bos() && state.flags_.match_bol_)
+ {
+ return true;
+ }
+
+ Traits const &traits = traits_cast<Traits>(state);
+ BidiIter cur = state.cur_;
+ BidiIter const end = state.end_;
+ std::advance(cur, static_cast<diff_type>(-!state.bos()));
+
+ for(; cur != end; ++cur)
+ {
+ if(traits.isctype(*cur, this->newline_))
+ {
+ state.cur_ = ++cur;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+private:
+ line_start_finder(line_start_finder const &);
+ line_start_finder &operator =(line_start_finder const &);
+
+ char_class_type newline_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// line_start_finder
+//
+template<typename BidiIter, typename Traits>
+struct line_start_finder<BidiIter, Traits, 1u>
+ : finder<BidiIter>
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef typename iterator_difference<BidiIter>::type diff_type;
+ typedef typename Traits::char_class_type char_class_type;
+
+ line_start_finder(Traits const &traits)
+ {
+ char_class_type newline = lookup_classname(traits, "newline");
+ for(int j = 0; j < 256; ++j)
+ {
+ this->bits_[j] = traits.isctype(static_cast<char_type>(static_cast<unsigned char>(j)), newline);
+ }
+ }
+
+ bool operator ()(match_state<BidiIter> &state) const
+ {
+ if(state.bos() && state.flags_.match_bol_)
+ {
+ return true;
+ }
+
+ BidiIter cur = state.cur_;
+ BidiIter const end = state.end_;
+ std::advance(cur, static_cast<diff_type>(-!state.bos()));
+
+ for(; cur != end; ++cur)
+ {
+ if(this->bits_[static_cast<unsigned char>(*cur)])
+ {
+ state.cur_ = ++cur;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+private:
+ line_start_finder(line_start_finder const &);
+ line_start_finder &operator =(line_start_finder const &);
+
+ bool bits_[256];
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// leading_simple_repeat_finder
+//
+template<typename BidiIter>
+struct leading_simple_repeat_finder
+ : finder<BidiIter>
+{
+ leading_simple_repeat_finder()
+ : finder<BidiIter>()
+ {}
+
+ bool operator ()(match_state<BidiIter> &state) const
+ {
+ state.cur_ = state.next_search_;
+ return true;
+ }
+
+private:
+ leading_simple_repeat_finder(leading_simple_repeat_finder const &);
+ leading_simple_repeat_finder &operator =(leading_simple_repeat_finder const &);
+};
+
+}}}
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/flow_control.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/flow_control.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,74 @@
+///////////////////////////////////////////////////////////////////////////////
+// flow_control.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_FLOW_CONTROL_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_FLOW_CONTROL_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// push_context_match
+//
+template<typename BidiIter>
+inline bool push_context_match
+(
+ regex_impl<BidiIter> const &impl
+ , match_state<BidiIter> &state
+ , matchable<BidiIter> const &next
+)
+{
+ // avoid infinite recursion
+ // BUGBUG this only catches direct infinite recursion, like sregex::compile("(?R)"), but
+ // not indirect infinite recursion where two rules invoke each other recursively.
+ if(state.is_active_regex(impl) && state.cur_ == state.sub_match(0).begin_)
+ {
+ return next.match(state);
+ }
+
+ // save state
+ match_context<BidiIter> context = state.push_context(impl, next, context);
+ detail::ignore_unused(context);
+
+ // match the nested regex and uninitialize the match context
+ // (reclaims the sub_match objects if necessary)
+ return state.pop_context(impl, impl.xpr_->match(state));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// pop_context_match
+//
+template<typename BidiIter>
+inline bool pop_context_match(match_state<BidiIter> &state)
+{
+ // save state
+ // BUGBUG nested regex could have changed state.traits_
+ match_context<BidiIter> &context(*state.context_.prev_context_);
+ state.swap_context(context);
+
+ // Finished matching the nested regex; now match the rest of the enclosing regex
+ bool success = context.next_ptr_->match(state);
+
+ // restore state
+ state.swap_context(context);
+ return success;
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif
+

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/icase.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/icase.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,42 @@
+///////////////////////////////////////////////////////////////////////////////
+// icase.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_ICASE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_ICASE_HPP_EAN_10_04_2005
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+#include <boost/xpressive/detail/static/modifier.hpp>
+#include <boost/xpressive/detail/core/linker.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+
+namespace boost { namespace xpressive { namespace regex_constants
+{
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Makes a sub-expression case-insensitive.
+///
+/// Use icase() to make a sub-expression case-insensitive. For instance,
+/// "foo" >> icase(set['b'] >> "ar") will match "foo" exactly followed by
+/// "bar" irrespective of case.
+detail::modifier_op<detail::icase_modifier> const icase = {{}, regex_constants::icase_};
+
+} // namespace regex_constants
+
+using regex_constants::icase;
+
+namespace detail
+{
+ inline void ignore_unused_icase()
+ {
+ ignore_unused(icase);
+ }
+}
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/linker.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/linker.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,325 @@
+///////////////////////////////////////////////////////////////////////////////
+// linker.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_LINKER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_LINKER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+#ifndef BOOST_NO_STD_LOCALE
+# include <locale>
+#endif
+#include <stack>
+#include <limits>
+#include <typeinfo>
+#include <boost/shared_ptr.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/version.hpp>
+
+#if BOOST_VERSION >= 103500
+# include <boost/fusion/include/for_each.hpp>
+#else
+# include <boost/spirit/fusion/algorithm/for_each.hpp>
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/dynamic/matchable.hpp>
+#include <boost/xpressive/detail/core/matchers.hpp>
+#include <boost/xpressive/detail/core/peeker.hpp>
+#include <boost/xpressive/detail/utility/never_true.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// icase_modifier
+//
+// wrapped by the modifier<> template and inserted into the xpression
+// template with the icase() helper function. icase_modifier morphs
+// a case-sensitive visitor into a case-insensitive visitor, which
+// causes all matchers visited to become case-insensitive.
+//
+struct icase_modifier
+{
+ template<typename Visitor>
+ struct apply {};
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct apply<xpression_visitor<BidiIter, ICase, Traits> >
+ {
+ typedef xpression_visitor<BidiIter, mpl::true_, Traits> type;
+ };
+
+ template<typename Visitor>
+ static typename apply<Visitor>::type
+ call(Visitor &visitor)
+ {
+ return typename apply<Visitor>::type(visitor.traits(), visitor.self());
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_traits_type : wrap a locale in the appropriate regex_traits
+//
+template<typename Locale, typename BidiIter>
+struct regex_traits_type
+{
+#ifndef BOOST_NO_STD_LOCALE
+
+ typedef typename iterator_value<BidiIter>::type char_type;
+
+ // if Locale is std::locale, wrap it in a cpp_regex_traits<Char>
+ typedef typename mpl::if_
+ <
+ is_same<Locale, std::locale>
+ , cpp_regex_traits<char_type>
+ , Locale
+ >::type type;
+
+#else
+
+ typedef Locale type;
+
+#endif
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// locale_modifier
+//
+// wrapped by the modifier<> template and inserted into the xpression
+// template with the imbue() helper function. Causes a sub-xpression to
+// use the specified Locale
+//
+template<typename Locale>
+struct locale_modifier
+{
+ typedef Locale locale_type;
+
+ locale_modifier(Locale const &loc)
+ : loc_(loc)
+ {
+ }
+
+ template<typename Visitor>
+ struct apply {};
+
+ template<typename BidiIter, typename ICase, typename OtherTraits>
+ struct apply<xpression_visitor<BidiIter, ICase, OtherTraits> >
+ {
+ typedef typename regex_traits_type<Locale, BidiIter>::type traits_type;
+ typedef xpression_visitor<BidiIter, ICase, traits_type> type;
+ };
+
+ template<typename Visitor>
+ typename apply<Visitor>::type
+ call(Visitor &visitor) const
+ {
+ return typename apply<Visitor>::type(this->loc_, visitor.self());
+ }
+
+ Locale getloc() const
+ {
+ return this->loc_;
+ }
+
+private:
+ Locale loc_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// xpression_linker
+//
+template<typename Char>
+struct xpression_linker
+{
+ template<typename Traits>
+ explicit xpression_linker(Traits const &traits)
+ : back_stack_()
+ , traits_(&traits)
+ , traits_type_(&typeid(Traits))
+ , has_backrefs_(false)
+ {
+ }
+
+ template<typename Matcher>
+ void accept(Matcher const &, void const *)
+ {
+ // no-op
+ }
+
+ template<typename Traits, typename ICase>
+ void accept(mark_matcher<Traits, ICase> const &, void const *)
+ {
+ this->has_backrefs_ = true;
+ }
+
+ template<typename Action>
+ void accept(action_matcher<Action> const &, void const *)
+ {
+ this->has_backrefs_ = true;
+ }
+
+ template<typename Predicate>
+ void accept(predicate_matcher<Predicate> const &, void const *)
+ {
+ this->has_backrefs_ = true;
+ }
+
+ void accept(repeat_begin_matcher const &, void const *next)
+ {
+ this->back_stack_.push(next);
+ }
+
+ template<typename Greedy>
+ void accept(repeat_end_matcher<Greedy> const &matcher, void const *)
+ {
+ matcher.back_ = this->back_stack_.top();
+ this->back_stack_.pop();
+ }
+
+ template<typename Alternates, typename Traits>
+ void accept(alternate_matcher<Alternates, Traits> const &matcher, void const *next)
+ {
+ xpression_peeker<Char> peeker(matcher.bset_, this->get_traits<Traits>());
+ this->alt_link(matcher.alternates_, next, &peeker);
+ }
+
+ void accept(alternate_end_matcher const &matcher, void const *)
+ {
+ matcher.back_ = this->back_stack_.top();
+ this->back_stack_.pop();
+ }
+
+ template<typename Xpr, typename Greedy>
+ void accept(optional_matcher<Xpr, Greedy> const &matcher, void const *next)
+ {
+ this->back_stack_.push(next);
+ matcher.xpr_.link(*this);
+ }
+
+ template<typename Xpr, typename Greedy>
+ void accept(optional_mark_matcher<Xpr, Greedy> const &matcher, void const *next)
+ {
+ this->back_stack_.push(next);
+ matcher.xpr_.link(*this);
+ }
+
+ template<typename Xpr>
+ void accept(keeper_matcher<Xpr> const &matcher, void const *)
+ {
+ matcher.xpr_.link(*this);
+ }
+
+ template<typename Xpr>
+ void accept(lookahead_matcher<Xpr> const &matcher, void const *)
+ {
+ matcher.xpr_.link(*this);
+ }
+
+ template<typename Xpr>
+ void accept(lookbehind_matcher<Xpr> const &matcher, void const *)
+ {
+ matcher.xpr_.link(*this);
+ }
+
+ template<typename Xpr, typename Greedy>
+ void accept(simple_repeat_matcher<Xpr, Greedy> const &matcher, void const *)
+ {
+ matcher.xpr_.link(*this);
+ }
+
+ // accessors
+ bool has_backrefs() const
+ {
+ return this->has_backrefs_;
+ }
+
+ // for use by alt_link_pred below
+ template<typename Xpr>
+ void alt_branch_link(Xpr const &xpr, void const *next, xpression_peeker<Char> *peeker)
+ {
+ this->back_stack_.push(next);
+ xpr.link(*this);
+ xpr.peek(*peeker);
+ }
+
+private:
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // alt_link_pred
+ //
+ struct alt_link_pred
+ {
+ xpression_linker<Char> *linker_;
+ xpression_peeker<Char> *peeker_;
+ void const *next_;
+
+ alt_link_pred
+ (
+ xpression_linker<Char> *linker
+ , xpression_peeker<Char> *peeker
+ , void const *next
+ )
+ : linker_(linker)
+ , peeker_(peeker)
+ , next_(next)
+ {
+ }
+
+ template<typename Xpr>
+ void operator ()(Xpr const &xpr) const
+ {
+ this->linker_->alt_branch_link(xpr, this->next_, this->peeker_);
+ }
+ };
+
+ template<typename BidiIter>
+ void alt_link
+ (
+ alternates_vector<BidiIter> const &alternates
+ , void const *next
+ , xpression_peeker<Char> *peeker
+ )
+ {
+ std::for_each(alternates.begin(), alternates.end(), alt_link_pred(this, peeker, next));
+ }
+
+ template<typename Alternates>
+ void alt_link
+ (
+ fusion::sequence_base<Alternates> const &alternates
+ , void const *next
+ , xpression_peeker<Char> *peeker
+ )
+ {
+#if BOOST_VERSION >= 103500
+ fusion::for_each(alternates.derived(), alt_link_pred(this, peeker, next));
+#else
+ fusion::for_each(alternates.cast(), alt_link_pred(this, peeker, next));
+#endif
+ }
+
+ template<typename Traits>
+ Traits const &get_traits() const
+ {
+ BOOST_ASSERT(*this->traits_type_ == typeid(Traits));
+ return *static_cast<Traits const *>(this->traits_);
+ }
+
+ std::stack<void const *> back_stack_;
+ void const *traits_;
+ std::type_info const *traits_type_;
+ bool has_backrefs_;
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/action_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/action_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,489 @@
+///////////////////////////////////////////////////////////////////////////////
+// action_matcher.hpp
+//
+// Copyright 2008 Eric Niebler.
+// Copyright 2008 David Jenkins.
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ACTION_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ACTION_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+#include <boost/version.hpp>
+#include <boost/ref.hpp>
+#include <boost/assert.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/action.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+#include <boost/xpressive/proto/context.hpp>
+#include <boost/xpressive/match_results.hpp> // for type_info_less
+#include <boost/xpressive/detail/static/transforms/as_action.hpp> // for 'read_attr'
+#if BOOST_VERSION >= 103500
+# include <boost/xpressive/proto/fusion.hpp>
+# include <boost/fusion/include/transform_view.hpp>
+# include <boost/fusion/include/invoke.hpp>
+# include <boost/fusion/include/push_front.hpp>
+# include <boost/fusion/include/pop_front.hpp>
+#endif
+
+#if BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable : 4510) // default constructor could not be generated
+#pragma warning(disable : 4512) // assignment operator could not be generated
+#pragma warning(disable : 4610) // can never be instantiated - user defined constructor required
+#endif
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ #if BOOST_VERSION >= 103500
+ struct DataMember
+ : proto::mem_ptr<proto::_, proto::terminal<proto::_> >
+ {};
+
+ template<typename Expr, long N>
+ struct child_
+ : remove_reference<typename mpl::if_<
+ is_const<Expr>
+ , typename proto::result_of::arg_c<Expr, N>::const_reference
+ , typename proto::result_of::arg_c<Expr, N>::reference
+ >::type>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // mem_ptr_eval
+ // Rewrites expressions of the form x->*foo(a) into foo(x, a) and then
+ // evaluates them.
+ template<typename Expr, typename Context, bool IsDataMember = proto::matches<Expr, DataMember>::value>
+ struct mem_ptr_eval
+ {
+ typedef typename child_<Expr, 0>::type left_type;
+ typedef typename child_<Expr, 1>::type right_type;
+
+ typedef
+ typename proto::result_of::arg<
+ typename proto::result_of::arg_c<right_type, 0>::type
+ >::type
+ function_type;
+
+ typedef
+ fusion::transform_view<
+ typename fusion::result_of::push_front<
+ typename fusion::result_of::pop_front<right_type>::type const
+ , reference_wrapper<left_type>
+ >::type const
+ , proto::eval_fun<Context>
+ >
+ evaluated_args;
+
+ typedef
+ typename fusion::result_of::invoke<function_type, evaluated_args>::type
+ result_type;
+
+ result_type operator()(Expr &expr, Context &ctx) const
+ {
+ return fusion::invoke<function_type>(
+ proto::arg(proto::arg_c<0>(proto::right(expr)))
+ , evaluated_args(
+ fusion::push_front(fusion::pop_front(proto::right(expr)), boost::ref(proto::left(expr)))
+ , proto::eval_fun<Context>(ctx)
+ )
+ );
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // mem_ptr_eval
+ // Rewrites expressions of the form x->*foo into foo(x) and then
+ // evaluates them.
+ template<typename Expr, typename Context>
+ struct mem_ptr_eval<Expr, Context, true>
+ {
+ typedef typename child_<Expr, 0>::type left_type;
+ typedef typename child_<Expr, 1>::type right_type;
+
+ typedef
+ typename proto::result_of::arg<right_type>::type
+ function_type;
+
+ typedef typename boost::result_of<
+ function_type(typename proto::result_of::eval<left_type, Context>::type)
+ >::type result_type;
+
+ result_type operator()(Expr &expr, Context &ctx) const
+ {
+ return proto::arg(proto::right(expr))(
+ proto::eval(proto::left(expr), ctx)
+ );
+ }
+ };
+ #endif
+
+ struct attr_with_default_tag
+ {};
+
+ template<typename T>
+ struct opt;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // action_context
+ //
+ struct action_context
+ {
+ explicit action_context(action_args_type *action_args)
+ : action_args_(action_args)
+ {}
+
+ action_args_type const &args() const
+ {
+ return *this->action_args_;
+ }
+
+ // eval_terminal
+ template<typename Expr, typename Arg>
+ struct eval_terminal
+ : proto::default_eval<Expr, action_context const>
+ {};
+
+ template<typename Expr, typename Arg>
+ struct eval_terminal<Expr, reference_wrapper<Arg> >
+ {
+ typedef Arg &result_type;
+ result_type operator()(Expr &expr, action_context const &) const
+ {
+ return proto::arg(expr).get();
+ }
+ };
+
+ template<typename Expr, typename Arg>
+ struct eval_terminal<Expr, opt<Arg> >
+ {
+ typedef Arg const &result_type;
+ result_type operator()(Expr &expr, action_context const &) const
+ {
+ return proto::arg(expr);
+ }
+ };
+
+ template<typename Expr, typename Type, typename Int>
+ struct eval_terminal<Expr, action_arg<Type, Int> >
+ {
+ typedef typename action_arg<Type, Int>::reference result_type;
+ result_type operator()(Expr &expr, action_context const &ctx) const
+ {
+ action_args_type::const_iterator where_ = ctx.args().find(&typeid(proto::arg(expr)));
+ if(where_ == ctx.args().end())
+ {
+ boost::throw_exception(
+ regex_error(
+ regex_constants::error_badarg
+ , "An argument to an action was unspecified"
+ )
+ );
+ }
+ return proto::arg(expr).cast(where_->second);
+ }
+ };
+
+ // eval
+ template<typename Expr, typename Tag = typename Expr::proto_tag>
+ struct eval
+ : proto::default_eval<Expr, action_context const>
+ {};
+
+ template<typename Expr>
+ struct eval<Expr, proto::tag::terminal>
+ : eval_terminal<Expr, typename proto::result_of::arg<Expr>::type>
+ {};
+
+ // Evaluate attributes like a1|42
+ template<typename Expr>
+ struct eval<Expr, attr_with_default_tag>
+ {
+ typedef
+ typename proto::result_of::arg<
+ typename proto::result_of::left<
+ typename proto::result_of::arg<
+ Expr
+ >::type
+ >::type
+ >::type
+ temp_type;
+
+ typedef typename temp_type::type result_type;
+
+ result_type operator ()(Expr const &expr, action_context const &ctx) const
+ {
+ return proto::arg(proto::left(proto::arg(expr))).t_
+ ? *proto::arg(proto::left(proto::arg(expr))).t_
+ : proto::eval(proto::right(proto::arg(expr)), ctx);
+ }
+ };
+
+ #if BOOST_VERSION >= 103500
+ template<typename Expr>
+ struct eval<Expr, proto::tag::mem_ptr>
+ : mem_ptr_eval<Expr, action_context const>
+ {};
+ #endif
+
+ private:
+ action_args_type *action_args_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // action
+ //
+ template<typename Actor>
+ struct action
+ : actionable
+ {
+ action(Actor const &actor)
+ : actionable()
+ , actor_(actor)
+ {
+ }
+
+ virtual void execute(action_args_type *action_args) const
+ {
+ action_context const ctx(action_args);
+ proto::eval(this->actor_, ctx);
+ }
+
+ private:
+ Actor actor_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // subreg_transform
+ //
+ struct subreg_transform : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef State unref_state;
+ typedef typename proto::terminal<sub_match<typename unref_state::iterator> >::type type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &, State const &state, Visitor &visitor) const
+ {
+ sub_match<typename State::iterator> const &sub = state.sub_matches_[ visitor ];
+ return proto::as_expr(sub);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // mark_transform
+ //
+ struct mark_transform : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef State unref_state;
+ typedef
+ typename proto::terminal<sub_match<typename unref_state::iterator> >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &) const
+ {
+ sub_match<typename State::iterator> const &sub = state.sub_matches_[ proto::arg(expr).mark_number_ ];
+ return proto::as_expr(sub);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // opt
+ //
+ template<typename T>
+ struct opt
+ {
+ typedef T type;
+ typedef T const &reference;
+
+ opt(T const *t)
+ : t_(t)
+ {}
+
+ operator reference() const
+ {
+ detail::ensure(0 != this->t_, regex_constants::error_badattr, "Use of uninitialized regex attribute");
+ return *this->t_;
+ }
+
+ T const *t_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // attr_transform
+ //
+ struct attr_transform : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename proto::result_of::as_expr<
+ opt<typename Expr::proto_arg0::matcher_type::value_type::second_type>
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &, State const &state, Visitor &) const
+ {
+ typedef typename Expr::proto_arg0::matcher_type::value_type::second_type attr_type;
+ int slot = typename Expr::proto_arg0::nbr_type();
+ attr_type const *attr = static_cast<attr_type const *>(state.attr_context_.attr_slots_[slot-1]);
+ return proto::as_expr(opt<attr_type>(attr));
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // attr_with_default_transform
+ //
+ template<typename Grammar, typename Callable = proto::callable>
+ struct attr_with_default_transform : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename proto::unary_expr<
+ attr_with_default_tag
+ , typename Grammar::template result<void(Expr, State, Visitor)>::type
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typename result<void(Expr, State, Visitor)>::type that = {
+ Grammar()(expr, state, visitor)
+ };
+ return that;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // by_ref_transform
+ //
+ struct by_ref_transform : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename proto::terminal<typename proto::result_of::arg<Expr>::const_reference>::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &) const
+ {
+ typedef typename result<void(Expr, State, Visitor)>::type that_type;
+ return that_type::make(proto::arg(expr));
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // BindActionArgs
+ //
+ struct BindActionArgs
+ : proto::or_<
+ proto::when<proto::terminal<any_matcher>, subreg_transform>
+ , proto::when<proto::terminal<mark_placeholder>, mark_transform>
+ , proto::when<proto::terminal<read_attr<proto::_, proto::_> >, attr_transform>
+ , proto::when<proto::terminal<proto::_>, by_ref_transform>
+ , proto::when<
+ proto::bitwise_or<proto::terminal<read_attr<proto::_, proto::_> >, BindActionArgs>
+ , attr_with_default_transform<proto::bitwise_or<attr_transform, BindActionArgs> >
+ >
+ , proto::otherwise<proto::nary_expr<proto::_, proto::vararg<BindActionArgs> > >
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // action_matcher
+ //
+ template<typename Actor>
+ struct action_matcher
+ : quant_style<quant_none, 0, false>
+ {
+ int sub_;
+ Actor actor_;
+
+ action_matcher(Actor const &actor, int sub)
+ : sub_(sub)
+ , actor_(actor)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ // Bind the arguments
+ int sub = this->sub_; // BUGBUG this is a hack
+ typedef typename BindActionArgs::template result<void(Actor, match_state<BidiIter>, int)>::type action_type;
+ action<action_type> actor(BindActionArgs()(this->actor_, state, sub));
+
+ // Put the action in the action list
+ actionable const **action_list_tail = state.action_list_tail_;
+ *state.action_list_tail_ = &actor;
+ state.action_list_tail_ = &actor.next;
+
+ // Match the rest of the pattern
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ BOOST_ASSERT(0 == actor.next);
+ // remove action from list
+ *action_list_tail = 0;
+ state.action_list_tail_ = action_list_tail;
+ return false;
+ }
+ };
+
+}}}
+
+#if BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/alternate_end_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/alternate_end_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,51 @@
+///////////////////////////////////////////////////////////////////////////////
+// alternate_end_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ALTERNATE_END_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ALTERNATE_END_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4100) // unreferenced formal parameter
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // alternate_end_matcher
+ //
+ struct alternate_end_matcher
+ : quant_style_assertion
+ {
+ mutable void const *back_;
+
+ alternate_end_matcher()
+ : back_(0)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ return next.pop_match(state, this->back_);
+ }
+ };
+
+}}}
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/alternate_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/alternate_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,132 @@
+///////////////////////////////////////////////////////////////////////////////
+// alternate_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ALTERNATE_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ALTERNATE_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/version.hpp>
+#if BOOST_VERSION <= 103200
+// WORKAROUND for Fusion bug in Boost 1.32
+namespace boost { namespace fusion
+{
+ namespace detail { struct iterator_root; }
+ using detail::iterator_root;
+}}
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/dynamic/matchable.hpp>
+#include <boost/xpressive/detail/utility/hash_peek_bitset.hpp>
+#include <boost/xpressive/detail/utility/algorithm.hpp>
+#include <boost/xpressive/detail/utility/any.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // alt_match_pred
+ //
+ template<typename BidiIter, typename Next>
+ struct alt_match_pred
+ {
+ alt_match_pred(match_state<BidiIter> &state)
+ : state_(&state)
+ {
+ }
+
+ template<typename Xpr>
+ bool operator ()(Xpr const &xpr) const
+ {
+ return xpr.BOOST_NESTED_TEMPLATE push_match<Next>(*this->state_);
+ }
+
+ private:
+ match_state<BidiIter> *state_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // alt_match
+ //
+ template<typename BidiIter, typename Next>
+ inline bool alt_match
+ (
+ alternates_vector<BidiIter> const &alts, match_state<BidiIter> &state, Next const &
+ )
+ {
+ return detail::any(alts.begin(), alts.end(), alt_match_pred<BidiIter, Next>(state));
+ }
+
+ template<typename Head, typename Tail, typename BidiIter, typename Next>
+ inline bool alt_match
+ (
+ alternates_list<Head, Tail> const &alts, match_state<BidiIter> &state, Next const &
+ )
+ {
+ return fusion::any(alts, alt_match_pred<BidiIter, Next>(state));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // alternate_matcher
+ template<typename Alternates, typename Traits>
+ struct alternate_matcher
+ : quant_style<
+ Alternates::width != unknown_width::value && Alternates::pure ? quant_fixed_width : quant_variable_width
+ , Alternates::width
+ , Alternates::pure
+ >
+ {
+ typedef Alternates alternates_type;
+ typedef typename Traits::char_type char_type;
+
+ Alternates alternates_;
+ mutable hash_peek_bitset<char_type> bset_;
+
+ explicit alternate_matcher(Alternates const &alternates = Alternates())
+ : alternates_(alternates)
+ , bset_()
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ if(!state.eos() && !this->can_match_(*state.cur_, traits_cast<Traits>(state)))
+ {
+ return false;
+ }
+
+ return detail::alt_match(this->alternates_, state, next);
+ }
+
+ detail::width get_width() const
+ {
+ // Only called when constructing static regexes, and this is a
+ // set of same-width alternates where the widths are known at compile
+ // time, as in: sregex rx = +(_ | 'a' | _n);
+ BOOST_MPL_ASSERT_RELATION(unknown_width::value, !=, Alternates::width);
+ return Alternates::width;
+ }
+
+ private:
+ alternate_matcher &operator =(alternate_matcher const &);
+
+ bool can_match_(char_type ch, Traits const &traits) const
+ {
+ return this->bset_.test(ch, traits);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/any_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/any_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,51 @@
+///////////////////////////////////////////////////////////////////////////////
+// any_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ANY_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ANY_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // any_matcher
+ //
+ struct any_matcher
+ {
+ BOOST_XPR_QUANT_STYLE(quant_fixed_width, 1, true)
+
+ template<typename BidiIter, typename Next>
+ static bool match(match_state<BidiIter> &state, Next const &next)
+ {
+ if(state.eos())
+ {
+ return false;
+ }
+
+ ++state.cur_;
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ --state.cur_;
+ return false;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_bol_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_bol_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,57 @@
+///////////////////////////////////////////////////////////////////////////////
+// assert_bol_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_BOL_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_BOL_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/core/matcher/assert_line_base.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // assert_bol_matcher
+ //
+ template<typename Traits>
+ struct assert_bol_matcher
+ : assert_line_base<Traits>
+ {
+ assert_bol_matcher(Traits const &traits)
+ : assert_line_base<Traits>(traits)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ if(state.bos())
+ {
+ if(!state.flags_.match_bol_)
+ {
+ return false;
+ }
+ }
+ else if(!this->is_line_break(state))
+ {
+ return false;
+ }
+
+ return next.match(state);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_bos_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_bos_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// assert_bos_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_BOS_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_BOS_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // assert_bos_matcher
+ // match the beginning of the sequence (\A)
+ struct assert_bos_matcher
+ {
+ BOOST_XPR_QUANT_STYLE(quant_none, 0, true)
+
+ template<typename BidiIter, typename Next>
+ static bool match(match_state<BidiIter> &state, Next const &next)
+ {
+ return state.bos() && next.match(state);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_eol_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_eol_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,57 @@
+///////////////////////////////////////////////////////////////////////////////
+// assert_eol_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_EOL_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_EOL_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/core/matcher/assert_line_base.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // assert_eol_matcher
+ //
+ template<typename Traits>
+ struct assert_eol_matcher
+ : assert_line_base<Traits>
+ {
+ assert_eol_matcher(Traits const &traits)
+ : assert_line_base<Traits>(traits)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ if(state.eos())
+ {
+ if(!state.flags_.match_eol_)
+ {
+ return false;
+ }
+ }
+ else if((state.bos() && !state.flags_.match_prev_avail_) || !this->is_line_break(state))
+ {
+ return false;
+ }
+
+ return next.match(state);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_eos_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_eos_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// assert_eos_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_EOS_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_EOS_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // assert_eos_matcher
+ // match the end of the sequence (\Z)
+ struct assert_eos_matcher
+ {
+ BOOST_XPR_QUANT_STYLE(quant_none, 0, true)
+
+ template<typename BidiIter, typename Next>
+ static bool match(match_state<BidiIter> &state, Next const &next)
+ {
+ return state.eos() && next.match(state);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_line_base.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_line_base.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////////
+// assert_line_base.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_DETAIL_ASSERT_LINE_BASE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_DETAIL_ASSERT_LINE_BASE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // assert_line_base
+ //
+ template<typename Traits>
+ struct assert_line_base
+ : quant_style_assertion
+ {
+ typedef typename Traits::char_type char_type;
+ typedef typename Traits::char_class_type char_class_type;
+
+ protected:
+ assert_line_base(Traits const &traits)
+ : newline_(lookup_classname(traits, "newline"))
+ , nl_(traits.widen('\n'))
+ , cr_(traits.widen('\r'))
+ {
+ }
+
+ template<typename BidiIter>
+ bool is_line_break(match_state<BidiIter> &state) const
+ {
+ BOOST_ASSERT(!state.bos() || state.flags_.match_prev_avail_);
+ BidiIter tmp = state.cur_;
+ char_type ch = *--tmp;
+
+ if(traits_cast<Traits>(state).isctype(ch, this->newline_))
+ {
+ // there is no line-break between \r and \n
+ if(this->cr_ != ch || state.eos() || this->nl_ != *state.cur_)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private:
+ char_class_type newline_;
+ char_type nl_, cr_;
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_word_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/assert_word_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,125 @@
+///////////////////////////////////////////////////////////////////////////////
+// assert_word_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_WORD_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ASSERT_WORD_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // word_boundary
+ //
+ template<typename IsBoundary>
+ struct word_boundary
+ {
+ template<typename BidiIter>
+ static bool eval(bool prevword, bool thisword, match_state<BidiIter> &state)
+ {
+ if((state.flags_.match_not_bow_ && state.bos()) || (state.flags_.match_not_eow_ && state.eos()))
+ {
+ return !IsBoundary::value;
+ }
+
+ return IsBoundary::value == (prevword != thisword);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // word_begin
+ //
+ struct word_begin
+ {
+ template<typename BidiIter>
+ static bool eval(bool prevword, bool thisword, match_state<BidiIter> &state)
+ {
+ if(state.flags_.match_not_bow_ && state.bos())
+ {
+ return false;
+ }
+
+ return !prevword && thisword;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // word_end
+ //
+ struct word_end
+ {
+ template<typename BidiIter>
+ static bool eval(bool prevword, bool thisword, match_state<BidiIter> &state)
+ {
+ if(state.flags_.match_not_eow_ && state.eos())
+ {
+ return false;
+ }
+
+ return prevword && !thisword;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // assert_word_matcher
+ //
+ template<typename Cond, typename Traits>
+ struct assert_word_matcher
+ : quant_style_assertion
+ {
+ typedef typename Traits::char_type char_type;
+ typedef typename Traits::char_class_type char_class_type;
+
+ assert_word_matcher(Traits const &traits)
+ : word_(lookup_classname(traits, "w"))
+ {
+ BOOST_ASSERT(0 != this->word_);
+ }
+
+ assert_word_matcher(char_class_type word)
+ : word_(word)
+ {}
+
+ bool is_word(Traits const &traits, char_type ch) const
+ {
+ detail::ignore_unused(traits);
+ return traits.isctype(traits.translate(ch), this->word_);
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ BidiIter cur = state.cur_;
+ bool const thisword = !state.eos() && this->is_word(traits_cast<Traits>(state), *cur);
+ bool const prevword = (!state.bos() || state.flags_.match_prev_avail_)
+ && this->is_word(traits_cast<Traits>(state), *--cur);
+
+ return Cond::eval(prevword, thisword, state) && next.match(state);
+ }
+
+ char_class_type word() const
+ {
+ return this->word_;
+ }
+
+ private:
+ char_class_type word_;
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/attr_begin_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/attr_begin_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,50 @@
+///////////////////////////////////////////////////////////////////////////////
+// attr_begin_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_BEGIN_MATCHER_HPP_EAN_06_09_2007
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_BEGIN_MATCHER_HPP_EAN_06_09_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // attr_begin_matcher
+ //
+ template<typename Nbr>
+ struct attr_begin_matcher
+ : quant_style<quant_none, 0, false>
+ {
+ template<typename BidiIter, typename Next>
+ static bool match(match_state<BidiIter> &state, Next const &next)
+ {
+ void const *attr_slots[Nbr::value] = {};
+ attr_context old_attr_context = state.attr_context_;
+ state.attr_context_.attr_slots_ = attr_slots;
+ state.attr_context_.prev_attr_context_ = &old_attr_context;
+
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ state.attr_context_ = old_attr_context;
+ return false;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/attr_end_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/attr_end_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////
+// attr_end_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_END_MATCHER_HPP_EAN_06_09_2007
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_END_MATCHER_HPP_EAN_06_09_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // attr_end_matcher
+ //
+ struct attr_end_matcher
+ : quant_style<quant_none, 0, false>
+ {
+ template<typename BidiIter, typename Next>
+ static bool match(match_state<BidiIter> &state, Next const &next)
+ {
+ attr_context old_attr_context = state.attr_context_;
+ state.attr_context_ = *old_attr_context.prev_attr_context_;
+
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ state.attr_context_ = old_attr_context;
+ return false;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/attr_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/attr_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,111 @@
+///////////////////////////////////////////////////////////////////////////////
+// attr_matcher.hpp
+//
+// Copyright 2008 Eric Niebler.
+// Copyright 2008 David Jenkins.
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_MATCHER_HPP_EAN_06_09_2007
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_ATTR_MATCHER_HPP_EAN_06_09_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/utility/symbols.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // char_translate
+ //
+ template<typename Traits, bool ICase>
+ struct char_translate
+ {
+ typedef typename Traits::char_type char_type;
+ Traits const &traits_;
+
+ explicit char_translate(Traits const &traits)
+ : traits_(traits)
+ {}
+
+ char_type operator ()(char_type ch1) const
+ {
+ return this->traits_.translate(ch1);
+ }
+ private:
+ char_translate &operator =(char_translate const &);
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // char_translate
+ //
+ template<typename Traits>
+ struct char_translate<Traits, true>
+ {
+ typedef typename Traits::char_type char_type;
+ Traits const &traits_;
+
+ explicit char_translate(Traits const &traits)
+ : traits_(traits)
+ {}
+
+ char_type operator ()(char_type ch1) const
+ {
+ return this->traits_.translate_nocase(ch1);
+ }
+ private:
+ char_translate &operator =(char_translate const &);
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // attr_matcher
+ // Note: the Matcher is a std::map
+ template<typename Matcher, typename Traits, typename ICase>
+ struct attr_matcher
+ : quant_style<quant_none, 0, false>
+ {
+ typedef typename Matcher::value_type::second_type const* result_type;
+
+ attr_matcher(int slot, Matcher const &matcher, Traits const& traits)
+ : slot_(slot-1)
+ {
+ char_translate<Traits, ICase::value> trans(traits);
+ this->sym_.load(matcher, trans);
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ BidiIter tmp = state.cur_;
+ char_translate<Traits, ICase::value> trans(traits_cast<Traits>(state));
+ result_type const &result = this->sym_(state.cur_, state.end_, trans);
+ if(result)
+ {
+ void const *old_slot = state.attr_context_.attr_slots_[this->slot_];
+ state.attr_context_.attr_slots_[this->slot_] = &*result;
+ if(next.match(state))
+ {
+ return true;
+ }
+ state.attr_context_.attr_slots_[this->slot_] = old_slot;
+ }
+ state.cur_ = tmp;
+ return false;
+ }
+
+ int slot_;
+ boost::xpressive::detail::symbols<Matcher> sym_;
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/charset_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/charset_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////////
+// charset_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_CHARSET_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_CHARSET_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // charset_matcher
+ //
+ template<typename Traits, typename ICase, typename CharSet>
+ struct charset_matcher
+ : quant_style_fixed_width<1>
+ {
+ typedef typename Traits::char_type char_type;
+ typedef Traits traits_type;
+ typedef ICase icase_type;
+
+ charset_matcher(CharSet const &charset = CharSet())
+ : charset_(charset)
+ {
+ }
+
+ void inverse()
+ {
+ this->charset_.inverse();
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ if(state.eos() || !this->charset_.test(*state.cur_, traits_cast<Traits>(state), icase_type()))
+ {
+ return false;
+ }
+
+ ++state.cur_;
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ --state.cur_;
+ return false;
+ }
+
+ CharSet charset_;
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/end_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/end_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,98 @@
+///////////////////////////////////////////////////////////////////////////////
+// end_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_END_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_END_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/core/sub_match_impl.hpp>
+#include <boost/xpressive/detail/core/flow_control.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // end_matcher
+ //
+ struct end_matcher
+ : quant_style_assertion
+ {
+ template<typename BidiIter, typename Next>
+ static bool match(match_state<BidiIter> &state, Next const &)
+ {
+ BidiIter const tmp = state.cur_;
+ sub_match_impl<BidiIter> &s0 = state.sub_match(0);
+ BOOST_ASSERT(!s0.matched);
+
+ // SPECIAL: if there is a match context on the context stack, then
+ // this pattern has been nested within another. pop that context and
+ // continue executing.
+ if(0 != state.context_.prev_context_)
+ {
+ if(!pop_context_match(state))
+ {
+ return false;
+ }
+
+ // record the end of sub-match zero
+ s0.first = s0.begin_;
+ s0.second = tmp;
+ s0.matched = true;
+
+ return true;
+ }
+ else if((state.flags_.match_all_ && !state.eos()) ||
+ (state.flags_.match_not_null_ && state.cur_ == s0.begin_))
+ {
+ return false;
+ }
+
+ // record the end of sub-match zero
+ s0.first = s0.begin_;
+ s0.second = tmp;
+ s0.matched = true;
+
+ // Now execute any actions that have been queued
+ for(actionable const *actor = state.action_list_.next; 0 != actor; actor = actor->next)
+ {
+ actor->execute(state.action_args_);
+ }
+
+ return true;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // independent_end_matcher
+ //
+ struct independent_end_matcher
+ : quant_style_assertion
+ {
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &) const
+ {
+ // Now execute any actions that have been queued
+ for(actionable const *actor = state.action_list_.next; 0 != actor; actor = actor->next)
+ {
+ actor->execute(state.action_args_);
+ }
+
+ return true;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/epsilon_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/epsilon_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////
+// epsilon_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_EPSILON_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_EPSILON_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // epsilon_matcher
+ //
+ struct epsilon_matcher
+ {
+ BOOST_XPR_QUANT_STYLE(quant_none, 0, true)
+
+ template<typename BidiIter, typename Next>
+ static bool match(match_state<BidiIter> &state, Next const &next)
+ {
+ return next.match(state);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/keeper_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/keeper_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,96 @@
+///////////////////////////////////////////////////////////////////////////////
+// keeper_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_KEEPER_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_KEEPER_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // keeper_matcher
+ // Xpr can be either a static_xpression, or a shared_matchable
+ template<typename Xpr>
+ struct keeper_matcher
+ : quant_style<quant_variable_width, unknown_width::value, Xpr::pure>
+ {
+ keeper_matcher(Xpr const &xpr, bool pure = Xpr::pure)
+ : xpr_(xpr)
+ , pure_(pure)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ return Xpr::pure || this->pure_
+ ? this->match_(state, next, mpl::true_())
+ : this->match_(state, next, mpl::false_());
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const
+ {
+ BidiIter const tmp = state.cur_;
+
+ // matching xpr is guaranteed to not produce side-effects, don't bother saving state
+ if(!this->xpr_.match(state))
+ {
+ return false;
+ }
+ else if(next.match(state))
+ {
+ return true;
+ }
+
+ state.cur_ = tmp;
+ return false;
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const
+ {
+ BidiIter const tmp = state.cur_;
+
+ // matching xpr could produce side-effects, save state
+ memento<BidiIter> mem = save_sub_matches(state);
+
+ if(!this->xpr_.match(state))
+ {
+ restore_action_queue(mem, state);
+ reclaim_sub_matches(mem, state, false);
+ return false;
+ }
+ restore_action_queue(mem, state);
+ if(next.match(state))
+ {
+ reclaim_sub_matches(mem, state, true);
+ return true;
+ }
+
+ restore_sub_matches(mem, state);
+ state.cur_ = tmp;
+ return false;
+ }
+
+ Xpr xpr_;
+ bool pure_; // false if matching xpr_ could modify the sub-matches
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/literal_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/literal_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,66 @@
+///////////////////////////////////////////////////////////////////////////////
+// literal_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LITERAL_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LITERAL_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/utility/traits_utils.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // literal_matcher
+ //
+ template<typename Traits, typename ICase, typename Not>
+ struct literal_matcher
+ : quant_style_fixed_width<1>
+ {
+ typedef typename Traits::char_type char_type;
+ typedef Not not_type;
+ typedef ICase icase_type;
+ char_type ch_;
+
+ explicit literal_matcher(char_type ch)
+ : ch_(ch)
+ {}
+
+ literal_matcher(char_type ch, Traits const &traits)
+ : ch_(detail::translate(ch, traits, icase_type()))
+ {}
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ if(state.eos() || Not::value ==
+ (detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type()) == this->ch_))
+ {
+ return false;
+ }
+
+ ++state.cur_;
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ --state.cur_;
+ return false;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/logical_newline_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/logical_newline_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,83 @@
+///////////////////////////////////////////////////////////////////////////////
+// logical_newline_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LOGICAL_NEWLINE_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LOGICAL_NEWLINE_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ //////////////////////////////////////////////////////////////////////////
+ // logical_newline_matcher
+ //
+ template<typename Traits>
+ struct logical_newline_matcher
+ : quant_style_variable_width
+ {
+ typedef typename Traits::char_type char_type;
+ typedef typename Traits::char_class_type char_class_type;
+
+ logical_newline_matcher(Traits const &traits)
+ : newline_(lookup_classname(traits, "newline"))
+ , nl_(traits.widen('\n'))
+ , cr_(traits.widen('\r'))
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ if(state.eos())
+ {
+ return false;
+ }
+
+ char_type ch = *state.cur_;
+ if(traits_cast<Traits>(state).isctype(ch, this->newline_))
+ {
+ ++state.cur_;
+ if(this->cr_ == ch && !state.eos() && this->nl_ == *state.cur_)
+ {
+ ++state.cur_;
+ if(next.match(state))
+ {
+ return true;
+ }
+ --state.cur_;
+ }
+ else if(next.match(state))
+ {
+ return true;
+ }
+
+ --state.cur_;
+ }
+ return false;
+ }
+
+ char_class_type newline() const
+ {
+ return this->newline_;
+ }
+
+ private:
+ char_class_type newline_;
+ char_type nl_, cr_;
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/lookahead_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/lookahead_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,151 @@
+///////////////////////////////////////////////////////////////////////////////
+// lookahead_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LOOKAHEAD_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LOOKAHEAD_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/utility/save_restore.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // lookahead_matcher
+ // Xpr can be either a static_xpression, or a shared_matchable
+ //
+ template<typename Xpr>
+ struct lookahead_matcher
+ : quant_style<quant_none, 0, Xpr::pure>
+ {
+ lookahead_matcher(Xpr const &xpr, bool no, bool pure = Xpr::pure)
+ : xpr_(xpr)
+ , not_(no)
+ , pure_(pure)
+ {
+ }
+
+ void inverse()
+ {
+ this->not_ = !this->not_;
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ return Xpr::pure || this->pure_
+ ? this->match_(state, next, mpl::true_())
+ : this->match_(state, next, mpl::false_());
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const
+ {
+ BidiIter const tmp = state.cur_;
+
+ if(this->not_)
+ {
+ // negative look-ahead assertions do not trigger partial matches.
+ save_restore<bool> partial_match(state.found_partial_match_);
+ detail::ignore_unused(partial_match);
+
+ if(this->xpr_.match(state))
+ {
+ state.cur_ = tmp;
+ return false;
+ }
+ else if(next.match(state))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if(!this->xpr_.match(state))
+ {
+ return false;
+ }
+ state.cur_ = tmp;
+ if(next.match(state))
+ {
+ return true;
+ }
+ }
+
+ BOOST_ASSERT(state.cur_ == tmp);
+ return false;
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const
+ {
+ BidiIter const tmp = state.cur_;
+
+ // matching xpr could produce side-effects, save state
+ memento<BidiIter> mem = save_sub_matches(state);
+
+ if(this->not_)
+ {
+ // negative look-ahead assertions do not trigger partial matches.
+ save_restore<bool> partial_match(state.found_partial_match_);
+ detail::ignore_unused(partial_match);
+
+ if(this->xpr_.match(state))
+ {
+ restore_action_queue(mem, state);
+ restore_sub_matches(mem, state);
+ state.cur_ = tmp;
+ return false;
+ }
+ restore_action_queue(mem, state);
+ if(next.match(state))
+ {
+ reclaim_sub_matches(mem, state, true);
+ return true;
+ }
+ reclaim_sub_matches(mem, state, false);
+ }
+ else
+ {
+ if(!this->xpr_.match(state))
+ {
+ restore_action_queue(mem, state);
+ reclaim_sub_matches(mem, state, false);
+ return false;
+ }
+ state.cur_ = tmp;
+ restore_action_queue(mem, state);
+ if(next.match(state))
+ {
+ reclaim_sub_matches(mem, state, true);
+ return true;
+ }
+ restore_sub_matches(mem, state);
+ }
+
+ BOOST_ASSERT(state.cur_ == tmp);
+ return false;
+ }
+
+ Xpr xpr_;
+ bool not_;
+ bool pure_; // false if matching xpr_ could modify the sub-matches
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/lookbehind_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/lookbehind_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,168 @@
+///////////////////////////////////////////////////////////////////////////////
+// lookbehind_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LOOKBEHIND_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_LOOKBEHIND_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/xpressive/regex_error.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/utility/algorithm.hpp>
+#include <boost/xpressive/detail/utility/save_restore.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // lookbehind_matcher
+ // Xpr can be either a static_xpression or a shared_matchable
+ template<typename Xpr>
+ struct lookbehind_matcher
+ : quant_style<quant_none, 0, Xpr::pure>
+ {
+ lookbehind_matcher(Xpr const &xpr, std::size_t width, bool no, bool pure = Xpr::pure)
+ : xpr_(xpr)
+ , not_(no)
+ , pure_(pure)
+ , width_(width)
+ {
+ detail::ensure(!is_unknown(this->width_), regex_constants::error_badlookbehind,
+ "Variable-width look-behind assertions are not supported");
+ }
+
+ void inverse()
+ {
+ this->not_ = !this->not_;
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ return Xpr::pure || this->pure_
+ ? this->match_(state, next, mpl::true_())
+ : this->match_(state, next, mpl::false_());
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const
+ {
+ typedef typename iterator_difference<BidiIter>::type difference_type;
+ BidiIter const tmp = state.cur_;
+ if(!detail::advance_to(state.cur_, -static_cast<difference_type>(this->width_), state.begin_))
+ {
+ state.cur_ = tmp;
+ return this->not_ ? next.match(state) : false;
+ }
+
+ if(this->not_)
+ {
+ if(this->xpr_.match(state))
+ {
+ BOOST_ASSERT(state.cur_ == tmp);
+ return false;
+ }
+ state.cur_ = tmp;
+ if(next.match(state))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if(!this->xpr_.match(state))
+ {
+ state.cur_ = tmp;
+ return false;
+ }
+ BOOST_ASSERT(state.cur_ == tmp);
+ if(next.match(state))
+ {
+ return true;
+ }
+ }
+
+ BOOST_ASSERT(state.cur_ == tmp);
+ return false;
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const
+ {
+ typedef typename iterator_difference<BidiIter>::type difference_type;
+ BidiIter const tmp = state.cur_;
+ if(!detail::advance_to(state.cur_, -static_cast<difference_type>(this->width_), state.begin_))
+ {
+ state.cur_ = tmp;
+ return this->not_ ? next.match(state) : false;
+ }
+
+ // matching xpr could produce side-effects, save state
+ memento<BidiIter> mem = save_sub_matches(state);
+
+ if(this->not_)
+ {
+ // negative look-ahead assertions do not trigger partial matches.
+ save_restore<bool> partial_match(state.found_partial_match_);
+ detail::ignore_unused(partial_match);
+
+ if(this->xpr_.match(state))
+ {
+ restore_action_queue(mem, state);
+ restore_sub_matches(mem, state);
+ BOOST_ASSERT(state.cur_ == tmp);
+ return false;
+ }
+ state.cur_ = tmp;
+ restore_action_queue(mem, state);
+ if(next.match(state))
+ {
+ reclaim_sub_matches(mem, state, true);
+ return true;
+ }
+ reclaim_sub_matches(mem, state, false);
+ }
+ else
+ {
+ if(!this->xpr_.match(state))
+ {
+ state.cur_ = tmp;
+ restore_action_queue(mem, state);
+ reclaim_sub_matches(mem, state, false);
+ return false;
+ }
+ BOOST_ASSERT(state.cur_ == tmp);
+ restore_action_queue(mem, state);
+ if(next.match(state))
+ {
+ reclaim_sub_matches(mem, state, true);
+ return true;
+ }
+ restore_sub_matches(mem, state);
+ }
+
+ BOOST_ASSERT(state.cur_ == tmp);
+ return false;
+ }
+
+ Xpr xpr_;
+ bool not_;
+ bool pure_; // false if matching xpr_ could modify the sub-matches
+ std::size_t width_;
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/mark_begin_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/mark_begin_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,56 @@
+///////////////////////////////////////////////////////////////////////////////
+// mark_begin_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_BEGIN_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_BEGIN_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // mark_begin_matcher
+ //
+ struct mark_begin_matcher
+ : quant_style<quant_fixed_width, 0, false>
+ {
+ int mark_number_; // signed because it could be negative
+
+ mark_begin_matcher(int mark_number)
+ : mark_number_(mark_number)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
+
+ BidiIter old_begin = br.begin_;
+ br.begin_ = state.cur_;
+
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ br.begin_ = old_begin;
+ return false;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/mark_end_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/mark_end_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,64 @@
+///////////////////////////////////////////////////////////////////////////////
+// mark_end_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_END_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_END_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // mark_end_matcher
+ //
+ struct mark_end_matcher
+ : quant_style<quant_none, 0, false>
+ {
+ int mark_number_;
+
+ mark_end_matcher(int mark_number)
+ : mark_number_(mark_number)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
+
+ BidiIter old_first = br.first;
+ BidiIter old_second = br.second;
+ bool old_matched = br.matched;
+
+ br.first = br.begin_;
+ br.second = state.cur_;
+ br.matched = true;
+
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ br.first = old_first;
+ br.second = old_second;
+ br.matched = old_matched;
+
+ return false;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/mark_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/mark_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,78 @@
+///////////////////////////////////////////////////////////////////////////////
+// mark_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_MARK_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/utility/traits_utils.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ // TODO: the mark matcher is acually a fixed-width matcher, but the width is
+ // not known until pattern match time.
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // mark_matcher
+ //
+ template<typename Traits, typename ICase>
+ struct mark_matcher
+ : quant_style_variable_width
+ {
+ typedef ICase icase_type;
+ int mark_number_;
+
+ mark_matcher(int mark_number, Traits const &)
+ : mark_number_(mark_number)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ BOOST_ASSERT(this->mark_number_ < static_cast<int>(state.mark_count_));
+ sub_match_impl<BidiIter> const &br = state.sub_match(this->mark_number_);
+
+ if(!br.matched)
+ {
+ return false;
+ }
+
+ BidiIter const tmp = state.cur_;
+ for(BidiIter begin = br.first, end = br.second; begin != end; ++begin, ++state.cur_)
+ {
+ if(state.eos()
+ || detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type())
+ != detail::translate(*begin, traits_cast<Traits>(state), icase_type()))
+ {
+ state.cur_ = tmp;
+ return false;
+ }
+ }
+
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ state.cur_ = tmp;
+ return false;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/optional_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/optional_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,121 @@
+///////////////////////////////////////////////////////////////////////////////
+// optional_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_OPTIONAL_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_OPTIONAL_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // optional_matcher
+ template<typename Xpr, typename Greedy>
+ struct optional_matcher
+ : quant_style<quant_variable_width, unknown_width::value, Xpr::pure>
+ {
+ Xpr xpr_;
+
+ explicit optional_matcher(Xpr const &xpr)
+ : xpr_(xpr)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ return this->match_(state, next, Greedy());
+ }
+
+ private:
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const // Greedy
+ {
+ return this->xpr_.BOOST_NESTED_TEMPLATE push_match<Next>(state)
+ || next.match(state);
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const // Non-greedy
+ {
+ return next.match(state)
+ || this->xpr_.BOOST_NESTED_TEMPLATE push_match<Next>(state);
+ }
+
+ optional_matcher &operator =(optional_matcher const &);
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // optional_mark_matcher
+ template<typename BidiIter, typename Next>
+ inline bool match_next(match_state<BidiIter> &state, Next const &next, int mark_number)
+ {
+ sub_match_impl<BidiIter> &br = state.sub_match(mark_number);
+
+ bool old_matched = br.matched;
+ br.matched = false;
+
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ br.matched = old_matched;
+ return false;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // optional_mark_matcher
+ template<typename Xpr, typename Greedy>
+ struct optional_mark_matcher
+ : quant_style<quant_variable_width, unknown_width::value, Xpr::pure>
+ {
+ Xpr xpr_;
+ int mark_number_;
+
+ explicit optional_mark_matcher(Xpr const &xpr, int mark_number)
+ : xpr_(xpr)
+ , mark_number_(mark_number)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ return this->match_(state, next, Greedy());
+ }
+
+ private:
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const // Greedy
+ {
+ return this->xpr_.BOOST_NESTED_TEMPLATE push_match<Next>(state)
+ || match_next(state, next, this->mark_number_);
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const // Non-greedy
+ {
+ return match_next(state, next, this->mark_number_)
+ || this->xpr_.BOOST_NESTED_TEMPLATE push_match<Next>(state);
+ }
+
+ optional_mark_matcher &operator =(optional_mark_matcher const &);
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/posix_charset_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/posix_charset_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,73 @@
+///////////////////////////////////////////////////////////////////////////////
+// posix_charset_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_POSIX_CHARSET_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_POSIX_CHARSET_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/utility/traits_utils.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // posix_charset_matcher
+ //
+ template<typename Traits>
+ struct posix_charset_matcher
+ : quant_style_fixed_width<1>
+ {
+ typedef Traits traits_type;
+ typedef typename Traits::char_class_type char_class_type;
+
+ posix_charset_matcher(char_class_type m, bool no)
+ : not_(no)
+ , mask_(m)
+ {
+ BOOST_ASSERT(0 != this->mask_);
+ }
+
+ void inverse()
+ {
+ this->not_ = !this->not_;
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ if(state.eos() || this->not_ == traits_cast<Traits>(state).isctype(
+ *state.cur_, this->mask_))
+ {
+ return false;
+ }
+
+ ++state.cur_;
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ --state.cur_;
+ return false;
+ }
+
+ bool not_;
+ char_class_type mask_;
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/predicate_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/predicate_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,147 @@
+///////////////////////////////////////////////////////////////////////////////
+// predicate_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_PREDICATE_MATCHER_HPP_EAN_03_22_2007
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_PREDICATE_MATCHER_HPP_EAN_03_22_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/matcher/action_matcher.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // predicate_context
+ //
+ template<typename BidiIter>
+ struct predicate_context
+ {
+ explicit predicate_context(int sub, sub_match_impl<BidiIter> const *sub_matches)
+ : sub_(sub)
+ , sub_matches_(sub_matches)
+ {}
+
+ // eval_terminal
+ template<typename Expr, typename Arg>
+ struct eval_terminal
+ : proto::default_eval<Expr, predicate_context const>
+ {};
+
+ template<typename Expr, typename Arg>
+ struct eval_terminal<Expr, reference_wrapper<Arg> >
+ {
+ typedef Arg &result_type;
+ result_type operator()(Expr &expr, predicate_context const &) const
+ {
+ return proto::arg(expr).get();
+ }
+ };
+
+ template<typename Expr>
+ struct eval_terminal<Expr, any_matcher>
+ {
+ typedef sub_match<BidiIter> const &result_type;
+ result_type operator()(Expr &, predicate_context const &ctx) const
+ {
+ return ctx.sub_matches_[ctx.sub_];
+ }
+ };
+
+ template<typename Expr>
+ struct eval_terminal<Expr, mark_placeholder>
+ {
+ typedef sub_match<BidiIter> const &result_type;
+ result_type operator()(Expr &expr, predicate_context const &ctx) const
+ {
+ return ctx.sub_matches_[proto::arg(expr).mark_number_];
+ }
+ };
+
+ // eval
+ template<typename Expr, typename Tag = typename Expr::proto_tag>
+ struct eval
+ : proto::default_eval<Expr, predicate_context const>
+ {};
+
+ template<typename Expr>
+ struct eval<Expr, proto::tag::terminal>
+ : eval_terminal<Expr, typename proto::result_of::arg<Expr>::type>
+ {};
+
+ #if BOOST_VERSION >= 103500
+ template<typename Expr>
+ struct eval<Expr, proto::tag::mem_ptr>
+ : mem_ptr_eval<Expr, predicate_context const>
+ {};
+ #endif
+
+ int sub_;
+ sub_match_impl<BidiIter> const *sub_matches_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // AssertionFunctor
+ //
+ struct AssertionFunctor
+ : proto::function<
+ proto::terminal<check_tag>
+ , proto::terminal<proto::_>
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // predicate_matcher
+ //
+ template<typename Predicate>
+ struct predicate_matcher
+ : quant_style_assertion
+ {
+ int sub_;
+ Predicate predicate_;
+
+ predicate_matcher(Predicate const &pred, int sub)
+ : sub_(sub)
+ , predicate_(pred)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ // Predicate is check(assertion), where assertion can be
+ // a lambda or a function object.
+ return this->match_(state, next, proto::matches<Predicate, AssertionFunctor>());
+ }
+
+ private:
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const
+ {
+ sub_match<BidiIter> const &sub = state.sub_match(this->sub_);
+ return proto::arg(proto::arg_c<1>(this->predicate_))(sub) && next.match(state);
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const
+ {
+ predicate_context<BidiIter> ctx(this->sub_, state.sub_matches_);
+ return proto::eval(proto::arg_c<1>(this->predicate_), ctx) && next.match(state);
+ }
+ };
+
+}}}
+
+#endif // BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_PREDICATE_MATCHER_HPP_EAN_03_22_2007

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/range_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/range_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,87 @@
+///////////////////////////////////////////////////////////////////////////////
+// range_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_RANGE_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_RANGE_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4100) // unreferenced formal parameter
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // range_matcher
+ //
+ template<typename Traits, typename ICase>
+ struct range_matcher
+ : quant_style_fixed_width<1>
+ {
+ typedef typename Traits::char_type char_type;
+ typedef ICase icase_type;
+ char_type ch_min_;
+ char_type ch_max_;
+ bool not_;
+
+ range_matcher(char_type ch_min, char_type ch_max, bool no, Traits const &)
+ : ch_min_(ch_min)
+ , ch_max_(ch_max)
+ , not_(no)
+ {
+ }
+
+ void inverse()
+ {
+ this->not_ = !this->not_;
+ }
+
+ bool in_range(Traits const &traits, char_type ch, mpl::false_) const // case-sensitive
+ {
+ return traits.in_range(this->ch_min_, this->ch_max_, ch);
+ }
+
+ bool in_range(Traits const &traits, char_type ch, mpl::true_) const // case-insensitive
+ {
+ return traits.in_range_nocase(this->ch_min_, this->ch_max_, ch);
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ if(state.eos() || this->not_ ==
+ this->in_range(traits_cast<Traits>(state), *state.cur_, icase_type()))
+ {
+ return false;
+ }
+
+ ++state.cur_;
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ --state.cur_;
+ return false;
+ }
+ };
+
+}}}
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/regex_byref_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/regex_byref_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,77 @@
+///////////////////////////////////////////////////////////////////////////////
+// regex_byref_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_REGEX_BYREF_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_REGEX_BYREF_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/xpressive/regex_error.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+#include <boost/xpressive/detail/core/adaptor.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // regex_byref_matcher
+ //
+ template<typename BidiIter>
+ struct regex_byref_matcher
+ : quant_style<quant_variable_width, unknown_width::value, false>
+ {
+ // avoid cyclic references by holding a weak_ptr to the
+ // regex_impl struct
+ weak_ptr<regex_impl<BidiIter> > wimpl_;
+
+ // the basic_regex object holds a ref-count to this regex_impl, so
+ // we don't have to worry about it going away.
+ regex_impl<BidiIter> const *pimpl_;
+
+ regex_byref_matcher(shared_ptr<regex_impl<BidiIter> > const &impl)
+ : wimpl_(impl)
+ , pimpl_(impl.get())
+ {
+ BOOST_ASSERT(this->pimpl_);
+ }
+
+ template<typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ BOOST_ASSERT(this->pimpl_ == this->wimpl_.lock().get());
+ ensure(this->pimpl_->xpr_, regex_constants::error_badref, "bad regex reference");
+
+ return push_context_match(*this->pimpl_, state, this->wrap_(next, is_static_xpression<Next>()));
+ }
+
+ private:
+ template<typename Next>
+ static xpression_adaptor<reference_wrapper<Next const>, matchable<BidiIter> > wrap_(Next const &next, mpl::true_)
+ {
+ // wrap the static xpression in a matchable interface
+ return xpression_adaptor<reference_wrapper<Next const>, matchable<BidiIter> >(boost::cref(next));
+ }
+
+ template<typename Next>
+ static Next const &wrap_(Next const &next, mpl::false_)
+ {
+ return next;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/regex_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/regex_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,63 @@
+///////////////////////////////////////////////////////////////////////////////
+// regex_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_REGEX_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_REGEX_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/assert.hpp>
+#include <boost/xpressive/regex_error.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/core/adaptor.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // regex_matcher
+ //
+ template<typename BidiIter>
+ struct regex_matcher
+ : quant_style<quant_variable_width, unknown_width::value, false>
+ {
+ regex_impl<BidiIter> impl_;
+
+ regex_matcher(shared_ptr<regex_impl<BidiIter> > const &impl)
+ : impl_()
+ {
+ this->impl_.xpr_ = impl->xpr_;
+ this->impl_.traits_ = impl->traits_;
+ this->impl_.mark_count_ = impl->mark_count_;
+ this->impl_.hidden_mark_count_ = impl->hidden_mark_count_;
+
+ ensure(this->impl_.xpr_, regex_constants::error_badref, "bad regex reference");
+ }
+
+ template<typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ // regex_matcher is used for embeding a dynamic regex in a static regex. As such,
+ // Next will always point to a static regex.
+ BOOST_MPL_ASSERT((is_static_xpression<Next>));
+
+ // wrap the static xpression in a matchable interface
+ xpression_adaptor<reference_wrapper<Next const>, matchable<BidiIter> > adaptor(boost::cref(next));
+ return push_context_match(this->impl_, state, adaptor);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/repeat_begin_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/repeat_begin_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,69 @@
+///////////////////////////////////////////////////////////////////////////////
+// repeat_end_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_REPEAT_BEGIN_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_REPEAT_BEGIN_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ //
+ // Note: here is the variable-width xpression quantifier. It always
+ // matches at least once, so if the min is 0, it is the responsibility
+ // of the parser to make it alternate with an epsilon matcher.
+ //
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // repeat_begin_matcher
+ //
+ struct repeat_begin_matcher
+ : quant_style<quant_variable_width, unknown_width::value, false>
+ {
+ int mark_number_;
+
+ repeat_begin_matcher(int mark_number)
+ : mark_number_(mark_number)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
+
+ unsigned int old_repeat_count = br.repeat_count_;
+ bool old_zero_width = br.zero_width_;
+
+ br.repeat_count_ = 1;
+ br.zero_width_ = false;
+
+ // "push" next onto the stack, so it can be "popped" in
+ // repeat_end_matcher and used to loop back.
+ if(next.BOOST_NESTED_TEMPLATE push_match<Next>(state))
+ {
+ return true;
+ }
+
+ br.repeat_count_ = old_repeat_count;
+ br.zero_width_ = old_zero_width;
+
+ return false;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/repeat_end_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/repeat_end_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,121 @@
+///////////////////////////////////////////////////////////////////////////////
+// repeat_end_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_REPEAT_END_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_REPEAT_END_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // repeat_end_matcher
+ //
+ template<typename Greedy>
+ struct repeat_end_matcher
+ : quant_style<quant_none, 0, false>
+ {
+ typedef Greedy greedy_type;
+ int mark_number_;
+ unsigned int min_, max_;
+ mutable void const *back_;
+
+ repeat_end_matcher(int mark_number, unsigned int min, unsigned int max)
+ : mark_number_(mark_number)
+ , min_(min)
+ , max_(max)
+ , back_(0)
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ // prevent repeated zero-width sub-matches from causing infinite recursion
+ sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
+
+ if(br.zero_width_ && br.begin_ == state.cur_)
+ {
+ return next.skip_match(state);
+ }
+
+ bool old_zero_width = br.zero_width_;
+ br.zero_width_ = (br.begin_ == state.cur_);
+
+ if(this->match_(state, next, greedy_type()))
+ {
+ return true;
+ }
+
+ br.zero_width_ = old_zero_width;
+ return false;
+ }
+
+ // greedy, variable-width quantifier
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const
+ {
+ sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
+
+ if(this->max_ > br.repeat_count_)
+ {
+ ++br.repeat_count_;
+ // loop back to the expression "pushed" in repeat_begin_matcher::match
+ if(next.top_match(state, this->back_))
+ {
+ return true;
+ }
+ else if(--br.repeat_count_ < this->min_)
+ {
+ return false;
+ }
+ }
+
+ // looping finished, continue matching the rest of the pattern
+ return next.skip_match(state);
+ }
+
+ // non-greedy, variable-width quantifier
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const
+ {
+ sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
+
+ if(this->min_ <= br.repeat_count_)
+ {
+ if(next.skip_match(state))
+ {
+ return true;
+ }
+ }
+
+ if(this->max_ > br.repeat_count_)
+ {
+ ++br.repeat_count_;
+ if(next.top_match(state, this->back_))
+ {
+ return true;
+ }
+ --br.repeat_count_;
+ }
+
+ return false;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/set_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/set_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,100 @@
+///////////////////////////////////////////////////////////////////////////////
+// set.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_SET_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_SET_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4127) // conditional expression constant
+# pragma warning(disable : 4100) // unreferenced formal parameter
+# pragma warning(disable : 4351) // vc8 new behavior: elements of array 'foo' will be default initialized
+#endif
+
+#include <algorithm>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/same_traits.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// set_matcher
+//
+template<typename Traits, typename Size>
+struct set_matcher
+ : quant_style_fixed_width<1>
+{
+ typedef typename Traits::char_type char_type;
+ char_type set_[ Size::value ];
+ bool not_;
+ bool icase_;
+
+ set_matcher()
+ : set_()
+ , not_(false)
+ , icase_(false)
+ {
+ }
+
+ void inverse()
+ {
+ this->not_ = !this->not_;
+ }
+
+ void nocase(Traits const &traits)
+ {
+ this->icase_ = true;
+
+ for(int i = 0; i < Size::value; ++i)
+ {
+ this->set_[i] = traits.translate_nocase(this->set_[i]);
+ }
+ }
+
+ bool in_set(Traits const &traits, char_type ch) const
+ {
+ char_type const *begin = &this->set_[0], *end = begin + Size::value;
+ ch = this->icase_ ? traits.translate_nocase(ch) : traits.translate(ch);
+ return end != std::find(begin, end, ch);
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ if(state.eos() || this->not_ == this->in_set(traits_cast<Traits>(state), *state.cur_))
+ {
+ return false;
+ }
+
+ if(++state.cur_, next.match(state))
+ {
+ return true;
+ }
+
+ return --state.cur_, false;
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// set_initializer
+struct set_initializer
+{
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,235 @@
+///////////////////////////////////////////////////////////////////////////////
+// simple_repeat_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_SIMPLE_REPEAT_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_SIMPLE_REPEAT_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/next_prior.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/static/type_traits.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // simple_repeat_traits
+ //
+ struct greedy_slow_tag {};
+ struct greedy_fast_tag {};
+ struct non_greedy_tag {};
+
+ typedef static_xpression<any_matcher, true_xpression> any_sxpr;
+ typedef matcher_wrapper<any_matcher> any_dxpr;
+
+ template<typename Xpr, typename Greedy, typename Random>
+ struct simple_repeat_traits
+ {
+ typedef typename mpl::if_<Greedy, greedy_slow_tag, non_greedy_tag>::type tag_type;
+ };
+
+ template<>
+ struct simple_repeat_traits<any_sxpr, mpl::true_, mpl::true_>
+ {
+ typedef greedy_fast_tag tag_type;
+ };
+
+ template<>
+ struct simple_repeat_traits<any_dxpr, mpl::true_, mpl::true_>
+ {
+ typedef greedy_fast_tag tag_type;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // simple_repeat_matcher
+ //
+ template<typename Xpr, typename Greedy>
+ struct simple_repeat_matcher
+ : quant_style_variable_width
+ {
+ typedef Xpr xpr_type;
+ typedef Greedy greedy_type;
+
+ Xpr xpr_;
+ unsigned int min_, max_;
+ std::size_t width_;
+ mutable bool leading_;
+
+ simple_repeat_matcher(Xpr const &xpr, unsigned int min, unsigned int max, std::size_t width)
+ : xpr_(xpr)
+ , min_(min)
+ , max_(max)
+ , width_(width)
+ , leading_(false)
+ {
+ // it is the job of the parser to make sure this never happens
+ BOOST_ASSERT(min <= max);
+ BOOST_ASSERT(0 != max);
+ BOOST_ASSERT(0 != width && unknown_width() != width);
+ BOOST_ASSERT(Xpr::width == unknown_width() || Xpr::width == width);
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ typedef mpl::bool_<is_random<BidiIter>::value> is_rand;
+ typedef typename simple_repeat_traits<Xpr, greedy_type, is_rand>::tag_type tag_type;
+ return this->match_(state, next, tag_type());
+ }
+
+ // greedy, fixed-width quantifier
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, greedy_slow_tag) const
+ {
+ int const diff = -static_cast<int>(Xpr::width == unknown_width::value ? this->width_ : Xpr::width);
+ unsigned int matches = 0;
+ BidiIter const tmp = state.cur_;
+
+ // greedily match as much as we can
+ while(matches < this->max_ && this->xpr_.match(state))
+ {
+ ++matches;
+ }
+
+ // If this repeater is at the front of the pattern, note
+ // how much of the input we consumed so that a repeated search
+ // doesn't have to cover the same ground again.
+ if(this->leading_)
+ {
+ state.next_search_ = (matches && matches < this->max_)
+ ? state.cur_
+ : (tmp == state.end_) ? tmp : boost::next(tmp);
+ }
+
+ if(this->min_ > matches)
+ {
+ state.cur_ = tmp;
+ return false;
+ }
+
+ // try matching the rest of the pattern, and back off if necessary
+ for(; ; --matches, std::advance(state.cur_, diff))
+ {
+ if(next.match(state))
+ {
+ return true;
+ }
+ else if(this->min_ == matches)
+ {
+ state.cur_ = tmp;
+ return false;
+ }
+ }
+ }
+
+ // non-greedy fixed-width quantification
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, non_greedy_tag) const
+ {
+ BOOST_ASSERT(!this->leading_);
+ BidiIter const tmp = state.cur_;
+ unsigned int matches = 0;
+
+ for(; matches < this->min_; ++matches)
+ {
+ if(!this->xpr_.match(state))
+ {
+ state.cur_ = tmp;
+ return false;
+ }
+ }
+
+ do
+ {
+ if(next.match(state))
+ {
+ return true;
+ }
+ }
+ while(matches++ < this->max_ && this->xpr_.match(state));
+
+ state.cur_ = tmp;
+ return false;
+ }
+
+ // when greedily matching any character, skip to the end instead of iterating there.
+ template<typename BidiIter, typename Next>
+ bool match_(match_state<BidiIter> &state, Next const &next, greedy_fast_tag) const
+ {
+ BidiIter const tmp = state.cur_;
+ std::size_t const diff_to_end = static_cast<std::size_t>(state.end_ - tmp);
+
+ // is there enough room?
+ if(this->min_ > diff_to_end)
+ {
+ if(this->leading_)
+ {
+ // BUGBUG
+ state.next_search_ = boost::next(tmp);
+ }
+ return false;
+ }
+
+ BidiIter const min_iter = tmp + this->min_;
+ state.cur_ += (std::min)((std::size_t)this->max_, diff_to_end);
+
+ if(this->leading_)
+ {
+ state.next_search_ = (diff_to_end && diff_to_end < this->max_)
+ ? state.cur_
+ : (tmp == state.end_) ? tmp : boost::next(tmp);
+ }
+
+ for(;; --state.cur_)
+ {
+ if(next.match(state))
+ {
+ return true;
+ }
+ else if(min_iter == state.cur_)
+ {
+ state.cur_ = tmp;
+ return false;
+ }
+ }
+ }
+
+ detail::width get_width() const
+ {
+ if(this->min_ != this->max_)
+ {
+ return unknown_width::value;
+ }
+ return this->min_ * this->width_;
+ }
+
+ private:
+ simple_repeat_matcher &operator =(simple_repeat_matcher const &);
+ };
+
+ // BUGBUG can all non-greedy quantification be done with the fixed width quantifier?
+
+ // BUGBUG matchers are chained together using static_xpression so that matchers to
+ // the left can invoke matchers to the right. This is so that if the left matcher
+ // succeeds but the right matcher fails, the left matcher is given the opportunity
+ // to try something else. This is how backtracking works. However, if the left matcher
+ // can succeed only one way (as with any_matcher, for example), it does not need
+ // backtracking. In this case, leaving its stack frame active is a waste of stack
+ // space. Can something be done?
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/string_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/string_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,90 @@
+///////////////////////////////////////////////////////////////////////////////
+// string_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_STRING_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_STRING_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <string>
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/utility/algorithm.hpp>
+#include <boost/xpressive/detail/utility/traits_utils.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // string_matcher
+ //
+ template<typename Traits, typename ICase>
+ struct string_matcher
+ : quant_style_fixed_unknown_width
+ {
+ typedef typename Traits::char_type char_type;
+ typedef typename Traits::string_type string_type;
+ typedef ICase icase_type;
+ string_type str_;
+ char_type const *end_;
+
+ string_matcher(string_type const &str, Traits const &traits)
+ : str_(str)
+ , end_()
+ {
+ typename range_iterator<string_type>::type cur = boost::begin(this->str_);
+ typename range_iterator<string_type>::type end = boost::end(this->str_);
+ for(; cur != end; ++cur)
+ {
+ *cur = detail::translate(*cur, traits, icase_type());
+ }
+ this->end_ = detail::data_end(str_);
+ }
+
+ string_matcher(string_matcher<Traits, ICase> const &that)
+ : str_(that.str_)
+ , end_(detail::data_end(str_))
+ {
+ }
+
+ template<typename BidiIter, typename Next>
+ bool match(match_state<BidiIter> &state, Next const &next) const
+ {
+ BidiIter const tmp = state.cur_;
+ char_type const *begin = detail::data_begin(this->str_);
+ for(; begin != this->end_; ++begin, ++state.cur_)
+ {
+ if(state.eos() ||
+ (detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type()) != *begin))
+ {
+ state.cur_ = tmp;
+ return false;
+ }
+ }
+
+ if(next.match(state))
+ {
+ return true;
+ }
+
+ state.cur_ = tmp;
+ return false;
+ }
+
+ detail::width get_width() const
+ {
+ return boost::size(this->str_);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/true_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matcher/true_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,38 @@
+///////////////////////////////////////////////////////////////////////////////
+// true_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_TRUE_MATCHER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_TRUE_MATCHER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // true_matcher
+ //
+ struct true_matcher
+ : quant_style_assertion
+ {
+ template<typename BidiIter, typename Next>
+ static bool match(match_state<BidiIter> &, Next const &)
+ {
+ return true;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matchers.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/matchers.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,50 @@
+///////////////////////////////////////////////////////////////////////////////
+// matchers.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHERS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHERS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//#include <boost/xpressive/detail/core/matcher/action_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/alternate_end_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/alternate_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/any_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/assert_bol_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/assert_bos_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/assert_eol_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/assert_eos_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/assert_word_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/attr_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/charset_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/end_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/epsilon_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/keeper_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/literal_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/logical_newline_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/lookahead_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/lookbehind_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/mark_begin_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/mark_end_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/mark_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/optional_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/posix_charset_matcher.hpp>
+//#include <boost/xpressive/detail/core/matcher/predicate_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/range_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/regex_byref_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/regex_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/repeat_begin_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/repeat_end_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/set_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/string_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/true_matcher.hpp>
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/optimize.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/optimize.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,116 @@
+///////////////////////////////////////////////////////////////////////////////
+// optimize.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_OPTIMIZE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_OPTIMIZE_HPP_EAN_10_04_2005
+
+#include <string>
+#include <utility>
+#include <boost/mpl/bool.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/xpressive/detail/core/finder.hpp>
+#include <boost/xpressive/detail/core/linker.hpp>
+#include <boost/xpressive/detail/core/peeker.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// optimize_regex
+//
+template<typename BidiIter, typename Traits>
+intrusive_ptr<finder<BidiIter> > optimize_regex
+(
+ xpression_peeker<typename iterator_value<BidiIter>::type> const &peeker
+ , Traits const &traits
+ , mpl::false_
+)
+{
+ if(peeker.line_start())
+ {
+ return intrusive_ptr<finder<BidiIter> >
+ (
+ new line_start_finder<BidiIter, Traits>(traits)
+ );
+ }
+ else if(peeker.leading_simple_repeat())
+ {
+ return intrusive_ptr<finder<BidiIter> >
+ (
+ new leading_simple_repeat_finder<BidiIter>()
+ );
+ }
+ else if(256 != peeker.bitset().count())
+ {
+ return intrusive_ptr<finder<BidiIter> >
+ (
+ new hash_peek_finder<BidiIter, Traits>(peeker.bitset())
+ );
+ }
+
+ return intrusive_ptr<finder<BidiIter> >();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// optimize_regex
+//
+template<typename BidiIter, typename Traits>
+intrusive_ptr<finder<BidiIter> > optimize_regex
+(
+ xpression_peeker<typename iterator_value<BidiIter>::type> const &peeker
+ , Traits const &traits
+ , mpl::true_
+)
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
+ // if we have a leading string literal, initialize a boyer-moore struct with it
+ peeker_string<char_type> const &str = peeker.get_string();
+ if(str.begin_ != str.end_)
+ {
+ BOOST_ASSERT(1 == peeker.bitset().count());
+ return intrusive_ptr<finder<BidiIter> >
+ (
+ new boyer_moore_finder<BidiIter, Traits>(str.begin_, str.end_, traits, str.icase_)
+ );
+ }
+
+ return optimize_regex<BidiIter>(peeker, traits, mpl::false_());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// common_compile
+//
+template<typename BidiIter, typename Traits>
+void common_compile
+(
+ intrusive_ptr<matchable_ex<BidiIter> const> const &regex
+ , regex_impl<BidiIter> &impl
+ , Traits const &traits
+)
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
+ // "link" the regex
+ xpression_linker<char_type> linker(traits);
+ regex->link(linker);
+
+ // "peek" into the compiled regex to see if there are optimization opportunities
+ hash_peek_bitset<char_type> bset;
+ xpression_peeker<char_type> peeker(bset, traits, linker.has_backrefs());
+ regex->peek(peeker);
+
+ // optimization: get the peek chars OR the boyer-moore search string
+ impl.finder_ = optimize_regex<BidiIter>(peeker, traits, is_random<BidiIter>());
+ impl.xpr_ = regex;
+}
+
+}}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/peeker.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/peeker.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,284 @@
+///////////////////////////////////////////////////////////////////////////////
+// peeker.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_PEEKER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_PEEKER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <string>
+#include <typeinfo>
+#include <boost/assert.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/size_t.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/matchers.hpp>
+#include <boost/xpressive/detail/utility/hash_peek_bitset.hpp>
+#include <boost/xpressive/detail/utility/never_true.hpp>
+#include <boost/xpressive/detail/utility/algorithm.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// peeker_string
+//
+template<typename Char>
+struct peeker_string
+{
+ Char const *begin_;
+ Char const *end_;
+ bool icase_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// char_sink
+//
+template<typename Traits, bool ICase>
+struct char_sink
+{
+ typedef typename Traits::char_type char_type;
+
+ char_sink(hash_peek_bitset<char_type> &bset, Traits const &traits)
+ : bset_(bset)
+ , traits_(traits)
+ {}
+
+ void operator()(char_type ch) const
+ {
+ this->bset_.set_char(ch, ICase, this->traits_);
+ }
+
+ hash_peek_bitset<char_type> &bset_;
+ Traits const &traits_;
+private:
+ char_sink &operator =(char_sink const &);
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// xpression_peeker
+//
+template<typename Char>
+struct xpression_peeker
+{
+ template<typename Traits>
+ xpression_peeker(hash_peek_bitset<Char> &bset, Traits const &traits, bool has_backrefs = false)
+ : bset_(bset)
+ , str_()
+ , line_start_(false)
+ , traits_(0)
+ , traits_type_(0)
+ , leading_simple_repeat_(0)
+ , has_backrefs_(has_backrefs)
+ {
+ this->set_traits(traits);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // accessors
+ peeker_string<Char> const &get_string() const
+ {
+ return this->str_;
+ }
+
+ bool line_start() const
+ {
+ return this->line_start_;
+ }
+
+ bool leading_simple_repeat() const
+ {
+ return 0 < this->leading_simple_repeat_;
+ }
+
+ hash_peek_bitset<Char> const &bitset() const
+ {
+ return this->bset_;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // modifiers
+ void fail()
+ {
+ this->bset_.set_all();
+ }
+
+ template<typename Matcher>
+ mpl::false_ accept(Matcher const &)
+ {
+ this->fail();
+ return mpl::false_();
+ }
+
+ mpl::true_ accept(mark_begin_matcher const &)
+ {
+ if(this->has_backrefs_)
+ {
+ --this->leading_simple_repeat_;
+ }
+ return mpl::true_();
+ }
+
+ mpl::true_ accept(repeat_begin_matcher const &)
+ {
+ --this->leading_simple_repeat_;
+ return mpl::true_();
+ }
+
+ template<typename Traits>
+ mpl::true_ accept(assert_bol_matcher<Traits> const &)
+ {
+ this->line_start_ = true;
+ return mpl::true_();
+ }
+
+ template<typename Traits, typename ICase>
+ mpl::false_ accept(literal_matcher<Traits, ICase, mpl::false_> const &xpr)
+ {
+ this->bset_.set_char(xpr.ch_, ICase(), this->get_traits_<Traits>());
+ return mpl::false_();
+ }
+
+ template<typename Traits, typename ICase>
+ mpl::false_ accept(string_matcher<Traits, ICase> const &xpr)
+ {
+ this->bset_.set_char(xpr.str_[0], ICase(), this->get_traits_<Traits>());
+ this->str_.begin_ = detail::data_begin(xpr.str_);
+ this->str_.end_ = detail::data_end(xpr.str_);
+ this->str_.icase_ = ICase::value;
+ return mpl::false_();
+ }
+
+ template<typename Alternates, typename Traits>
+ mpl::false_ accept(alternate_matcher<Alternates, Traits> const &xpr)
+ {
+ BOOST_ASSERT(0 != xpr.bset_.count());
+ this->bset_.set_bitset(xpr.bset_);
+ return mpl::false_();
+ }
+
+ template<typename Matcher, typename Traits, typename ICase>
+ mpl::false_ accept(attr_matcher<Matcher, Traits, ICase> const &xpr)
+ {
+ xpr.sym_.peek(char_sink<Traits, ICase::value>(this->bset_, this->get_traits_<Traits>()));
+ return mpl::false_();
+ }
+
+ template<typename Xpr, typename Greedy>
+ mpl::false_ accept(optional_matcher<Xpr, Greedy> const &)
+ {
+ this->fail(); // a union of xpr and next
+ return mpl::false_();
+ }
+
+ template<typename Xpr, typename Greedy>
+ mpl::false_ accept(optional_mark_matcher<Xpr, Greedy> const &)
+ {
+ this->fail(); // a union of xpr and next
+ return mpl::false_();
+ }
+
+ //template<typename Xpr, typename Greedy>
+ //mpl::true_ accept(optional_matcher<Xpr, Greedy> const &xpr)
+ //{
+ // xpr.xpr_.peek(*this); // a union of xpr and next
+ // return mpl::true_();
+ //}
+
+ //template<typename Xpr, typename Greedy>
+ //mpl::true_ accept(optional_mark_matcher<Xpr, Greedy> const &xpr)
+ //{
+ // xpr.xpr_.peek(*this); // a union of xpr and next
+ // return mpl::true_();
+ //}
+
+ template<typename Traits>
+ mpl::false_ accept(posix_charset_matcher<Traits> const &xpr)
+ {
+ this->bset_.set_class(xpr.mask_, xpr.not_, this->get_traits_<Traits>());
+ return mpl::false_();
+ }
+
+ template<typename ICase, typename Traits>
+ typename enable_if<is_narrow_char<typename Traits::char_type>, mpl::false_>::type
+ accept(charset_matcher<Traits, ICase, basic_chset<Char> > const &xpr)
+ {
+ BOOST_ASSERT(0 != xpr.charset_.base().count());
+ this->bset_.set_charset(xpr.charset_, ICase());
+ return mpl::false_();
+ }
+
+ template<typename Traits, typename ICase>
+ mpl::false_ accept(range_matcher<Traits, ICase> const &xpr)
+ {
+ this->bset_.set_range(xpr.ch_min_, xpr.ch_max_, xpr.not_, ICase(), this->get_traits_<Traits>());
+ return mpl::false_();
+ }
+
+ template<typename Xpr, typename Greedy>
+ mpl::false_ accept(simple_repeat_matcher<Xpr, Greedy> const &xpr)
+ {
+ if(Greedy() && 1U == xpr.width_)
+ {
+ ++this->leading_simple_repeat_;
+ xpr.leading_ = this->leading_simple_repeat();
+ }
+ 0 != xpr.min_ ? xpr.xpr_.peek(*this) : this->fail(); // could be a union of xpr and next
+ return mpl::false_();
+ }
+
+ template<typename Xpr>
+ mpl::false_ accept(keeper_matcher<Xpr> const &xpr)
+ {
+ xpr.xpr_.peek(*this);
+ return mpl::false_();
+ }
+
+ template<typename Traits>
+ void set_traits(Traits const &traits)
+ {
+ if(0 == this->traits_)
+ {
+ this->traits_ = &traits;
+ this->traits_type_ = &typeid(Traits);
+ }
+ else if(*this->traits_type_ != typeid(Traits) || this->get_traits_<Traits>() != traits)
+ {
+ this->fail(); // traits mis-match! set all and bail
+ }
+ }
+
+private:
+ xpression_peeker(xpression_peeker const &);
+ xpression_peeker &operator =(xpression_peeker const &);
+
+ template<typename Traits>
+ Traits const &get_traits_() const
+ {
+ BOOST_ASSERT(!!(*this->traits_type_ == typeid(Traits)));
+ return *static_cast<Traits const *>(this->traits_);
+ }
+
+ hash_peek_bitset<Char> &bset_;
+ peeker_string<Char> str_;
+ bool str_icase_;
+ bool line_start_;
+ void const *traits_;
+ std::type_info const *traits_type_;
+ int leading_simple_repeat_;
+ bool has_backrefs_;
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/quant_style.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/quant_style.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,129 @@
+///////////////////////////////////////////////////////////////////////////////
+// quant_style.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_QUANT_STYLE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_QUANT_STYLE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/xpressive/detail/utility/width.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(is_boost_xpressive_xpression_)
+
+///////////////////////////////////////////////////////////////////////////////
+// is_xpr
+//
+template<typename Xpr>
+struct is_xpr
+ : has_is_boost_xpressive_xpression_<Xpr>
+{};
+
+///////////////////////////////////////////////////////////////////////////////
+// quant_enum
+//
+enum quant_enum
+{
+ quant_none,
+ quant_fixed_width,
+ quant_variable_width
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// quant_style
+//
+template<quant_enum QuantStyle, std::size_t Width = unknown_width::value, bool Pure = true>
+struct quant_style
+{
+ typedef void is_boost_xpressive_xpression_;
+
+ // Which quantification strategy to use?
+ BOOST_STATIC_CONSTANT(int, quant = QuantStyle);
+
+ // how many characters this matcher consumes
+ BOOST_STATIC_CONSTANT(std::size_t, width = Width);
+
+ // whether this matcher has observable side-effects
+ BOOST_STATIC_CONSTANT(bool, pure = Pure);
+
+ static detail::width get_width()
+ {
+ return width;
+ }
+};
+
+#define BOOST_XPR_QUANT_STYLE(Style, Width, Pure) \
+ typedef void is_boost_xpressive_xpression_; \
+ BOOST_STATIC_CONSTANT(int, quant = Style); \
+ BOOST_STATIC_CONSTANT(std::size_t, width = Width); \
+ BOOST_STATIC_CONSTANT(bool, pure = Pure); \
+ static detail::width get_width() { return width; } \
+ /**/
+
+// // Replace transmogrify stupidity with rebindable matchers/placeholders
+//#define BOOST_XPR_IDENTITY_REBIND(TYPE) \/
+// template<typename BidiIter, typename ICase, typename Traits> \/
+// struct rebind \/
+// { \/
+// typedef TYPE type; \/
+// }; \/
+// /**/
+
+///////////////////////////////////////////////////////////////////////////////
+// quant_style_none
+// this sub-expression cannot be quantified
+typedef quant_style<quant_none> quant_style_none;
+
+///////////////////////////////////////////////////////////////////////////////
+// quant_style_fixed_unknown_width
+// this sub-expression is fixed width for the purpose of quantification, but
+// the width cannot be determined at compile time. An example would be the
+// string_matcher or the mark_matcher.
+typedef quant_style<quant_fixed_width> quant_style_fixed_unknown_width;
+
+///////////////////////////////////////////////////////////////////////////////
+// quant_style_variable_width
+// this sub-expression can match a variable number of characters
+typedef quant_style<quant_variable_width> quant_style_variable_width;
+
+///////////////////////////////////////////////////////////////////////////////
+// quant_style_fixed_width
+// for when the sub-expression has a fixed width that is known at compile time
+template<std::size_t Width>
+struct quant_style_fixed_width
+ : quant_style<quant_fixed_width, Width>
+{
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// quant_style_assertion
+// a zero-width assertion.
+struct quant_style_assertion
+ : quant_style<quant_none, 0>
+{
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// quant_type
+//
+template<typename Matcher>
+struct quant_type
+ : mpl::int_<Matcher::quant>
+{
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/regex_impl.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/regex_impl.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,212 @@
+///////////////////////////////////////////////////////////////////////////////
+// regex_impl.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_REGEX_IMPL_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_REGEX_IMPL_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <vector>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/xpressive/regex_traits.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/dynamic/matchable.hpp>
+#include <boost/xpressive/detail/utility/tracking_ptr.hpp>
+#include <boost/xpressive/detail/utility/counted_base.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// finder
+template<typename BidiIter>
+struct finder
+ : counted_base<finder<BidiIter> >
+{
+ virtual ~finder() {}
+ virtual bool ok_for_partial_matches() const { return true; }
+ virtual bool operator ()(match_state<BidiIter> &state) const = 0;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// traits
+template<typename Char>
+struct traits
+ : counted_base<traits<Char> >
+{
+ virtual ~traits() {}
+ virtual Char tolower(Char ch) const = 0;
+ virtual Char toupper(Char ch) const = 0;
+ virtual bool in_range(Char from, Char to, Char ch) const = 0;
+ virtual int value(Char ch, int radix) const = 0;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// named_mark
+template<typename Char>
+struct named_mark
+{
+ typedef typename detail::string_type<Char>::type string_type;
+
+ named_mark(string_type name, std::size_t mark_nbr)
+ : name_(name)
+ , mark_nbr_(mark_nbr)
+ {}
+
+ string_type name_;
+ std::size_t mark_nbr_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// traits_holder
+template<typename Traits>
+struct traits_holder
+ : traits<typename Traits::char_type>
+{
+ typedef typename Traits::char_type char_type;
+
+ explicit traits_holder(Traits const &traits)
+ : traits_(traits)
+ {
+ }
+
+ Traits const &traits() const
+ {
+ return this->traits_;
+ }
+
+ char_type tolower(char_type ch) const
+ {
+ return this->tolower_(ch, typename Traits::version_tag());
+ }
+
+ char_type toupper(char_type ch) const
+ {
+ return this->toupper_(ch, typename Traits::version_tag());
+ }
+
+ int value(char_type ch, int radix) const
+ {
+ return this->traits_.value(ch, radix);
+ }
+
+ bool in_range(char_type from, char_type to, char_type ch) const
+ {
+ return this->traits_.in_range(from, to, ch);
+ }
+
+private:
+ char_type tolower_(char_type ch, regex_traits_version_1_tag) const
+ {
+ return ch;
+ }
+
+ char_type toupper_(char_type ch, regex_traits_version_1_tag) const
+ {
+ return ch;
+ }
+
+ char_type tolower_(char_type ch, regex_traits_version_2_tag) const
+ {
+ return this->traits_.tolower(ch);
+ }
+
+ char_type toupper_(char_type ch, regex_traits_version_2_tag) const
+ {
+ return this->traits_.toupper(ch);
+ }
+
+ Traits traits_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_impl
+//
+template<typename BidiIter>
+struct regex_impl
+ : enable_reference_tracking<regex_impl<BidiIter> >
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
+ regex_impl()
+ : enable_reference_tracking<regex_impl<BidiIter> >()
+ , xpr_()
+ , traits_()
+ , finder_()
+ , named_marks_()
+ , mark_count_(0)
+ , hidden_mark_count_(0)
+ {
+ #ifdef BOOST_XPRESSIVE_DEBUG_CYCLE_TEST
+ ++instances;
+ #endif
+ }
+
+ regex_impl(regex_impl<BidiIter> const &that)
+ : enable_reference_tracking<regex_impl<BidiIter> >(that)
+ , xpr_(that.xpr_)
+ , traits_(that.traits_)
+ , finder_(that.finder_)
+ , named_marks_(that.named_marks_)
+ , mark_count_(that.mark_count_)
+ , hidden_mark_count_(that.hidden_mark_count_)
+ {
+ #ifdef BOOST_XPRESSIVE_DEBUG_CYCLE_TEST
+ ++instances;
+ #endif
+ }
+
+ ~regex_impl()
+ {
+ #ifdef BOOST_XPRESSIVE_DEBUG_CYCLE_TEST
+ --instances;
+ #endif
+ }
+
+ void swap(regex_impl<BidiIter> &that)
+ {
+ enable_reference_tracking<regex_impl<BidiIter> >::swap(that);
+ this->xpr_.swap(that.xpr_);
+ this->traits_.swap(that.traits_);
+ this->finder_.swap(that.finder_);
+ this->named_marks_.swap(that.named_marks_);
+ std::swap(this->mark_count_, that.mark_count_);
+ std::swap(this->hidden_mark_count_, that.hidden_mark_count_);
+ }
+
+ intrusive_ptr<matchable_ex<BidiIter> const> xpr_;
+ intrusive_ptr<traits<char_type> const> traits_;
+ intrusive_ptr<finder<BidiIter> > finder_;
+ std::vector<named_mark<char_type> > named_marks_;
+ std::size_t mark_count_;
+ std::size_t hidden_mark_count_;
+
+ #ifdef BOOST_XPRESSIVE_DEBUG_CYCLE_TEST
+ static int instances;
+ #endif
+
+private:
+ regex_impl &operator =(regex_impl const &);
+};
+
+template<typename BidiIter>
+void swap(regex_impl<BidiIter> &left, regex_impl<BidiIter> &right)
+{
+ left.swap(right);
+}
+
+#ifdef BOOST_XPRESSIVE_DEBUG_CYCLE_TEST
+template<typename BidiIter>
+int regex_impl<BidiIter>::instances = 0;
+#endif
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/results_cache.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/results_cache.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,142 @@
+///////////////////////////////////////////////////////////////////////////////
+// results_cache.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_RESULTS_CACHE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_RESULTS_CACHE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <list>
+#include <boost/detail/workaround.hpp>
+#include <boost/assert.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/access.hpp>
+#include <boost/xpressive/match_results.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// nested_results
+// BUGBUG by using std::list, it makes construction of of an empty nested_results
+// incur a dynamic allocation. As a result, construction an empty match_results is
+// likewise not free. FIXME.
+#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206))
+template<typename BidiIter>
+struct nested_results
+ : std::list<match_results<BidiIter> >
+{
+ friend struct results_cache<BidiIter>;
+ friend struct match_results<BidiIter>;
+};
+#else
+template<typename BidiIter>
+struct nested_results
+ : private std::list<match_results<BidiIter> >
+{
+ friend struct results_cache<BidiIter>;
+ friend struct match_results<BidiIter>;
+ typedef std::list<match_results<BidiIter> > base_type;
+
+ using base_type::iterator;
+ using base_type::const_iterator;
+ #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB , == 1)
+ // old Dinkumware doesn't expose pointer typedefs
+ typedef base_type::value_type *pointer;
+ typedef base_type::value_type const *const_pointer;
+ #else
+ using base_type::pointer;
+ using base_type::const_pointer;
+ #endif
+ using base_type::reference;
+ using base_type::const_reference;
+ using base_type::size_type;
+ using base_type::begin;
+ using base_type::end;
+ using base_type::size;
+ using base_type::empty;
+ using base_type::front;
+ using base_type::back;
+};
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// results_cache
+//
+// cache storage for reclaimed match_results structs
+template<typename BidiIter>
+struct results_cache
+{
+ typedef core_access<BidiIter> access;
+
+ match_results<BidiIter> &append_new(nested_results<BidiIter> &out)
+ {
+ if(this->cache_.empty())
+ {
+ out.push_back(match_results<BidiIter>());
+ }
+ else
+ {
+ BOOST_ASSERT(access::get_nested_results(this->cache_.back()).empty());
+ out.splice(out.end(), this->cache_, --this->cache_.end());
+ }
+ return out.back();
+ }
+
+ // move the last match_results struct into the cache
+ void reclaim_last(nested_results<BidiIter> &out)
+ {
+ BOOST_ASSERT(!out.empty());
+ // first, reclaim any nested results
+ nested_results<BidiIter> &nested = access::get_nested_results(out.back());
+ if(!nested.empty())
+ {
+ this->reclaim_all(nested);
+ }
+ // then, reclaim the last match_results
+ this->cache_.splice(this->cache_.end(), out, --out.end());
+ }
+
+ // move the last n match_results structs into the cache
+ void reclaim_last_n(nested_results<BidiIter> &out, std::size_t count)
+ {
+ for(; 0 != count; --count)
+ {
+ this->reclaim_last(out);
+ }
+ }
+
+ void reclaim_all(nested_results<BidiIter> &out)
+ {
+ typedef typename nested_results<BidiIter>::iterator iter_type;
+
+ // first, recursively reclaim all the nested results
+ for(iter_type begin = out.begin(); begin != out.end(); ++begin)
+ {
+ nested_results<BidiIter> &nested = access::get_nested_results(*begin);
+
+ if(!nested.empty())
+ {
+ this->reclaim_all(nested);
+ }
+ }
+
+ // next, reclaim the results themselves
+ this->cache_.splice(this->cache_.end(), out);
+ }
+
+private:
+
+ nested_results<BidiIter> cache_;
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/state.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/state.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,401 @@
+///////////////////////////////////////////////////////////////////////////////
+// state.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_STATE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_STATE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/noncopyable.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/access.hpp>
+#include <boost/xpressive/detail/core/action.hpp>
+#include <boost/xpressive/detail/core/sub_match_vector.hpp>
+#include <boost/xpressive/detail/utility/sequence_stack.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// match_context
+//
+template<typename BidiIter>
+struct match_context
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
+ match_context()
+ : results_ptr_(0)
+ , prev_context_(0)
+ , next_ptr_(0)
+ , traits_(0)
+ {
+ }
+
+ // pointer to the current match results, passed to actions as a parameter.
+ match_results<BidiIter> *results_ptr_;
+
+ // The previous match context, if this match_context corresponds to a nested regex invocation
+ match_context<BidiIter> *prev_context_;
+
+ // If this is a nested match, the "next" sub-expression to execute after the nested match
+ matchable<BidiIter> const *next_ptr_;
+
+ // A pointer to the current traits object
+ detail::traits<char_type> const *traits_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// attr_context
+//
+struct attr_context
+{
+ // Slots for holding type-erased pointers to attributes
+ void const **attr_slots_;
+
+ // The previous attr context, if one exists
+ attr_context *prev_attr_context_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// match_flags
+//
+struct match_flags
+{
+ bool match_all_;
+ bool match_prev_avail_;
+ bool match_bol_;
+ bool match_eol_;
+ bool match_not_bow_;
+ bool match_not_eow_;
+ bool match_not_null_;
+ bool match_continuous_;
+ bool match_partial_;
+
+ explicit match_flags(regex_constants::match_flag_type flags)
+ : match_all_(false)
+ , match_prev_avail_(0 != (flags & regex_constants::match_prev_avail))
+ , match_bol_(match_prev_avail_ || 0 == (flags & regex_constants::match_not_bol))
+ , match_eol_(0 == (flags & regex_constants::match_not_eol))
+ , match_not_bow_(!match_prev_avail_ && 0 != (flags & regex_constants::match_not_bow))
+ , match_not_eow_(0 != (flags & regex_constants::match_not_eow))
+ , match_not_null_(0 != (flags & regex_constants::match_not_null))
+ , match_continuous_(0 != (flags & regex_constants::match_continuous))
+ , match_partial_(0 != (flags & regex_constants::match_partial))
+ {
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// match_state
+//
+template<typename BidiIter>
+struct match_state
+ : noncopyable
+{
+ typedef BidiIter iterator;
+ typedef core_access<BidiIter> access;
+ typedef detail::match_context<BidiIter> match_context;
+ typedef detail::results_extras<BidiIter> results_extras;
+ typedef detail::regex_impl<BidiIter> regex_impl;
+ typedef detail::matchable<BidiIter> matchable;
+ typedef xpressive::match_results<BidiIter> match_results;
+ typedef detail::sub_match_impl<BidiIter> sub_match_impl;
+ typedef detail::actionable actionable;
+
+ BidiIter cur_;
+ sub_match_impl *sub_matches_;
+ std::size_t mark_count_;
+ BidiIter begin_;
+ BidiIter end_;
+
+ match_flags flags_;
+ bool found_partial_match_;
+
+ match_context context_;
+ results_extras *extras_;
+ actionable action_list_;
+ actionable const **action_list_tail_;
+ action_args_type *action_args_;
+ attr_context attr_context_;
+ BidiIter next_search_;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ //
+ match_state
+ (
+ BidiIter begin
+ , BidiIter end
+ , match_results &what
+ , regex_impl const &impl
+ , regex_constants::match_flag_type flags
+ )
+ : cur_(begin)
+ , sub_matches_(0)
+ , mark_count_(0)
+ , begin_(begin)
+ , end_(end)
+ , flags_(flags)
+ , found_partial_match_(false)
+ , context_() // zero-initializes the fields of context_
+ , extras_(&core_access<BidiIter>::get_extras(what))
+ , action_list_()
+ , action_list_tail_(&action_list_.next)
+ , action_args_(&core_access<BidiIter>::get_action_args(what))
+ , attr_context_() // zero-initializes the fields of attr_context_
+ , next_search_(begin)
+ {
+ // reclaim any cached memory in the match_results struct
+ this->extras_->sub_match_stack_.unwind();
+
+ // initialize the context_ struct
+ this->init_(impl, what);
+
+ // move all the nested match_results structs into the match_results cache
+ this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // reset
+ void reset(match_results &what, regex_impl const &impl)
+ {
+ this->extras_ = &core_access<BidiIter>::get_extras(what);
+ this->action_list_.next = 0;
+ this->action_list_tail_ = &action_list_.next;
+ this->action_args_ = &core_access<BidiIter>::get_action_args(what);
+ this->attr_context_ = attr_context();
+ this->context_.prev_context_ = 0;
+ this->found_partial_match_ = false;
+ this->extras_->sub_match_stack_.unwind();
+ this->init_(impl, what);
+ this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // push_context
+ // called to prepare the state object for a regex match
+ match_context push_context(regex_impl const &impl, matchable const &next, match_context &prev)
+ {
+ // save state
+ match_context context = this->context_;
+
+ // create a new nested match_results for this regex
+ nested_results<BidiIter> &nested = access::get_nested_results(*context.results_ptr_);
+ match_results &what = this->extras_->results_cache_.append_new(nested);
+
+ // (re)initialize the match context
+ this->init_(impl, what);
+
+ // create a linked list of match_context structs
+ this->context_.prev_context_ = &prev;
+ this->context_.next_ptr_ = &next;
+
+ // record the start of the zero-th sub-match
+ this->sub_matches_[0].begin_ = this->cur_;
+
+ return context;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // pop_context
+ // called after a nested match failed to restore the context
+ bool pop_context(regex_impl const &impl, bool success)
+ {
+ match_context &context = *this->context_.prev_context_;
+ if(!success)
+ {
+ match_results &what = *context.results_ptr_;
+ this->uninit_(impl, what);
+
+ // send the match_results struct back to the cache
+ nested_results<BidiIter> &nested = access::get_nested_results(what);
+ this->extras_->results_cache_.reclaim_last(nested);
+ }
+
+ // restore the state
+ this->context_ = context;
+ match_results &results = *this->context_.results_ptr_;
+ this->sub_matches_ = access::get_sub_matches(access::get_sub_match_vector(results));
+ this->mark_count_ = results.size();
+ return success;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // swap_context
+ void swap_context(match_context &context)
+ {
+ std::swap(this->context_, context);
+ match_results &results = *this->context_.results_ptr_;
+ this->sub_matches_ = access::get_sub_matches(access::get_sub_match_vector(results));
+ this->mark_count_ = results.size();
+ }
+
+ // beginning of buffer
+ bool bos() const
+ {
+ return this->cur_ == this->begin_;
+ }
+
+ // end of buffer
+ bool eos()
+ {
+ return this->cur_ == this->end_ && this->found_partial_match();
+ }
+
+ // is this the regex that is currently executing?
+ bool is_active_regex(regex_impl const &impl) const
+ {
+ return impl.xpr_.get() == this->context_.results_ptr_->regex_id();
+ }
+
+ // fetch the n-th sub_match
+ sub_match_impl &sub_match(int n)
+ {
+ return this->sub_matches_[n];
+ }
+
+ // called when a partial match has succeeded
+ void set_partial_match()
+ {
+ sub_match_impl &sub0 = this->sub_match(0);
+ sub0.first = sub0.begin_;
+ sub0.second = this->end_;
+ sub0.matched = false;
+ }
+
+ template<typename Traits>
+ Traits const &get_traits() const
+ {
+ return static_cast<traits_holder<Traits> const *>(this->context_.traits_)->traits();
+ }
+
+private:
+
+ void init_(regex_impl const &impl, match_results &what)
+ {
+ regex_id_type const id = impl.xpr_.get();
+ std::size_t const total_mark_count = impl.mark_count_ + impl.hidden_mark_count_ + 1;
+
+ // initialize the context and the sub_match vector
+ this->context_.results_ptr_ = &what;
+ this->context_.traits_ = impl.traits_.get();
+ this->mark_count_ = impl.mark_count_ + 1;
+ this->sub_matches_ = this->extras_->sub_match_stack_.push_sequence(total_mark_count);
+ this->sub_matches_ += impl.hidden_mark_count_;
+
+ // initialize the match_results struct
+ access::init_match_results(what, id, impl.traits_, this->sub_matches_, this->mark_count_, impl.named_marks_);
+ }
+
+ void uninit_(regex_impl const &impl, match_results &)
+ {
+ extras_->sub_match_stack_.unwind_to(this->sub_matches_ - impl.hidden_mark_count_);
+ }
+
+ bool found_partial_match()
+ {
+ this->found_partial_match_ = true;
+ return true;
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// memento
+//
+template<typename BidiIter>
+struct memento
+{
+ sub_match_impl<BidiIter> *old_sub_matches_;
+ std::size_t nested_results_count_;
+ actionable const *action_list_head_;
+ actionable const **action_list_tail_;
+ attr_context attr_context_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// save_sub_matches
+//
+template<typename BidiIter>
+inline memento<BidiIter> save_sub_matches(match_state<BidiIter> &state)
+{
+ memento<BidiIter> mem =
+ {
+ state.extras_->sub_match_stack_.push_sequence(state.mark_count_, no_fill)
+ , state.context_.results_ptr_->nested_results().size()
+ , state.action_list_.next
+ , state.action_list_tail_
+ , state.attr_context_
+ };
+ state.action_list_.next = 0;
+ state.action_list_tail_ = &state.action_list_.next;
+ std::copy(state.sub_matches_, state.sub_matches_ + state.mark_count_, mem.old_sub_matches_);
+ return mem;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// restore_action_queue
+//
+template<typename BidiIter>
+inline void restore_action_queue(memento<BidiIter> const &mem, match_state<BidiIter> &state)
+{
+ state.action_list_.next = mem.action_list_head_;
+ state.action_list_tail_ = mem.action_list_tail_;
+ *state.action_list_tail_ = 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// restore_sub_matches
+//
+template<typename BidiIter>
+inline void restore_sub_matches(memento<BidiIter> const &mem, match_state<BidiIter> &state)
+{
+ typedef core_access<BidiIter> access;
+ nested_results<BidiIter> &nested = access::get_nested_results(*state.context_.results_ptr_);
+ std::size_t count = nested.size() - mem.nested_results_count_;
+ state.extras_->results_cache_.reclaim_last_n(nested, count);
+ std::copy(mem.old_sub_matches_, mem.old_sub_matches_ + state.mark_count_, state.sub_matches_);
+ state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_);
+ state.attr_context_ = mem.attr_context_;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// reclaim_sub_matches
+//
+template<typename BidiIter>
+inline void reclaim_sub_matches(memento<BidiIter> const &mem, match_state<BidiIter> &state, bool success)
+{
+ std::size_t count = state.context_.results_ptr_->nested_results().size() - mem.nested_results_count_;
+ if(count == 0)
+ {
+ state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_);
+ }
+ // else we have we must orphan this block of backrefs because we are using the stack
+ // space above it.
+
+ if(!success)
+ {
+ state.attr_context_ = mem.attr_context_;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// traits_cast
+//
+template<typename Traits, typename BidiIter>
+inline Traits const &traits_cast(match_state<BidiIter> const &state)
+{
+ return state.template get_traits<Traits>();
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/sub_match_impl.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/sub_match_impl.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////
+// sub_match_impl.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_SUB_MATCH_IMPL_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_SUB_MATCH_IMPL_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/sub_match.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+// TODO: sub_match_impl is a POD IFF BidiIter is POD. Pool allocation
+// of them can be made more efficient if they are. Or maybe all they
+// need is trivial constructor/destructor. (???)
+
+///////////////////////////////////////////////////////////////////////////////
+// sub_match_impl
+//
+template<typename BidiIter>
+struct sub_match_impl
+ : sub_match<BidiIter>
+{
+ unsigned int repeat_count_;
+ BidiIter begin_;
+ bool zero_width_;
+
+ sub_match_impl()
+ : sub_match<BidiIter>()
+ , repeat_count_(0)
+ , begin_()
+ , zero_width_(false)
+ {
+ }
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/sub_match_vector.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/core/sub_match_vector.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,171 @@
+///////////////////////////////////////////////////////////////////////////////
+// sub_match_vector.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CORE_SUB_MATCH_VECTOR_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CORE_SUB_MATCH_VECTOR_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/noncopyable.hpp>
+#include <boost/iterator_adaptors.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/sub_match_impl.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+#if BOOST_ITERATOR_ADAPTORS_VERSION >= 0x0200
+
+//////////////////////////////////////////////////////////////////////////
+// sub_match_iterator
+//
+template<typename Value, typename MainIter>
+struct sub_match_iterator
+ : iterator_adaptor
+ <
+ sub_match_iterator<Value, MainIter>
+ , MainIter
+ , Value
+ , std::random_access_iterator_tag
+ >
+{
+ typedef iterator_adaptor
+ <
+ sub_match_iterator<Value, MainIter>
+ , MainIter
+ , Value
+ , std::random_access_iterator_tag
+ > base_t;
+
+ sub_match_iterator(MainIter baseiter)
+ : base_t(baseiter)
+ {
+ }
+};
+
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// sub_match_vector
+//
+template<typename BidiIter>
+struct sub_match_vector
+ : private noncopyable
+{
+private:
+ struct dummy { int i_; };
+ typedef int dummy::*bool_type;
+
+public:
+ typedef sub_match<BidiIter> value_type;
+ typedef std::size_t size_type;
+ typedef value_type const &const_reference;
+ typedef const_reference reference;
+ typedef typename iterator_difference<BidiIter>::type difference_type;
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef typename sub_match<BidiIter>::string_type string_type;
+
+#if BOOST_ITERATOR_ADAPTORS_VERSION >= 0x0200
+
+ typedef sub_match_iterator
+ <
+ value_type const
+ , sub_match_impl<BidiIter> const *
+ > const_iterator;
+
+#else
+
+ typedef iterator_adaptor
+ <
+ sub_match_impl<BidiIter> const *
+ , default_iterator_policies
+ , value_type
+ , value_type const &
+ , value_type const *
+ > const_iterator;
+
+#endif // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200
+
+ typedef const_iterator iterator;
+
+ sub_match_vector()
+ : size_(0)
+ , sub_matches_(0)
+ {
+ }
+
+ const_reference operator [](size_type index) const
+ {
+ static value_type const s_null;
+ return (index >= this->size_)
+ ? s_null
+ : *static_cast<value_type const *>(&this->sub_matches_[ index ]);
+ }
+
+ size_type size() const
+ {
+ return this->size_;
+ }
+
+ bool empty() const
+ {
+ return 0 == this->size();
+ }
+
+ const_iterator begin() const
+ {
+ return const_iterator(this->sub_matches_);
+ }
+
+ const_iterator end() const
+ {
+ return const_iterator(this->sub_matches_ + this->size_);
+ }
+
+ operator bool_type() const
+ {
+ return (!this->empty() && (*this)[0].matched) ? &dummy::i_ : 0;
+ }
+
+ bool operator !() const
+ {
+ return this->empty() || !(*this)[0].matched;
+ }
+
+ void swap(sub_match_vector<BidiIter> &that)
+ {
+ std::swap(this->size_, that.size_);
+ std::swap(this->sub_matches_, that.sub_matches_);
+ }
+
+private:
+ friend struct detail::core_access<BidiIter>;
+
+ void init_(sub_match_impl<BidiIter> *sub_matches, size_type size)
+ {
+ this->size_ = size;
+ this->sub_matches_ = sub_matches;
+ }
+
+ void init_(sub_match_impl<BidiIter> *sub_matches, size_type size, sub_match_vector<BidiIter> const &that)
+ {
+ BOOST_ASSERT(size == that.size_);
+ this->size_ = size;
+ this->sub_matches_ = sub_matches;
+ std::copy(that.sub_matches_, that.sub_matches_ + that.size_, this->sub_matches_);
+ }
+
+ size_type size_;
+ sub_match_impl<BidiIter> *sub_matches_;
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/detail_fwd.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/detail_fwd.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,482 @@
+///////////////////////////////////////////////////////////////////////////////
+// detail_fwd.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_DETAIL_FWD_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_DETAIL_FWD_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <map>
+#include <string>
+#include <vector>
+#include <climits> // for INT_MAX
+#include <typeinfo>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/size_t.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/xpressive/xpressive_fwd.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ typedef unsigned int uint_t;
+
+ template<uint_t Min, uint_t Max = Min>
+ struct generic_quant_tag;
+
+ struct modifier_tag;
+
+ struct check_tag;
+
+ typedef mpl::size_t<INT_MAX / 2 - 1> unknown_width;
+
+ struct type_info_less;
+
+ typedef std::map<std::type_info const *, void *, type_info_less> action_args_type;
+
+ struct action_context;
+
+ template<typename BidiIter>
+ struct replacement_context;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // placeholders
+ //
+ struct mark_placeholder;
+
+ struct posix_charset_placeholder;
+
+ template<typename Cond>
+ struct assert_word_placeholder;
+
+ template<typename Char>
+ struct range_placeholder;
+
+ struct assert_bol_placeholder;
+
+ struct assert_eol_placeholder;
+
+ struct logical_newline_placeholder;
+
+ struct self_placeholder;
+
+ template<typename Nbr>
+ struct attribute_placeholder;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // matchers
+ //
+ struct end_matcher;
+
+ struct independent_end_matcher;
+
+ struct assert_bos_matcher;
+
+ struct assert_eos_matcher;
+
+ template<typename Traits>
+ struct assert_bol_matcher;
+
+ template<typename Traits>
+ struct assert_eol_matcher;
+
+ template<typename Cond, typename Traits>
+ struct assert_word_matcher;
+
+ struct true_matcher;
+
+ template<typename Alternates, typename Traits>
+ struct alternate_matcher;
+
+ struct alternate_end_matcher;
+
+ template<typename Traits>
+ struct posix_charset_matcher;
+
+ template<typename BidiIter>
+ struct sequence;
+
+ template<typename Traits, typename ICase>
+ struct mark_matcher;
+
+ struct mark_begin_matcher;
+
+ struct mark_end_matcher;
+
+ template<typename BidiIter>
+ struct regex_matcher;
+
+ template<typename BidiIter>
+ struct regex_byref_matcher;
+
+ template<typename Traits>
+ struct compound_charset;
+
+ template<typename Traits, typename ICase, typename CharSet = compound_charset<Traits> >
+ struct charset_matcher;
+
+ template<typename Traits, typename ICase>
+ struct range_matcher;
+
+ template<typename Traits, typename Size>
+ struct set_matcher;
+
+ template<typename Xpr, typename Greedy>
+ struct simple_repeat_matcher;
+
+ struct repeat_begin_matcher;
+
+ template<typename Greedy>
+ struct repeat_end_matcher;
+
+ template<typename Traits, typename ICase, typename Not>
+ struct literal_matcher;
+
+ template<typename Traits, typename ICase>
+ struct string_matcher;
+
+ template<typename Actor>
+ struct action_matcher;
+
+ template<typename Predicate>
+ struct predicate_matcher;
+
+ template<typename Xpr, typename Greedy>
+ struct optional_matcher;
+
+ template<typename Xpr, typename Greedy>
+ struct optional_mark_matcher;
+
+ template<typename Matcher, typename Traits, typename ICase>
+ struct attr_matcher;
+
+ template<typename Nbr>
+ struct attr_begin_matcher;
+
+ struct attr_end_matcher;
+
+ template<typename Xpr>
+ struct is_modifiable;
+
+ template<typename Head, typename Tail>
+ struct alternates_list;
+
+ template<typename Modifier>
+ struct modifier_op;
+
+ struct icase_modifier;
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct xpression_visitor;
+
+ template<typename BidiIter>
+ struct regex_impl;
+
+ struct epsilon_matcher;
+
+ template<typename BidiIter>
+ struct nested_results;
+
+ template<typename BidiIter>
+ struct regex_id_filter_predicate;
+
+ template<typename Xpr>
+ struct keeper_matcher;
+
+ template<typename Xpr>
+ struct lookahead_matcher;
+
+ template<typename Xpr>
+ struct lookbehind_matcher;
+
+ template<typename IsBoundary>
+ struct word_boundary;
+
+ template<typename BidiIter, typename Matcher>
+ sequence<BidiIter> make_dynamic(Matcher const &matcher);
+
+ template<typename Char>
+ struct xpression_linker;
+
+ template<typename Char>
+ struct xpression_peeker;
+
+ struct any_matcher;
+
+ template<typename Traits>
+ struct logical_newline_matcher;
+
+ typedef proto::terminal<logical_newline_placeholder>::type logical_newline_xpression;
+
+ struct set_initializer;
+
+ typedef proto::terminal<set_initializer>::type set_initializer_type;
+
+ struct lookahead_tag;
+
+ struct lookbehind_tag;
+
+ struct keeper_tag;
+
+ template<typename Locale>
+ struct locale_modifier;
+
+ template<typename Matcher>
+ struct matcher_wrapper;
+
+ template<typename Locale, typename BidiIter>
+ struct regex_traits_type;
+
+ template<typename Expr>
+ struct let_;
+
+ template<typename Args, typename BidiIter>
+ void bind_args(let_<Args> const &, match_results<BidiIter> &);
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Misc.
+ struct no_next;
+
+ template<typename BidiIter>
+ struct core_access;
+
+ template<typename BidiIter>
+ struct match_state;
+
+ template<typename BidiIter>
+ struct matchable;
+
+ template<typename BidiIter>
+ struct matchable_ex;
+
+ template<typename Matcher, typename BidiIter>
+ struct dynamic_xpression;
+
+ template<typename BidiIter>
+ struct shared_matchable;
+
+ template<typename BidiIter>
+ struct alternates_vector;
+
+ template<typename Matcher, typename Next>
+ struct static_xpression;
+
+ typedef static_xpression<end_matcher, no_next> end_xpression;
+
+ typedef static_xpression<alternate_end_matcher, no_next> alternate_end_xpression;
+
+ typedef static_xpression<independent_end_matcher, no_next> independent_end_xpression;
+
+ typedef static_xpression<true_matcher, no_next> true_xpression;
+
+ template<typename Matcher, typename Next = end_xpression>
+ struct static_xpression;
+
+ template<typename Top, typename Next>
+ struct stacked_xpression;
+
+ template<typename Xpr>
+ struct is_static_xpression;
+
+ template<typename BidiIter>
+ struct sub_match_impl;
+
+ template<typename BidiIter>
+ struct results_cache;
+
+ template<typename T>
+ struct sequence_stack;
+
+ template<typename BidiIter>
+ struct results_extras;
+
+ template<typename BidiIter>
+ struct match_context;
+
+ template<typename BidiIter>
+ struct sub_match_vector;
+
+ template<typename T, typename U>
+ struct action_arg;
+
+ struct actionable;
+
+ template<typename Char>
+ struct traits;
+
+ template<typename Traits, typename BidiIter>
+ Traits const &traits_cast(match_state<BidiIter> const &state);
+
+ template<typename Char>
+ struct basic_chset;
+
+ template<typename Char>
+ struct named_mark;
+
+ template<typename BidiIter>
+ struct memento;
+
+ template<typename Char, typename Traits>
+ void set_char(compound_charset<Traits> &chset, Char ch, Traits const &traits, bool icase);
+
+ template<typename Char, typename Traits>
+ void set_range(compound_charset<Traits> &chset, Char from, Char to, Traits const &traits, bool icase);
+
+ template<typename Traits>
+ void set_class(compound_charset<Traits> &chset, typename Traits::char_class_type char_class, bool no, Traits const &traits);
+
+ template<typename Char, typename Traits>
+ void set_char(basic_chset<Char> &chset, Char ch, Traits const &traits, bool icase);
+
+ template<typename Char, typename Traits>
+ void set_range(basic_chset<Char> &chset, Char from, Char to, Traits const &traits, bool icase);
+
+ template<typename Char, typename Traits>
+ void set_class(basic_chset<Char> &chset, typename Traits::char_class_type char_class, bool no, Traits const &traits);
+
+ template<typename Matcher>
+ static_xpression<Matcher> const
+ make_static(Matcher const &matcher);
+
+ template<typename Matcher, typename Next>
+ static_xpression<Matcher, Next> const
+ make_static(Matcher const &matcher, Next const &next);
+
+ int get_mark_number(basic_mark_tag const &);
+
+ template<typename Xpr, typename BidiIter>
+ void static_compile(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl);
+
+ struct quant_spec;
+
+ template<typename BidiIter, typename Xpr>
+ void make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq, Xpr const &xpr);
+
+ template<typename BidiIter>
+ void make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq);
+
+ template<typename BidiIter>
+ void make_repeat(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr);
+
+ template<typename BidiIter>
+ void make_repeat(quant_spec const &spec, sequence<BidiIter> &seq);
+
+ template<typename BidiIter>
+ void make_optional(quant_spec const &spec, sequence<BidiIter> &seq);
+
+ template<typename BidiIter>
+ void make_optional(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr);
+
+ template<typename Char>
+ struct string_type
+ {
+ typedef std::vector<Char> type;
+ };
+
+ template<>
+ struct string_type<char>
+ {
+ typedef std::string type;
+ };
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ template<>
+ struct string_type<wchar_t>
+ {
+ typedef std::wstring type;
+ };
+ #endif
+
+}}} // namespace boost::xpressive::detail
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+ using proto::_;
+ using proto::or_;
+ using proto::if_;
+ using proto::call;
+ using proto::when;
+ using proto::otherwise;
+ using proto::switch_;
+ using proto::make;
+ using proto::_arg;
+ using proto::_left;
+ using proto::_right;
+ using proto::not_;
+ using proto::_state;
+ using proto::_visitor;
+ using proto::callable;
+ using proto::fold;
+ using proto::reverse_fold;
+ using proto::fold_tree;
+ using proto::reverse_fold_tree;
+ using proto::terminal;
+ using proto::shift_right;
+ using proto::bitwise_or;
+ using proto::logical_not;
+ using proto::dereference;
+ using proto::posit;
+ using proto::negate;
+ using proto::complement;
+ using proto::comma;
+ using proto::assign;
+ using proto::subscript;
+ using proto::nary_expr;
+ using proto::unary_expr;
+ using proto::binary_expr;
+ using proto::_deep_copy;
+ using proto::vararg;
+ namespace tag = proto::tag;
+}}}
+
+namespace boost { namespace xpressive { namespace op
+{
+ struct push;
+ struct push_back;
+ struct pop;
+ struct push_front;
+ struct pop_back;
+ struct pop_front;
+ struct back;
+ struct front;
+ struct top;
+ struct first;
+ struct second;
+ struct matched;
+ struct length;
+ struct str;
+ struct insert;
+ struct make_pair;
+
+ template<typename T>
+ struct as;
+ template<typename T>
+ struct static_cast_;
+ template<typename T>
+ struct dynamic_cast_;
+ template<typename T>
+ struct const_cast_;
+ template<typename T>
+ struct construct;
+ template<typename T>
+ struct throw_;
+}}} // namespace boost::xpressive::op
+
+/// INTERNAL ONLY
+namespace boost { namespace xpressive
+{
+
+ /// INTERNAL ONLY
+ template<typename Traits, std::size_t N>
+ typename Traits::char_class_type
+ lookup_classname(Traits const &traits, char const (&cname)[N], bool icase = false);
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/dynamic.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/dynamic.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,337 @@
+///////////////////////////////////////////////////////////////////////////////
+// dynamic.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_DYNAMIC_DYNAMIC_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_DYNAMIC_DYNAMIC_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <vector>
+#include <utility>
+#include <algorithm>
+#include <boost/assert.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/dynamic/matchable.hpp>
+#include <boost/xpressive/detail/dynamic/sequence.hpp>
+#include <boost/xpressive/detail/core/icase.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// invalid_xpression
+template<typename BidiIter>
+struct invalid_xpression
+ : matchable_ex<BidiIter>
+{
+ invalid_xpression()
+ : matchable_ex<BidiIter>()
+ {
+ intrusive_ptr_add_ref(this); // keep alive forever
+ }
+
+ bool match(match_state<BidiIter> &) const
+ {
+ BOOST_ASSERT(false);
+ return false;
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// get_invalid_xpression
+template<typename BidiIter>
+inline shared_matchable<BidiIter> const &get_invalid_xpression()
+{
+ static invalid_xpression<BidiIter> const invalid_xpr;
+ static intrusive_ptr<matchable_ex<BidiIter> const> const invalid_ptr(&invalid_xpr);
+ static shared_matchable<BidiIter> const invalid_matchable(invalid_ptr);
+ return invalid_matchable;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// dynamic_xpression
+template<typename Matcher, typename BidiIter>
+struct dynamic_xpression
+ : Matcher
+ , matchable_ex<BidiIter>
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
+ dynamic_xpression(Matcher const &matcher = Matcher())
+ : Matcher(matcher)
+ , next_(get_invalid_xpression<BidiIter>())
+ {
+ }
+
+ virtual bool match(match_state<BidiIter> &state) const
+ {
+ return this->Matcher::match(state, *this->next_.matchable());
+ }
+
+ virtual void link(xpression_linker<char_type> &linker) const
+ {
+ linker.accept(*static_cast<Matcher const *>(this), this->next_.matchable().get());
+ this->next_.link(linker);
+ }
+
+ virtual void peek(xpression_peeker<char_type> &peeker) const
+ {
+ this->peek_next_(peeker.accept(*static_cast<Matcher const *>(this)), peeker);
+ }
+
+ virtual void repeat(quant_spec const &spec, sequence<BidiIter> &seq) const
+ {
+ this->repeat_(spec, seq, quant_type<Matcher>(), is_same<Matcher, mark_begin_matcher>());
+ }
+
+private:
+ friend struct sequence<BidiIter>;
+
+ void peek_next_(mpl::true_, xpression_peeker<char_type> &peeker) const
+ {
+ this->next_.peek(peeker);
+ }
+
+ void peek_next_(mpl::false_, xpression_peeker<char_type> &) const
+ {
+ // no-op
+ }
+
+ void repeat_(quant_spec const &spec, sequence<BidiIter> &seq, mpl::int_<quant_none>, mpl::false_) const
+ {
+ if(quant_none == seq.quant())
+ {
+ boost::throw_exception(
+ regex_error(regex_constants::error_badrepeat, "expression cannot be quantified")
+ );
+ }
+ else
+ {
+ this->repeat_(spec, seq, mpl::int_<quant_variable_width>(), mpl::false_());
+ }
+ }
+
+ void repeat_(quant_spec const &spec, sequence<BidiIter> &seq, mpl::int_<quant_fixed_width>, mpl::false_) const
+ {
+ if(this->next_ == get_invalid_xpression<BidiIter>())
+ {
+ make_simple_repeat(spec, seq, matcher_wrapper<Matcher>(*this));
+ }
+ else
+ {
+ this->repeat_(spec, seq, mpl::int_<quant_variable_width>(), mpl::false_());
+ }
+ }
+
+ void repeat_(quant_spec const &spec, sequence<BidiIter> &seq, mpl::int_<quant_variable_width>, mpl::false_) const
+ {
+ if(!is_unknown(seq.width()) && seq.pure())
+ {
+ make_simple_repeat(spec, seq);
+ }
+ else
+ {
+ make_repeat(spec, seq);
+ }
+ }
+
+ void repeat_(quant_spec const &spec, sequence<BidiIter> &seq, mpl::int_<quant_fixed_width>, mpl::true_) const
+ {
+ make_repeat(spec, seq, this->mark_number_);
+ }
+
+ shared_matchable<BidiIter> next_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// make_dynamic
+template<typename BidiIter, typename Matcher>
+inline sequence<BidiIter> make_dynamic(Matcher const &matcher)
+{
+ typedef dynamic_xpression<Matcher, BidiIter> xpression_type;
+ intrusive_ptr<xpression_type> xpr(new xpression_type(matcher));
+ return sequence<BidiIter>(xpr);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// alternates_vector
+template<typename BidiIter>
+struct alternates_vector
+ : std::vector<shared_matchable<BidiIter> >
+{
+ BOOST_STATIC_CONSTANT(std::size_t, width = unknown_width::value);
+ BOOST_STATIC_CONSTANT(bool, pure = false);
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// matcher_wrapper
+template<typename Matcher>
+struct matcher_wrapper
+ : Matcher
+{
+ matcher_wrapper(Matcher const &matcher = Matcher())
+ : Matcher(matcher)
+ {
+ }
+
+ template<typename BidiIter>
+ bool match(match_state<BidiIter> &state) const
+ {
+ return this->Matcher::match(state, matcher_wrapper<true_matcher>());
+ }
+
+ template<typename Char>
+ void link(xpression_linker<Char> &linker) const
+ {
+ linker.accept(*static_cast<Matcher const *>(this), 0);
+ }
+
+ template<typename Char>
+ void peek(xpression_peeker<Char> &peeker) const
+ {
+ peeker.accept(*static_cast<Matcher const *>(this));
+ }
+};
+
+//////////////////////////////////////////////////////////////////////////
+// make_simple_repeat
+template<typename BidiIter, typename Xpr>
+inline void
+make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq, Xpr const &xpr)
+{
+ if(spec.greedy_)
+ {
+ simple_repeat_matcher<Xpr, mpl::true_> quant(xpr, spec.min_, spec.max_, seq.width().value());
+ seq = make_dynamic<BidiIter>(quant);
+ }
+ else
+ {
+ simple_repeat_matcher<Xpr, mpl::false_> quant(xpr, spec.min_, spec.max_, seq.width().value());
+ seq = make_dynamic<BidiIter>(quant);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// make_simple_repeat
+template<typename BidiIter>
+inline void
+make_simple_repeat(quant_spec const &spec, sequence<BidiIter> &seq)
+{
+ seq += make_dynamic<BidiIter>(true_matcher());
+ make_simple_repeat(spec, seq, seq.xpr());
+}
+
+//////////////////////////////////////////////////////////////////////////
+// make_optional
+template<typename BidiIter>
+inline void
+make_optional(quant_spec const &spec, sequence<BidiIter> &seq)
+{
+ typedef shared_matchable<BidiIter> xpr_type;
+ seq += make_dynamic<BidiIter>(alternate_end_matcher());
+ if(spec.greedy_)
+ {
+ optional_matcher<xpr_type, mpl::true_> opt(seq.xpr());
+ seq = make_dynamic<BidiIter>(opt);
+ }
+ else
+ {
+ optional_matcher<xpr_type, mpl::false_> opt(seq.xpr());
+ seq = make_dynamic<BidiIter>(opt);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// make_optional
+template<typename BidiIter>
+inline void
+make_optional(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr)
+{
+ typedef shared_matchable<BidiIter> xpr_type;
+ seq += make_dynamic<BidiIter>(alternate_end_matcher());
+ if(spec.greedy_)
+ {
+ optional_mark_matcher<xpr_type, mpl::true_> opt(seq.xpr(), mark_nbr);
+ seq = make_dynamic<BidiIter>(opt);
+ }
+ else
+ {
+ optional_mark_matcher<xpr_type, mpl::false_> opt(seq.xpr(), mark_nbr);
+ seq = make_dynamic<BidiIter>(opt);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// make_repeat
+template<typename BidiIter>
+inline void
+make_repeat(quant_spec const &spec, sequence<BidiIter> &seq)
+{
+ // only bother creating a repeater if max is greater than one
+ if(1 < spec.max_)
+ {
+ // create a hidden mark so this expression can be quantified
+ int mark_nbr = -static_cast<int>(++*spec.hidden_mark_count_);
+ seq = make_dynamic<BidiIter>(mark_begin_matcher(mark_nbr)) + seq
+ + make_dynamic<BidiIter>(mark_end_matcher(mark_nbr));
+ make_repeat(spec, seq, mark_nbr);
+ return;
+ }
+
+ // if min is 0, the repeat must be made optional
+ if(0 == spec.min_)
+ {
+ make_optional(spec, seq);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+// make_repeat
+template<typename BidiIter>
+inline void
+make_repeat(quant_spec const &spec, sequence<BidiIter> &seq, int mark_nbr)
+{
+ BOOST_ASSERT(spec.max_); // we should never get here if max is 0
+
+ // only bother creating a repeater if max is greater than one
+ if(1 < spec.max_)
+ {
+ // TODO: statically bind the repeat matchers to the mark matchers for better perf
+ unsigned int min = spec.min_ ? spec.min_ : 1U;
+ repeat_begin_matcher repeat_begin(mark_nbr);
+ if(spec.greedy_)
+ {
+ repeat_end_matcher<mpl::true_> repeat_end(mark_nbr, min, spec.max_);
+ seq = make_dynamic<BidiIter>(repeat_begin) + seq
+ + make_dynamic<BidiIter>(repeat_end);
+ }
+ else
+ {
+ repeat_end_matcher<mpl::false_> repeat_end(mark_nbr, min, spec.max_);
+ seq = make_dynamic<BidiIter>(repeat_begin) + seq
+ + make_dynamic<BidiIter>(repeat_end);
+ }
+ }
+
+ // if min is 0, the repeat must be made optional
+ if(0 == spec.min_)
+ {
+ make_optional(spec, seq, mark_nbr);
+ }
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/matchable.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/matchable.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,177 @@
+///////////////////////////////////////////////////////////////////////////////
+// matchable.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_DYNAMIC_MATCHABLE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_DYNAMIC_MATCHABLE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/utility/counted_base.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/dynamic/sequence.hpp>
+#include <boost/xpressive/regex_error.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+//////////////////////////////////////////////////////////////////////////
+// quant_spec
+struct quant_spec
+{
+ unsigned int min_;
+ unsigned int max_;
+ bool greedy_;
+ std::size_t *hidden_mark_count_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// matchable
+template<typename BidiIter>
+struct matchable
+{
+ typedef BidiIter iterator_type;
+ typedef typename iterator_value<iterator_type>::type char_type;
+ virtual ~matchable() {}
+ virtual bool match(match_state<BidiIter> &state) const = 0;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// matchable_ex
+template<typename BidiIter>
+struct matchable_ex
+ : matchable<BidiIter>
+ , counted_base<matchable_ex<BidiIter> >
+{
+ typedef BidiIter iterator_type;
+ typedef typename iterator_value<iterator_type>::type char_type;
+
+ virtual void link(xpression_linker<char_type> &) const
+ {
+ }
+
+ virtual void peek(xpression_peeker<char_type> &peeker) const
+ {
+ peeker.fail();
+ }
+
+ virtual void repeat(quant_spec const &, sequence<BidiIter> &) const
+ {
+ boost::throw_exception(
+ regex_error(regex_constants::error_badrepeat, "expression cannot be quantified")
+ );
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+ // The following 4 functions (push_match, top_match, pop_match and skip_match) are
+ // used to implement looping and branching across the matchers. Call push_match to record
+ // a position. Then, another matcher further down the xpression chain has the
+ // option to call either top_match, pop_match or skip_match. top_match and pop_match will
+ // jump back to the place recorded by push_match, whereas skip_match will skip the jump and
+ // pass execution down the xpression chain. top_match will leave the xpression on top of the
+ // stack, whereas pop_match will remove it. Each function comes in 2 flavors: one for
+ // statically bound xpressions and one for dynamically bound xpressions.
+ //
+
+ template<typename Top>
+ bool push_match(match_state<BidiIter> &state) const
+ {
+ BOOST_MPL_ASSERT((is_same<Top, matchable_ex<BidiIter> >));
+ return this->match(state);
+ }
+
+ static bool top_match(match_state<BidiIter> &state, void const *top)
+ {
+ return static_cast<matchable_ex<BidiIter> const *>(top)->match(state);
+ }
+
+ static bool pop_match(match_state<BidiIter> &state, void const *top)
+ {
+ return static_cast<matchable_ex<BidiIter> const *>(top)->match(state);
+ }
+
+ bool skip_match(match_state<BidiIter> &state) const
+ {
+ return this->match(state);
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// shared_matchable
+template<typename BidiIter>
+struct shared_matchable
+{
+ typedef BidiIter iterator_type;
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef intrusive_ptr<matchable_ex<BidiIter> const> matchable_ptr;
+
+ BOOST_STATIC_CONSTANT(std::size_t, width = unknown_width::value);
+ BOOST_STATIC_CONSTANT(bool, pure = false);
+
+ shared_matchable(matchable_ptr const &xpr = matchable_ptr())
+ : xpr_(xpr)
+ {
+ }
+
+ bool operator !() const
+ {
+ return !this->xpr_;
+ }
+
+ friend bool operator ==(shared_matchable<BidiIter> const &left, shared_matchable<BidiIter> const &right)
+ {
+ return left.xpr_ == right.xpr_;
+ }
+
+ friend bool operator !=(shared_matchable<BidiIter> const &left, shared_matchable<BidiIter> const &right)
+ {
+ return left.xpr_ != right.xpr_;
+ }
+
+ matchable_ptr const &matchable() const
+ {
+ return this->xpr_;
+ }
+
+ bool match(match_state<BidiIter> &state) const
+ {
+ return this->xpr_->match(state);
+ }
+
+ void link(xpression_linker<char_type> &linker) const
+ {
+ this->xpr_->link(linker);
+ }
+
+ void peek(xpression_peeker<char_type> &peeker) const
+ {
+ this->xpr_->peek(peeker);
+ }
+
+ // BUGBUG yuk!
+ template<typename Top>
+ bool push_match(match_state<BidiIter> &state) const
+ {
+ BOOST_MPL_ASSERT((is_same<Top, matchable_ex<BidiIter> >));
+ return this->match(state);
+ }
+
+private:
+ matchable_ptr xpr_;
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parse_charset.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parse_charset.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,365 @@
+///////////////////////////////////////////////////////////////////////////////
+// parse_charset.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_DYNAMIC_PARSE_CHARSET_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_DYNAMIC_PARSE_CHARSET_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/integer.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/numeric/conversion/converter.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/dynamic/parser_enum.hpp>
+#include <boost/xpressive/detail/utility/literals.hpp>
+#include <boost/xpressive/detail/utility/chset/chset.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+enum escape_type
+{
+ escape_char
+ , escape_mark
+ , escape_class
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// escape_value
+//
+template<typename Char, typename Class>
+struct escape_value
+{
+ Char ch_;
+ int mark_nbr_;
+ Class class_;
+ escape_type type_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// char_overflow_handler
+//
+struct char_overflow_handler
+{
+ void operator ()(numeric::range_check_result result) const // throw(regex_error)
+ {
+ if(numeric::cInRange != result)
+ {
+ boost::throw_exception(
+ regex_error(
+ regex_constants::error_escape
+ , "character escape too large to fit in target character type"
+ )
+ );
+ }
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// parse_escape
+//
+template<typename FwdIter, typename CompilerTraits>
+escape_value<typename iterator_value<FwdIter>::type, typename CompilerTraits::regex_traits::char_class_type>
+parse_escape(FwdIter &begin, FwdIter end, CompilerTraits &traits)
+{
+ using namespace regex_constants;
+ typedef typename iterator_value<FwdIter>::type char_type;
+ typedef typename CompilerTraits::regex_traits regex_traits;
+ typedef typename regex_traits::char_class_type char_class_type;
+
+ // define an unsigned type the same size as char_type
+ typedef typename boost::uint_t<CHAR_BIT * sizeof(char_type)>::least uchar_t;
+ BOOST_MPL_ASSERT_RELATION(sizeof(uchar_t), ==, sizeof(char_type));
+ typedef numeric::conversion_traits<uchar_t, int> converstion_traits;
+
+ ensure(begin != end, error_escape, "unexpected end of pattern found");
+ numeric::converter<int, uchar_t, converstion_traits, char_overflow_handler> converter;
+ escape_value<char_type,char_class_type> esc = { 0, 0, 0, escape_char };
+ bool const icase = (0 != (regex_constants::icase_ & traits.flags()));
+ regex_traits const &rxtraits = traits.traits();
+ FwdIter tmp;
+
+ esc.class_ = rxtraits.lookup_classname(begin, begin + 1, icase);
+ if(0 != esc.class_)
+ {
+ esc.type_ = escape_class;
+ return esc;
+ }
+
+ if(-1 != rxtraits.value(*begin, 8))
+ {
+ esc.ch_ = converter(toi(begin, end, rxtraits, 8, 0777));
+ return esc;
+ }
+
+ switch(*begin)
+ {
+ // bell character
+ case BOOST_XPR_CHAR_(char_type, 'a'):
+ esc.ch_ = BOOST_XPR_CHAR_(char_type, '\a');
+ ++begin;
+ break;
+ // escape character
+ case BOOST_XPR_CHAR_(char_type, 'e'):
+ esc.ch_ = converter(27);
+ ++begin;
+ break;
+ // control character
+ case BOOST_XPR_CHAR_(char_type, 'c'):
+ ensure(++begin != end, error_escape, "unexpected end of pattern found");
+ ensure
+ (
+ rxtraits.in_range(BOOST_XPR_CHAR_(char_type, 'a'), BOOST_XPR_CHAR_(char_type, 'z'), *begin)
+ || rxtraits.in_range(BOOST_XPR_CHAR_(char_type, 'A'), BOOST_XPR_CHAR_(char_type, 'Z'), *begin)
+ , error_escape
+ , "invalid escape control letter; must be one of a-z or A-Z"
+ );
+ // Convert to character according to ECMA-262, section 15.10.2.10:
+ esc.ch_ = converter(*begin % 32);
+ ++begin;
+ break;
+ // formfeed character
+ case BOOST_XPR_CHAR_(char_type, 'f'):
+ esc.ch_ = BOOST_XPR_CHAR_(char_type, '\f');
+ ++begin;
+ break;
+ // newline
+ case BOOST_XPR_CHAR_(char_type, 'n'):
+ esc.ch_ = BOOST_XPR_CHAR_(char_type, '\n');
+ ++begin;
+ break;
+ // return
+ case BOOST_XPR_CHAR_(char_type, 'r'):
+ esc.ch_ = BOOST_XPR_CHAR_(char_type, '\r');
+ ++begin;
+ break;
+ // horizontal tab
+ case BOOST_XPR_CHAR_(char_type, 't'):
+ esc.ch_ = BOOST_XPR_CHAR_(char_type, '\t');
+ ++begin;
+ break;
+ // vertical tab
+ case BOOST_XPR_CHAR_(char_type, 'v'):
+ esc.ch_ = BOOST_XPR_CHAR_(char_type, '\v');
+ ++begin;
+ break;
+ // hex escape sequence
+ case BOOST_XPR_CHAR_(char_type, 'x'):
+ ensure(++begin != end, error_escape, "unexpected end of pattern found");
+ tmp = begin;
+ esc.ch_ = converter(toi(begin, end, rxtraits, 16, 0xff));
+ ensure(2 == std::distance(tmp, begin), error_escape, "invalid hex escape : "
+ "must be \\x HexDigit HexDigit");
+ break;
+ // Unicode escape sequence
+ case BOOST_XPR_CHAR_(char_type, 'u'):
+ ensure(++begin != end, error_escape, "unexpected end of pattern found");
+ tmp = begin;
+ esc.ch_ = converter(toi(begin, end, rxtraits, 16, 0xffff));
+ ensure(4 == std::distance(tmp, begin), error_escape, "invalid Unicode escape : "
+ "must be \\u HexDigit HexDigit HexDigit HexDigit");
+ break;
+ // backslash
+ case BOOST_XPR_CHAR_(char_type, '\\'):
+ //esc.ch_ = BOOST_XPR_CHAR_(char_type, '\\');
+ //++begin;
+ //break;
+ // all other escaped characters represent themselves
+ default:
+ esc.ch_ = *begin;
+ ++begin;
+ break;
+ }
+
+ return esc;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// parse_charset
+//
+template<typename FwdIter, typename RegexTraits, typename CompilerTraits>
+inline void parse_charset
+(
+ FwdIter &begin
+ , FwdIter end
+ , compound_charset<RegexTraits> &chset
+ , CompilerTraits &traits
+)
+{
+ using namespace regex_constants;
+ typedef typename RegexTraits::char_type char_type;
+ typedef typename RegexTraits::char_class_type char_class_type;
+ BOOST_ASSERT(begin != end);
+ RegexTraits const &rxtraits = traits.traits();
+ bool const icase = (0 != (regex_constants::icase_ & traits.flags()));
+ FwdIter iprev = FwdIter();
+ escape_value<char_type, char_class_type> esc = {0, 0, 0, escape_char};
+ bool invert = false;
+
+ // check to see if we have an inverse charset
+ if(begin != end && token_charset_invert == traits.get_charset_token(iprev = begin, end))
+ {
+ begin = iprev;
+ invert = true;
+ }
+
+ // skip the end token if-and-only-if it is the first token in the charset
+ if(begin != end && token_charset_end == traits.get_charset_token(iprev = begin, end))
+ {
+ for(; begin != iprev; ++begin)
+ {
+ chset.set_char(*begin, rxtraits, icase);
+ }
+ }
+
+ compiler_token_type tok;
+ char_type ch_prev = char_type(), ch_next = char_type();
+ bool have_prev = false;
+
+ ensure(begin != end, error_brack, "unexpected end of pattern found");
+
+ // remember the current position and grab the next token
+ iprev = begin;
+ tok = traits.get_charset_token(begin, end);
+ do
+ {
+ ensure(begin != end, error_brack, "unexpected end of pattern found");
+
+ if(token_charset_hyphen == tok && have_prev)
+ {
+ // remember the current position
+ FwdIter iprev2 = begin;
+ have_prev = false;
+
+ // ch_prev is lower bound of a range
+ switch(traits.get_charset_token(begin, end))
+ {
+ case token_charset_hyphen:
+ case token_charset_invert:
+ begin = iprev2; // un-get these tokens and fall through
+ case token_literal:
+ ch_next = *begin++;
+ detail::ensure(ch_prev <= ch_next, error_range, "invalid charset range");
+ chset.set_range(ch_prev, ch_next, rxtraits, icase);
+ continue;
+ case token_charset_backspace:
+ ch_next = char_type(8); // backspace
+ detail::ensure(ch_prev <= ch_next, error_range, "invalid charset range");
+ chset.set_range(ch_prev, ch_next, rxtraits, icase);
+ continue;
+ case token_escape:
+ esc = parse_escape(begin, end, traits);
+ if(escape_char == esc.type_)
+ {
+ detail::ensure(ch_prev <= esc.ch_, error_range, "invalid charset range");
+ chset.set_range(ch_prev, esc.ch_, rxtraits, icase);
+ continue;
+ }
+ case token_charset_end: // fall through
+ default: // not a range.
+ begin = iprev; // backup to hyphen token
+ chset.set_char(ch_prev, rxtraits, icase);
+ chset.set_char(*begin++, rxtraits, icase);
+ continue;
+ }
+ }
+
+ if(have_prev)
+ {
+ chset.set_char(ch_prev, rxtraits, icase);
+ have_prev = false;
+ }
+
+ switch(tok)
+ {
+ case token_charset_hyphen:
+ case token_charset_invert:
+ case token_charset_end:
+ case token_posix_charset_end:
+ begin = iprev; // un-get these tokens
+ ch_prev = *begin++;
+ have_prev = true;
+ continue;
+
+ case token_charset_backspace:
+ ch_prev = char_type(8); // backspace
+ have_prev = true;
+ continue;
+
+ case token_posix_charset_begin:
+ {
+ FwdIter tmp = begin, start = begin;
+ bool invert = (token_charset_invert == traits.get_charset_token(tmp, end));
+ if(invert)
+ {
+ begin = start = tmp;
+ }
+ while(token_literal == (tok = traits.get_charset_token(begin, end)))
+ {
+ tmp = ++begin;
+ ensure(begin != end, error_brack, "unexpected end of pattern found");
+ }
+ if(token_posix_charset_end == tok)
+ {
+ char_class_type chclass = rxtraits.lookup_classname(start, tmp, icase);
+ ensure(0 != chclass, error_ctype, "unknown class name");
+ chset.set_class(chclass, invert);
+ continue;
+ }
+ begin = iprev; // un-get this token
+ ch_prev = *begin++;
+ have_prev = true;
+ }
+ continue;
+
+ case token_escape:
+ esc = parse_escape(begin, end, traits);
+ if(escape_char == esc.type_)
+ {
+ ch_prev = esc.ch_;
+ have_prev = true;
+ }
+ else if(escape_class == esc.type_)
+ {
+ char_class_type upper_ = lookup_classname(rxtraits, "upper");
+ BOOST_ASSERT(0 != upper_);
+ chset.set_class(esc.class_, rxtraits.isctype(*begin++, upper_));
+ }
+ else
+ {
+ BOOST_ASSERT(false);
+ }
+ continue;
+
+ default:
+ ch_prev = *begin++;
+ have_prev = true;
+ continue;
+ }
+ }
+ while(ensure((iprev = begin) != end, error_brack, "unexpected end of pattern found"),
+ token_charset_end != (tok = traits.get_charset_token(begin, end)));
+
+ if(have_prev)
+ {
+ chset.set_char(ch_prev, rxtraits, icase);
+ }
+
+ if(invert)
+ {
+ chset.inverse();
+ }
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parser.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parser.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,360 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file parser.hpp
+/// Contains the definition of regex_compiler, a factory for building regex objects
+/// from strings.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_DYNAMIC_PARSER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_DYNAMIC_PARSER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4127) // conditional expression is constant
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/matchers.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+#include <boost/xpressive/detail/dynamic/dynamic.hpp>
+
+// The Regular Expression grammar, in pseudo BNF:
+//
+// expression = alternates ;
+//
+// alternates = sequence, *('|', sequence) ;
+//
+// sequence = quant, *(quant) ;
+//
+// quant = atom, [*+?] ;
+//
+// atom = literal |
+// '.' |
+// '\' any |
+// '(' expression ')' ;
+//
+// literal = not a meta-character ;
+//
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// make_char_xpression
+//
+template<typename BidiIter, typename Char, typename Traits>
+inline sequence<BidiIter> make_char_xpression
+(
+ Char ch
+ , regex_constants::syntax_option_type flags
+ , Traits const &traits
+)
+{
+ if(0 != (regex_constants::icase_ & flags))
+ {
+ literal_matcher<Traits, mpl::true_, mpl::false_> matcher(ch, traits);
+ return make_dynamic<BidiIter>(matcher);
+ }
+ else
+ {
+ literal_matcher<Traits, mpl::false_, mpl::false_> matcher(ch, traits);
+ return make_dynamic<BidiIter>(matcher);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// make_any_xpression
+//
+template<typename BidiIter, typename Traits>
+inline sequence<BidiIter> make_any_xpression
+(
+ regex_constants::syntax_option_type flags
+ , Traits const &traits
+)
+{
+ using namespace regex_constants;
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef detail::set_matcher<Traits, mpl::int_<2> > set_matcher;
+ typedef literal_matcher<Traits, mpl::false_, mpl::true_> literal_matcher;
+
+ char_type const newline = traits.widen('\n');
+ set_matcher s;
+ s.set_[0] = newline;
+ s.set_[1] = 0;
+ s.inverse();
+
+ switch(((int)not_dot_newline | not_dot_null) & flags)
+ {
+ case not_dot_null:
+ return make_dynamic<BidiIter>(literal_matcher(char_type(0), traits));
+
+ case not_dot_newline:
+ return make_dynamic<BidiIter>(literal_matcher(newline, traits));
+
+ case (int)not_dot_newline | not_dot_null:
+ return make_dynamic<BidiIter>(s);
+
+ default:
+ return make_dynamic<BidiIter>(any_matcher());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// make_literal_xpression
+//
+template<typename BidiIter, typename Traits>
+inline sequence<BidiIter> make_literal_xpression
+(
+ typename Traits::string_type const &literal
+ , regex_constants::syntax_option_type flags
+ , Traits const &traits
+)
+{
+ BOOST_ASSERT(0 != literal.size());
+ if(1 == literal.size())
+ {
+ return make_char_xpression<BidiIter>(literal[0], flags, traits);
+ }
+
+ if(0 != (regex_constants::icase_ & flags))
+ {
+ string_matcher<Traits, mpl::true_> matcher(literal, traits);
+ return make_dynamic<BidiIter>(matcher);
+ }
+ else
+ {
+ string_matcher<Traits, mpl::false_> matcher(literal, traits);
+ return make_dynamic<BidiIter>(matcher);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// make_backref_xpression
+//
+template<typename BidiIter, typename Traits>
+inline sequence<BidiIter> make_backref_xpression
+(
+ int mark_nbr
+ , regex_constants::syntax_option_type flags
+ , Traits const &traits
+)
+{
+ if(0 != (regex_constants::icase_ & flags))
+ {
+ return make_dynamic<BidiIter>
+ (
+ mark_matcher<Traits, mpl::true_>(mark_nbr, traits)
+ );
+ }
+ else
+ {
+ return make_dynamic<BidiIter>
+ (
+ mark_matcher<Traits, mpl::false_>(mark_nbr, traits)
+ );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// merge_charset
+//
+template<typename Char, typename Traits>
+inline void merge_charset
+(
+ basic_chset<Char> &basic
+ , compound_charset<Traits> const &compound
+ , Traits const &traits
+)
+{
+ detail::ignore_unused(traits);
+ if(0 != compound.posix_yes())
+ {
+ typename Traits::char_class_type mask = compound.posix_yes();
+ for(int i = 0; i <= UCHAR_MAX; ++i)
+ {
+ if(traits.isctype((Char)i, mask))
+ {
+ basic.set((Char)i);
+ }
+ }
+ }
+
+ if(!compound.posix_no().empty())
+ {
+ for(std::size_t j = 0; j < compound.posix_no().size(); ++j)
+ {
+ typename Traits::char_class_type mask = compound.posix_no()[j];
+ for(int i = 0; i <= UCHAR_MAX; ++i)
+ {
+ if(!traits.isctype((Char)i, mask))
+ {
+ basic.set((Char)i);
+ }
+ }
+ }
+ }
+
+ if(compound.is_inverted())
+ {
+ basic.inverse();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// make_charset_xpression
+//
+template<typename BidiIter, typename Traits>
+inline sequence<BidiIter> make_charset_xpression
+(
+ compound_charset<Traits> &chset
+ , Traits const &traits
+ , regex_constants::syntax_option_type flags
+)
+{
+ typedef typename Traits::char_type char_type;
+ bool const icase = (0 != (regex_constants::icase_ & flags));
+ bool const optimize = is_narrow_char<char_type>::value && 0 != (regex_constants::optimize & flags);
+
+ // don't care about compile speed -- fold eveything into a bitset<256>
+ if(optimize)
+ {
+ typedef basic_chset<char_type> charset_type;
+ charset_type charset(chset.base());
+ if(icase)
+ {
+ charset_matcher<Traits, mpl::true_, charset_type> matcher(charset);
+ merge_charset(matcher.charset_, chset, traits);
+ return make_dynamic<BidiIter>(matcher);
+ }
+ else
+ {
+ charset_matcher<Traits, mpl::false_, charset_type> matcher(charset);
+ merge_charset(matcher.charset_, chset, traits);
+ return make_dynamic<BidiIter>(matcher);
+ }
+ }
+
+ // special case to make [[:digit:]] fast
+ else if(chset.base().empty() && chset.posix_no().empty())
+ {
+ BOOST_ASSERT(0 != chset.posix_yes());
+ posix_charset_matcher<Traits> matcher(chset.posix_yes(), chset.is_inverted());
+ return make_dynamic<BidiIter>(matcher);
+ }
+
+ // default, slow
+ else
+ {
+ if(icase)
+ {
+ charset_matcher<Traits, mpl::true_> matcher(chset);
+ return make_dynamic<BidiIter>(matcher);
+ }
+ else
+ {
+ charset_matcher<Traits, mpl::false_> matcher(chset);
+ return make_dynamic<BidiIter>(matcher);
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// make_posix_charset_xpression
+//
+template<typename BidiIter, typename Traits>
+inline sequence<BidiIter> make_posix_charset_xpression
+(
+ typename Traits::char_class_type m
+ , bool no
+ , regex_constants::syntax_option_type //flags
+ , Traits const & //traits
+)
+{
+ posix_charset_matcher<Traits> charset(m, no);
+ return make_dynamic<BidiIter>(charset);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// make_assert_begin_line
+//
+template<typename BidiIter, typename Traits>
+inline sequence<BidiIter> make_assert_begin_line
+(
+ regex_constants::syntax_option_type flags
+ , Traits const &traits
+)
+{
+ if(0 != (regex_constants::single_line & flags))
+ {
+ return detail::make_dynamic<BidiIter>(detail::assert_bos_matcher());
+ }
+ else
+ {
+ detail::assert_bol_matcher<Traits> matcher(traits);
+ return detail::make_dynamic<BidiIter>(matcher);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// make_assert_end_line
+//
+template<typename BidiIter, typename Traits>
+inline sequence<BidiIter> make_assert_end_line
+(
+ regex_constants::syntax_option_type flags
+ , Traits const &traits
+)
+{
+ if(0 != (regex_constants::single_line & flags))
+ {
+ return detail::make_dynamic<BidiIter>(detail::assert_eos_matcher());
+ }
+ else
+ {
+ detail::assert_eol_matcher<Traits> matcher(traits);
+ return detail::make_dynamic<BidiIter>(matcher);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// make_assert_word
+//
+template<typename BidiIter, typename Cond, typename Traits>
+inline sequence<BidiIter> make_assert_word(Cond, Traits const &traits)
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+ return detail::make_dynamic<BidiIter>
+ (
+ detail::assert_word_matcher<Cond, Traits>(traits)
+ );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// make_independent_end_xpression
+//
+template<typename BidiIter>
+inline sequence<BidiIter> make_independent_end_xpression(bool pure)
+{
+ if(pure)
+ {
+ return detail::make_dynamic<BidiIter>(detail::true_matcher());
+ }
+ else
+ {
+ return detail::make_dynamic<BidiIter>(detail::independent_end_matcher());
+ }
+}
+
+}}} // namespace boost::xpressive::detail
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parser_enum.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parser_enum.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,77 @@
+///////////////////////////////////////////////////////////////////////////////
+// parser_enum.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_DYNAMIC_PARSER_ENUM_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_DYNAMIC_PARSER_ENUM_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+namespace boost { namespace xpressive { namespace regex_constants
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// compiler_token_type
+//
+enum compiler_token_type
+{
+ token_literal,
+ token_any, // .
+ token_escape, //
+ token_group_begin, // (
+ token_group_end, // )
+ token_alternate, // |
+ token_invalid_quantifier, // {
+ token_charset_begin, // [
+ token_charset_end, // ]
+ token_charset_invert, // ^
+ token_charset_hyphen, // -
+ token_charset_backspace, // \b
+ token_posix_charset_begin, // [:
+ token_posix_charset_end, // :]
+
+ token_quote_meta_begin, // \Q
+ token_quote_meta_end, // \E
+
+ token_no_mark, // ?:
+ token_positive_lookahead, // ?=
+ token_negative_lookahead, // ?!
+ token_positive_lookbehind, // ?<=
+ token_negative_lookbehind, // ?<!
+ token_independent_sub_expression, // ?>
+ token_comment, // ?#
+ token_recurse, // ?R
+ token_rule_assign, // ?$[name]=
+ token_rule_ref, // ?$[name]
+ token_named_mark, // ?P<name>
+ token_named_mark_ref, // ?P=name
+
+ token_assert_begin_sequence, // \A
+ token_assert_end_sequence, // \Z
+ token_assert_begin_line, // ^
+ token_assert_end_line, // $
+ token_assert_word_begin, // \<
+ token_assert_word_end, // \>
+ token_assert_word_boundary, // \b
+ token_assert_not_word_boundary, // \B
+
+ token_escape_newline, // \n
+ token_escape_escape, // \e
+ token_escape_formfeed, // \f
+ token_escape_horizontal_tab, // \t
+ token_escape_vertical_tab, // \v
+ token_escape_bell, // \a
+ token_escape_control, // \c
+
+ token_end_of_pattern
+};
+
+}}} // namespace boost::xpressive::regex_constants
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parser_traits.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/parser_traits.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,459 @@
+///////////////////////////////////////////////////////////////////////////////
+// detail/dynamic/parser_traits.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_DYNAMIC_PARSER_TRAITS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_DYNAMIC_PARSER_TRAITS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <string>
+#include <climits>
+#include <boost/assert.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/xpressive/regex_error.hpp>
+#include <boost/xpressive/regex_traits.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/dynamic/matchable.hpp>
+#include <boost/xpressive/detail/dynamic/parser_enum.hpp>
+#include <boost/xpressive/detail/utility/literals.hpp>
+#include <boost/xpressive/detail/utility/algorithm.hpp>
+
+namespace boost { namespace xpressive
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// compiler_traits
+// this works for char and wchar_t. it must be specialized for anything else.
+//
+template<typename RegexTraits>
+struct compiler_traits
+{
+ typedef RegexTraits regex_traits;
+ typedef typename regex_traits::char_type char_type;
+ typedef typename regex_traits::string_type string_type;
+ typedef typename regex_traits::locale_type locale_type;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // constructor
+ explicit compiler_traits(RegexTraits const &traits = RegexTraits())
+ : traits_(traits)
+ , flags_(regex_constants::ECMAScript)
+ , space_(lookup_classname(traits_, "space"))
+ , alnum_(lookup_classname(traits_, "alnum"))
+ {
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // flags
+ regex_constants::syntax_option_type flags() const
+ {
+ return this->flags_;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // flags
+ void flags(regex_constants::syntax_option_type flags)
+ {
+ this->flags_ = flags;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // traits
+ regex_traits &traits()
+ {
+ return this->traits_;
+ }
+
+ regex_traits const &traits() const
+ {
+ return this->traits_;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // imbue
+ locale_type imbue(locale_type const &loc)
+ {
+ locale_type oldloc = this->traits().imbue(loc);
+ this->space_ = lookup_classname(this->traits(), "space");
+ this->alnum_ = lookup_classname(this->traits(), "alnum");
+ return oldloc;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // getloc
+ locale_type getloc() const
+ {
+ return this->traits().getloc();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // get_token
+ // get a token and advance the iterator
+ template<typename FwdIter>
+ regex_constants::compiler_token_type get_token(FwdIter &begin, FwdIter end)
+ {
+ using namespace regex_constants;
+ if(this->eat_ws_(begin, end) == end)
+ {
+ return regex_constants::token_end_of_pattern;
+ }
+
+ switch(*begin)
+ {
+ case BOOST_XPR_CHAR_(char_type, '\\'): return this->get_escape_token(++begin, end);
+ case BOOST_XPR_CHAR_(char_type, '.'): ++begin; return token_any;
+ case BOOST_XPR_CHAR_(char_type, '^'): ++begin; return token_assert_begin_line;
+ case BOOST_XPR_CHAR_(char_type, '$'): ++begin; return token_assert_end_line;
+ case BOOST_XPR_CHAR_(char_type, '('): ++begin; return token_group_begin;
+ case BOOST_XPR_CHAR_(char_type, ')'): ++begin; return token_group_end;
+ case BOOST_XPR_CHAR_(char_type, '|'): ++begin; return token_alternate;
+ case BOOST_XPR_CHAR_(char_type, '['): ++begin; return token_charset_begin;
+ case BOOST_XPR_CHAR_(char_type, ']'): ++begin; return token_charset_end;
+
+ case BOOST_XPR_CHAR_(char_type, '*'):
+ case BOOST_XPR_CHAR_(char_type, '+'):
+ case BOOST_XPR_CHAR_(char_type, '?'):
+ return token_invalid_quantifier;
+
+ case BOOST_XPR_CHAR_(char_type, '{'):
+ default:
+ return token_literal;
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // get_quant_spec
+ template<typename FwdIter>
+ bool get_quant_spec(FwdIter &begin, FwdIter end, detail::quant_spec &spec)
+ {
+ using namespace regex_constants;
+ FwdIter old_begin;
+
+ if(this->eat_ws_(begin, end) == end)
+ {
+ return false;
+ }
+
+ switch(*begin)
+ {
+ case BOOST_XPR_CHAR_(char_type, '*'):
+ spec.min_ = 0;
+ spec.max_ = (std::numeric_limits<unsigned int>::max)();
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, '+'):
+ spec.min_ = 1;
+ spec.max_ = (std::numeric_limits<unsigned int>::max)();
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, '?'):
+ spec.min_ = 0;
+ spec.max_ = 1;
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, '{'):
+ old_begin = this->eat_ws_(++begin, end);
+ spec.min_ = spec.max_ = detail::toi(begin, end, this->traits());
+ detail::ensure
+ (
+ begin != old_begin && begin != end, error_brace, "invalid quantifier"
+ );
+
+ if(*begin == BOOST_XPR_CHAR_(char_type, ','))
+ {
+ old_begin = this->eat_ws_(++begin, end);
+ spec.max_ = detail::toi(begin, end, this->traits());
+ detail::ensure
+ (
+ begin != end && BOOST_XPR_CHAR_(char_type, '}') == *begin
+ , error_brace, "invalid quantifier"
+ );
+
+ if(begin == old_begin)
+ {
+ spec.max_ = (std::numeric_limits<unsigned int>::max)();
+ }
+ else
+ {
+ detail::ensure
+ (
+ spec.min_ <= spec.max_, error_badbrace, "invalid quantification range"
+ );
+ }
+ }
+ else
+ {
+ detail::ensure
+ (
+ BOOST_XPR_CHAR_(char_type, '}') == *begin, error_brace, "invalid quantifier"
+ );
+ }
+ break;
+
+ default:
+ return false;
+ }
+
+ spec.greedy_ = true;
+ if(this->eat_ws_(++begin, end) != end && BOOST_XPR_CHAR_(char_type, '?') == *begin)
+ {
+ ++begin;
+ spec.greedy_ = false;
+ }
+
+ return true;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // get_group_type
+ template<typename FwdIter>
+ regex_constants::compiler_token_type get_group_type(FwdIter &begin, FwdIter end, string_type &name)
+ {
+ using namespace regex_constants;
+ if(this->eat_ws_(begin, end) != end && BOOST_XPR_CHAR_(char_type, '?') == *begin)
+ {
+ this->eat_ws_(++begin, end);
+ detail::ensure(begin != end, error_paren, "incomplete extension");
+
+ switch(*begin)
+ {
+ case BOOST_XPR_CHAR_(char_type, ':'): ++begin; return token_no_mark;
+ case BOOST_XPR_CHAR_(char_type, '>'): ++begin; return token_independent_sub_expression;
+ case BOOST_XPR_CHAR_(char_type, '#'): ++begin; return token_comment;
+ case BOOST_XPR_CHAR_(char_type, '='): ++begin; return token_positive_lookahead;
+ case BOOST_XPR_CHAR_(char_type, '!'): ++begin; return token_negative_lookahead;
+ case BOOST_XPR_CHAR_(char_type, 'R'): ++begin; return token_recurse;
+ case BOOST_XPR_CHAR_(char_type, '$'):
+ this->get_name_(++begin, end, name);
+ detail::ensure(begin != end, error_paren, "incomplete extension");
+ if(BOOST_XPR_CHAR_(char_type, '=') == *begin)
+ {
+ ++begin;
+ return token_rule_assign;
+ }
+ return token_rule_ref;
+
+ case BOOST_XPR_CHAR_(char_type, '<'):
+ this->eat_ws_(++begin, end);
+ detail::ensure(begin != end, error_paren, "incomplete extension");
+ switch(*begin)
+ {
+ case BOOST_XPR_CHAR_(char_type, '='): ++begin; return token_positive_lookbehind;
+ case BOOST_XPR_CHAR_(char_type, '!'): ++begin; return token_negative_lookbehind;
+ default:
+ boost::throw_exception(regex_error(error_badbrace, "unrecognized extension"));
+ }
+
+ case BOOST_XPR_CHAR_(char_type, 'P'):
+ this->eat_ws_(++begin, end);
+ detail::ensure(begin != end, error_paren, "incomplete extension");
+ switch(*begin)
+ {
+ case BOOST_XPR_CHAR_(char_type, '<'):
+ this->get_name_(++begin, end, name);
+ detail::ensure(begin != end && BOOST_XPR_CHAR_(char_type, '>') == *begin++, error_paren, "incomplete extension");
+ return token_named_mark;
+ case BOOST_XPR_CHAR_(char_type, '='):
+ this->get_name_(++begin, end, name);
+ detail::ensure(begin != end, error_paren, "incomplete extension");
+ return token_named_mark_ref;
+ default:
+ boost::throw_exception(regex_error(error_badbrace, "unrecognized extension"));
+ }
+
+ case BOOST_XPR_CHAR_(char_type, 'i'):
+ case BOOST_XPR_CHAR_(char_type, 'm'):
+ case BOOST_XPR_CHAR_(char_type, 's'):
+ case BOOST_XPR_CHAR_(char_type, 'x'):
+ case BOOST_XPR_CHAR_(char_type, '-'):
+ return this->parse_mods_(begin, end);
+
+ default:
+ boost::throw_exception(regex_error(error_badbrace, "unrecognized extension"));
+ }
+ }
+
+ return token_literal;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // get_charset_token
+ // NOTE: white-space is *never* ignored in a charset.
+ template<typename FwdIter>
+ regex_constants::compiler_token_type get_charset_token(FwdIter &begin, FwdIter end)
+ {
+ using namespace regex_constants;
+ BOOST_ASSERT(begin != end);
+ switch(*begin)
+ {
+ case BOOST_XPR_CHAR_(char_type, '^'): ++begin; return token_charset_invert;
+ case BOOST_XPR_CHAR_(char_type, '-'): ++begin; return token_charset_hyphen;
+ case BOOST_XPR_CHAR_(char_type, ']'): ++begin; return token_charset_end;
+ case BOOST_XPR_CHAR_(char_type, '['):
+ {
+ FwdIter next = begin; ++next;
+ if(next != end && *next == BOOST_XPR_CHAR_(char_type, ':'))
+ {
+ begin = ++next;
+ return token_posix_charset_begin;
+ }
+ }
+ break;
+ case BOOST_XPR_CHAR_(char_type, ':'):
+ {
+ FwdIter next = begin; ++next;
+ if(next != end && *next == BOOST_XPR_CHAR_(char_type, ']'))
+ {
+ begin = ++next;
+ return token_posix_charset_end;
+ }
+ }
+ break;
+ case BOOST_XPR_CHAR_(char_type, '\\'):
+ if(++begin != end)
+ {
+ switch(*begin)
+ {
+ case BOOST_XPR_CHAR_(char_type, 'b'): ++begin; return token_charset_backspace;
+ default:;
+ }
+ }
+ return token_escape;
+ default:;
+ }
+ return token_literal;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // get_escape_token
+ template<typename FwdIter>
+ regex_constants::compiler_token_type get_escape_token(FwdIter &begin, FwdIter end)
+ {
+ using namespace regex_constants;
+ if(begin != end)
+ {
+ switch(*begin)
+ {
+ //case BOOST_XPR_CHAR_(char_type, 'a'): ++begin; return token_escape_bell;
+ //case BOOST_XPR_CHAR_(char_type, 'c'): ++begin; return token_escape_control;
+ //case BOOST_XPR_CHAR_(char_type, 'e'): ++begin; return token_escape_escape;
+ //case BOOST_XPR_CHAR_(char_type, 'f'): ++begin; return token_escape_formfeed;
+ //case BOOST_XPR_CHAR_(char_type, 'n'): ++begin; return token_escape_newline;
+ //case BOOST_XPR_CHAR_(char_type, 't'): ++begin; return token_escape_horizontal_tab;
+ //case BOOST_XPR_CHAR_(char_type, 'v'): ++begin; return token_escape_vertical_tab;
+ case BOOST_XPR_CHAR_(char_type, 'A'): ++begin; return token_assert_begin_sequence;
+ case BOOST_XPR_CHAR_(char_type, 'b'): ++begin; return token_assert_word_boundary;
+ case BOOST_XPR_CHAR_(char_type, 'B'): ++begin; return token_assert_not_word_boundary;
+ case BOOST_XPR_CHAR_(char_type, 'E'): ++begin; return token_quote_meta_end;
+ case BOOST_XPR_CHAR_(char_type, 'Q'): ++begin; return token_quote_meta_begin;
+ case BOOST_XPR_CHAR_(char_type, 'Z'): ++begin; return token_assert_end_sequence;
+ // Non-standard extension to ECMAScript syntax
+ case BOOST_XPR_CHAR_(char_type, '<'): ++begin; return token_assert_word_begin;
+ case BOOST_XPR_CHAR_(char_type, '>'): ++begin; return token_assert_word_end;
+ default:; // fall-through
+ }
+ }
+
+ return token_escape;
+ }
+
+private:
+
+ //////////////////////////////////////////////////////////////////////////
+ // parse_mods_
+ template<typename FwdIter>
+ regex_constants::compiler_token_type parse_mods_(FwdIter &begin, FwdIter end)
+ {
+ using namespace regex_constants;
+ bool set = true;
+ do switch(*begin)
+ {
+ case BOOST_XPR_CHAR_(char_type, 'i'): this->flag_(set, icase_); break;
+ case BOOST_XPR_CHAR_(char_type, 'm'): this->flag_(!set, single_line); break;
+ case BOOST_XPR_CHAR_(char_type, 's'): this->flag_(!set, not_dot_newline); break;
+ case BOOST_XPR_CHAR_(char_type, 'x'): this->flag_(set, ignore_white_space); break;
+ case BOOST_XPR_CHAR_(char_type, ':'): ++begin; // fall-through
+ case BOOST_XPR_CHAR_(char_type, ')'): return token_no_mark;
+ case BOOST_XPR_CHAR_(char_type, '-'): if(false == (set = !set)) break; // else fall-through
+ default: boost::throw_exception(regex_error(error_paren, "unknown pattern modifier"));
+ }
+ while(detail::ensure(++begin != end, error_paren, "incomplete extension"));
+ // this return is technically unreachable, but this must
+ // be here to work around a bug in gcc 4.0
+ return token_no_mark;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // flag_
+ void flag_(bool set, regex_constants::syntax_option_type flag)
+ {
+ this->flags_ = set ? (this->flags_ | flag) : (this->flags_ & ~flag);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // is_space_
+ bool is_space_(char_type ch) const
+ {
+ return 0 != this->space_ && this->traits().isctype(ch, this->space_);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // is_alnum_
+ bool is_alnum_(char_type ch) const
+ {
+ return 0 != this->alnum_ && this->traits().isctype(ch, this->alnum_);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // get_name_
+ template<typename FwdIter>
+ void get_name_(FwdIter &begin, FwdIter end, string_type &name)
+ {
+ this->eat_ws_(begin, end);
+ for(name.clear(); begin != end && this->is_alnum_(*begin); ++begin)
+ {
+ name.push_back(*begin);
+ }
+ this->eat_ws_(begin, end);
+ detail::ensure(!name.empty(), regex_constants::error_paren, "incomplete extension");
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // eat_ws_
+ template<typename FwdIter>
+ FwdIter &eat_ws_(FwdIter &begin, FwdIter end)
+ {
+ if(0 != (regex_constants::ignore_white_space & this->flags()))
+ {
+ while(end != begin && (BOOST_XPR_CHAR_(char_type, '#') == *begin || this->is_space_(*begin)))
+ {
+ if(BOOST_XPR_CHAR_(char_type, '#') == *begin++)
+ {
+ while(end != begin && BOOST_XPR_CHAR_(char_type, '\n') != *begin++) {}
+ }
+ else
+ {
+ for(; end != begin && this->is_space_(*begin); ++begin) {}
+ }
+ }
+ }
+
+ return begin;
+ }
+
+ regex_traits traits_;
+ regex_constants::syntax_option_type flags_;
+ typename regex_traits::char_class_type space_;
+ typename regex_traits::char_class_type alnum_;
+};
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/sequence.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/dynamic/sequence.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,175 @@
+///////////////////////////////////////////////////////////////////////////////
+// sequence.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_DYNAMIC_SEQUENCE_HPP_EAN_04_10_2006
+#define BOOST_XPRESSIVE_DETAIL_DYNAMIC_SEQUENCE_HPP_EAN_04_10_2006
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/xpressive/detail/utility/width.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// sequence
+template<typename BidiIter>
+struct sequence
+{
+ sequence()
+ : pure_(true)
+ , width_(0)
+ , quant_(quant_none)
+ , head_()
+ , tail_(0)
+ , alt_end_xpr_()
+ , alternates_(0)
+ {
+ }
+
+ template<typename Matcher>
+ sequence(intrusive_ptr<dynamic_xpression<Matcher, BidiIter> > const &xpr)
+ : pure_(Matcher::pure)
+ , width_(xpr->Matcher::get_width())
+ , quant_(static_cast<quant_enum>(Matcher::quant))
+ , head_(xpr)
+ , tail_(&xpr->next_)
+ , alt_end_xpr_()
+ , alternates_(0)
+ {
+ }
+
+ template<typename Traits>
+ sequence(intrusive_ptr<dynamic_xpression<alternate_matcher<alternates_vector<BidiIter>, Traits>, BidiIter> > const &xpr)
+ : pure_(true)
+ , width_(0)
+ , quant_(quant_none)
+ , head_(xpr)
+ , tail_(&xpr->next_)
+ , alt_end_xpr_()
+ , alternates_(&xpr->alternates_)
+ {
+ }
+
+ bool empty() const
+ {
+ return !this->head_;
+ }
+
+ sequence<BidiIter> &operator +=(sequence<BidiIter> const &that)
+ {
+ if(this->empty())
+ {
+ *this = that;
+ }
+ else if(!that.empty())
+ {
+ *this->tail_ = that.head_;
+ this->tail_ = that.tail_;
+ // keep track of sequence width and purity
+ this->width_ += that.width_;
+ this->pure_ = this->pure_ && that.pure_;
+ this->set_quant_();
+ }
+ return *this;
+ }
+
+ sequence<BidiIter> &operator |=(sequence<BidiIter> that)
+ {
+ BOOST_ASSERT(!this->empty());
+ BOOST_ASSERT(0 != this->alternates_);
+
+ // Keep track of width and purity
+ if(this->alternates_->empty())
+ {
+ this->width_ = that.width_;
+ this->pure_ = that.pure_;
+ }
+ else
+ {
+ this->width_ |= that.width_;
+ this->pure_ = this->pure_ && that.pure_;
+ }
+
+ // through the wonders of reference counting, all alternates_ can share an end_alternate
+ if(!this->alt_end_xpr_)
+ {
+ this->alt_end_xpr_ = new alt_end_xpr_type;
+ }
+
+ // terminate each alternate with an alternate_end_matcher
+ that += sequence(this->alt_end_xpr_);
+ this->alternates_->push_back(that.head_);
+ this->set_quant_();
+ return *this;
+ }
+
+ void repeat(quant_spec const &spec)
+ {
+ this->xpr().matchable()->repeat(spec, *this);
+ }
+
+ shared_matchable<BidiIter> const &xpr() const
+ {
+ return this->head_;
+ }
+
+ detail::width width() const
+ {
+ return this->width_;
+ }
+
+ bool pure() const
+ {
+ return this->pure_;
+ }
+
+ quant_enum quant() const
+ {
+ return this->quant_;
+ }
+
+private:
+ typedef dynamic_xpression<alternate_end_matcher, BidiIter> alt_end_xpr_type;
+
+ void set_quant_()
+ {
+ this->quant_ = (!is_unknown(this->width_) && this->pure_)
+ ? (!this->width_ ? quant_none : quant_fixed_width)
+ : quant_variable_width;
+ }
+
+ bool pure_;
+ detail::width width_;
+ quant_enum quant_;
+ shared_matchable<BidiIter> head_;
+ shared_matchable<BidiIter> *tail_;
+ intrusive_ptr<alt_end_xpr_type> alt_end_xpr_;
+ alternates_vector<BidiIter> *alternates_;
+};
+
+template<typename BidiIter>
+inline sequence<BidiIter> operator +(sequence<BidiIter> left, sequence<BidiIter> const &right)
+{
+ return left += right;
+}
+
+template<typename BidiIter>
+inline sequence<BidiIter> operator |(sequence<BidiIter> left, sequence<BidiIter> const &right)
+{
+ return left |= right;
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/compile.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/compile.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,99 @@
+///////////////////////////////////////////////////////////////////////////////
+// compile.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_COMPILE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_STATIC_COMPILE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+#include <boost/xpressive/regex_traits.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+#include <boost/xpressive/detail/core/linker.hpp>
+#include <boost/xpressive/detail/core/optimize.hpp>
+#include <boost/xpressive/detail/core/adaptor.hpp>
+#include <boost/xpressive/detail/core/matcher/end_matcher.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/detail/static/visitor.hpp>
+#include <boost/xpressive/detail/static/grammar.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // static_compile_impl2
+ template<typename Xpr, typename BidiIter, typename Traits>
+ void static_compile_impl2(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl, Traits const &traits)
+ {
+ typedef typename iterator_value<BidiIter>::type char_type;
+ impl->tracking_clear();
+ impl->traits_ = new traits_holder<Traits>(traits);
+
+ // "compile" the regex and wrap it in an xpression_adaptor.
+ xpression_visitor<BidiIter, mpl::false_, Traits> visitor(traits, impl);
+ intrusive_ptr<matchable_ex<BidiIter> const> adxpr = make_adaptor<matchable_ex<BidiIter> >(
+ Grammar<char_type>()(xpr, end_xpression(), visitor)
+ );
+
+ // Link and optimize the regex
+ common_compile(adxpr, *impl, visitor.traits());
+
+ // References changed, update dependencies.
+ impl->tracking_update();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // pattern for imbued regexes.
+ struct XpressiveLocaleModifier
+ : proto::binary_expr<
+ modifier_tag
+ , proto::terminal<locale_modifier<proto::_> >
+ , proto::_
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // static_compile_impl1
+ template<typename Xpr, typename BidiIter>
+ typename disable_if<proto::matches<Xpr, XpressiveLocaleModifier> >::type
+ static_compile_impl1(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl)
+ {
+ // use default traits
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef typename default_regex_traits<char_type>::type traits_type;
+ traits_type traits;
+ static_compile_impl2(xpr, impl, traits);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // static_compile_impl1
+ template<typename Xpr, typename BidiIter>
+ typename enable_if<proto::matches<Xpr, XpressiveLocaleModifier> >::type
+ static_compile_impl1(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl)
+ {
+ // use specified traits
+ typedef typename proto::result_of::arg<typename proto::result_of::left<Xpr>::type>::type::locale_type locale_type;
+ typedef typename regex_traits_type<locale_type, BidiIter>::type traits_type;
+ static_compile_impl2(proto::right(xpr), impl, traits_type(proto::arg(proto::left(xpr)).getloc()));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // static_compile
+ template<typename Xpr, typename BidiIter>
+ void static_compile(Xpr const &xpr, shared_ptr<regex_impl<BidiIter> > const &impl)
+ {
+ static_compile_impl1(xpr, impl);
+ }
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/grammar.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/grammar.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,365 @@
+///////////////////////////////////////////////////////////////////////////////
+// grammar.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_GRAMMAR_HPP_EAN_11_12_2006
+#define BOOST_XPRESSIVE_DETAIL_STATIC_GRAMMAR_HPP_EAN_11_12_2006
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+#include <boost/xpressive/detail/static/is_pure.hpp>
+#include <boost/xpressive/detail/static/transforms/as_matcher.hpp>
+#include <boost/xpressive/detail/static/transforms/as_alternate.hpp>
+#include <boost/xpressive/detail/static/transforms/as_sequence.hpp>
+#include <boost/xpressive/detail/static/transforms/as_quantifier.hpp>
+#include <boost/xpressive/detail/static/transforms/as_marker.hpp>
+#include <boost/xpressive/detail/static/transforms/as_set.hpp>
+#include <boost/xpressive/detail/static/transforms/as_independent.hpp>
+#include <boost/xpressive/detail/static/transforms/as_modifier.hpp>
+#include <boost/xpressive/detail/static/transforms/as_inverse.hpp>
+#include <boost/xpressive/detail/static/transforms/as_action.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+
+#define BOOST_XPRESSIVE_CHECK_REGEX(Expr, Char)\
+ BOOST_MPL_ASSERT\
+ ((\
+ typename boost::mpl::if_<\
+ boost::xpressive::is_valid_regex<Expr, Char>\
+ , boost::mpl::true_\
+ , boost::xpressive::INVALID_REGULAR_EXPRESSION\
+ >::type\
+ ));
+
+//////////////////////////////////////////////////////////////////////////
+//**********************************************************************//
+//* << NOTE! >> *//
+//* *//
+//* Whenever you change this grammar, you MUST also make corresponding *//
+//* changes to width_of.hpp and is_pure.hpp. *//
+//* *//
+//**********************************************************************//
+//////////////////////////////////////////////////////////////////////////
+
+namespace boost { namespace xpressive
+{
+ template<typename Char>
+ struct Grammar;
+
+ template<typename Char>
+ struct ActionableGrammar;
+
+ namespace grammar_detail
+ {
+ ///////////////////////////////////////////////////////////////////////////
+ // CharLiteral
+ template<typename Char>
+ struct CharLiteral;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // ListSet
+ template<typename Char>
+ struct ListSet;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // as_repeat
+ template<typename Char, typename Gram, typename Greedy>
+ struct as_repeat
+ : if_<
+ make<detail::use_simple_repeat<_arg, Char> >
+ , as_simple_quantifier<Gram, Greedy>
+ , as_default_quantifier<Greedy>
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////
+ // NonGreedyRepeatCases
+ template<typename Gram>
+ struct NonGreedyRepeatCases
+ {
+ template<typename Tag, typename Dummy = void>
+ struct case_
+ : not_<_>
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::dereference, Dummy>
+ : dereference<Gram>
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::posit, Dummy>
+ : posit<Gram>
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::logical_not, Dummy>
+ : logical_not<Gram>
+ {};
+
+ template<uint_t Min, uint_t Max, typename Dummy>
+ struct case_<detail::generic_quant_tag<Min, Max>, Dummy>
+ : unary_expr<detail::generic_quant_tag<Min, Max>, Gram>
+ {};
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // InvertibleCases
+ template<typename Char, typename Gram>
+ struct InvertibleCases
+ {
+ template<typename Tag, typename Dummy = void>
+ struct case_
+ : not_<_>
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::comma, Dummy>
+ : when<ListSet<Char>, as_list_set_matcher<Char> >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::assign, Dummy>
+ : when<ListSet<Char>, as_list_set_matcher<Char> >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::subscript, Dummy>
+ : when<subscript<detail::set_initializer_type, Gram>, call<as_set_matcher<Gram>(_right)> >
+ {};
+
+ template<typename Dummy>
+ struct case_<detail::lookahead_tag, Dummy>
+ : when<
+ unary_expr<detail::lookahead_tag, Gram>
+ , as_lookahead<Gram>
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<detail::lookbehind_tag, Dummy>
+ : when<
+ unary_expr<detail::lookbehind_tag, Gram>
+ , as_lookbehind<Gram>
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::terminal, Dummy>
+ : when<
+ or_<
+ CharLiteral<Char>
+ , terminal<detail::posix_charset_placeholder>
+ , terminal<detail::range_placeholder<_> >
+ , terminal<detail::logical_newline_placeholder>
+ , terminal<detail::assert_word_placeholder<detail::word_boundary<mpl::true_> > >
+ >
+ , as_matcher
+ >
+ {};
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Cases
+ template<typename Char, typename Gram>
+ struct Cases
+ {
+ template<typename Tag, typename Dummy = void>
+ struct case_
+ : not_<_>
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::terminal, Dummy>
+ : when<
+ _
+ , in_sequence<as_matcher>
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::shift_right, Dummy>
+ : when<
+ shift_right<Gram, Gram>
+ , reverse_fold<_, _state, Gram>
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::bitwise_or, Dummy>
+ : when<
+ bitwise_or<Gram, Gram>
+ , in_sequence<
+ as_alternate_matcher<
+ reverse_fold_tree<_, make<fusion::nil>, in_alternate_list<Gram> >
+ >
+ >
+ >
+ {};
+
+ template<typename Dummy, typename Greedy>
+ struct case_<optional_tag<Greedy> , Dummy>
+ : when<
+ unary_expr<optional_tag<Greedy>, Gram>
+ , in_sequence<call<as_optional<Gram, Greedy>(_arg)> >
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::dereference, Dummy>
+ : when<
+ dereference<Gram>
+ , call<Gram(as_repeat<Char, Gram, mpl::true_>)>
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::posit, Dummy>
+ : when<
+ posit<Gram>
+ , call<Gram(as_repeat<Char, Gram, mpl::true_>)>
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::logical_not, Dummy>
+ : when<
+ logical_not<Gram>
+ , call<Gram(as_repeat<Char, Gram, mpl::true_>)>
+ >
+ {};
+
+ template<uint_t Min, uint_t Max, typename Dummy>
+ struct case_<detail::generic_quant_tag<Min, Max>, Dummy>
+ : when<
+ unary_expr<detail::generic_quant_tag<Min, Max>, Gram>
+ , call<Gram(as_repeat<Char, Gram, mpl::true_>)>
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::negate, Dummy>
+ : when<
+ negate<switch_<NonGreedyRepeatCases<Gram> > >
+ , call<Gram(call<as_repeat<Char, Gram, mpl::false_>(_arg)>)>
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::complement, Dummy>
+ : when<
+ complement<switch_<InvertibleCases<Char, Gram> > >
+ , in_sequence<call<as_inverse(call<switch_<InvertibleCases<Char, Gram> >(_arg)>)> >
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<detail::modifier_tag, Dummy>
+ : when<binary_expr<detail::modifier_tag, _, Gram>, as_modifier<Gram> >
+ {};
+
+ template<typename Dummy>
+ struct case_<detail::lookahead_tag, Dummy>
+ : when<
+ unary_expr<detail::lookahead_tag, Gram>
+ , in_sequence<as_lookahead<Gram> >
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<detail::lookbehind_tag, Dummy>
+ : when<
+ unary_expr<detail::lookbehind_tag, Gram>
+ , in_sequence<as_lookbehind<Gram> >
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<detail::keeper_tag, Dummy>
+ : when<
+ unary_expr<detail::keeper_tag, Gram>
+ , in_sequence<as_keeper<Gram> >
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::comma, Dummy>
+ : when<ListSet<Char>, in_sequence<as_list_set_matcher<Char> > >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::assign, Dummy>
+ : or_<
+ when<assign<detail::basic_mark_tag, Gram>, call<Gram(as_marker)> >
+ , when<ListSet<Char>, in_sequence<as_list_set_matcher<Char> > >
+ >
+ {};
+
+ template<typename Dummy>
+ struct case_<tag::subscript, Dummy>
+ : or_<
+ when<subscript<detail::set_initializer_type, Gram>, in_sequence<call<as_set_matcher<Gram>(_right)> > >
+ , when<subscript<ActionableGrammar<Char>, _>, call<ActionableGrammar<Char>(as_action)> >
+ >
+ {};
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // ActionableCases
+ template<typename Char, typename Gram>
+ struct ActionableCases
+ {
+ template<typename Tag, typename Dummy = void>
+ struct case_
+ : Cases<Char, Gram>::template case_<Tag>
+ {};
+
+ // Only in sub-expressions with actions attached do we allow attribute assignements
+ template<typename Dummy>
+ struct case_<proto::tag::assign, Dummy>
+ : or_<
+ typename Cases<Char, Gram>::template case_<proto::tag::assign>
+ , when<proto::assign<terminal<detail::attribute_placeholder<_> >, _>, in_sequence<as_attr_matcher> >
+ >
+ {};
+ };
+
+ } // namespace detail
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Grammar
+ template<typename Char>
+ struct Grammar
+ : proto::switch_<grammar_detail::Cases<Char, Grammar<Char> > >
+ {};
+
+ template<typename Char>
+ struct ActionableGrammar
+ : proto::switch_<grammar_detail::ActionableCases<Char, ActionableGrammar<Char> > >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////
+ // INVALID_REGULAR_EXPRESSION
+ struct INVALID_REGULAR_EXPRESSION
+ : mpl::false_
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////
+ // is_valid_regex
+ template<typename Expr, typename Char>
+ struct is_valid_regex
+ : proto::matches<Expr, Grammar<Char> >
+ {};
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/is_pure.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/is_pure.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,212 @@
+///////////////////////////////////////////////////////////////////////////////
+// is_pure.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_IS_PURE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_STATIC_IS_PURE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/ref.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/not_equal_to.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/width_of.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // use_simple_repeat_terminal
+ //
+ template<typename Expr, typename Char, bool IsXpr = is_xpr<Expr>::value>
+ struct use_simple_repeat_terminal
+ : mpl::bool_<
+ Expr::quant == quant_fixed_width
+ || (Expr::width != unknown_width::value && Expr::pure)
+ >
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_terminal<Expr, Char, false>
+ : mpl::true_ // char literals, string literals, etc.
+ {};
+
+ template<typename BidiIter, typename Char>
+ struct use_simple_repeat_terminal<tracking_ptr<regex_impl<BidiIter> >, Char, false>
+ : mpl::false_ // basic_regex
+ {};
+
+ template<typename BidiIter, typename Char>
+ struct use_simple_repeat_terminal<reference_wrapper<basic_regex<BidiIter> >, Char, false>
+ : mpl::false_ // basic_regex
+ {};
+
+ template<typename BidiIter, typename Char>
+ struct use_simple_repeat_terminal<reference_wrapper<basic_regex<BidiIter> const>, Char, false>
+ : mpl::false_ // basic_regex
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // use_simple_repeat_
+ //
+ template<typename Expr, typename Char, typename Tag = typename Expr::proto_tag>
+ struct use_simple_repeat_
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::terminal>
+ : use_simple_repeat_terminal<typename proto::result_of::arg<Expr>::type, Char>
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::shift_right>
+ : mpl::and_<
+ use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ , use_simple_repeat_<typename Expr::proto_arg1::proto_base_expr, Char>
+ >
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::bitwise_or>
+ : mpl::and_<
+ mpl::not_equal_to<unknown_width, width_of<Expr, Char> >
+ , use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ , use_simple_repeat_<typename Expr::proto_arg1::proto_base_expr, Char>
+ >
+ {};
+
+ template<typename Left>
+ struct use_simple_repeat_assign
+ {};
+
+ template<>
+ struct use_simple_repeat_assign<mark_placeholder>
+ : mpl::false_
+ {};
+
+ template<>
+ struct use_simple_repeat_assign<set_initializer>
+ : mpl::true_
+ {};
+
+ template<typename Nbr>
+ struct use_simple_repeat_assign<attribute_placeholder<Nbr> >
+ : mpl::false_
+ {};
+
+ // either (s1 = ...) or (a1 = ...) or (set = ...)
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::assign>
+ : use_simple_repeat_assign<typename proto::result_of::arg<typename Expr::proto_arg0::proto_base_expr>::type>
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, modifier_tag>
+ : use_simple_repeat_<typename Expr::proto_arg1::proto_base_expr, Char>
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, lookahead_tag>
+ : mpl::false_
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, lookbehind_tag>
+ : mpl::false_
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, keeper_tag>
+ : mpl::false_
+ {};
+
+ // when complementing a set or an assertion, the purity is that of the set (true) or the assertion
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::complement>
+ : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ {};
+
+ // The comma is used in list-initialized sets, which are pure
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::comma>
+ : mpl::true_
+ {};
+
+ // The subscript operator[] is used for sets, as in set['a' | range('b','h')]
+ // It is also used for actions, which by definition have side-effects and thus are impure
+ template<typename Expr, typename Char, typename Left>
+ struct use_simple_repeat_subscript
+ : mpl::false_
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_subscript<Expr, Char, set_initializer_type>
+ : mpl::true_
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::subscript>
+ : use_simple_repeat_subscript<Expr, Char, typename Expr::proto_arg0::proto_base_expr>
+ {};
+
+ // Quantified expressions are variable-width and cannot use the simple quantifier
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::posit>
+ : mpl::false_
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::dereference>
+ : mpl::false_
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::logical_not>
+ : mpl::false_
+ {};
+
+ template<typename Expr, typename Char, uint_t Min, uint_t Max>
+ struct use_simple_repeat_<Expr, Char, generic_quant_tag<Min, Max> >
+ : mpl::false_
+ {};
+
+ template<typename Expr, typename Char, uint_t Count>
+ struct use_simple_repeat_<Expr, Char, generic_quant_tag<Count, Count> >
+ : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ {};
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat_<Expr, Char, proto::tag::negate>
+ : use_simple_repeat_<typename Expr::proto_arg0::proto_base_expr, Char>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // use_simple_repeat
+ //
+ template<typename Expr, typename Char>
+ struct use_simple_repeat
+ : use_simple_repeat_<Expr, Char>
+ {
+ // should never try to repeat something of 0-width
+ BOOST_MPL_ASSERT_RELATION(0, !=, (width_of<Expr, Char>::value));
+ };
+
+ template<typename Expr, typename Char>
+ struct use_simple_repeat<Expr &, Char>
+ : use_simple_repeat_<Expr, Char>
+ {
+ // should never try to repeat something of 0-width
+ BOOST_MPL_ASSERT_RELATION(0, !=, (width_of<Expr, Char>::value));
+ };
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/modifier.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/modifier.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,66 @@
+///////////////////////////////////////////////////////////////////////////////
+// modifier.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_MODIFIER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_STATIC_MODIFIER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4510) // default constructor could not be generated
+# pragma warning(disable : 4610) // user defined constructor required
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // modifier
+ template<typename Modifier>
+ struct modifier_op
+ {
+ typedef regex_constants::syntax_option_type opt_type;
+
+ template<typename Expr>
+ struct apply
+ {
+ typedef typename proto::binary_expr<
+ modifier_tag
+ , typename proto::terminal<Modifier>::type
+ , typename proto::result_of::as_arg<Expr const>::type
+ >::type type;
+ };
+
+ template<typename Expr>
+ typename apply<Expr>::type const
+ operator ()(Expr const &expr) const
+ {
+ typename apply<Expr>::type that = {{this->mod_}, proto::as_arg(expr)};
+ return that;
+ }
+
+ operator opt_type() const
+ {
+ return this->opt_;
+ }
+
+ Modifier mod_;
+ opt_type opt_;
+ };
+
+}}}
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/placeholders.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/placeholders.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,119 @@
+///////////////////////////////////////////////////////////////////////////////
+// placeholders.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_PLACEHOLDERS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_STATIC_PLACEHOLDERS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable:4510) // default constructor could not be generated
+# pragma warning(disable:4610) // can never be instantiated - user defined constructor required
+#endif
+
+#include <string>
+#include <boost/shared_ptr.hpp>
+#include <boost/xpressive/detail/core/quant_style.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// mark_placeholder
+//
+struct mark_placeholder
+{
+ BOOST_XPR_QUANT_STYLE(quant_variable_width, unknown_width::value, true)
+
+ int mark_number_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// posix_charset_placeholder
+//
+struct posix_charset_placeholder
+{
+ BOOST_XPR_QUANT_STYLE(quant_fixed_width, 1, true)
+
+ char const *name_;
+ bool not_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// assert_word_placeholder
+//
+template<typename Cond>
+struct assert_word_placeholder
+{
+ BOOST_XPR_QUANT_STYLE(quant_none, 0, true)
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// range_placeholder
+//
+template<typename Char>
+struct range_placeholder
+{
+ BOOST_XPR_QUANT_STYLE(quant_fixed_width, 1, true)
+
+ Char ch_min_;
+ Char ch_max_;
+ bool not_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// assert_bol_placeholder
+//
+struct assert_bol_placeholder
+{
+ BOOST_XPR_QUANT_STYLE(quant_none, 0, true)
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// assert_eol_placeholder
+//
+struct assert_eol_placeholder
+{
+ BOOST_XPR_QUANT_STYLE(quant_none, 0, true)
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// logical_newline_placeholder
+//
+struct logical_newline_placeholder
+{
+ BOOST_XPR_QUANT_STYLE(quant_variable_width, unknown_width::value, true)
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// self_placeholder
+//
+struct self_placeholder
+{
+ BOOST_XPR_QUANT_STYLE(quant_variable_width, unknown_width::value, false)
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// attribute_placeholder
+//
+template<typename Nbr>
+struct attribute_placeholder
+{
+ BOOST_XPR_QUANT_STYLE(quant_variable_width, unknown_width::value, false)
+
+ typedef Nbr nbr_type;
+};
+
+}}} // namespace boost::xpressive::detail
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/static.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/static.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,259 @@
+///////////////////////////////////////////////////////////////////////////////
+// static.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_STATIC_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_STATIC_STATIC_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/assert.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/core/linker.hpp>
+#include <boost/xpressive/detail/core/peeker.hpp>
+#include <boost/xpressive/detail/static/placeholders.hpp>
+#include <boost/xpressive/detail/utility/width.hpp>
+
+// Random thoughts:
+// - must support indirect repeat counts {$n,$m}
+// - add ws to eat whitespace (make *ws illegal)
+// - a{n,m} -> repeat<n,m>(a)
+// - a{$n,$m} -> repeat(n,m)(a)
+// - add nil to match nothing
+// - instead of s1, s2, etc., how about s[1], s[2], etc.? Needlessly verbose?
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// stacked_xpression
+//
+template<typename Top, typename Next>
+struct stacked_xpression
+ : Next
+{
+ // match
+ // delegates to Next
+ template<typename BidiIter>
+ bool match(match_state<BidiIter> &state) const
+ {
+ return static_cast<Next const *>(this)->
+ BOOST_NESTED_TEMPLATE push_match<Top>(state);
+ }
+
+ // top_match
+ // jump back to the xpression on top of the xpression stack,
+ // and keep the xpression on the stack.
+ template<typename BidiIter>
+ static bool top_match(match_state<BidiIter> &state, void const *top)
+ {
+ return static_cast<Top const *>(top)->
+ BOOST_NESTED_TEMPLATE push_match<Top>(state);
+ }
+
+ // pop_match
+ // jump back to the xpression on top of the xpression stack,
+ // pop the xpression off the stack.
+ template<typename BidiIter>
+ static bool pop_match(match_state<BidiIter> &state, void const *top)
+ {
+ return static_cast<Top const *>(top)->match(state);
+ }
+
+ // skip_match
+ // pop the xpression off the top of the stack and ignore it; call
+ // match on next.
+ template<typename BidiIter>
+ bool skip_match(match_state<BidiIter> &state) const
+ {
+ // could be static_xpression::skip_impl or stacked_xpression::skip_impl
+ // depending on if there is 1 or more than 1 xpression on the
+ // xpression stack
+ return Top::skip_impl(*static_cast<Next const *>(this), state);
+ }
+
+//protected:
+
+ // skip_impl
+ // implementation of skip_match.
+ template<typename That, typename BidiIter>
+ static bool skip_impl(That const &that, match_state<BidiIter> &state)
+ {
+ return that.BOOST_NESTED_TEMPLATE push_match<Top>(state);
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// stacked_xpression_cast
+//
+template<typename Top, typename Next>
+inline stacked_xpression<Top, Next> const &stacked_xpression_cast(Next const &next)
+{
+ // NOTE: this is a little white lie. The "next" object doesn't really have
+ // the type to which we're casting it. It is harmless, though. We are only using
+ // the cast to decorate the next object with type information. It is done
+ // this way to save stack space.
+ BOOST_MPL_ASSERT_RELATION(sizeof(stacked_xpression<Top, Next>), ==, sizeof(Next));
+ return *static_cast<stacked_xpression<Top, Next> const *>(&next);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// static_xpression
+//
+template<typename Matcher, typename Next>
+struct static_xpression
+ : Matcher
+{
+ Next next_;
+
+ BOOST_STATIC_CONSTANT(bool, pure = Matcher::pure && Next::pure);
+ BOOST_STATIC_CONSTANT(
+ std::size_t
+ , width =
+ Matcher::width != unknown_width::value && Next::width != unknown_width::value
+ ? Matcher::width + Next::width
+ : unknown_width::value
+ );
+
+ static_xpression(Matcher const &matcher = Matcher(), Next const &next = Next())
+ : Matcher(matcher)
+ , next_(next)
+ {
+ }
+
+ // match
+ // delegates to the Matcher
+ template<typename BidiIter>
+ bool match(match_state<BidiIter> &state) const
+ {
+ return this->Matcher::match(state, this->next_);
+ }
+
+ // push_match
+ // call match on this, but also push "Top" onto the xpression
+ // stack so we know what we are jumping back to later.
+ template<typename Top, typename BidiIter>
+ bool push_match(match_state<BidiIter> &state) const
+ {
+ return this->Matcher::match(state, stacked_xpression_cast<Top>(this->next_));
+ }
+
+ // skip_impl
+ // implementation of skip_match, called from stacked_xpression::skip_match
+ template<typename That, typename BidiIter>
+ static bool skip_impl(That const &that, match_state<BidiIter> &state)
+ {
+ return that.match(state);
+ }
+
+ // for linking a compiled regular xpression
+ template<typename Char>
+ void link(xpression_linker<Char> &linker) const
+ {
+ linker.accept(*static_cast<Matcher const *>(this), &this->next_);
+ this->next_.link(linker);
+ }
+
+ // for building a lead-follow
+ template<typename Char>
+ void peek(xpression_peeker<Char> &peeker) const
+ {
+ this->peek_next_(peeker.accept(*static_cast<Matcher const *>(this)), peeker);
+ }
+
+ // for getting xpression width
+ detail::width get_width() const
+ {
+ return this->get_width_(mpl::size_t<width>());
+ }
+
+private:
+
+ static_xpression &operator =(static_xpression const &);
+
+ template<typename Char>
+ void peek_next_(mpl::true_, xpression_peeker<Char> &peeker) const
+ {
+ this->next_.peek(peeker);
+ }
+
+ template<typename Char>
+ void peek_next_(mpl::false_, xpression_peeker<Char> &) const
+ {
+ // no-op
+ }
+
+ template<std::size_t Width>
+ detail::width get_width_(mpl::size_t<Width>) const
+ {
+ return Width;
+ }
+
+ detail::width get_width_(unknown_width) const
+ {
+ // Should only be called in contexts where the width is
+ // known to be fixed.
+ return this->Matcher::get_width() + this->next_.get_width();
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// make_static
+//
+template<typename Matcher>
+inline static_xpression<Matcher> const
+make_static(Matcher const &matcher)
+{
+ return static_xpression<Matcher>(matcher);
+}
+
+template<typename Matcher, typename Next>
+inline static_xpression<Matcher, Next> const
+make_static(Matcher const &matcher, Next const &next)
+{
+ return static_xpression<Matcher, Next>(matcher, next);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// no_next
+//
+struct no_next
+{
+ BOOST_STATIC_CONSTANT(std::size_t, width = 0);
+ BOOST_STATIC_CONSTANT(bool, pure = true);
+
+ template<typename Char>
+ void link(xpression_linker<Char> &) const
+ {
+ }
+
+ template<typename Char>
+ void peek(xpression_peeker<Char> &peeker) const
+ {
+ peeker.fail();
+ }
+
+ detail::width get_width() const
+ {
+ return 0;
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// get_mark_number
+//
+inline int get_mark_number(basic_mark_tag const &mark)
+{
+ return proto::arg(mark).mark_number_;
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_action.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_action.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,329 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_action.hpp
+//
+// Copyright 2008 Eric Niebler.
+// Copyright 2008 David Jenkins.
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_ACTION_HPP_EAN_04_05_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_ACTION_HPP_EAN_04_05_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/sizeof.hpp>
+#include <boost/mpl/min_max.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/matcher/attr_end_matcher.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/detail/static/transforms/as_quantifier.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+#include <boost/xpressive/proto/transform.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // read_attr
+ // Placeholder that knows the slot number of an attribute as well as the type
+ // of the object stored in it.
+ template<typename Nbr, typename Matcher>
+ struct read_attr
+ {
+ typedef Nbr nbr_type;
+ typedef Matcher matcher_type;
+ };
+
+ template<typename Nbr, typename Matcher>
+ struct read_attr<Nbr, Matcher &>
+ {
+ typedef Nbr nbr_type;
+ typedef Matcher matcher_type;
+ };
+
+}}}
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // FindAttr
+ // Look for patterns like (a1= terminal<RHS>) and return the type of the RHS.
+ template<typename Nbr>
+ struct FindAttr
+ : or_<
+ // Ignore nested actions, because attributes are scoped
+ when< subscript<_, _>, _state >
+ , when< terminal<_>, _state >
+ , when< proto::assign<terminal<detail::attribute_placeholder<Nbr> >, _>, call<_arg(_right)> >
+ , otherwise< fold<_, _state, FindAttr<Nbr> > >
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_read_attr
+ // For patterns like (a1 = RHS)[ref(i) = a1], transform to
+ // (a1 = RHS)[ref(i) = read_attr<1, RHS>] so that when reading the attribute
+ // we know what type is stored in the attribute slot.
+ struct as_read_attr : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename proto::result_of::as_expr<
+ detail::read_attr<
+ typename Expr::proto_arg0::nbr_type
+ , typename FindAttr<typename Expr::proto_arg0::nbr_type>::template result<void(
+ State
+ , mpl::void_
+ , int
+ )>::type
+ >
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &, State const &, Visitor &) const
+ {
+ typename result<void(Expr, State, Visitor)>::type that = {{}};
+ return that;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // by_value
+ // Store all terminals within an action by value to avoid dangling references.
+ struct by_value : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename proto::result_of::as_expr<
+ typename proto::result_of::arg<Expr>::type
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &) const
+ {
+ return proto::as_expr(proto::arg(expr));
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // DeepCopy
+ // Turn all refs into values, and also bind all attribute placeholders with
+ // the types from which they are being assigned.
+ struct DeepCopy
+ : or_<
+ when< terminal<detail::attribute_placeholder<_> >, as_read_attr>
+ , when< terminal<_>, by_value >
+ , otherwise< nary_expr<_, vararg<DeepCopy> > >
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // attr_nbr
+ // For an attribute placeholder, return the attribute's slot number.
+ struct attr_nbr : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename Expr::proto_arg0::nbr_type::type type;
+ };
+ };
+
+ struct max_attr;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // MaxAttr
+ // In an action (rx)[act], find the largest attribute slot being used.
+ struct MaxAttr
+ : or_<
+ when< terminal<detail::attribute_placeholder<_> >, attr_nbr>
+ , when< terminal<_>, make<mpl::int_<0> > >
+ // Ignore nested actions, because attributes are scoped:
+ , when< subscript<_, _>, make<mpl::int_<0> > >
+ , otherwise< fold<_, make<mpl::int_<0> >, max_attr> >
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // max_attr
+ // Take the maximum of the current attr slot number and the state.
+ struct max_attr : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename mpl::max<State, typename MaxAttr::template result<void(Expr, State, Visitor)>::type >::type type;
+ };
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_attr_matcher
+ // turn a1=matcher into attr_matcher<Matcher>(1)
+ struct as_attr_matcher : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ detail::attr_matcher<
+ typename proto::result_of::arg<typename Expr::proto_arg1>::type
+ , typename Visitor::traits_type
+ , typename Visitor::icase_type
+ >
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ return typename result<void(Expr, State, Visitor)>::type(
+ Expr::proto_arg0::proto_base_expr::proto_arg0::nbr_type::value
+ , proto::arg(proto::right(expr))
+ , visitor.traits()
+ );
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // add_attrs
+ // Wrap an expression in attr_begin_matcher/attr_end_matcher pair
+ struct add_attrs : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename shift_right<
+ typename terminal<
+ detail::attr_begin_matcher<typename MaxAttr::template result<void(Expr, mpl::int_<0>, int)>::type >
+ >::type
+ , typename shift_right<
+ Expr
+ , terminal<detail::attr_end_matcher>::type
+ >::type
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &) const
+ {
+ detail::attr_begin_matcher<typename MaxAttr::template result<void(Expr, mpl::int_<0>, int)>::type > begin;
+ detail::attr_end_matcher end;
+ typename result<void(Expr, State, Visitor)>::type that = {{begin}, {expr, {end}}};
+ return that;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // InsertAttrs
+ struct InsertAttrs
+ : if_<MaxAttr, add_attrs, _>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // CheckAssertion
+ struct CheckAssertion
+ : proto::function<terminal<detail::check_tag>, _>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // action_transform
+ // Turn A[B] into (mark_begin(n) >> A >> mark_end(n) >> action_matcher<B>(n))
+ // If A and B use attributes, wrap the above expression in
+ // a attr_begin_matcher<Count> / attr_end_matcher pair, where Count is
+ // the number of attribute slots used by the pattern/action.
+ struct as_action : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename proto::result_of::left<Expr>::type expr_type;
+ typedef typename proto::result_of::right<Expr>::type action_type;
+ typedef typename DeepCopy::template result<void(action_type, expr_type, int)>::type action_copy_type;
+
+ typedef
+ typename InsertMark::template result<void(expr_type, State, Visitor)>::type
+ marked_expr_type;
+
+ typedef
+ typename mpl::if_<
+ proto::matches<action_type, CheckAssertion>
+ , detail::predicate_matcher<action_copy_type>
+ , detail::action_matcher<action_copy_type>
+ >::type
+ matcher_type;
+
+ typedef
+ typename proto::shift_right<
+ marked_expr_type
+ , typename proto::terminal<matcher_type>::type
+ >::type
+ no_attr_type;
+
+ typedef
+ typename InsertAttrs::template result<void(no_attr_type, State, Visitor)>::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef result<void(Expr, State, Visitor)> apply_type;
+ typedef typename apply_type::matcher_type matcher_type;
+
+ int dummy = 0;
+ typename apply_type::marked_expr_type marked_expr =
+ InsertMark()(proto::left(expr), state, visitor);
+
+ typename apply_type::no_attr_type that =
+ {
+ marked_expr
+ , {
+ matcher_type
+ (
+ DeepCopy()(proto::right(expr), proto::left(expr), dummy)
+ , proto::arg(proto::left(marked_expr)).mark_number_
+ )
+ }
+ };
+
+ return InsertAttrs()(that, state, visitor);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_alternate.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_alternate.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,119 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_alternate.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_ALTERNATE_HPP_EAN_04_01_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_ALTERNATE_HPP_EAN_04_01_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/detail/core/matcher/alternate_matcher.hpp>
+#include <boost/xpressive/detail/utility/cons.hpp>
+
+namespace boost { namespace xpressive
+{
+ namespace detail
+ {
+ ///////////////////////////////////////////////////////////////////////////////
+ // alternates_list
+ // a fusion-compatible sequence of alternate expressions, that also keeps
+ // track of the list's width and purity.
+ template<typename Head, typename Tail>
+ struct alternates_list
+ : fusion::cons<Head, Tail>
+ {
+ BOOST_STATIC_CONSTANT(std::size_t, width = Head::width == Tail::width ? Head::width : detail::unknown_width::value);
+ BOOST_STATIC_CONSTANT(bool, pure = Head::pure && Tail::pure);
+
+ alternates_list(Head const &head, Tail const &tail)
+ : fusion::cons<Head, Tail>(head, tail)
+ {
+ }
+ };
+
+ template<typename Head>
+ struct alternates_list<Head, fusion::nil>
+ : fusion::cons<Head, fusion::nil>
+ {
+ BOOST_STATIC_CONSTANT(std::size_t, width = Head::width);
+ BOOST_STATIC_CONSTANT(bool, pure = Head::pure);
+
+ alternates_list(Head const &head, fusion::nil const &tail)
+ : fusion::cons<Head, fusion::nil>(head, tail)
+ {
+ }
+ };
+ }
+
+ namespace grammar_detail
+ {
+ ///////////////////////////////////////////////////////////////////////////////
+ // in_alternate_list
+ template<typename Grammar>
+ struct in_alternate_list : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef detail::alternates_list<
+ typename Grammar::template result<void(Expr, detail::alternate_end_xpression, Visitor)>::type
+ , State
+ > type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return typename result<void(Expr, State, Visitor)>::type(
+ Grammar()(expr, detail::alternate_end_xpression(), visitor)
+ , state
+ );
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_alternate_matcher
+ template<typename Grammar>
+ struct as_alternate_matcher : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef detail::alternate_matcher<
+ typename Grammar::template result<void(Expr, State, Visitor)>::type
+ , typename Visitor::traits_type
+ > type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return typename result<void(Expr, State, Visitor)>::type(
+ Grammar()(expr, state, visitor)
+ );
+ }
+ };
+
+ }
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_independent.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_independent.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,202 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_independent.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_INDEPENDENT_HPP_EAN_04_05_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_INDEPENDENT_HPP_EAN_04_05_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/sizeof.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+#include <boost/xpressive/proto/transform.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ struct keeper_tag
+ {};
+
+ struct lookahead_tag
+ {};
+
+ struct lookbehind_tag
+ {};
+}}}
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+ // A grammar that only accepts static regexes that
+ // don't have semantic actions.
+ struct NotHasAction
+ : proto::switch_<struct NotHasActionCases>
+ {};
+
+ struct NotHasActionCases
+ {
+ template<typename Tag, int Dummy = 0>
+ struct case_
+ : proto::nary_expr<Tag, proto::vararg<NotHasAction> >
+ {};
+
+ template<int Dummy>
+ struct case_<proto::tag::terminal, Dummy>
+ : not_< or_<
+ proto::terminal<detail::tracking_ptr<detail::regex_impl<_> > >,
+ proto::terminal<reference_wrapper<_> >
+ > >
+ {};
+
+ template<int Dummy>
+ struct case_<proto::tag::comma, Dummy>
+ : proto::_ // because (set='a','b') can't contain an action
+ {};
+
+ template<int Dummy>
+ struct case_<proto::tag::complement, Dummy>
+ : proto::_ // because in ~X, X can't contain an unscoped action
+ {};
+
+ template<int Dummy>
+ struct case_<detail::lookahead_tag, Dummy>
+ : proto::_ // because actions in lookaheads are scoped
+ {};
+
+ template<int Dummy>
+ struct case_<detail::lookbehind_tag, Dummy>
+ : proto::_ // because actions in lookbehinds are scoped
+ {};
+
+ template<int Dummy>
+ struct case_<detail::keeper_tag, Dummy>
+ : proto::_ // because actions in keepers are scoped
+ {};
+
+ template<int Dummy>
+ struct case_<proto::tag::subscript, Dummy>
+ : proto::subscript<detail::set_initializer_type, _>
+ {}; // only accept set[...], not actions!
+ };
+
+ struct IndependentEndXpression
+ : or_<
+ when<NotHasAction, detail::true_xpression()>
+ , otherwise<detail::independent_end_xpression()>
+ >
+ {};
+
+ template<typename Grammar>
+ struct as_lookahead : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename proto::result_of::arg<Expr>::type arg_type;
+
+ typedef
+ typename Grammar::template result<void(
+ arg_type
+ , typename IndependentEndXpression::result<void(arg_type, int, int)>::type
+ , Visitor
+ )>::type
+ xpr_type;
+ typedef detail::lookahead_matcher<xpr_type> type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ typedef result<void(Expr, State, Visitor)> result_type;
+ int i = 0;
+ return typename result_type::type(
+ Grammar()(
+ proto::arg(expr)
+ , IndependentEndXpression()(proto::arg(expr), i, i)
+ , visitor
+ )
+ , false
+ );
+ }
+ };
+
+ template<typename Grammar>
+ struct as_lookbehind : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename proto::result_of::arg<Expr>::type arg_type;
+ typedef
+ typename Grammar::template result<void(
+ arg_type
+ , typename IndependentEndXpression::result<void(arg_type, int, int)>::type
+ , Visitor
+ )>::type
+ xpr_type;
+ typedef detail::lookbehind_matcher<xpr_type> type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ typedef typename result<void(Expr, State, Visitor)>::xpr_type xpr_type;
+ int i = 0;
+ xpr_type const &expr2 = Grammar()(
+ proto::arg(expr)
+ , IndependentEndXpression()(proto::arg(expr), i, i)
+ , visitor
+ );
+ std::size_t width = expr2.get_width().value();
+ return detail::lookbehind_matcher<xpr_type>(expr2, width, false);
+ }
+ };
+
+ template<typename Grammar>
+ struct as_keeper : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename proto::result_of::arg<Expr>::type arg_type;
+ typedef detail::keeper_matcher<
+ typename Grammar::template result<void(
+ arg_type
+ , typename IndependentEndXpression::result<void(arg_type, int, int)>::type
+ , Visitor
+ )>::type
+ > type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ int i = 0;
+ return typename result<void(Expr, State, Visitor)>::type(
+ Grammar()(
+ proto::arg(expr)
+ , IndependentEndXpression()(proto::arg(expr), i, i)
+ , visitor
+ )
+ );
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_inverse.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_inverse.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,94 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_inverse.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_INVERSE_HPP_EAN_04_05_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_INVERSE_HPP_EAN_04_05_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/sizeof.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+
+#define UNCV(x) typename remove_const<x>::type
+#define UNREF(x) typename remove_reference<x>::type
+#define UNCVREF(x) UNCV(UNREF(x))
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+
+ template<typename T>
+ struct inverter
+ {
+ typedef T type;
+ static T call(T t)
+ {
+ t.inverse();
+ return t;
+ }
+ };
+
+ template<typename Traits, typename ICase, typename Not>
+ struct inverter<detail::literal_matcher<Traits, ICase, Not> >
+ {
+ typedef detail::literal_matcher<Traits, ICase, typename mpl::not_<Not>::type> type;
+ static type call(detail::literal_matcher<Traits, ICase, Not> t)
+ {
+ return type(t.ch_);
+ }
+ };
+
+ template<typename Traits>
+ struct inverter<detail::logical_newline_matcher<Traits> >
+ {
+ // ~_ln matches any one character that is not in the "newline" character class
+ typedef detail::posix_charset_matcher<Traits> type;
+ static type call(detail::logical_newline_matcher<Traits> t)
+ {
+ return type(t.newline(), true);
+ }
+ };
+
+ template<typename Traits>
+ struct inverter<detail::assert_word_matcher<detail::word_boundary<mpl::true_>, Traits> >
+ {
+ typedef detail::assert_word_matcher<detail::word_boundary<mpl::false_>, Traits> type;
+ static type call(detail::assert_word_matcher<detail::word_boundary<mpl::true_>, Traits> t)
+ {
+ return type(t.word());
+ }
+ };
+
+ struct as_inverse : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Matcher>
+ struct result<This(Matcher)>
+ : inverter<UNCVREF(Matcher)>
+ {};
+
+ template<typename Matcher>
+ typename inverter<Matcher>::type operator ()(Matcher const &matcher) const
+ {
+ return inverter<Matcher>::call(matcher);
+ }
+ };
+
+}}}
+
+#undef UNCV
+#undef UNREF
+#undef UNCVREF
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_marker.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_marker.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_marker.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MARKER_HPP_EAN_04_01_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MARKER_HPP_EAN_04_01_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_marker
+ // Insert mark tags before and after the expression
+ struct as_marker : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename shift_right<
+ terminal<detail::mark_begin_matcher>::type
+ , typename shift_right<
+ typename proto::result_of::right<Expr>::type
+ , terminal<detail::mark_end_matcher>::type
+ >::type
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &) const
+ {
+ int mark_nbr = detail::get_mark_number(proto::left(expr));
+ detail::mark_begin_matcher begin(mark_nbr);
+ detail::mark_end_matcher end(mark_nbr);
+
+ typename result<void(Expr, State, Visitor)>::type that
+ = {{begin}, {proto::right(expr), {end}}};
+ return that;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_matcher.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_matcher.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,46 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_matcher.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MATCHER_HPP_EAN_04_01_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MATCHER_HPP_EAN_04_01_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/assert.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+ struct as_matcher : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename Visitor::template apply<
+ typename proto::result_of::arg<Expr>::type
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ return visitor.call(proto::arg(expr));
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_modifier.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_modifier.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,69 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_modifier.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MODIFIER_HPP_EAN_04_05_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_MODIFIER_HPP_EAN_04_05_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/sizeof.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+
+#define UNCV(x) typename remove_const<x>::type
+#define UNREF(x) typename remove_reference<x>::type
+#define UNCVREF(x) UNCV(UNREF(x))
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // regex operator tags
+ struct modifier_tag
+ {};
+
+}}}
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_modifier
+ template<typename Grammar>
+ struct as_modifier : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename proto::result_of::arg<typename proto::result_of::left<Expr>::type>::type modifier_type;
+ typedef typename modifier_type::BOOST_NESTED_TEMPLATE apply<Visitor>::type visitor_type;
+ typedef typename Grammar::template result<void(typename proto::result_of::right<Expr>::type, State, visitor_type)>::type type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef result<void(Expr, State, Visitor)> result_;
+ typedef typename result_::visitor_type new_visitor_type;
+ new_visitor_type new_visitor(proto::arg(proto::left(expr)).call(visitor));
+ return Grammar()(proto::right(expr), state, new_visitor);
+ }
+ };
+
+}}}
+
+#undef UNCV
+#undef UNREF
+#undef UNCVREF
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_quantifier.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_quantifier.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,339 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_quantifier.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_QUANTIFIER_HPP_EAN_04_01_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_QUANTIFIER_HPP_EAN_04_01_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // generic_quant_tag
+ template<uint_t Min, uint_t Max>
+ struct generic_quant_tag
+ {
+ typedef mpl::integral_c<uint_t, Min> min_type;
+ typedef mpl::integral_c<uint_t, Max> max_type;
+ };
+}}}
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+ using detail::uint_t;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // min_type / max_type
+ template<typename Tag>
+ struct min_type : Tag::min_type {};
+
+ template<>
+ struct min_type<proto::tag::posit> : mpl::integral_c<uint_t, 1> {};
+
+ template<>
+ struct min_type<proto::tag::dereference> : mpl::integral_c<uint_t, 0> {};
+
+ template<>
+ struct min_type<proto::tag::logical_not> : mpl::integral_c<uint_t, 0> {};
+
+ template<typename Tag>
+ struct max_type : Tag::max_type {};
+
+ template<>
+ struct max_type<proto::tag::posit> : mpl::integral_c<uint_t, UINT_MAX-1> {};
+
+ template<>
+ struct max_type<proto::tag::dereference> : mpl::integral_c<uint_t, UINT_MAX-1> {};
+
+ template<>
+ struct max_type<proto::tag::logical_not> : mpl::integral_c<uint_t, 1> {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_simple_quantifier
+ template<typename Grammar, typename Greedy>
+ struct as_simple_quantifier : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename proto::result_of::arg<Expr>::type arg_type;
+ typedef typename Grammar::template result<void(arg_type, detail::true_xpression, Visitor)>::type xpr_type;
+ typedef detail::simple_repeat_matcher<xpr_type, Greedy> matcher_type;
+ typedef typename proto::terminal<matcher_type>::type type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ typedef result<void(Expr, State, Visitor)> result_;
+ typedef typename result_::arg_type arg_type;
+ typedef typename result_::xpr_type xpr_type;
+ typedef typename result_::matcher_type matcher_type;
+ typedef typename Expr::proto_tag tag;
+
+ xpr_type const &xpr = Grammar()(proto::arg(expr), detail::true_xpression(), visitor);
+ matcher_type matcher(xpr, (uint_t)min_type<tag>(), (uint_t)max_type<tag>(), xpr.get_width().value());
+ return proto::terminal<matcher_type>::type::make(matcher);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // add_hidden_mark
+ struct add_hidden_mark : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename shift_right<
+ terminal<detail::mark_begin_matcher>::type
+ , typename shift_right<
+ Expr
+ , terminal<detail::mark_end_matcher>::type
+ >::type
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ // we're inserting a hidden mark ... so grab the next hidden mark number.
+ int mark_nbr = visitor.get_hidden_mark();
+ detail::mark_begin_matcher begin(mark_nbr);
+ detail::mark_end_matcher end(mark_nbr);
+
+ typename result<void(Expr, State, Visitor)>::type that
+ = {{begin}, {expr, {end}}};
+ return that;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // InsertMark
+ struct InsertMark
+ : or_<
+ when<proto::assign<detail::basic_mark_tag, _>, _>
+ , otherwise<add_hidden_mark>
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_default_quantifier_impl
+ template<typename Greedy, uint_t Min, uint_t Max>
+ struct as_default_quantifier_impl : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename InsertMark::template result<void(typename proto::result_of::arg<Expr>::type, State, Visitor)>::type
+ marked_sub_type;
+
+ typedef
+ typename shift_right<
+ terminal<detail::repeat_begin_matcher>::type
+ , typename shift_right<
+ marked_sub_type
+ , typename terminal<detail::repeat_end_matcher<Greedy> >::type
+ >::type
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ // Ensure this sub-expression is book-ended with mark matchers
+ typename result<void(Expr, State, Visitor)>::marked_sub_type const &
+ marked_sub = InsertMark()(proto::arg(expr), state, visitor);
+
+ // Get the mark_number from the begin_mark_matcher
+ int mark_number = proto::arg(proto::left(marked_sub)).mark_number_;
+ BOOST_ASSERT(0 != mark_number);
+
+ uint_t min_ = (uint_t)min_type<typename Expr::proto_tag>();
+ uint_t max_ = (uint_t)max_type<typename Expr::proto_tag>();
+
+ detail::repeat_begin_matcher begin(mark_number);
+ detail::repeat_end_matcher<Greedy> end(mark_number, min_, max_);
+
+ typename result<void(Expr, State, Visitor)>::type that
+ = {{begin}, {marked_sub, {end}}};
+ return that;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // optional_tag
+ template<typename Greedy>
+ struct optional_tag
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_default_optional
+ template<typename Grammar, typename Greedy>
+ struct as_default_optional : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef detail::optional_matcher<
+ typename Grammar::template result<void(Expr, detail::alternate_end_xpression, Visitor)>::type
+ , Greedy
+ > type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ return typename result<void(Expr, State, Visitor)>::type(
+ Grammar()(expr, detail::alternate_end_xpression(), visitor)
+ );
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_mark_optional
+ template<typename Grammar, typename Greedy>
+ struct as_mark_optional : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef detail::optional_mark_matcher<
+ typename Grammar::template result<void(Expr, detail::alternate_end_xpression, Visitor)>::type
+ , Greedy
+ > type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ int mark_number = proto::arg(proto::left(expr)).mark_number_;
+ return typename result<void(Expr, State, Visitor)>::type(
+ Grammar()(expr, detail::alternate_end_xpression(), visitor)
+ , mark_number
+ );
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // IsMarkerOrRepeater
+ struct IsMarkerOrRepeater
+ : or_<
+ shift_right<terminal<detail::repeat_begin_matcher>, _>
+ , assign<terminal<detail::mark_placeholder>, _>
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_optional
+ template<typename Grammar, typename Greedy>
+ struct as_optional
+ : or_<
+ when<IsMarkerOrRepeater, as_mark_optional<Grammar, Greedy> >
+ , otherwise<as_default_optional<Grammar, Greedy> >
+ >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // make_optional_
+ template<typename Greedy>
+ struct make_optional_ : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename unary_expr<optional_tag<Greedy>, Expr>::type type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename unary_expr<optional_tag<Greedy>, Expr>::type
+ operator ()(Expr const &expr, State const &, Visitor &) const
+ {
+ typename unary_expr<optional_tag<Greedy>, Expr>::type that = {expr};
+ return that;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_default_quantifier_impl
+ template<typename Greedy, uint_t Max>
+ struct as_default_quantifier_impl<Greedy, 0, Max>
+ : call<make_optional_<Greedy>(as_default_quantifier_impl<Greedy, 1, Max>)>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_default_quantifier_impl
+ template<typename Greedy>
+ struct as_default_quantifier_impl<Greedy, 0, 1>
+ : call<make_optional_<Greedy>(_arg)>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_default_quantifier
+ template<typename Greedy>
+ struct as_default_quantifier : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ as_default_quantifier_impl<
+ Greedy
+ , min_type<typename Expr::proto_tag>::value
+ , max_type<typename Expr::proto_tag>::value
+ >
+ impl;
+
+ typedef typename impl::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return as_default_quantifier_impl<
+ Greedy
+ , min_type<typename Expr::proto_tag>::value
+ , max_type<typename Expr::proto_tag>::value
+ >()(expr, state, visitor);
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_sequence.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_sequence.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,50 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_sequence.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_SEQUENCE_HPP_EAN_04_01_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_SEQUENCE_HPP_EAN_04_01_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+ template<typename Grammar>
+ struct in_sequence : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef detail::static_xpression<
+ typename Grammar::template result<void(Expr, State, Visitor)>::type
+ , State
+ > type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return typename result<void(Expr, State, Visitor)>::type(
+ Grammar()(expr, state, visitor)
+ , state
+ );
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_set.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transforms/as_set.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,213 @@
+///////////////////////////////////////////////////////////////////////////////
+// as_set.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_SET_HPP_EAN_04_05_2007
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_SET_HPP_EAN_04_05_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/assert.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/static/static.hpp>
+#include <boost/xpressive/detail/utility/chset/chset.hpp>
+#include <boost/xpressive/detail/utility/traits_utils.hpp>
+
+namespace boost { namespace xpressive { namespace grammar_detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////
+ // CharLiteral
+ template<typename Char>
+ struct CharLiteral
+ : or_<
+ terminal<char>
+ , terminal<Char>
+ >
+ {};
+
+ template<>
+ struct CharLiteral<char>
+ : terminal<char>
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////
+ // ListSet
+ // matches expressions like (set= 'a','b','c')
+ // calculates the size of the set
+ template<typename Char>
+ struct ListSet
+ : or_<
+ when<
+ comma<ListSet<Char>, CharLiteral<Char> >
+ , make<mpl::next<call<ListSet<Char>(_left)> > > // TODO make a custom transform for this...
+ >
+ , when<
+ assign<detail::set_initializer_type, CharLiteral<Char> >
+ , make<mpl::int_<1> >
+ >
+ >
+ {};
+
+ template<typename Char, typename Traits>
+ void fill_list_set(Char *&, detail::set_initializer_type, Traits const &)
+ {}
+
+ template<typename Char, typename Expr, typename Traits>
+ void fill_list_set(Char *&buffer, Expr const &expr, Traits const &traits)
+ {
+ fill_list_set(buffer, proto::left(expr), traits);
+ *buffer++ = traits.translate(detail::char_cast<Char>(proto::arg(proto::right(expr)), traits));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // as_list_set_matcher
+ template<typename Char>
+ struct as_list_set_matcher
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef detail::set_matcher<
+ typename Visitor::traits_type
+ , typename ListSet<Char>::template result<void(Expr, State, Visitor)>::type
+ > type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ detail::set_matcher<
+ typename Visitor::traits_type
+ , typename ListSet<Char>::template result<void(Expr, State, Visitor)>::type
+ > set;
+ typename Visitor::char_type *buffer = set.set_;
+ fill_list_set(buffer, expr, visitor.traits());
+ return set;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // merge_charset
+ //
+ template<typename Grammar, typename CharSet, typename Visitor>
+ struct merge_charset
+ {
+ typedef typename Visitor::traits_type traits_type;
+ typedef typename CharSet::char_type char_type;
+ typedef typename CharSet::icase_type icase_type;
+
+ merge_charset(CharSet &charset, Visitor &visitor)
+ : charset_(charset)
+ , visitor_(visitor)
+ {}
+
+ template<typename Expr>
+ void operator ()(Expr const &expr) const
+ {
+ this->call_(expr, typename Expr::proto_tag());
+ }
+
+ private:
+ merge_charset &operator =(merge_charset const &);
+
+ template<typename Expr, typename Tag>
+ void call_(Expr const &expr, Tag) const
+ {
+ this->set_(Grammar()(expr, detail::end_xpression(), this->visitor_));
+ }
+
+ template<typename Expr>
+ void call_(Expr const &expr, tag::bitwise_or) const
+ {
+ (*this)(proto::left(expr));
+ (*this)(proto::right(expr));
+ }
+
+ template<typename Not>
+ void set_(detail::literal_matcher<traits_type, icase_type, Not> const &ch) const
+ {
+ // BUGBUG fixme!
+ BOOST_MPL_ASSERT_NOT((Not));
+ set_char(this->charset_.charset_, ch.ch_, this->visitor_.traits(), icase_type());
+ }
+
+ void set_(detail::range_matcher<traits_type, icase_type> const &rg) const
+ {
+ // BUGBUG fixme!
+ BOOST_ASSERT(!rg.not_);
+ set_range(this->charset_.charset_, rg.ch_min_, rg.ch_max_, this->visitor_.traits(), icase_type());
+ }
+
+ template<typename Size>
+ void set_(detail::set_matcher<traits_type, Size> const &set_) const
+ {
+ // BUGBUG fixme!
+ BOOST_ASSERT(!set_.not_);
+ for(int i = 0; i < Size::value; ++i)
+ {
+ set_char(this->charset_.charset_, set_.set_[i], this->visitor_.traits(), icase_type());
+ }
+ }
+
+ void set_(detail::posix_charset_matcher<traits_type> const &posix) const
+ {
+ set_class(this->charset_.charset_, posix.mask_, posix.not_, this->visitor_.traits());
+ }
+
+ CharSet &charset_;
+ Visitor &visitor_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ //
+ template<typename Grammar>
+ struct as_set_matcher : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename Visitor::char_type char_type;
+
+ // if sizeof(char_type)==1, merge everything into a basic_chset
+ // BUGBUG this is not optimal.
+ typedef typename mpl::if_<
+ detail::is_narrow_char<char_type>
+ , detail::basic_chset<char_type>
+ , detail::compound_charset<typename Visitor::traits_type>
+ >::type charset_type;
+
+ typedef detail::charset_matcher<
+ typename Visitor::traits_type
+ , typename Visitor::icase_type
+ , charset_type
+ > type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &, Visitor &visitor) const
+ {
+ typedef typename result<void(Expr, State, Visitor)>::type set_type;
+ set_type matcher;
+ merge_charset<Grammar, set_type, Visitor> merge(matcher, visitor);
+ merge(expr); // Walks the tree and fills in the charset
+ return matcher;
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transmogrify.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/transmogrify.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,240 @@
+///////////////////////////////////////////////////////////////////////////////
+// transmogrify.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSMOGRIFY_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSMOGRIFY_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <cstring> // for std::strlen
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/matchers.hpp>
+#include <boost/xpressive/detail/static/placeholders.hpp>
+#include <boost/xpressive/detail/utility/dont_care.hpp>
+#include <boost/xpressive/detail/utility/traits_utils.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ template<typename T, typename Char>
+ struct is_char_literal
+ : mpl::or_<is_same<T, Char>, is_same<T, char> >
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // transmogrify
+ //
+ template<typename BidiIter, typename ICase, typename Traits, typename Matcher, typename EnableIf = void>
+ struct default_transmogrify
+ {
+ typedef typename Traits::char_type char_type;
+ typedef typename Traits::string_type string_type;
+
+ typedef typename mpl::if_
+ <
+ is_char_literal<Matcher, char_type>
+ , literal_matcher<Traits, ICase, mpl::false_>
+ , string_matcher<Traits, ICase>
+ >::type type;
+
+ template<typename Matcher2, typename Visitor>
+ static type call(Matcher2 const &m, Visitor &visitor)
+ {
+ return default_transmogrify::call_(m, visitor, is_char_literal<Matcher2, char_type>());
+ }
+
+ template<typename Matcher2, typename Visitor>
+ static type call_(Matcher2 const &m, Visitor &visitor, mpl::true_)
+ {
+ char_type ch = char_cast<char_type>(m, visitor.traits());
+ return type(ch, visitor.traits());
+ }
+
+ template<typename Matcher2, typename Visitor>
+ static type call_(Matcher2 const &m, Visitor &visitor, mpl::false_)
+ {
+ string_type str = string_cast<string_type>(m, visitor.traits());
+ return type(str, visitor.traits());
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits, typename Matcher>
+ struct default_transmogrify<BidiIter, ICase, Traits, Matcher, typename Matcher::is_boost_xpressive_xpression_>
+ {
+ typedef Matcher type;
+
+ template<typename Matcher2>
+ static Matcher2 const &call(Matcher2 const &m, dont_care)
+ {
+ return m;
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits, typename Matcher>
+ struct transmogrify
+ : default_transmogrify<BidiIter, ICase, Traits, Matcher>
+ {};
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct transmogrify<BidiIter, ICase, Traits, assert_bol_placeholder >
+ {
+ typedef assert_bol_matcher<Traits> type;
+
+ template<typename Matcher2, typename Visitor>
+ static type call(Matcher2, Visitor &visitor)
+ {
+ return type(visitor.traits());
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct transmogrify<BidiIter, ICase, Traits, assert_eol_placeholder >
+ {
+ typedef assert_eol_matcher<Traits> type;
+
+ template<typename Matcher2, typename Visitor>
+ static type call(Matcher2, Visitor &visitor)
+ {
+ return type(visitor.traits());
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct transmogrify<BidiIter, ICase, Traits, logical_newline_placeholder >
+ {
+ typedef logical_newline_matcher<Traits> type;
+
+ template<typename Matcher2, typename Visitor>
+ static type call(Matcher2, Visitor &visitor)
+ {
+ return type(visitor.traits());
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits, typename Char>
+ struct transmogrify<BidiIter, ICase, Traits, range_placeholder<Char> >
+ {
+ // By design, we don't widen character ranges.
+ typedef typename iterator_value<BidiIter>::type char_type;
+ BOOST_MPL_ASSERT((is_same<Char, char_type>));
+ typedef range_matcher<Traits, ICase> type;
+
+ template<typename Matcher2, typename Visitor>
+ static type call(Matcher2 const &m, Visitor &visitor)
+ {
+ return type(m.ch_min_, m.ch_max_, m.not_, visitor.traits());
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct transmogrify<BidiIter, ICase, Traits, mark_placeholder >
+ {
+ typedef mark_matcher<Traits, ICase> type;
+
+ template<typename Matcher2, typename Visitor>
+ static type call(Matcher2 const &m, Visitor &visitor)
+ {
+ return type(m.mark_number_, visitor.traits());
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct transmogrify<BidiIter, ICase, Traits, posix_charset_placeholder >
+ {
+ typedef posix_charset_matcher<Traits> type;
+
+ template<typename Matcher2, typename Visitor>
+ static type call(Matcher2 const &m, Visitor &visitor)
+ {
+ char const *name_end = m.name_ + std::strlen(m.name_);
+ return type(visitor.traits().lookup_classname(m.name_, name_end, ICase::value), m.not_);
+ }
+ };
+
+ template<typename BidiIter, typename Traits, typename Size>
+ struct transmogrify<BidiIter, mpl::true_, Traits, set_matcher<Traits, Size> >
+ {
+ typedef set_matcher<Traits, Size> type;
+
+ template<typename Matcher2, typename Visitor>
+ static type call(Matcher2 m, Visitor &visitor)
+ {
+ m.nocase(visitor.traits());
+ return m;
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits, typename Cond>
+ struct transmogrify<BidiIter, ICase, Traits, assert_word_placeholder<Cond> >
+ {
+ typedef assert_word_matcher<Cond, Traits> type;
+
+ template<typename Visitor>
+ static type call(dont_care, Visitor &visitor)
+ {
+ return type(visitor.traits());
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct transmogrify<BidiIter, ICase, Traits, reference_wrapper<basic_regex<BidiIter> > >
+ {
+ typedef regex_byref_matcher<BidiIter> type;
+
+ template<typename Matcher2>
+ static type call(Matcher2 const &m, dont_care)
+ {
+ return type(detail::core_access<BidiIter>::get_regex_impl(m.get()));
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct transmogrify<BidiIter, ICase, Traits, reference_wrapper<basic_regex<BidiIter> const> >
+ {
+ typedef regex_byref_matcher<BidiIter> type;
+
+ template<typename Matcher2>
+ static type call(Matcher2 const &m, dont_care)
+ {
+ return type(detail::core_access<BidiIter>::get_regex_impl(m.get()));
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct transmogrify<BidiIter, ICase, Traits, tracking_ptr<regex_impl<BidiIter> > >
+ {
+ typedef regex_matcher<BidiIter> type;
+
+ template<typename Matcher2>
+ static type call(Matcher2 const &m, dont_care)
+ {
+ return type(m.get());
+ }
+ };
+
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct transmogrify<BidiIter, ICase, Traits, self_placeholder >
+ {
+ typedef regex_byref_matcher<BidiIter> type;
+
+ template<typename Matcher2, typename Visitor>
+ static type call(Matcher2, Visitor &visitor)
+ {
+ return type(visitor.self());
+ }
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/type_traits.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/type_traits.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////////
+// type_traits.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TYPE_TRAITS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_STATIC_TYPE_TRAITS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// is_static_xpression
+//
+template<typename T>
+struct is_static_xpression
+ : mpl::false_
+{
+};
+
+template<typename Matcher, typename Next>
+struct is_static_xpression<static_xpression<Matcher, Next> >
+ : mpl::true_
+{
+};
+
+template<typename Top, typename Next>
+struct is_static_xpression<stacked_xpression<Top, Next> >
+ : mpl::true_
+{
+};
+
+//////////////////////////////////////////////////////////////////////////
+// is_random
+//
+template<typename BidiIter>
+struct is_random
+ : is_convertible
+ <
+ typename iterator_category<BidiIter>::type
+ , std::random_access_iterator_tag
+ >
+{
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/visitor.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/visitor.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,144 @@
+///////////////////////////////////////////////////////////////////////////////
+// visitor.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_VISITOR_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_STATIC_VISITOR_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/ref.hpp>
+#include <boost/mpl/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+#include <boost/xpressive/detail/static/transmogrify.hpp>
+#include <boost/xpressive/detail/core/matcher/mark_begin_matcher.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ //
+ template<typename BidiIter>
+ struct xpression_visitor_base
+ {
+ explicit xpression_visitor_base(shared_ptr<regex_impl<BidiIter> > const &self)
+ : self_(self)
+ {
+ }
+
+ void swap(xpression_visitor_base<BidiIter> &that)
+ {
+ this->self_.swap(that.self_);
+ }
+
+ int get_hidden_mark()
+ {
+ return -(int)(++this->self_->hidden_mark_count_);
+ }
+
+ void mark_number(int mark_number)
+ {
+ if(0 < mark_number)
+ {
+ this->self_->mark_count_ =
+ (std::max)(this->self_->mark_count_, (std::size_t)mark_number);
+ }
+ }
+
+ shared_ptr<regex_impl<BidiIter> > &self()
+ {
+ return this->self_;
+ }
+
+ protected:
+
+ template<typename Matcher>
+ void visit_(Matcher const &)
+ {
+ }
+
+ void visit_(reference_wrapper<basic_regex<BidiIter> > const &rex)
+ {
+ // when visiting an embedded regex, track the references
+ this->self_->track_reference(*detail::core_access<BidiIter>::get_regex_impl(rex.get()));
+ }
+
+ void visit_(reference_wrapper<basic_regex<BidiIter> const> const &rex)
+ {
+ // when visiting an embedded regex, track the references
+ this->self_->track_reference(*detail::core_access<BidiIter>::get_regex_impl(rex.get()));
+ }
+
+ void visit_(tracking_ptr<regex_impl<BidiIter> > const &rex)
+ {
+ // when visiting an embedded regex, track the references
+ this->self_->track_reference(*rex.get());
+ }
+
+ void visit_(mark_placeholder const &backref)
+ {
+ // keep track of the largest mark number found
+ this->mark_number(backref.mark_number_);
+ }
+
+ void visit_(mark_begin_matcher const &mark_begin)
+ {
+ // keep track of the largest mark number found
+ this->mark_number(mark_begin.mark_number_);
+ }
+
+ private:
+ shared_ptr<regex_impl<BidiIter> > self_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ //
+ template<typename BidiIter, typename ICase, typename Traits>
+ struct xpression_visitor
+ : xpression_visitor_base<BidiIter>
+ {
+ typedef BidiIter iterator_type;
+ typedef ICase icase_type;
+ typedef Traits traits_type;
+ typedef typename boost::iterator_value<BidiIter>::type char_type;
+
+ explicit xpression_visitor(Traits const &tr, shared_ptr<regex_impl<BidiIter> > const &self)
+ : xpression_visitor_base<BidiIter>(self)
+ , traits_(tr)
+ {
+ }
+
+ template<typename Matcher>
+ struct apply
+ {
+ typedef typename transmogrify<BidiIter, ICase, Traits, Matcher>::type type;
+ };
+
+ template<typename Matcher>
+ typename apply<Matcher>::type
+ call(Matcher const &matcher)
+ {
+ this->visit_(matcher);
+ return transmogrify<BidiIter, ICase, Traits, Matcher>::call(matcher, *this);
+ }
+
+ Traits const &traits() const
+ {
+ return this->traits_;
+ }
+
+ private:
+
+ Traits traits_;
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/width_of.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/static/width_of.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,251 @@
+///////////////////////////////////////////////////////////////////////////////
+// width_of.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_STATIC_WIDTH_OF_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_STATIC_WIDTH_OF_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/ref.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/plus.hpp>
+#include <boost/mpl/times.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/size_t.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // is_char
+ //
+ template<typename T>
+ struct is_char
+ : mpl::false_
+ {};
+
+ template<>
+ struct is_char<char>
+ : mpl::true_
+ {};
+
+ template<>
+ struct is_char<wchar_t>
+ : mpl::true_
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // width_of_terminal
+ //
+ template<typename Expr, typename Char, bool IsXpr = is_xpr<Expr>::value>
+ struct width_of_terminal
+ : mpl::size_t<Expr::width> // xpressive literals
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of_terminal<Expr, Char, false>
+ : unknown_width // unknown literals (eg, basic_string, basic_regex, etc.)
+ {};
+
+ template<typename Char>
+ struct width_of_terminal<Char, Char, false>
+ : mpl::size_t<1> // char literals
+ {};
+
+ template<typename Char>
+ struct width_of_terminal<char, Char, false>
+ : mpl::size_t<1> // char literals
+ {};
+
+ template<>
+ struct width_of_terminal<char, char, false>
+ : mpl::size_t<1> // char literals
+ {};
+
+ template<typename Elem, std::size_t N, typename Char>
+ struct width_of_terminal<Elem (&) [N], Char, false>
+ : mpl::size_t<N-is_char<Elem>::value> // string literals
+ {};
+
+ template<typename Elem, std::size_t N, typename Char>
+ struct width_of_terminal<Elem const (&) [N], Char, false>
+ : mpl::size_t<N-is_char<Elem>::value> // string literals
+ {};
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // width_of
+ //
+ template<typename Expr, typename Char, typename Tag = typename Expr::proto_tag>
+ struct width_of
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::terminal>
+ : width_of_terminal<typename proto::result_of::arg<Expr>::type, Char>
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::shift_right>
+ : mpl::if_<
+ mpl::or_<
+ mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg0::proto_base_expr, Char> >
+ , mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg1::proto_base_expr, Char> >
+ >
+ , unknown_width
+ , mpl::plus<
+ width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ , width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ >
+ >::type
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::bitwise_or>
+ : mpl::if_<
+ mpl::or_<
+ mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg0::proto_base_expr, Char> >
+ , mpl::not_equal_to<
+ width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ , width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ >
+ >
+ , unknown_width
+ , width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ >::type
+ {};
+
+ template<typename Expr, typename Char, typename Left>
+ struct width_of_assign
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of_assign<Expr, Char, mark_placeholder>
+ : width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of_assign<Expr, Char, set_initializer>
+ : mpl::size_t<1>
+ {};
+
+ template<typename Expr, typename Char, typename Nbr>
+ struct width_of_assign<Expr, Char, attribute_placeholder<Nbr> >
+ : unknown_width
+ {};
+
+ // either (s1 = ...) or (a1 = ...) or (set = ...)
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::assign>
+ : width_of_assign<Expr, Char, typename proto::result_of::arg<typename Expr::proto_arg0::proto_base_expr>::type>
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, modifier_tag>
+ : width_of<typename Expr::proto_arg1::proto_base_expr, Char>
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, lookahead_tag>
+ : mpl::size_t<0>
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, lookbehind_tag>
+ : mpl::size_t<0>
+ {};
+
+ // keep() is used to turn off backtracking, so they should only be used
+ // for things that are variable-width (eg. quantified)
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, keeper_tag>
+ : unknown_width
+ {
+ // If this assert fires, you put something that doesn't require backtracking
+ // in a keep(). In that case, the keep() is not necessary and you should just
+ // remove it.
+ BOOST_MPL_ASSERT_RELATION((width_of<typename Expr::proto_arg0::proto_base_expr, Char>::value), ==, unknown_width::value);
+ };
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::posit>
+ : unknown_width
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::dereference>
+ : unknown_width
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::logical_not>
+ : unknown_width
+ {};
+
+ template<typename Expr, typename Char, uint_t Min, uint_t Max>
+ struct width_of<Expr, Char, generic_quant_tag<Min, Max> >
+ : unknown_width
+ {};
+
+ template<typename Expr, typename Char, uint_t Count>
+ struct width_of<Expr, Char, generic_quant_tag<Count, Count> >
+ : mpl::if_<
+ mpl::equal_to<unknown_width, width_of<typename Expr::proto_arg0::proto_base_expr, Char> >
+ , unknown_width
+ , mpl::times<
+ width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ , mpl::size_t<Count>
+ >
+ >::type
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::negate>
+ : width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ {};
+
+ // when complementing a set or an assertion, the width is that of the set (1) or the assertion (0)
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::complement>
+ : width_of<typename Expr::proto_arg0::proto_base_expr, Char>
+ {};
+
+ // The comma is used in list-initialized sets, and the width of sets are 1
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::comma>
+ : mpl::size_t<1>
+ {};
+
+ // The subscript operator[] is used for sets, as in set['a' | range('b','h')],
+ // or for actions as in (any >> expr)[ action ]
+ template<typename Expr, typename Char, typename Left>
+ struct width_of_subscript
+ : width_of<Left, Char>
+ {};
+
+ template<typename Expr, typename Char>
+ struct width_of_subscript<Expr, Char, set_initializer_type>
+ : mpl::size_t<1>
+ {
+ // If Left is "set" then make sure that Right has a width_of 1
+ BOOST_MPL_ASSERT_RELATION(1, ==, (width_of<typename Expr::proto_arg1::proto_base_expr, Char>::value));
+ };
+
+ template<typename Expr, typename Char>
+ struct width_of<Expr, Char, proto::tag::subscript>
+ : width_of_subscript<Expr, Char, typename Expr::proto_arg0::proto_base_expr>
+ {};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/algorithm.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/algorithm.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,174 @@
+///////////////////////////////////////////////////////////////////////////////
+// algorithm.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_ALGORITHM_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_ALGORITHM_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <string>
+#include <climits>
+#include <algorithm>
+#include <boost/version.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/begin.hpp>
+#include <boost/range/size.hpp>
+#include <boost/range/value_type.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// any
+//
+template<typename InIter, typename Pred>
+inline bool any(InIter begin, InIter end, Pred pred)
+{
+ return end != std::find_if(begin, end, pred);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// find_nth_if
+//
+template<typename FwdIter, typename Diff, typename Pred>
+FwdIter find_nth_if(FwdIter begin, FwdIter end, Diff count, Pred pred)
+{
+ for(; begin != end; ++begin)
+ {
+ if(pred(*begin) && 0 == count--)
+ {
+ return begin;
+ }
+ }
+
+ return end;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// toi
+//
+template<typename InIter, typename Traits>
+int toi(InIter &begin, InIter end, Traits const &traits, int radix = 10, int max = INT_MAX)
+{
+ detail::ignore_unused(traits);
+ int i = 0, c = 0;
+ for(; begin != end && -1 != (c = traits.value(*begin, radix)); ++begin)
+ {
+ if(max < ((i *= radix) += c))
+ return i / radix;
+ }
+ return i;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// advance_to
+//
+template<typename BidiIter, typename Diff>
+inline bool advance_to_impl(BidiIter & iter, Diff diff, BidiIter end, std::bidirectional_iterator_tag)
+{
+ for(; 0 < diff && iter != end; --diff)
+ ++iter;
+ for(; 0 > diff && iter != end; ++diff)
+ --iter;
+ return 0 == diff;
+}
+
+template<typename RandIter, typename Diff>
+inline bool advance_to_impl(RandIter & iter, Diff diff, RandIter end, std::random_access_iterator_tag)
+{
+ if(0 < diff)
+ {
+ if((end - iter) < diff)
+ return false;
+ }
+ else if(0 > diff)
+ {
+ if((iter - end) < -diff)
+ return false;
+ }
+ iter += diff;
+ return true;
+}
+
+template<typename Iter, typename Diff>
+inline bool advance_to(Iter & iter, Diff diff, Iter end)
+{
+ return detail::advance_to_impl(iter, diff, end, typename iterator_category<Iter>::type());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// range_data
+//
+template<typename T>
+struct range_data
+ : range_value<T>
+{};
+
+template<typename T>
+struct range_data<T *>
+ : remove_const<T>
+{};
+
+template<typename T> std::ptrdiff_t is_null_terminated(T const &) { return 0; }
+#if BOOST_VERSION >= 103500
+inline std::ptrdiff_t is_null_terminated(char const *) { return 1; }
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+inline std::ptrdiff_t is_null_terminated(wchar_t const *) { return 1; }
+#endif
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// data_begin/data_end
+//
+template<typename Cont>
+typename range_data<Cont>::type const *data_begin(Cont const &cont)
+{
+ return &*boost::begin(cont);
+}
+
+template<typename Cont>
+typename range_data<Cont>::type const *data_end(Cont const &cont)
+{
+ return &*boost::begin(cont) + boost::size(cont) - is_null_terminated(cont);
+}
+
+template<typename Char, typename Traits, typename Alloc>
+Char const *data_begin(std::basic_string<Char, Traits, Alloc> const &str)
+{
+ return str.data();
+}
+
+template<typename Char, typename Traits, typename Alloc>
+Char const *data_end(std::basic_string<Char, Traits, Alloc> const &str)
+{
+ return str.data() + str.size();
+}
+
+template<typename Char>
+Char const *data_begin(Char const *const &sz)
+{
+ return sz;
+}
+
+template<typename Char>
+Char const *data_end(Char const *const &sz)
+{
+ Char const *tmp = sz;
+ for(; *tmp; ++tmp)
+ ;
+ return tmp;
+}
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/any.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/any.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,108 @@
+///////////////////////////////////////////////////////////////////////////////
+// any.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_ANY_HPP_EAN_11_19_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_ANY_HPP_EAN_11_19_2005
+
+#include <boost/version.hpp>
+
+#if BOOST_VERSION >= 103300
+
+// In Boost 1.33+, we have a cons list in Fusion, so just include it.
+
+# if BOOST_VERSION >= 103500
+# include <boost/fusion/include/any.hpp> // Boost 1.35+ has Fusion2
+# else
+# include <boost/spirit/fusion/algorithm/any.hpp> // Fusion1
+# endif
+
+#else
+
+# include <boost/spirit/fusion/sequence/begin.hpp>
+# include <boost/spirit/fusion/sequence/end.hpp>
+# include <boost/spirit/fusion/iterator/equal_to.hpp>
+# include <boost/mpl/bool.hpp>
+# include <boost/spirit/fusion/iterator/equal_to.hpp>
+# include <boost/spirit/fusion/iterator/next.hpp>
+# include <boost/spirit/fusion/iterator/deref.hpp>
+
+namespace boost { namespace fusion
+{
+
+ namespace detail
+ {
+ template <typename First, typename Last, typename F>
+ inline bool
+ any(First const&, Last const&, F const&, mpl::true_)
+ {
+ return false;
+ }
+
+ template <typename First, typename Last, typename F>
+ inline bool
+ any(First const& first, Last const& last, F const& f, mpl::false_)
+ {
+ if(f(*first))
+ return true;
+ return detail::any(fusion::next(first), last, f
+ , meta::equal_to<BOOST_DEDUCED_TYPENAME meta::next<First>::type, Last>());
+ }
+ }
+
+ namespace meta
+ {
+ template <typename Sequence, typename F>
+ struct any
+ {
+ typedef bool type;
+ };
+ }
+
+ namespace function
+ {
+ struct any
+ {
+ template <typename Sequence, typename F>
+ struct apply
+ {
+ typedef bool type;
+ };
+
+ template <typename Sequence, typename F>
+ inline bool
+ operator()(Sequence const& seq, F const& f) const
+ {
+ return detail::any(
+ fusion::begin(seq)
+ , fusion::end(seq)
+ , f
+ , meta::equal_to<
+ BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
+ , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
+ }
+
+ template <typename Sequence, typename F>
+ inline bool
+ operator()(Sequence& seq, F const& f) const
+ {
+ return detail::any(
+ fusion::begin(seq)
+ , fusion::end(seq)
+ , f
+ , meta::equal_to<
+ BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
+ , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
+ }
+ };
+ }
+
+ function::any const any = function::any();
+}}
+
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/boyer_moore.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/boyer_moore.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,198 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file boyer_moore.hpp
+/// Contains the boyer-moore implementation. Note: this is *not* a general-
+/// purpose boyer-moore implementation. It truncates the search string at
+/// 256 characters, but it is sufficient for the needs of xpressive.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_BOYER_MOORE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_BOYER_MOORE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4100) // unreferenced formal parameter
+#endif
+
+#include <climits> // for UCHAR_MAX
+#include <cstddef> // for std::ptrdiff_t
+#include <utility> // for std::max
+#include <vector>
+#include <boost/mpl/bool.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// boyer_moore
+//
+template<typename BidiIter, typename Traits>
+struct boyer_moore
+ : noncopyable
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef Traits traits_type;
+ typedef has_fold_case<Traits> case_fold;
+ typedef typename Traits::string_type string_type;
+
+ // initialize the Boyer-Moore search data structure, using the
+ // search sub-sequence to prime the pump.
+ boyer_moore(char_type const *begin, char_type const *end, Traits const &traits, bool icase)
+ : begin_(begin)
+ , last_(begin)
+ , fold_()
+ , find_fun_(
+ icase
+ ? (case_fold() ? &boyer_moore::find_nocase_fold_ : &boyer_moore::find_nocase_)
+ : &boyer_moore::find_
+ )
+ {
+ std::ptrdiff_t const uchar_max = UCHAR_MAX;
+ std::ptrdiff_t diff = std::distance(begin, end);
+ this->length_ = static_cast<unsigned char>((std::min)(diff, uchar_max));
+ std::fill_n(static_cast<unsigned char *>(this->offsets_), uchar_max + 1, this->length_);
+ --this->length_;
+
+ icase ? this->init_(traits, case_fold()) : this->init_(traits, mpl::false_());
+ }
+
+ BidiIter find(BidiIter begin, BidiIter end, Traits const &traits) const
+ {
+ return (this->*this->find_fun_)(begin, end, traits);
+ }
+
+private:
+
+ void init_(Traits const &traits, mpl::false_)
+ {
+ for(unsigned char offset = this->length_; offset; --offset, ++this->last_)
+ {
+ this->offsets_[traits.hash(*this->last_)] = offset;
+ }
+ }
+
+ void init_(Traits const &traits, mpl::true_)
+ {
+ this->fold_.reserve(this->length_ + 1);
+ for(unsigned char offset = this->length_; offset; --offset, ++this->last_)
+ {
+ this->fold_.push_back(traits.fold_case(*this->last_));
+ for(typename string_type::const_iterator beg = this->fold_.back().begin(), end = this->fold_.back().end();
+ beg != end; ++beg)
+ {
+ this->offsets_[traits.hash(*beg)] = offset;
+ }
+ }
+ this->fold_.push_back(traits.fold_case(*this->last_));
+ }
+
+ // case-sensitive Boyer-Moore search
+ BidiIter find_(BidiIter begin, BidiIter end, Traits const &traits) const
+ {
+ typedef typename boost::iterator_difference<BidiIter>::type diff_type;
+ diff_type const endpos = std::distance(begin, end);
+ diff_type offset = static_cast<diff_type>(this->length_);
+
+ for(diff_type curpos = offset; curpos < endpos; curpos += offset)
+ {
+ std::advance(begin, offset);
+
+ char_type const *pat_tmp = this->last_;
+ BidiIter str_tmp = begin;
+
+ for(; traits.translate(*str_tmp) == *pat_tmp; --pat_tmp, --str_tmp)
+ {
+ if(pat_tmp == this->begin_)
+ {
+ return str_tmp;
+ }
+ }
+
+ offset = this->offsets_[traits.hash(traits.translate(*begin))];
+ }
+
+ return end;
+ }
+
+ // case-insensitive Boyer-Moore search
+ BidiIter find_nocase_(BidiIter begin, BidiIter end, Traits const &traits) const
+ {
+ typedef typename boost::iterator_difference<BidiIter>::type diff_type;
+ diff_type const endpos = std::distance(begin, end);
+ diff_type offset = static_cast<diff_type>(this->length_);
+
+ for(diff_type curpos = offset; curpos < endpos; curpos += offset)
+ {
+ std::advance(begin, offset);
+
+ char_type const *pat_tmp = this->last_;
+ BidiIter str_tmp = begin;
+
+ for(; traits.translate_nocase(*str_tmp) == *pat_tmp; --pat_tmp, --str_tmp)
+ {
+ if(pat_tmp == this->begin_)
+ {
+ return str_tmp;
+ }
+ }
+
+ offset = this->offsets_[traits.hash(traits.translate_nocase(*begin))];
+ }
+
+ return end;
+ }
+
+ // case-insensitive Boyer-Moore search with case-folding
+ BidiIter find_nocase_fold_(BidiIter begin, BidiIter end, Traits const &traits) const
+ {
+ typedef typename boost::iterator_difference<BidiIter>::type diff_type;
+ diff_type const endpos = std::distance(begin, end);
+ diff_type offset = static_cast<diff_type>(this->length_);
+
+ for(diff_type curpos = offset; curpos < endpos; curpos += offset)
+ {
+ std::advance(begin, offset);
+
+ string_type const *pat_tmp = &this->fold_.back();
+ BidiIter str_tmp = begin;
+
+ for(; pat_tmp->end() != std::find(pat_tmp->begin(), pat_tmp->end(), *str_tmp);
+ --pat_tmp, --str_tmp)
+ {
+ if(pat_tmp == &this->fold_.front())
+ {
+ return str_tmp;
+ }
+ }
+
+ offset = this->offsets_[traits.hash(*begin)];
+ }
+
+ return end;
+ }
+
+private:
+
+ char_type const *begin_;
+ char_type const *last_;
+ std::vector<string_type> fold_;
+ BidiIter (boyer_moore::*const find_fun_)(BidiIter, BidiIter, Traits const &) const;
+ unsigned char length_;
+ unsigned char offsets_[UCHAR_MAX + 1];
+};
+
+}}} // namespace boost::xpressive::detail
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/basic_chset.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/basic_chset.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,172 @@
+/*=============================================================================
+ Copyright (c) 2001-2003 Joel de Guzman
+ Copyright (c) 2001-2003 Daniel Nuffer
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#ifndef BOOST_XPRESSIVE_SPIRIT_BASIC_CHSET_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_SPIRIT_BASIC_CHSET_HPP_EAN_10_04_2005
+
+///////////////////////////////////////////////////////////////////////////////
+#include <bitset>
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/detail/utility/chset/range_run.ipp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////
+//
+// basic_chset: basic character set implementation using range_run
+//
+///////////////////////////////////////////////////////////////////////////
+template<typename Char>
+struct basic_chset
+{
+ basic_chset();
+ basic_chset(basic_chset const &arg);
+
+ bool empty() const;
+ void set(Char from, Char to);
+ template<typename Traits>
+ void set(Char from, Char to, Traits const &traits);
+ void set(Char c);
+ template<typename Traits>
+ void set(Char c, Traits const &traits);
+
+ void clear(Char from, Char to);
+ template<typename Traits>
+ void clear(Char from, Char to, Traits const &traits);
+ void clear(Char c);
+ template<typename Traits>
+ void clear(Char c, Traits const &traits);
+ void clear();
+
+ template<typename Traits>
+ bool test(Char v, Traits const &traits, mpl::false_) const; // case-sensitive
+ template<typename Traits>
+ bool test(Char v, Traits const &traits, mpl::true_) const; // case-insensitive
+
+ void inverse();
+ void swap(basic_chset& x);
+
+ basic_chset &operator |=(basic_chset const &x);
+ basic_chset &operator &=(basic_chset const &x);
+ basic_chset &operator -=(basic_chset const &x);
+ basic_chset &operator ^=(basic_chset const &x);
+
+private:
+ range_run<Char> rr_;
+};
+
+#if(CHAR_BIT == 8)
+
+///////////////////////////////////////////////////////////////////////////
+//
+// basic_chset: specializations for 8 bit chars using std::bitset
+//
+///////////////////////////////////////////////////////////////////////////
+template<typename Char>
+struct basic_chset_8bit
+{
+ basic_chset_8bit();
+ basic_chset_8bit(basic_chset_8bit const &arg);
+
+ bool empty() const;
+
+ void set(Char from, Char to);
+ template<typename Traits>
+ void set(Char from, Char to, Traits const &traits);
+ void set(Char c);
+ template<typename Traits>
+ void set(Char c, Traits const &traits);
+
+ void clear(Char from, Char to);
+ template<typename Traits>
+ void clear(Char from, Char to, Traits const &traits);
+ void clear(Char c);
+ template<typename Traits>
+ void clear(Char c, Traits const &traits);
+ void clear();
+
+ template<typename Traits>
+ bool test(Char v, Traits const &traits, mpl::false_) const; // case-sensitive
+ template<typename Traits>
+ bool test(Char v, Traits const &traits, mpl::true_) const; // case-insensitive
+
+ void inverse();
+ void swap(basic_chset_8bit& x);
+
+ basic_chset_8bit &operator |=(basic_chset_8bit const &x);
+ basic_chset_8bit &operator &=(basic_chset_8bit const &x);
+ basic_chset_8bit &operator -=(basic_chset_8bit const &x);
+ basic_chset_8bit &operator ^=(basic_chset_8bit const &x);
+
+ std::bitset<256> const &base() const;
+
+private:
+ std::bitset<256> bset_; // BUGBUG range-checking slows this down
+};
+
+/////////////////////////////////
+template<>
+struct basic_chset<char>
+ : basic_chset_8bit<char>
+{
+};
+
+/////////////////////////////////
+template<>
+struct basic_chset<signed char>
+ : basic_chset_8bit<signed char>
+{
+};
+
+/////////////////////////////////
+template<>
+struct basic_chset<unsigned char>
+ : basic_chset_8bit<unsigned char>
+{
+};
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// is_narrow_char
+template<typename Char>
+struct is_narrow_char
+ : mpl::false_
+{};
+
+template<>
+struct is_narrow_char<char>
+ : mpl::true_
+{};
+
+template<>
+struct is_narrow_char<signed char>
+ : mpl::true_
+{};
+
+template<>
+struct is_narrow_char<unsigned char>
+ : mpl::true_
+{};
+
+///////////////////////////////////////////////////////////////////////////////
+// helpers
+template<typename Char, typename Traits>
+void set_char(basic_chset<Char> &chset, Char ch, Traits const &traits, bool icase);
+
+template<typename Char, typename Traits>
+void set_range(basic_chset<Char> &chset, Char from, Char to, Traits const &traits, bool icase);
+
+template<typename Char, typename Traits>
+void set_class(basic_chset<Char> &chset, typename Traits::char_class_type char_class, bool no, Traits const &traits);
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/basic_chset.ipp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/basic_chset.ipp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,409 @@
+/*=============================================================================
+ Copyright (c) 2001-2003 Joel de Guzman
+ Copyright (c) 2001-2003 Daniel Nuffer
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#ifndef BOOST_XPRESSIVE_SPIRIT_BASIC_CHSET_IPP
+#define BOOST_XPRESSIVE_SPIRIT_BASIC_CHSET_IPP
+
+///////////////////////////////////////////////////////////////////////////////
+#include <bitset>
+#include <boost/xpressive/detail/utility/chset/basic_chset.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// basic_chset: character set implementation
+//
+///////////////////////////////////////////////////////////////////////////////
+template<typename Char>
+inline basic_chset<Char>::basic_chset()
+{
+}
+
+//////////////////////////////////
+template<typename Char>
+inline basic_chset<Char>::basic_chset(basic_chset const &arg)
+ : rr_(arg.rr_)
+{
+}
+
+//////////////////////////////////
+template<typename Char>
+inline bool basic_chset<Char>::empty() const
+{
+ return this->rr_.empty();
+}
+
+//////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline bool basic_chset<Char>::test(Char v, Traits const &, mpl::false_) const // case-sensitive
+{
+ return this->rr_.test(v);
+}
+
+//////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline bool basic_chset<Char>::test(Char v, Traits const &traits, mpl::true_) const // case-insensitive
+{
+ return this->rr_.test(v, traits);
+}
+
+//////////////////////////////////
+template<typename Char>
+inline void basic_chset<Char>::set(Char from, Char to)
+{
+ this->rr_.set(range<Char>(from, to));
+}
+
+//////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline void basic_chset<Char>::set(Char from, Char to, Traits const &)
+{
+ this->rr_.set(range<Char>(from, to));
+}
+
+//////////////////////////////////
+template<typename Char>
+inline void basic_chset<Char>::set(Char c)
+{
+ this->rr_.set(range<Char>(c, c));
+}
+
+//////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline void basic_chset<Char>::set(Char c, Traits const &)
+{
+ this->rr_.set(range<Char>(c, c));
+}
+
+//////////////////////////////////
+template<typename Char>
+inline void basic_chset<Char>::clear(Char c)
+{
+ this->rr_.clear(range<Char>(c, c));
+}
+
+//////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline void basic_chset<Char>::clear(Char c, Traits const &)
+{
+ this->rr_.clear(range<Char>(c, c));
+}
+
+//////////////////////////////////
+template<typename Char>
+inline void basic_chset<Char>::clear(Char from, Char to)
+{
+ this->rr_.clear(range<Char>(from, to));
+}
+
+//////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline void basic_chset<Char>::clear(Char from, Char to, Traits const &)
+{
+ this->rr_.clear(range<Char>(from, to));
+}
+
+//////////////////////////////////
+template<typename Char>
+inline void basic_chset<Char>::clear()
+{
+ this->rr_.clear();
+}
+
+/////////////////////////////////
+template<typename Char>
+inline void basic_chset<Char>::inverse()
+{
+ // BUGBUG is this right? Does this handle icase correctly?
+ basic_chset<Char> inv;
+ inv.set((std::numeric_limits<Char>::min)(), (std::numeric_limits<Char>::max)());
+ inv -= *this;
+ this->swap(inv);
+}
+
+/////////////////////////////////
+template<typename Char>
+inline void basic_chset<Char>::swap(basic_chset<Char> &that)
+{
+ this->rr_.swap(that.rr_);
+}
+
+/////////////////////////////////
+template<typename Char>
+inline basic_chset<Char> &
+basic_chset<Char>::operator |=(basic_chset<Char> const &that)
+{
+ typedef typename range_run<Char>::const_iterator const_iterator;
+ for(const_iterator iter = that.rr_.begin(); iter != that.rr_.end(); ++iter)
+ {
+ this->rr_.set(*iter);
+ }
+ return *this;
+}
+
+/////////////////////////////////
+template<typename Char>
+inline basic_chset<Char> &
+basic_chset<Char>::operator &=(basic_chset<Char> const &that)
+{
+ basic_chset<Char> inv;
+ inv.set((std::numeric_limits<Char>::min)(), (std::numeric_limits<Char>::max)());
+ inv -= that;
+ *this -= inv;
+ return *this;
+}
+
+/////////////////////////////////
+template<typename Char>
+inline basic_chset<Char> &
+basic_chset<Char>::operator -=(basic_chset<Char> const &that)
+{
+ typedef typename range_run<Char>::const_iterator const_iterator;
+ for(const_iterator iter = that.rr_.begin(); iter != that.rr_.end(); ++iter)
+ {
+ this->rr_.clear(*iter);
+ }
+ return *this;
+}
+
+/////////////////////////////////
+template<typename Char>
+inline basic_chset<Char> &
+basic_chset<Char>::operator ^=(basic_chset<Char> const &that)
+{
+ basic_chset bma = that;
+ bma -= *this;
+ *this -= that;
+ *this |= bma;
+ return *this;
+}
+
+#if(CHAR_BIT == 8)
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// basic_chset: specializations for 8 bit chars using std::bitset
+//
+///////////////////////////////////////////////////////////////////////////////
+template<typename Char>
+inline basic_chset_8bit<Char>::basic_chset_8bit()
+{
+}
+
+/////////////////////////////////
+template<typename Char>
+inline basic_chset_8bit<Char>::basic_chset_8bit(basic_chset_8bit<Char> const &arg)
+ : bset_(arg.bset_)
+{
+}
+
+/////////////////////////////////
+template<typename Char>
+inline bool basic_chset_8bit<Char>::empty() const
+{
+ return !this->bset_.any();
+}
+
+/////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline bool basic_chset_8bit<Char>::test(Char v, Traits const &, mpl::false_) const // case-sensitive
+{
+ return this->bset_.test((unsigned char)v);
+}
+
+/////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline bool basic_chset_8bit<Char>::test(Char v, Traits const &traits, mpl::true_) const // case-insensitive
+{
+ return this->bset_.test((unsigned char)traits.translate_nocase(v));
+}
+
+/////////////////////////////////
+template<typename Char>
+inline void basic_chset_8bit<Char>::set(Char from, Char to)
+{
+ for(int i = from; i <= to; ++i)
+ {
+ this->bset_.set((unsigned char)i);
+ }
+}
+
+/////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline void basic_chset_8bit<Char>::set(Char from, Char to, Traits const &traits)
+{
+ for(int i = from; i <= to; ++i)
+ {
+ this->bset_.set((unsigned char)traits.translate_nocase((Char)i));
+ }
+}
+
+/////////////////////////////////
+template<typename Char>
+inline void basic_chset_8bit<Char>::set(Char c)
+{
+ this->bset_.set((unsigned char)c);
+}
+
+/////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline void basic_chset_8bit<Char>::set(Char c, Traits const &traits)
+{
+ this->bset_.set((unsigned char)traits.translate_nocase(c));
+}
+
+/////////////////////////////////
+template<typename Char>
+inline void basic_chset_8bit<Char>::clear(Char from, Char to)
+{
+ for(int i = from; i <= to; ++i)
+ {
+ this->bset_.reset((unsigned char)i);
+ }
+}
+
+/////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline void basic_chset_8bit<Char>::clear(Char from, Char to, Traits const &traits)
+{
+ for(int i = from; i <= to; ++i)
+ {
+ this->bset_.reset((unsigned char)traits.translate_nocase((Char)i));
+ }
+}
+
+/////////////////////////////////
+template<typename Char>
+inline void basic_chset_8bit<Char>::clear(Char c)
+{
+ this->bset_.reset((unsigned char)c);
+}
+
+/////////////////////////////////
+template<typename Char>
+template<typename Traits>
+inline void basic_chset_8bit<Char>::clear(Char c, Traits const &traits)
+{
+ this->bset_.reset((unsigned char)traits.tranlsate_nocase(c));
+}
+
+/////////////////////////////////
+template<typename Char>
+inline void basic_chset_8bit<Char>::clear()
+{
+ this->bset_.reset();
+}
+
+/////////////////////////////////
+template<typename Char>
+inline void basic_chset_8bit<Char>::inverse()
+{
+ this->bset_.flip();
+}
+
+/////////////////////////////////
+template<typename Char>
+inline void basic_chset_8bit<Char>::swap(basic_chset_8bit<Char> &that)
+{
+ std::swap(this->bset_, that.bset_);
+}
+
+/////////////////////////////////
+template<typename Char>
+inline basic_chset_8bit<Char> &
+basic_chset_8bit<Char>::operator |=(basic_chset_8bit<Char> const &that)
+{
+ this->bset_ |= that.bset_;
+ return *this;
+}
+
+/////////////////////////////////
+template<typename Char>
+inline basic_chset_8bit<Char> &
+basic_chset_8bit<Char>::operator &=(basic_chset_8bit<Char> const &that)
+{
+ this->bset_ &= that.bset_;
+ return *this;
+}
+
+/////////////////////////////////
+template<typename Char>
+inline basic_chset_8bit<Char> &
+basic_chset_8bit<Char>::operator -=(basic_chset_8bit<Char> const &that)
+{
+ this->bset_ &= ~that.bset_;
+ return *this;
+}
+
+/////////////////////////////////
+template<typename Char>
+inline basic_chset_8bit<Char> &
+basic_chset_8bit<Char>::operator ^=(basic_chset_8bit<Char> const &that)
+{
+ this->bset_ ^= that.bset_;
+ return *this;
+}
+
+template<typename Char>
+inline std::bitset<256> const &
+basic_chset_8bit<Char>::base() const
+{
+ return this->bset_;
+}
+
+#endif // if(CHAR_BIT == 8)
+
+
+///////////////////////////////////////////////////////////////////////////////
+// helpers
+template<typename Char, typename Traits>
+inline void set_char(basic_chset<Char> &chset, Char ch, Traits const &traits, bool icase)
+{
+ icase ? chset.set(ch, traits) : chset.set(ch);
+}
+
+template<typename Char, typename Traits>
+inline void set_range(basic_chset<Char> &chset, Char from, Char to, Traits const &traits, bool icase)
+{
+ icase ? chset.set(from, to, traits) : chset.set(from, to);
+}
+
+template<typename Char, typename Traits>
+inline void set_class(basic_chset<Char> &chset, typename Traits::char_class_type char_class, bool no, Traits const &traits)
+{
+ BOOST_MPL_ASSERT_RELATION(1, ==, sizeof(Char));
+ for(std::size_t i = 0; i <= UCHAR_MAX; ++i)
+ {
+ typedef typename std::char_traits<Char>::int_type int_type;
+ Char ch = std::char_traits<Char>::to_char_type(static_cast<int_type>(i));
+ if(no != traits.isctype(ch, char_class))
+ {
+ chset.set(ch);
+ }
+ }
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif
+

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/chset.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/chset.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,165 @@
+///////////////////////////////////////////////////////////////////////////////
+// chset.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_CHSET_CHSET_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_CHSET_CHSET_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <vector>
+#include <boost/call_traits.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/utility/algorithm.hpp>
+#include <boost/xpressive/detail/utility/chset/basic_chset.ipp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// compound_charset
+//
+template<typename Traits>
+struct compound_charset
+ : private basic_chset<typename Traits::char_type>
+{
+ typedef typename Traits::char_type char_type;
+ typedef basic_chset<char_type> base_type;
+ typedef Traits traits_type;
+ typedef typename Traits::char_class_type char_class_type;
+
+ compound_charset()
+ : base_type()
+ , complement_(false)
+ , has_posix_(false)
+ , posix_yes_()
+ , posix_no_()
+ {
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // accessors
+ basic_chset<char_type> const &base() const
+ {
+ return *this;
+ }
+
+ bool is_inverted() const
+ {
+ return this->complement_;
+ }
+
+ char_class_type posix_yes() const
+ {
+ return this->posix_yes_;
+ }
+
+ std::vector<char_class_type> const &posix_no() const
+ {
+ return this->posix_no_;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // complement
+ void inverse()
+ {
+ this->complement_ = !this->complement_;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // set
+ void set_char(char_type ch, Traits const &traits, bool icase)
+ {
+ icase ? this->base_type::set(ch, traits) : this->base_type::set(ch);
+ }
+
+ void set_range(char_type from, char_type to, Traits const &traits, bool icase)
+ {
+ icase ? this->base_type::set(from, to, traits) : this->base_type::set(from, to);
+ }
+
+ void set_class(char_class_type const &m, bool no)
+ {
+ this->has_posix_ = true;
+
+ if(no)
+ {
+ this->posix_no_.push_back(m);
+ }
+ else
+ {
+ this->posix_yes_ |= m;
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // test
+ template<typename ICase>
+ bool test(char_type ch, Traits const &traits, ICase) const
+ {
+ return this->complement_ !=
+ (this->base_type::test(ch, traits, ICase()) ||
+ (this->has_posix_ && this->test_posix(ch, traits)));
+ }
+
+private:
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // not_posix_pred
+ struct not_posix_pred
+ {
+ char_type ch_;
+ Traits const *traits_ptr_;
+
+ bool operator ()(typename call_traits<char_class_type>::param_type m) const
+ {
+ return !this->traits_ptr_->isctype(this->ch_, m);
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // test_posix
+ bool test_posix(char_type ch, Traits const &traits) const
+ {
+ not_posix_pred const pred = {ch, &traits};
+ return traits.isctype(ch, this->posix_yes_)
+ || any(this->posix_no_.begin(), this->posix_no_.end(), pred);
+ }
+
+ bool complement_;
+ bool has_posix_;
+ char_class_type posix_yes_;
+ std::vector<char_class_type> posix_no_;
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// helpers
+template<typename Char, typename Traits>
+inline void set_char(compound_charset<Traits> &chset, Char ch, Traits const &traits, bool icase)
+{
+ chset.set_char(ch, traits, icase);
+}
+
+template<typename Char, typename Traits>
+inline void set_range(compound_charset<Traits> &chset, Char from, Char to, Traits const &traits, bool icase)
+{
+ chset.set_range(from, to, traits, icase);
+}
+
+template<typename Traits>
+inline void set_class(compound_charset<Traits> &chset, typename Traits::char_class_type char_class, bool no, Traits const &)
+{
+ chset.set_class(char_class, no);
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif
+

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/range_run.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/range_run.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,102 @@
+/*=============================================================================
+ Copyright (c) 2001-2003 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#ifndef BOOST_XPRESSIVE_SPIRIT_RANGE_RUN_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_SPIRIT_RANGE_RUN_HPP_EAN_10_04_2005
+
+///////////////////////////////////////////////////////////////////////////////
+#include <vector>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////
+//
+// range class
+//
+// Implements a closed range of values. This class is used in
+// the implementation of the range_run class.
+//
+// { Low level implementation detail }
+// { Not to be confused with spirit::range }
+//
+///////////////////////////////////////////////////////////////////////////
+template<typename Char>
+struct range
+{
+ range(Char first, Char last);
+
+ bool is_valid() const;
+ bool includes(Char v) const;
+ bool includes(range const &r) const;
+ bool overlaps(range const &r) const;
+ void merge(range const &r);
+
+ Char first_;
+ Char last_;
+};
+
+//////////////////////////////////
+template<typename Char>
+struct range_compare
+{
+ bool operator()(range<Char> const &x, range<Char> const &y) const
+ {
+ return x.first_ < y.first_;
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////
+//
+// range_run
+//
+// An implementation of a sparse bit (boolean) set. The set uses
+// a sorted vector of disjoint ranges. This class implements the
+// bare minimum essentials from which the full range of set
+// operators can be implemented. The set is constructed from
+// ranges. Internally, adjacent or overlapping ranges are
+// coalesced.
+//
+// range_runs are very space-economical in situations where there
+// are lots of ranges and a few individual disjoint values.
+// Searching is O(log n) where n is the number of ranges.
+//
+// { Low level implementation detail }
+//
+///////////////////////////////////////////////////////////////////////////
+template<typename Char>
+struct range_run
+{
+ typedef range<Char> range_type;
+ typedef std::vector<range_type> run_type;
+ typedef typename run_type::iterator iterator;
+ typedef typename run_type::const_iterator const_iterator;
+
+ void swap(range_run& rr);
+ bool empty() const;
+ bool test(Char v) const;
+ template<typename Traits>
+ bool test(Char v, Traits const &traits) const;
+ void set(range_type const &r);
+ void clear(range_type const &r);
+ void clear();
+
+ const_iterator begin() const;
+ const_iterator end() const;
+
+private:
+ void merge(iterator iter, range_type const &r);
+
+ run_type run_;
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif
+

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/range_run.ipp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/chset/range_run.ipp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,235 @@
+/*=============================================================================
+ Copyright (c) 2001-2003 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#ifndef BOOST_XPRESSIVE_SPIRIT_RANGE_RUN_IPP
+#define BOOST_XPRESSIVE_SPIRIT_RANGE_RUN_IPP
+
+///////////////////////////////////////////////////////////////////////////////
+#include <algorithm> // for std::lower_bound
+#include <boost/limits.hpp>
+#include <boost/assert.hpp>
+#include <boost/xpressive/detail/utility/chset/range_run.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////
+//
+// range class implementation
+//
+///////////////////////////////////////////////////////////////////////
+template<typename Char>
+inline range<Char>::range(Char first, Char last)
+ : first_(first)
+ , last_(last)
+{
+}
+
+//////////////////////////////////
+template<typename Char>
+inline bool range<Char>::is_valid() const
+{
+ return this->first_ <= this->last_;
+}
+
+//////////////////////////////////
+template<typename Char>
+inline bool range<Char>::includes(range<Char> const &r) const
+{
+ return (this->first_ <= r.first_) && (this->last_ >= r.last_);
+}
+
+//////////////////////////////////
+template<typename Char>
+inline bool range<Char>::includes(Char v) const
+{
+ return (this->first_ <= v) && (this->last_ >= v);
+}
+
+//////////////////////////////////
+template<typename Char>
+inline bool range<Char>::overlaps(range<Char> const &r) const
+{
+ Char decr_first = (std::min)(this->first_, Char(this->first_-1));
+ Char incr_last = (std::max)(this->last_, Char(this->last_+1));
+
+ return (decr_first <= r.last_) && (incr_last >= r.first_);
+}
+
+//////////////////////////////////
+template<typename Char>
+inline void range<Char>::merge(range<Char> const &r)
+{
+ this->first_ = (std::min)(this->first_, r.first_);
+ this->last_ = (std::max)(this->last_, r.last_);
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// range_run class implementation
+//
+///////////////////////////////////////////////////////////////////////
+template<typename Char>
+inline bool range_run<Char>::empty() const
+{
+ return this->run_.empty();
+}
+
+template<typename Char>
+inline bool range_run<Char>::test(Char v) const
+{
+ if(this->run_.empty())
+ {
+ return false;
+ }
+
+ const_iterator iter = std::lower_bound(
+ this->run_.begin()
+ , this->run_.end()
+ , range<Char>(v, v)
+ , range_compare<Char>()
+ );
+
+ return (iter != this->run_.end() && iter->includes(v))
+ || (iter != this->run_.begin() && (--iter)->includes(v));
+}
+
+template<typename Char>
+template<typename Traits>
+inline bool range_run<Char>::test(Char v, Traits const &traits) const
+{
+ const_iterator begin = this->run_.begin();
+ const_iterator end = this->run_.end();
+
+ for(; begin != end; ++begin)
+ {
+ if(traits.in_range_nocase(begin->first_, begin->last_, v))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+//////////////////////////////////
+template<typename Char>
+inline void range_run<Char>::swap(range_run<Char> &rr)
+{
+ this->run_.swap(rr.run_);
+}
+
+//////////////////////////////////
+template<typename Char>
+void range_run<Char>::merge(iterator iter, range<Char> const &r)
+{
+ BOOST_ASSERT(iter != this->run_.end());
+ iter->merge(r);
+
+ iterator i = iter;
+ while(++i != this->run_.end() && iter->overlaps(*i))
+ {
+ iter->merge(*i);
+ }
+
+ this->run_.erase(++iter, i);
+}
+
+//////////////////////////////////
+template<typename Char>
+void range_run<Char>::set(range<Char> const &r)
+{
+ BOOST_ASSERT(r.is_valid());
+ if(!this->run_.empty())
+ {
+ iterator iter = std::lower_bound(this->run_.begin(), this->run_.end(), r, range_compare<Char>());
+
+ if((iter != this->run_.end() && iter->includes(r)) ||
+ (iter != this->run_.begin() && (iter - 1)->includes(r)))
+ {
+ return;
+ }
+ else if(iter != this->run_.begin() && (iter - 1)->overlaps(r))
+ {
+ this->merge(--iter, r);
+ }
+ else if(iter != this->run_.end() && iter->overlaps(r))
+ {
+ this->merge(iter, r);
+ }
+ else
+ {
+ this->run_.insert(iter, r);
+ }
+ }
+ else
+ {
+ this->run_.push_back(r);
+ }
+}
+
+//////////////////////////////////
+template<typename Char>
+void range_run<Char>::clear(range<Char> const &r)
+{
+ BOOST_ASSERT(r.is_valid());
+ if(!this->run_.empty())
+ {
+ iterator iter = std::lower_bound(this->run_.begin(), this->run_.end(), r, range_compare<Char>());
+ iterator left_iter;
+
+ if((iter != this->run_.begin()) &&
+ (left_iter = (iter - 1))->includes(r.first_))
+ {
+ if(left_iter->last_ > r.last_)
+ {
+ Char save_last = left_iter->last_;
+ left_iter->last_ = r.first_-1;
+ this->run_.insert(iter, range<Char>(r.last_+1, save_last));
+ return;
+ }
+ else
+ {
+ left_iter->last_ = r.first_-1;
+ }
+ }
+
+ iterator i = iter;
+ for(; i != this->run_.end() && r.includes(*i); ++i) {}
+ if(i != this->run_.end() && i->includes(r.last_))
+ {
+ i->first_ = r.last_+1;
+ }
+ this->run_.erase(iter, i);
+ }
+}
+
+//////////////////////////////////
+template<typename Char>
+inline void range_run<Char>::clear()
+{
+ this->run_.clear();
+}
+
+//////////////////////////////////
+template<typename Char>
+inline typename range_run<Char>::const_iterator range_run<Char>::begin() const
+{
+ return this->run_.begin();
+}
+
+//////////////////////////////////
+template<typename Char>
+inline typename range_run<Char>::const_iterator range_run<Char>::end() const
+{
+ return this->run_.end();
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/cons.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/cons.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,309 @@
+///////////////////////////////////////////////////////////////////////////////
+// cons.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_CONS_HPP_EAN_11_19_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_CONS_HPP_EAN_11_19_2005
+
+#include <boost/version.hpp>
+
+#if BOOST_VERSION >= 103300
+
+// In Boost 1.33+, we have a cons list in Fusion, so just include it.
+
+# if BOOST_VERSION >= 103500
+# include <boost/fusion/include/cons.hpp> // Boost 1.35+ has Fusion2
+# else
+# include <boost/spirit/fusion/sequence/cons.hpp> // Fusion1
+# endif
+
+#else
+
+// For earlier versions of Boost, put the definition of cons here
+# include <boost/call_traits.hpp>
+# include <boost/mpl/if.hpp>
+# include <boost/mpl/eval_if.hpp>
+# include <boost/mpl/identity.hpp>
+# include <boost/type_traits/is_const.hpp>
+# include <boost/type_traits/add_const.hpp>
+# include <boost/type_traits/add_reference.hpp>
+# include <boost/spirit/fusion/detail/config.hpp>
+# include <boost/spirit/fusion/detail/access.hpp>
+# include <boost/spirit/fusion/iterator/next.hpp>
+# include <boost/spirit/fusion/iterator/equal_to.hpp>
+# include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp>
+# include <boost/spirit/fusion/iterator/detail/iterator_base.hpp>
+# include <boost/spirit/fusion/sequence/begin.hpp>
+# include <boost/spirit/fusion/sequence/end.hpp>
+# include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp>
+# include <boost/spirit/fusion/sequence/detail/sequence_base.hpp>
+
+namespace boost { namespace fusion
+{
+ struct nil;
+
+ struct cons_tag;
+
+ template <typename Car, typename Cdr>
+ struct cons;
+
+ struct cons_iterator_tag;
+
+ template <typename Cons>
+ struct cons_iterator;
+
+ namespace cons_detail
+ {
+ template <typename Iterator>
+ struct deref_traits_impl
+ {
+ typedef typename Iterator::cons_type cons_type;
+ typedef typename cons_type::car_type value_type;
+
+ typedef typename mpl::eval_if<
+ is_const<cons_type>
+ , add_reference<typename add_const<value_type>::type>
+ , add_reference<value_type> >::type
+ type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return detail::ref(i.cons.car);
+ }
+ };
+
+ template <typename Iterator>
+ struct next_traits_impl
+ {
+ typedef typename Iterator::cons_type cons_type;
+ typedef typename cons_type::cdr_type cdr_type;
+
+ typedef cons_iterator<
+ typename mpl::eval_if<
+ is_const<cons_type>
+ , add_const<cdr_type>
+ , mpl::identity<cdr_type>
+ >::type>
+ type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(detail::ref(i.cons.cdr));
+ }
+ };
+
+ template <typename Iterator>
+ struct value_traits_impl
+ {
+ typedef typename Iterator::cons_type cons_type;
+ typedef typename cons_type::car_type type;
+ };
+
+ template <typename Cons>
+ struct begin_traits_impl
+ {
+ typedef cons_iterator<Cons> type;
+
+ static type
+ call(Cons& t)
+ {
+ return type(t);
+ }
+ };
+
+ template <typename Cons>
+ struct end_traits_impl
+ {
+ typedef cons_iterator<
+ typename mpl::if_<is_const<Cons>, nil const, nil>::type>
+ type;
+
+ static type
+ call(Cons& t)
+ {
+ FUSION_RETURN_DEFAULT_CONSTRUCTED;
+ }
+ };
+ } // namespace cons_detail
+
+ namespace meta
+ {
+ template <typename Tag>
+ struct deref_impl;
+
+ template <>
+ struct deref_impl<cons_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply : cons_detail::deref_traits_impl<Iterator> {};
+ };
+
+ template <typename Tag>
+ struct next_impl;
+
+ template <>
+ struct next_impl<cons_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply : cons_detail::next_traits_impl<Iterator> {};
+ };
+
+ template <typename Tag>
+ struct value_impl;
+
+ template <>
+ struct value_impl<cons_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply : cons_detail::value_traits_impl<Iterator> {};
+ };
+
+ template <typename Tag>
+ struct begin_impl;
+
+ template <>
+ struct begin_impl<cons_tag>
+ {
+ template <typename Sequence>
+ struct apply : cons_detail::begin_traits_impl<Sequence>
+ {};
+ };
+
+ template <typename Tag>
+ struct end_impl;
+
+ template <>
+ struct end_impl<cons_tag>
+ {
+ template <typename Sequence>
+ struct apply : cons_detail::end_traits_impl<Sequence>
+ {};
+ };
+ } // namespace meta
+
+ template <typename Cons = nil>
+ struct cons_iterator : iterator_base<cons_iterator<Cons> >
+ {
+ typedef cons_iterator_tag tag;
+ typedef Cons cons_type;
+
+ explicit cons_iterator(cons_type& cons_)
+ : cons(cons_) {}
+
+ cons_type& cons;
+ };
+
+ template <>
+ struct cons_iterator<nil> : iterator_base<cons_iterator<nil> >
+ {
+ typedef cons_iterator_tag tag;
+ typedef nil cons_type;
+ cons_iterator() {}
+ explicit cons_iterator(nil const&) {}
+ };
+
+ template <>
+ struct cons_iterator<nil const> : iterator_base<cons_iterator<nil const> >
+ {
+ typedef cons_iterator_tag tag;
+ typedef nil const cons_type;
+ cons_iterator() {}
+ explicit cons_iterator(nil const&) {}
+ };
+
+ struct nil : sequence_base<nil>
+ {
+ typedef cons_tag tag;
+ typedef void_t car_type;
+ typedef void_t cdr_type;
+ };
+
+ template <typename Car, typename Cdr = nil>
+ struct cons : sequence_base<cons<Car,Cdr> >
+ {
+ typedef cons_tag tag;
+ typedef typename call_traits<Car>::value_type car_type;
+ typedef Cdr cdr_type;
+
+ cons()
+ : car(), cdr() {}
+
+ explicit cons(
+ typename call_traits<Car>::param_type car_
+ , typename call_traits<Cdr>::param_type cdr_ = Cdr())
+ : car(car_), cdr(cdr_) {}
+
+ car_type car;
+ cdr_type cdr;
+ };
+
+ template <typename Car>
+ inline cons<Car>
+ make_cons(Car const& car)
+ {
+ return cons<Car>(car);
+ }
+
+ template <typename Car, typename Cdr>
+ inline cons<Car, Cdr>
+ make_cons(Car const& car, Cdr const& cdr)
+ {
+ return cons<Car, Cdr>(car, cdr);
+ }
+}} // namespace boost::fusion
+
+namespace boost { namespace mpl
+{
+ template <typename Tag>
+ struct begin_impl;
+
+ template <typename Tag>
+ struct end_impl;
+
+ template <>
+ struct begin_impl<fusion::cons_tag>
+ : fusion::meta::begin_impl<fusion::cons_tag>
+ {
+ };
+
+ template <>
+ struct end_impl<fusion::cons_tag>
+ : fusion::meta::end_impl<fusion::cons_tag>
+ {
+ };
+
+}} // namespace boost::mpl
+
+#endif
+
+// Before Boost v1.33.1, Fusion cons lists were not valid MPL sequences.
+#if BOOST_VERSION < 103301
+namespace boost { namespace mpl
+{
+ template<typename Iterator>
+ struct next;
+
+ template<typename Cons>
+ struct next<fusion::cons_iterator<Cons> >
+ : fusion::cons_detail::next_traits_impl<fusion::cons_iterator<Cons> >
+ {
+ };
+
+ template<typename Iterator>
+ struct deref;
+
+ template<typename Cons>
+ struct deref<fusion::cons_iterator<Cons> >
+ : fusion::cons_detail::value_traits_impl<fusion::cons_iterator<Cons> >
+ {
+ };
+
+}} // namespace boost::mpl
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/counted_base.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/counted_base.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,84 @@
+//////////////////////////////////////////////////////////////////////////////
+// (c) Copyright Andreas Huber Doenni 2002-2005, Eric Niebler 2006
+// Distributed under the Boost Software License, Version 1.0. (See accompany-
+// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_COUNTED_BASE_HPP_EAN_04_16_2006
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_COUNTED_BASE_HPP_EAN_04_16_2006
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/detail/atomic_count.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+ template<typename Derived>
+ struct counted_base_access;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // counted_base
+ template<typename Derived>
+ struct counted_base
+ {
+ long use_count() const
+ {
+ return this->count_;
+ }
+
+ protected:
+ counted_base()
+ : count_(0)
+ {
+ }
+
+ counted_base(counted_base<Derived> const &)
+ : count_(0)
+ {
+ }
+
+ counted_base &operator =(counted_base<Derived> const &)
+ {
+ return *this;
+ }
+
+ private:
+ friend struct counted_base_access<Derived>;
+ mutable boost::detail::atomic_count count_;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+ // counted_base_access
+ template<typename Derived>
+ struct counted_base_access
+ {
+ static void add_ref(counted_base<Derived> const *that)
+ {
+ ++that->count_;
+ }
+
+ static void release(counted_base<Derived> const *that)
+ {
+ BOOST_ASSERT(0 < that->count_);
+ if(0 == --that->count_)
+ {
+ boost::checked_delete(static_cast<Derived const *>(that));
+ }
+ }
+ };
+
+ template<typename Derived>
+ inline void intrusive_ptr_add_ref(counted_base<Derived> const *that)
+ {
+ counted_base_access<Derived>::add_ref(that);
+ }
+
+ template<typename Derived>
+ inline void intrusive_ptr_release(counted_base<Derived> const *that)
+ {
+ counted_base_access<Derived>::release(that);
+ }
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/dont_care.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/dont_care.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// dont_care.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_DONT_CARE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_DONT_CARE_HPP_EAN_10_04_2005
+
+namespace boost { namespace xpressive { namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // for function arguments we don't care about
+ struct dont_care
+ {
+ dont_care() {}
+
+ template<typename T>
+ dont_care(T const &) {}
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/hash_peek_bitset.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/hash_peek_bitset.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,175 @@
+///////////////////////////////////////////////////////////////////////////////
+// hash_peek_bitset.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_HASH_PEEK_BITSET_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_HASH_PEEK_BITSET_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4100) // unreferenced formal parameter
+# pragma warning(disable : 4127) // conditional expression constant
+#endif
+
+#include <bitset>
+#include <string> // for std::char_traits
+#include <boost/xpressive/detail/utility/chset/basic_chset.ipp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// hash_peek_bitset
+//
+template<typename Char>
+struct hash_peek_bitset
+{
+ typedef Char char_type;
+ typedef typename std::char_traits<char_type>::int_type int_type;
+
+ hash_peek_bitset()
+ : icase_(false)
+ , bset_()
+ {
+ }
+
+ std::size_t count() const
+ {
+ return this->bset_.count();
+ }
+
+ void set_all()
+ {
+ this->icase_ = false;
+ this->bset_.set();
+ }
+
+ template<typename Traits>
+ void set_char(char_type ch, bool icase, Traits const &traits)
+ {
+ if(this->test_icase_(icase))
+ {
+ ch = icase ? traits.translate_nocase(ch) : traits.translate(ch);
+ this->bset_.set(traits.hash(ch));
+ }
+ }
+
+ template<typename Traits>
+ void set_range(char_type from, char_type to, bool no, bool icase, Traits const &traits)
+ {
+ int_type ifrom = std::char_traits<char_type>::to_int_type(from);
+ int_type ito = std::char_traits<char_type>::to_int_type(to);
+ BOOST_ASSERT(ifrom <= ito);
+ // bound the computational complexity. BUGBUG could set the inverse range
+ if(no || 256 < (ito - ifrom))
+ {
+ this->set_all();
+ }
+ else if(this->test_icase_(icase))
+ {
+ for(int_type i = ifrom; i <= ito; ++i)
+ {
+ char_type ch = std::char_traits<char_type>::to_char_type(i);
+ ch = icase ? traits.translate_nocase(ch) : traits.translate(ch);
+ this->bset_.set(traits.hash(ch));
+ }
+ }
+ }
+
+ template<typename Traits>
+ void set_class(typename Traits::char_class_type char_class, bool no, Traits const &traits)
+ {
+ if(1 != sizeof(char_type))
+ {
+ // wide character set, no efficient way of filling in the bitset, so set them all to 1
+ this->set_all();
+ }
+ else
+ {
+ for(std::size_t i = 0; i <= UCHAR_MAX; ++i)
+ {
+ char_type ch = std::char_traits<char_type>::to_char_type(static_cast<int_type>(i));
+ if(no != traits.isctype(ch, char_class))
+ {
+ this->bset_.set(i);
+ }
+ }
+ }
+ }
+
+ void set_bitset(hash_peek_bitset<Char> const &that)
+ {
+ this->bset_ |= that.bset_;
+ }
+
+ void set_charset(basic_chset_8bit<Char> const &that, bool icase)
+ {
+ if(this->test_icase_(icase))
+ {
+ this->bset_ |= that.base();
+ }
+ }
+
+ bool icase() const
+ {
+ return this->icase_;
+ }
+
+ template<typename Traits>
+ bool test(char_type ch, Traits const &traits) const
+ {
+ ch = this->icase_ ? traits.translate_nocase(ch) : traits.translate(ch);
+ return this->bset_.test(traits.hash(ch));
+ }
+
+ template<typename Traits>
+ bool test(char_type ch, Traits const &traits, mpl::false_) const
+ {
+ BOOST_ASSERT(!this->icase_);
+ return this->bset_.test(traits.hash(traits.translate(ch)));
+ }
+
+ template<typename Traits>
+ bool test(char_type ch, Traits const &traits, mpl::true_) const
+ {
+ BOOST_ASSERT(this->icase_);
+ return this->bset_.test(traits.hash(traits.translate_nocase(ch)));
+ }
+
+private:
+
+ // Make sure all sub-expressions being merged have the same case-sensitivity
+ bool test_icase_(bool icase)
+ {
+ std::size_t count = this->bset_.count();
+
+ if(256 == count)
+ {
+ return false; // all set already, nothing to do
+ }
+ else if(0 != count && this->icase_ != icase)
+ {
+ this->set_all(); // icase mismatch! set all and bail
+ return false;
+ }
+
+ this->icase_ = icase;
+ return true;
+ }
+
+ bool icase_;
+ std::bitset<256> bset_;
+};
+
+}}} // namespace boost::xpressive::detail
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/ignore_unused.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/ignore_unused.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,27 @@
+///////////////////////////////////////////////////////////////////////////////
+// ignore_unused.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_IGNORE_UNUSED_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_IGNORE_UNUSED_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ template<typename T>
+ void ignore_unused(T const &)
+ {
+ }
+
+}}}
+
+#endif
+

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/literals.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/literals.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,85 @@
+///////////////////////////////////////////////////////////////////////////////
+// literals.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_LITERALS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_LITERALS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
+#include <boost/cstdint.hpp> // for BOOST_STATIC_CONSTANT
+#include <boost/detail/workaround.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// char_literal
+//
+template<typename Char, boost::intmax_t Ch, boost::intmax_t Wch>
+struct char_literal;
+
+template<typename Char, boost::intmax_t Ch>
+struct char_literal<Char, Ch, Ch>
+{
+ BOOST_STATIC_CONSTANT(boost::intmax_t, value = Ch);
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+template<typename Char, boost::intmax_t Ch>
+boost::intmax_t const char_literal<Char, Ch, Ch>::value;
+#endif
+
+template<typename Ch>
+struct string_literal;
+
+template<>
+struct string_literal<char>
+{
+ static char const *pick(char const *cstr, wchar_t const *)
+ {
+ return cstr;
+ }
+
+ static char pick(char ch, wchar_t)
+ {
+ return ch;
+ }
+};
+
+template<>
+struct string_literal<wchar_t>
+{
+ static wchar_t const *pick(char const *, wchar_t const *cstr)
+ {
+ return cstr;
+ }
+
+ static wchar_t pick(char, wchar_t ch)
+ {
+ return ch;
+ }
+};
+
+#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206))
+
+# define BOOST_XPR_CHAR_(Char, ch) ch
+# define BOOST_XPR_CSTR_(Char, st) boost::xpressive::detail::string_literal<Char>::pick(st, L##st)
+
+#else
+
+# define BOOST_XPR_CHAR_(Char, ch) boost::xpressive::detail::char_literal<Char, ch, L##ch>::value
+# define BOOST_XPR_CSTR_(Char, st) boost::xpressive::detail::string_literal<Char>::pick(st, L##st)
+
+#endif
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/never_true.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/never_true.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// never_true.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_NEVER_TRUE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_NEVER_TRUE_HPP_EAN_10_04_2005
+
+#include <boost/mpl/bool.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ // for use in static asserts
+ template<typename T>
+ struct never_true
+ : mpl::false_
+ {
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/save_restore.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/save_restore.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,55 @@
+///////////////////////////////////////////////////////////////////////////////
+// save_restore.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_SAVE_RESTORE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_SAVE_RESTORE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/noncopyable.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ template<typename T>
+ struct save_restore
+ : private noncopyable
+ {
+ explicit save_restore(T &t)
+ : ref(t)
+ , val(t)
+ {
+ }
+
+ save_restore(T &t, T const &n)
+ : ref(t)
+ , val(t)
+ {
+ this->ref = n;
+ }
+
+ ~save_restore()
+ {
+ this->ref = this->val;
+ }
+
+ void restore()
+ {
+ this->ref = this->val;
+ }
+
+ private:
+ T &ref;
+ T const val;
+ };
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/sequence_stack.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/sequence_stack.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,241 @@
+///////////////////////////////////////////////////////////////////////////////
+// sequence_stack.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_SEQUENCE_STACK_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_SEQUENCE_STACK_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4127) // conditional expression constant
+#endif
+
+#include <algorithm>
+#include <functional>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+//////////////////////////////////////////////////////////////////////////
+// sequence_stack
+//
+// For storing a stack of sequences of type T, where each sequence
+// is guaranteed to be stored in contiguous memory.
+template<typename T>
+struct sequence_stack
+{
+private:
+
+ struct chunk
+ {
+ chunk(std::size_t size, std::size_t count, chunk *back, chunk *next)
+ : begin_(new T[ size ])
+ , curr_(begin_ + count)
+ , end_(begin_ + size)
+ , back_(back)
+ , next_(next)
+ {
+ if(this->back_)
+ this->back_->next_ = this;
+ if(this->next_)
+ this->next_->back_ = this;
+ }
+
+ ~chunk()
+ {
+ delete[] this->begin_;
+ }
+
+ std::size_t size() const
+ {
+ return static_cast<std::size_t>(this->end_ - this->begin_);
+ }
+
+ T *const begin_, *curr_, *const end_;
+ chunk *back_, *next_;
+
+ private:
+ chunk &operator =(chunk const &);
+ };
+
+ chunk *current_chunk_;
+
+ // Cache these for faster access
+ T *begin_;
+ T *curr_;
+ T *end_;
+
+ T *grow_(std::size_t count)
+ {
+ if(this->current_chunk_)
+ {
+ // write the cached value of current into the expr.
+ // OK to do this even if later statements throw.
+ this->current_chunk_->curr_ = this->curr_;
+
+ // Do we have a expr with enough available memory already?
+ if(this->current_chunk_->next_ && count <= this->current_chunk_->next_->size())
+ {
+ this->current_chunk_ = this->current_chunk_->next_;
+ this->curr_ = this->current_chunk_->curr_ = this->current_chunk_->begin_ + count;
+ this->end_ = this->current_chunk_->end_;
+ this->begin_ = this->current_chunk_->begin_;
+ std::fill_n(this->begin_, count, T());
+ return this->begin_;
+ }
+
+ // grow exponentially
+ std::size_t new_size = (std::max)(count, static_cast<std::size_t>(this->current_chunk_->size() * 1.5));
+
+ // Create a new expr and insert it into the list
+ this->current_chunk_ = new chunk(new_size, count, this->current_chunk_, this->current_chunk_->next_);
+ }
+ else
+ {
+ // first chunk is 256
+ std::size_t new_size = (std::max)(count, static_cast<std::size_t>(256U));
+
+ // Create a new expr and insert it into the list
+ this->current_chunk_ = new chunk(new_size, count, 0, 0);
+ }
+
+ this->begin_ = this->current_chunk_->begin_;
+ this->curr_ = this->current_chunk_->curr_;
+ this->end_ = this->current_chunk_->end_;
+ return this->begin_;
+ }
+
+ void unwind_chunk_()
+ {
+ // write the cached value of curr_ into current_chunk_
+ this->current_chunk_->curr_ = this->begin_;
+ // make the previous chunk the current
+ this->current_chunk_ = this->current_chunk_->back_;
+
+ // update the cache
+ this->begin_ = this->current_chunk_->begin_;
+ this->curr_ = this->current_chunk_->curr_;
+ this->end_ = this->current_chunk_->end_;
+ }
+
+ bool in_current_chunk(T *ptr) const
+ {
+ return !std::less<void*>()(ptr, this->begin_) && std::less<void*>()(ptr, this->end_);
+ }
+
+public:
+ sequence_stack()
+ : current_chunk_(0)
+ , begin_(0)
+ , curr_(0)
+ , end_(0)
+ {
+ }
+
+ ~sequence_stack()
+ {
+ this->clear();
+ }
+
+ // walk to the front of the linked list
+ void unwind()
+ {
+ if(this->current_chunk_)
+ {
+ while(this->current_chunk_->back_)
+ {
+ this->current_chunk_->curr_ = this->current_chunk_->begin_;
+ this->current_chunk_ = this->current_chunk_->back_;
+ }
+
+ this->begin_ = this->curr_ = this->current_chunk_->curr_ = this->current_chunk_->begin_;
+ this->end_ = this->current_chunk_->end_;
+ }
+ }
+
+ void clear()
+ {
+ // walk to the front of the list
+ this->unwind();
+
+ // delete the list
+ for(chunk *next; this->current_chunk_; this->current_chunk_ = next)
+ {
+ next = this->current_chunk_->next_;
+ delete this->current_chunk_;
+ }
+
+ this->begin_ = this->curr_ = this->end_ = 0;
+ }
+
+ template<bool Fill>
+ T *push_sequence(std::size_t count, mpl::bool_<Fill>)
+ {
+ // This is the ptr to return
+ T *ptr = this->curr_;
+
+ // Advance the high-water mark
+ this->curr_ += count;
+
+ // Check to see if we have overflowed this buffer
+ if(std::less<void*>()(this->end_, this->curr_))
+ {
+ // oops, back this out.
+ this->curr_ = ptr;
+
+ // allocate a new block and return a ptr to the new memory
+ return this->grow_(count);
+ }
+
+ if(Fill)
+ {
+ std::fill_n(ptr, count, T());
+ }
+
+ return ptr;
+ }
+
+ T *push_sequence(std::size_t count)
+ {
+ return this->push_sequence(count, mpl::true_());
+ }
+
+ void unwind_to(T *ptr)
+ {
+ while(!this->in_current_chunk(ptr))
+ {
+ // completely unwind the current chunk, move to the previous chunk
+ this->unwind_chunk_();
+ }
+ this->current_chunk_->curr_ = this->curr_ = ptr;
+ }
+
+ // shrink-to-fit: remove any unused nodes in the chain
+ void conserve()
+ {
+ if(this->current_chunk_)
+ {
+ for(chunk *next; this->current_chunk_->next_; this->current_chunk_->next_ = next)
+ {
+ next = this->current_chunk_->next_->next_;
+ delete this->current_chunk_->next_;
+ }
+ }
+ }
+};
+
+typedef mpl::false_ no_fill_t;
+no_fill_t const no_fill = {};
+
+}}} // namespace boost::xpressive::detail
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/symbols.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/symbols.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,278 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file symbols.hpp
+/// Contains the Ternary Search Trie implementation.
+/// Based on the following papers:
+/// J. Bentley and R. Sedgewick. (1998) Ternary search trees. Dr. Dobbs Journal
+/// G. Badr and B.J. Oommen. (2005) Self-Adjusting of Ternary Search Tries Using
+/// Conditional Rotations and Randomized Heuristics
+//
+// Copyright 2007 David Jenkins.
+// Copyright 2007 Eric Niebler.
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_SYMBOLS_HPP_DRJ_06_11_2007
+#define BOOST_XPRESSIVE_DETAIL_SYMBOLS_HPP_DRJ_06_11_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/noncopyable.hpp>
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/value_type.hpp>
+#include <boost/range/const_iterator.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // symbols (using a ternary search trie)
+ //
+ template<typename Map>
+ struct symbols
+ {
+ typedef typename range_value<Map>::type::first_type key_type;
+ typedef typename range_value<Map>::type::second_type value_type;
+ typedef typename range_value<key_type>::type char_type;
+ typedef typename range_const_iterator<Map>::type iterator;
+ typedef typename range_const_iterator<key_type>::type key_iterator;
+ typedef value_type const *result_type;
+
+ // copies of this symbol table share the TST
+
+ template<typename Trans>
+ void load(Map const &map, Trans trans)
+ {
+ iterator begin = boost::begin(map);
+ iterator end = boost::end(map);
+ node* root_p = this->root.get();
+ for(; begin != end; ++begin)
+ {
+ key_iterator kbegin = boost::begin(begin->first);
+ key_iterator kend = boost::end(begin->first);
+ root_p = this->insert(root_p, kbegin, kend, &begin->second, trans);
+ }
+ this->root.reset(root_p);
+ }
+
+ template<typename BidiIter, typename Trans>
+ result_type operator ()(BidiIter &begin, BidiIter end, Trans trans) const
+ {
+ return this->search(begin, end, trans, this->root.get());
+ }
+
+ template<typename Sink>
+ void peek(Sink const &sink) const
+ {
+ this->peek_(this->root.get(), sink);
+ }
+
+ private:
+ ///////////////////////////////////////////////////////////////////////////////
+ // struct node : a node in the TST.
+ // The "eq" field stores the result pointer when ch is zero.
+ //
+ struct node
+ : boost::noncopyable
+ {
+ node(char_type c)
+ : ch(c)
+ , lo(0)
+ , eq(0)
+ , hi(0)
+ #ifdef BOOST_DISABLE_THREADS
+ , tau(0)
+ #endif
+ {}
+
+ ~node()
+ {
+ delete lo;
+ if (ch)
+ delete eq;
+ delete hi;
+ }
+
+ void swap(node& that)
+ {
+ std::swap(ch, that.ch);
+ std::swap(lo, that.lo);
+ std::swap(eq, that.eq);
+ std::swap(hi, that.hi);
+ #ifdef BOOST_DISABLE_THREADS
+ std::swap(tau, that.tau);
+ #endif
+ }
+
+ char_type ch;
+ node* lo;
+ union
+ {
+ node* eq;
+ result_type result;
+ };
+ node* hi;
+ #ifdef BOOST_DISABLE_THREADS
+ long tau;
+ #endif
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // insert : insert a string into the TST
+ //
+ template<typename Trans>
+ node* insert(node* p, key_iterator &begin, key_iterator end, result_type r, Trans trans) const
+ {
+ char_type c1 = 0;
+
+ if(begin != end)
+ {
+ c1 = trans(*begin);
+ }
+
+ if(!p)
+ {
+ p = new node(c1);
+ }
+
+ if(c1 < p->ch)
+ {
+ p->lo = this->insert(p->lo, begin, end, r, trans);
+ }
+ else if(c1 == p->ch)
+ {
+ if(0 == c1)
+ {
+ p->result = r;
+ }
+ else
+ {
+ p->eq = this->insert(p->eq, ++begin, end, r, trans);
+ }
+ }
+ else
+ {
+ p->hi = this->insert(p->hi, begin, end, r, trans);
+ }
+
+ return p;
+ }
+
+ #ifdef BOOST_DISABLE_THREADS
+ ///////////////////////////////////////////////////////////////////////////////
+ // conditional rotation : the goal is to minimize the overall
+ // weighted path length of each binary search tree
+ //
+ bool const cond_rotation(bool left, node* const i, node* const j) const
+ {
+ // don't rotate top node in binary search tree
+ if (i == j)
+ return false;
+ // calculate psi (the rotation condition)
+ node* const k = (left ? i->hi : i->lo);
+ long psi = 2*i->tau - j->tau - (k ? k->tau : 0);
+ if (psi <= 0)
+ return false;
+
+ // recalculate the tau values
+ j->tau += -i->tau + (k ? k->tau : 0);
+ i->tau += j->tau - (k ? k->tau : 0);
+ // fixup links and swap nodes
+ if (left)
+ {
+ j->lo = k;
+ i->hi = i;
+ }
+ else
+ {
+ j->hi = k;
+ i->lo = i;
+ }
+ (*i).swap(*j);
+ return true;
+ }
+ #endif
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // search : find a string in the TST
+ //
+ template<typename BidiIter, typename Trans>
+ result_type search(BidiIter &begin, BidiIter end, Trans trans, node* p) const
+ {
+ result_type r = 0;
+ node* p2 = p;
+ bool left = false;
+ char_type c1 = (begin != end ? trans(*begin) : 0);
+ while(p)
+ {
+ #ifdef BOOST_DISABLE_THREADS
+ ++p->tau;
+ #endif
+ if(c1 == p->ch)
+ {
+ // conditional rotation test
+ #ifdef BOOST_DISABLE_THREADS
+ if (this->cond_rotation(left, p, p2))
+ p = p2;
+ #endif
+ if (0 == p->ch)
+ {
+ // it's a match!
+ r = p->result;
+ }
+ if(begin == end)
+ break;
+ ++begin;
+ p = p->eq;
+ // search for the longest match first
+ r = search(begin,end,trans,p);
+ if (0 == r)
+ {
+ // search for a match ending here
+ r = search(end,end,trans,p);
+ if (0 == r)
+ {
+ --begin;
+ }
+ }
+ break;
+ }
+ else if(c1 < p->ch)
+ {
+ left = true;
+ p2 = p;
+ p = p->lo;
+ }
+ else // (c1 > p->ch)
+ {
+ left = false;
+ p2 = p;
+ p = p->hi;
+ }
+ }
+ return r;
+ }
+
+ template<typename Sink>
+ void peek_(node const *const &p, Sink const &sink) const
+ {
+ if(p)
+ {
+ sink(p->ch);
+ this->peek_(p->lo, sink);
+ this->peek_(p->hi, sink);
+ }
+ }
+
+ boost::shared_ptr<node> root;
+ };
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/tracking_ptr.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/tracking_ptr.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,494 @@
+///////////////////////////////////////////////////////////////////////////////
+// tracking_ptr.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_TRACKING_PTR_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_TRACKING_PTR_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#ifdef BOOST_XPRESSIVE_DEBUG_TRACKING_POINTER
+# include <iostream>
+#endif
+#include <set>
+#include <functional>
+#include <boost/config.hpp>
+#include <boost/assert.hpp>
+#include <boost/weak_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/detail/atomic_count.hpp>
+#include <boost/iterator/iterator_facade.hpp>
+#include <boost/iterator/filter_iterator.hpp>
+#include <boost/type_traits/is_base_and_derived.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+template<typename Type>
+struct tracking_ptr;
+
+template<typename Derived>
+struct enable_reference_tracking;
+
+///////////////////////////////////////////////////////////////////////////////
+// weak_iterator
+// steps through a set of weak_ptr, converts to shared_ptrs on the fly and
+// removes from the set the weak_ptrs that have expired.
+template<typename Derived>
+struct weak_iterator
+ : iterator_facade
+ <
+ weak_iterator<Derived>
+ , shared_ptr<Derived> const
+ , std::forward_iterator_tag
+ >
+{
+ typedef std::set<weak_ptr<Derived> > set_type;
+ typedef typename set_type::iterator base_iterator;
+
+ weak_iterator()
+ : cur_()
+ , iter_()
+ , set_(0)
+ {
+ }
+
+ weak_iterator(base_iterator iter, set_type *set)
+ : cur_()
+ , iter_(iter)
+ , set_(set)
+ {
+ this->satisfy_();
+ }
+
+private:
+ friend class boost::iterator_core_access;
+
+ shared_ptr<Derived> const &dereference() const
+ {
+ return this->cur_;
+ }
+
+ void increment()
+ {
+ ++this->iter_;
+ this->satisfy_();
+ }
+
+ bool equal(weak_iterator<Derived> const &that) const
+ {
+ return this->iter_ == that.iter_;
+ }
+
+ void satisfy_()
+ {
+ while(this->iter_ != this->set_->end())
+ {
+ this->cur_ = this->iter_->lock();
+ if(this->cur_)
+ return;
+ base_iterator tmp = this->iter_++;
+ this->set_->erase(tmp);
+ }
+ this->cur_.reset();
+ }
+
+ shared_ptr<Derived> cur_;
+ base_iterator iter_;
+ set_type *set_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// filter_self
+// for use with a filter_iterator to filter a node out of a list of dependencies
+template<typename Derived>
+struct filter_self
+ : std::unary_function<shared_ptr<Derived>, bool>
+{
+ filter_self(enable_reference_tracking<Derived> *self)
+ : self_(self)
+ {
+ }
+
+ bool operator ()(shared_ptr<Derived> const &that) const
+ {
+ return this->self_ != that.get();
+ }
+
+private:
+ enable_reference_tracking<Derived> *self_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// swap without bringing in std::swap -- must be found by ADL.
+template<typename T>
+void adl_swap(T &t1, T &t2)
+{
+ swap(t1, t2);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// enable_reference_tracking
+// inherit from this type to enable reference tracking for a type. You can
+// then use tracking_ptr (below) as a holder for derived objects.
+//
+template<typename Derived>
+struct enable_reference_tracking
+{
+ typedef std::set<shared_ptr<Derived> > references_type;
+ typedef std::set<weak_ptr<Derived> > dependents_type;
+
+ void tracking_copy(Derived const &that)
+ {
+ if(&this->derived_() != &that)
+ {
+ this->raw_copy_(that);
+ this->tracking_update();
+ }
+ }
+
+ void tracking_clear()
+ {
+ this->raw_copy_(Derived());
+ }
+
+ // called automatically as a result of a tracking_copy(). Must be called explicitly
+ // if you change the references without calling tracking_copy().
+ void tracking_update()
+ {
+ // add "this" as a dependency to all the references
+ this->update_references_();
+ // notify our dependencies that we have new references
+ this->update_dependents_();
+ }
+
+ void track_reference(enable_reference_tracking<Derived> &that)
+ {
+ // avoid some unbounded memory growth in certain circumstances by
+ // opportunistically removing stale dependencies from "that"
+ that.purge_stale_deps_();
+ // add "that" as a reference
+ this->refs_.insert(that.self_);
+ // also inherit that's references
+ this->refs_.insert(that.refs_.begin(), that.refs_.end());
+ }
+
+ long use_count() const
+ {
+ return this->cnt_;
+ }
+
+ void add_ref()
+ {
+ ++this->cnt_;
+ }
+
+ void release()
+ {
+ BOOST_ASSERT(0 < this->cnt_);
+ if(0 == --this->cnt_)
+ {
+ this->refs_.clear();
+ this->self_.reset();
+ }
+ }
+
+ //{{AFX_DEBUG
+ #ifdef BOOST_XPRESSIVE_DEBUG_TRACKING_POINTER
+ friend std::ostream &operator <<(std::ostream &sout, enable_reference_tracking<Derived> const &that)
+ {
+ that.dump_(sout);
+ return sout;
+ }
+ #endif
+ //}}AFX_DEBUG
+
+protected:
+
+ enable_reference_tracking()
+ : refs_()
+ , deps_()
+ , self_()
+ , cnt_(0)
+ {
+ }
+
+ enable_reference_tracking(enable_reference_tracking<Derived> const &that)
+ : refs_()
+ , deps_()
+ , self_()
+ , cnt_(0)
+ {
+ this->operator =(that);
+ }
+
+ enable_reference_tracking<Derived> &operator =(enable_reference_tracking<Derived> const &that)
+ {
+ references_type(that.refs_).swap(this->refs_);
+ return *this;
+ }
+
+ void swap(enable_reference_tracking<Derived> &that)
+ {
+ this->refs_.swap(that.refs_);
+ }
+
+private:
+ friend struct tracking_ptr<Derived>;
+
+ Derived &derived_()
+ {
+ return *static_cast<Derived *>(this);
+ }
+
+ void raw_copy_(Derived that)
+ {
+ detail::adl_swap(this->derived_(), that);
+ }
+
+ bool has_deps_() const
+ {
+ return !this->deps_.empty();
+ }
+
+ void update_references_()
+ {
+ typename references_type::iterator cur = this->refs_.begin();
+ typename references_type::iterator end = this->refs_.end();
+ for(; cur != end; ++cur)
+ {
+ // for each reference, add this as a dependency
+ (*cur)->track_dependency_(*this);
+ }
+ }
+
+ void update_dependents_()
+ {
+ // called whenever this regex object changes (i.e., is assigned to). it walks
+ // the list of dependent regexes and updates *their* lists of references,
+ // thereby spreading out the reference counting responsibility evenly.
+ weak_iterator<Derived> cur(this->deps_.begin(), &this->deps_);
+ weak_iterator<Derived> end(this->deps_.end(), &this->deps_);
+
+ for(; cur != end; ++cur)
+ {
+ (*cur)->track_reference(*this);
+ }
+ }
+
+ void track_dependency_(enable_reference_tracking<Derived> &dep)
+ {
+ if(this == &dep) // never add ourself as a dependency
+ return;
+
+ // add dep as a dependency
+ this->deps_.insert(dep.self_);
+
+ filter_self<Derived> not_self(this);
+ weak_iterator<Derived> begin(dep.deps_.begin(), &dep.deps_);
+ weak_iterator<Derived> end(dep.deps_.end(), &dep.deps_);
+
+ // also inherit dep's dependencies
+ this->deps_.insert(
+ make_filter_iterator(not_self, begin, end)
+ , make_filter_iterator(not_self, end, end)
+ );
+ }
+
+ void purge_stale_deps_()
+ {
+ weak_iterator<Derived> cur(this->deps_.begin(), &this->deps_);
+ weak_iterator<Derived> end(this->deps_.end(), &this->deps_);
+
+ for(; cur != end; ++cur)
+ ;
+ }
+
+ //{{AFX_DEBUG
+ #ifdef BOOST_XPRESSIVE_DEBUG_TRACKING_POINTER
+ void dump_(std::ostream &sout) const;
+ #endif
+ //}}AFX_DEBUG
+
+ references_type refs_;
+ dependents_type deps_;
+ shared_ptr<Derived> self_;
+ boost::detail::atomic_count cnt_;
+};
+
+template<typename Derived>
+inline void intrusive_ptr_add_ref(enable_reference_tracking<Derived> *p)
+{
+ p->add_ref();
+}
+
+template<typename Derived>
+inline void intrusive_ptr_release(enable_reference_tracking<Derived> *p)
+{
+ p->release();
+}
+
+//{{AFX_DEBUG
+#ifdef BOOST_XPRESSIVE_DEBUG_TRACKING_POINTER
+///////////////////////////////////////////////////////////////////////////////
+// dump_
+//
+template<typename Derived>
+inline void enable_reference_tracking<Derived>::dump_(std::ostream &sout) const
+{
+ shared_ptr<Derived> this_ = this->self_;
+ sout << "0x" << (void*)this << " cnt=" << this_.use_count()-1 << " refs={";
+ typename references_type::const_iterator cur1 = this->refs_.begin();
+ typename references_type::const_iterator end1 = this->refs_.end();
+ for(; cur1 != end1; ++cur1)
+ {
+ sout << "0x" << (void*)&**cur1 << ',';
+ }
+ sout << "} deps={";
+ typename dependents_type::const_iterator cur2 = this->deps_.begin();
+ typename dependents_type::const_iterator end2 = this->deps_.end();
+ for(; cur2 != end2; ++cur2)
+ {
+ // ericne, 27/nov/05: CW9_4 doesn't like if(shared_ptr x = y)
+ shared_ptr<Derived> dep = cur2->lock();
+ if(dep.get())
+ {
+ sout << "0x" << (void*)&*dep << ',';
+ }
+ }
+ sout << '}';
+}
+#endif
+//}}AFX_DEBUG
+
+///////////////////////////////////////////////////////////////////////////////
+// tracking_ptr
+// holder for a reference-tracked type. Does cycle-breaking, lazy initialization
+// and copy-on-write. TODO: implement move semantics.
+//
+template<typename Type>
+struct tracking_ptr
+{
+ BOOST_MPL_ASSERT((is_base_and_derived<enable_reference_tracking<Type>, Type>));
+ typedef Type element_type;
+
+ tracking_ptr()
+ : impl_()
+ {
+ }
+
+ tracking_ptr(tracking_ptr<element_type> const &that)
+ : impl_()
+ {
+ this->operator =(that);
+ }
+
+ tracking_ptr<element_type> &operator =(tracking_ptr<element_type> const &that)
+ {
+ // Note: the copy-and-swap idiom doesn't work here if has_deps_()==true
+ // because it invalidates references to the element_type object.
+ if(this != &that)
+ {
+ if(that)
+ {
+ if(that.has_deps_() || this->has_deps_())
+ {
+ this->fork_(); // deep copy, forks data if necessary
+ this->impl_->tracking_copy(*that);
+ }
+ else
+ {
+ this->impl_ = that.impl_; // shallow, copy-on-write
+ }
+ }
+ else if(*this)
+ {
+ this->impl_->tracking_clear();
+ }
+ }
+ return *this;
+ }
+
+ // NOTE: this does *not* do tracking. Can't provide a non-throwing swap that tracks references
+ void swap(tracking_ptr<element_type> &that) // throw()
+ {
+ this->impl_.swap(that.impl_);
+ }
+
+ // calling this forces this->impl_ to fork.
+ shared_ptr<element_type> const &get() const
+ {
+ if(intrusive_ptr<element_type> impl = this->fork_())
+ {
+ this->impl_->tracking_copy(*impl);
+ }
+ return this->impl_->self_;
+ }
+
+ #if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
+ typedef bool unspecified_bool_type;
+ #else
+ typedef typename intrusive_ptr<element_type>::unspecified_bool_type unspecified_bool_type;
+ #endif
+
+ // smart-pointer operators
+ operator unspecified_bool_type() const
+ {
+ return this->impl_;
+ }
+
+ bool operator !() const
+ {
+ return !this->impl_;
+ }
+
+ // Since this does not un-share the data, it returns a ptr-to-const
+ element_type const *operator ->() const
+ {
+ return get_pointer(this->impl_);
+ }
+
+ // Since this does not un-share the data, it returns a ref-to-const
+ element_type const &operator *() const
+ {
+ return *this->impl_;
+ }
+
+private:
+
+ // calling this forces impl_ to fork.
+ intrusive_ptr<element_type> fork_() const
+ {
+ intrusive_ptr<element_type> impl;
+ if(!this->impl_ || 1 != this->impl_->use_count())
+ {
+ impl = this->impl_;
+ BOOST_ASSERT(!this->has_deps_());
+ shared_ptr<element_type> simpl(new element_type);
+ this->impl_ = get_pointer(simpl->self_ = simpl);
+ }
+ return impl;
+ }
+
+ // does anybody have a dependency on us?
+ bool has_deps_() const
+ {
+ return this->impl_ && this->impl_->has_deps_();
+ }
+
+ // mutable to allow lazy initialization
+ mutable intrusive_ptr<element_type> impl_;
+};
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/traits_utils.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/traits_utils.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,145 @@
+///////////////////////////////////////////////////////////////////////////////
+// traits_utils.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_TRAITS_UTILS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_TRAITS_UTILS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+# pragma warning(push)
+# pragma warning(disable : 4100) // unreferenced formal parameter
+#endif
+
+#include <string>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/xpressive/detail/utility/algorithm.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // char_cast
+ //
+ template<typename ToChar, typename FromChar, typename Traits>
+ inline ToChar
+ char_cast(FromChar from, Traits const &, typename enable_if<is_same<ToChar, FromChar> >::type * = 0)
+ {
+ return from;
+ }
+
+ template<typename ToChar, typename FromChar, typename Traits>
+ inline ToChar
+ char_cast(FromChar from, Traits const &traits, typename disable_if<is_same<ToChar, FromChar> >::type * = 0)
+ {
+ BOOST_MPL_ASSERT((is_same<FromChar, char>));
+ return traits.widen(from);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // widen_fun
+ //
+ template<typename Traits>
+ struct widen_fun
+ {
+ typedef typename Traits::char_type result_type;
+ explicit widen_fun(Traits const &traits)
+ : traits_(traits)
+ {}
+
+ result_type operator()(char ch) const
+ {
+ return this->traits_.widen(ch);
+ }
+
+ Traits const &traits_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // string_cast_
+ //
+ template<
+ typename To
+ , typename From
+ , typename ToChar = typename detail::range_data<To>::type
+ , typename FromChar = typename detail::range_data<From>::type
+ >
+ struct string_cast_
+ {
+ BOOST_MPL_ASSERT((is_same<FromChar, char>));
+ typedef To const result_type;
+ template<typename Traits>
+ result_type operator()(From const &from, Traits const &traits) const
+ {
+ widen_fun<Traits> widen(traits);
+ To to(
+ boost::make_transform_iterator(detail::data_begin(from), widen)
+ , boost::make_transform_iterator(detail::data_end(from), widen)
+ );
+ return to;
+ }
+ };
+
+ template<typename To, typename From, typename Char>
+ struct string_cast_<To, From, Char, Char>
+ {
+ typedef To const result_type;
+ template<typename Traits>
+ result_type operator()(From const &from, Traits const &) const
+ {
+ To to(detail::data_begin(from), detail::data_end(from));
+ return to;
+ }
+ };
+
+ template<typename From, typename Char>
+ struct string_cast_<From, From, Char, Char>
+ {
+ typedef From const &result_type;
+ template<typename Traits>
+ result_type operator()(From const &from, Traits const &) const
+ {
+ return from;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // string_cast
+ //
+ template<typename To, typename From, typename Traits>
+ typename string_cast_<To, From>::result_type
+ string_cast(From const &from, Traits const &traits)
+ {
+ return string_cast_<To, From>()(from, traits);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // translate
+ //
+ template<typename Char, typename Traits>
+ inline Char translate(Char ch, Traits const &traits, mpl::false_) // case-sensitive
+ {
+ return traits.translate(ch);
+ }
+
+ template<typename Char, typename Traits>
+ inline Char translate(Char ch, Traits const &traits, mpl::true_) // case-insensitive
+ {
+ return traits.translate_nocase(ch);
+ }
+
+}}} // namespace boost::xpressive::detail
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/width.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/detail/utility/width.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,94 @@
+///////////////////////////////////////////////////////////////////////////////
+// width.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_WIDTH_HPP_EAN_04_07_2006
+#define BOOST_XPRESSIVE_DETAIL_UTILITY_WIDTH_HPP_EAN_04_07_2006
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <climits> // for INT_MAX
+#include <boost/mpl/size_t.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+typedef mpl::size_t<INT_MAX / 2 - 1> unknown_width;
+struct width;
+bool is_unknown(width const &that);
+
+///////////////////////////////////////////////////////////////////////////////
+// width
+struct width
+{
+ width(std::size_t value = 0)
+ : value_(value)
+ {
+ }
+
+ bool operator !() const
+ {
+ return !this->value_;
+ }
+
+ width &operator +=(width const &that)
+ {
+ this->value_ =
+ !is_unknown(*this) && !is_unknown(that)
+ ? this->value_ + that.value_
+ : unknown_width();
+ return *this;
+ }
+
+ width &operator |=(width const &that)
+ {
+ this->value_ =
+ this->value_ == that.value_
+ ? this->value_
+ : unknown_width();
+ return *this;
+ }
+
+ std::size_t value() const
+ {
+ return this->value_;
+ }
+
+private:
+ std::size_t value_;
+};
+
+inline bool is_unknown(width const &that)
+{
+ return unknown_width::value == that.value();
+}
+
+inline bool operator ==(width const &left, width const &right)
+{
+ return left.value() == right.value();
+}
+
+inline bool operator !=(width const &left, width const &right)
+{
+ return left.value() != right.value();
+}
+
+inline width operator +(width left, width const &right)
+{
+ return left += right;
+}
+
+inline width operator |(width left, width const &right)
+{
+ return left |= right;
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/match_results.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/match_results.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,1392 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file match_results.hpp
+/// Contains the definition of the match_results type and associated helpers.
+/// The match_results type holds the results of a regex_match() or
+/// regex_search() operation.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// Acknowledgements: Thanks to Markus Schoepflin for helping to track down
+// a tricky formatting bug on HP Tru64, and to Steven Watanabe for suggesting
+// the fix.
+
+#ifndef BOOST_XPRESSIVE_MATCH_RESULTS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_MATCH_RESULTS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <map>
+#include <string>
+#include <vector>
+#include <utility>
+#include <iterator>
+#include <typeinfo>
+#include <algorithm>
+#include <boost/config.hpp>
+#include <boost/assert.hpp>
+#include <boost/integer.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/size_t.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/iterator_adaptors.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/numeric/conversion/converter.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/begin.hpp>
+#include <boost/range/as_literal.hpp>
+#include <boost/range/const_iterator.hpp>
+#include <boost/type_traits/is_function.hpp>
+#if BOOST_ITERATOR_ADAPTORS_VERSION >= 0x0200
+# include <boost/iterator/filter_iterator.hpp>
+#endif
+#include <boost/xpressive/regex_constants.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/regex_impl.hpp>
+#include <boost/xpressive/detail/core/sub_match_vector.hpp>
+#include <boost/xpressive/detail/utility/sequence_stack.hpp>
+#include <boost/xpressive/detail/core/results_cache.hpp>
+#include <boost/xpressive/detail/utility/literals.hpp>
+#include <boost/xpressive/detail/utility/algorithm.hpp>
+#include <boost/xpressive/detail/utility/counted_base.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/eval.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// type_info_less
+//
+struct type_info_less
+{
+ bool operator()(std::type_info const *left, std::type_info const *right) const
+ {
+ return 0 != left->before(*right);
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// ActionArgBinding
+//
+struct ActionArgBinding
+ : proto::assign<proto::terminal<action_arg<proto::_, proto::_> >, proto::terminal<proto::_> >
+{
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// results_extras
+//
+template<typename BidiIter>
+struct results_extras
+ : counted_base<results_extras<BidiIter> >
+{
+ sequence_stack<sub_match_impl<BidiIter> > sub_match_stack_;
+ results_cache<BidiIter> results_cache_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// char_overflow_handler_
+//
+struct char_overflow_handler_
+{
+ void operator ()(numeric::range_check_result result) const // throw(regex_error)
+ {
+ if(numeric::cInRange != result)
+ {
+ boost::throw_exception(
+ regex_error(
+ regex_constants::error_escape
+ , "character escape too large to fit in target character type"
+ )
+ );
+ }
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// transform_op enum
+//
+enum transform_op { None = 0, Upper = 1, Lower = 2 };
+enum transform_scope { Next = 0, Rest = 1 };
+
+///////////////////////////////////////////////////////////////////////////////
+// case_converting_iterator
+//
+template<typename OutputIterator, typename Char>
+struct case_converting_iterator
+ : std::iterator<std::output_iterator_tag, Char, void, void, case_converting_iterator<OutputIterator, Char> >
+{
+ case_converting_iterator(OutputIterator const &out, traits<Char> const *traits)
+ : out_(out)
+ , traits_(traits)
+ , next_(None)
+ , rest_(None)
+ {}
+
+ OutputIterator base() const
+ {
+ return this->out_;
+ }
+
+ case_converting_iterator &operator ++()
+ {
+ ++this->out_;
+ this->next_ = None;
+ return *this;
+ }
+
+ case_converting_iterator operator ++(int)
+ {
+ case_converting_iterator tmp(*this);
+ ++*this;
+ return tmp;
+ }
+
+ case_converting_iterator &operator *()
+ {
+ return *this;
+ }
+
+ friend bool set_transform(case_converting_iterator &iter, transform_op trans, transform_scope scope)
+ {
+ BOOST_ASSERT(scope == Next || scope == Rest);
+ if(scope == Next)
+ iter.next_ = trans;
+ else
+ iter.rest_ = trans;
+ return true;
+ }
+
+ case_converting_iterator &operator =(Char ch)
+ {
+ switch(this->next_ ? this->next_ : this->rest_)
+ {
+ case Lower:
+ ch = this->traits_->tolower(ch);
+ break;
+
+ case Upper:
+ ch = this->traits_->toupper(ch);
+ break;
+
+ default:;
+ }
+
+ *this->out_ = ch;
+ return *this;
+ }
+
+private:
+ OutputIterator out_;
+ traits<Char> const *traits_;
+ transform_op next_, rest_;
+};
+
+template<typename Iterator>
+inline bool set_transform(Iterator &, transform_op, transform_scope)
+{
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// noop_output_iterator
+//
+template<typename Char>
+struct noop_output_iterator
+ : std::iterator<std::output_iterator_tag, Char, void, void, noop_output_iterator<Char> >
+{
+ noop_output_iterator &operator ++()
+ {
+ return *this;
+ }
+
+ noop_output_iterator &operator ++(int)
+ {
+ return *this;
+ }
+
+ noop_output_iterator &operator *()
+ {
+ return *this;
+ }
+
+ noop_output_iterator &operator =(Char const &)
+ {
+ return *this;
+ }
+};
+
+struct any_type { any_type(...); };
+typedef char no_type;
+typedef char (&unary_type)[2];
+typedef char (&binary_type)[3];
+typedef char (&ternary_type)[4];
+
+no_type check_is_formatter(unary_type, binary_type, ternary_type);
+
+template<typename T>
+unary_type check_is_formatter(T const &, binary_type, ternary_type);
+
+template<typename T>
+binary_type check_is_formatter(unary_type, T const &, ternary_type);
+
+template<typename T, typename U>
+binary_type check_is_formatter(T const &, U const &, ternary_type);
+
+template<typename T>
+ternary_type check_is_formatter(unary_type, binary_type, T const &);
+
+template<typename T, typename U>
+ternary_type check_is_formatter(T const &, binary_type, U const &);
+
+template<typename T, typename U>
+ternary_type check_is_formatter(unary_type, T const &, U const &);
+
+template<typename T, typename U, typename V>
+ternary_type check_is_formatter(T const &, U const &, V const &);
+
+struct unary_binary_ternary
+{
+ typedef unary_type (*unary_fun)(any_type);
+ typedef binary_type (*binary_fun)(any_type, any_type);
+ typedef ternary_type (*ternary_fun)(any_type, any_type, any_type);
+ operator unary_fun();
+ operator binary_fun();
+ operator ternary_fun();
+};
+
+template<typename Formatter, bool IsFunction = is_function<Formatter>::value>
+struct formatter_wrapper
+ : Formatter
+ , unary_binary_ternary
+{
+ formatter_wrapper();
+};
+
+template<typename Formatter>
+struct formatter_wrapper<Formatter, true>
+ : unary_binary_ternary
+{
+ operator Formatter *();
+};
+
+template<typename Formatter>
+struct formatter_wrapper<Formatter *, false>
+ : unary_binary_ternary
+{
+ operator Formatter *();
+};
+
+template<typename Formatter, typename What, typename Out, typename Void = void>
+struct formatter_arity
+{
+ static formatter_wrapper<Formatter> &formatter;
+ static What &what;
+ static Out &out;
+ BOOST_STATIC_CONSTANT(
+ std::size_t
+ , value = sizeof(
+ check_is_formatter(
+ formatter(what)
+ , formatter(what, out)
+ , formatter(what, out, regex_constants::format_default)
+ )
+ ) - 1
+ );
+ typedef mpl::size_t<value> type;
+};
+
+template<typename Formatter, typename What, typename Out>
+struct formatter_arity<Formatter, What, Out, typename Formatter::proto_is_expr_>
+ : mpl::size_t<4>
+{};
+
+template<typename T>
+struct is_char_ptr
+ : mpl::false_
+{};
+
+template<typename T>
+struct is_char_ptr<T *>
+ : mpl::not_<is_function<T> >
+{};
+
+#if BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 0)
+// work around gcc-4.0.1 compiler bug wrt function references
+template<typename T>
+typename mpl::if_<is_function<T>, T *, T const &>::type
+as_callable(T const &t)
+{
+ return t;
+}
+#endif
+
+} // detail
+
+///////////////////////////////////////////////////////////////////////////////
+// match_results
+/// \brief Class template match_results\<\> holds the results of a regex_match() or a
+/// regex_search() as a collection of sub_match objects.
+///
+/// Class template match_results\<\> denotes a collection of sequences representing the result of
+/// a regular expression match. Storage for the collection is allocated and freed as necessary by
+/// the member functions of class match_results\<\>.
+///
+/// The class template match_results\<\> conforms to the requirements of a Sequence, as specified
+/// in (lib.sequence.reqmts), except that only operations defined for const-qualified Sequences are
+/// supported.
+template<typename BidiIter>
+struct match_results
+{
+private:
+ /// INTERNAL ONLY
+ ///
+ struct dummy { int i_; };
+ typedef int dummy::*bool_type;
+
+public:
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef typename detail::string_type<char_type>::type string_type;
+ typedef std::size_t size_type;
+ typedef sub_match<BidiIter> value_type;
+ typedef typename iterator_difference<BidiIter>::type difference_type;
+ typedef value_type const &reference;
+ typedef value_type const &const_reference;
+
+ typedef typename detail::sub_match_vector<BidiIter>::iterator iterator;
+ typedef typename detail::sub_match_vector<BidiIter>::const_iterator const_iterator;
+ typedef typename detail::nested_results<BidiIter> nested_results_type;
+
+ /// \post regex_id() == 0
+ /// \post size() == 0
+ /// \post empty() == true
+ /// \post str() == string_type()
+ match_results()
+ : regex_id_(0)
+ , sub_matches_()
+ , base_()
+ , prefix_()
+ , suffix_()
+ , nested_results_()
+ , extras_ptr_()
+ , traits_()
+ , args_()
+ , named_marks_()
+ {
+ }
+
+ /// \param that The match_results object to copy
+ /// \post regex_id() == that.regex_id().
+ /// \post size() == that.size().
+ /// \post empty() == that.empty().
+ /// \post str(n) == that.str(n) for all positive integers n \< that.size().
+ /// \post prefix() == that.prefix().
+ /// \post suffix() == that.suffix().
+ /// \post (*this)[n] == that[n] for all positive integers n \< that.size().
+ /// \post length(n) == that.length(n) for all positive integers n \< that.size().
+ /// \post position(n) == that.position(n) for all positive integers n \< that.size().
+ match_results(match_results<BidiIter> const &that)
+ : regex_id_(that.regex_id_)
+ , sub_matches_()
+ , base_()
+ , prefix_()
+ , suffix_()
+ , nested_results_()
+ , extras_ptr_()
+ , traits_()
+ , args_(that.args_)
+ , named_marks_(that.named_marks_)
+ {
+ if(that)
+ {
+ extras_type &extras = this->get_extras_();
+ std::size_t size = that.sub_matches_.size();
+ detail::sub_match_impl<BidiIter> *sub_matches = extras.sub_match_stack_.push_sequence(size);
+ detail::core_access<BidiIter>::init_sub_match_vector(this->sub_matches_, sub_matches, size, that.sub_matches_);
+
+ // BUGBUG this doesn't share the extras::sequence_stack
+ this->nested_results_ = that.nested_results_;
+ this->prefix_ = that.prefix_;
+ this->suffix_ = that.suffix_;
+ this->base_ = that.base_;
+ this->traits_ = that.traits_;
+ }
+ }
+
+ ~match_results()
+ {
+ }
+
+ /// \param that The match_results object to copy.
+ /// \post regex_id() == that.regex_id().
+ /// \post size() == that.size().
+ /// \post empty() == that.empty().
+ /// \post str(n) == that.str(n) for all positive integers n \< that.size().
+ /// \post prefix() == that.prefix().
+ /// \post suffix() == that.suffix().
+ /// \post (*this)[n] == that[n] for all positive integers n \< that.size().
+ /// \post length(n) == that.length(n) for all positive integers n \< that.size().
+ /// \post position(n) == that.position(n) for all positive integers n \< that.size().
+ match_results<BidiIter> &operator =(match_results<BidiIter> const &that)
+ {
+ match_results<BidiIter>(that).swap(*this);
+ return *this;
+ }
+
+ /// Returns one plus the number of marked sub-expressions in the regular
+ /// expression that was matched if *this represents the result of a
+ /// successful match. Otherwise returns 0.
+ size_type size() const
+ {
+ return this->sub_matches_.size();
+ }
+
+ /// Returns size() == 0.
+ ///
+ bool empty() const
+ {
+ return 0 == this->size();
+ }
+
+ /// Returns (*this)[sub].length().
+ ///
+ difference_type length(size_type sub = 0) const
+ {
+ return this->sub_matches_[ sub ].length();
+ }
+
+ /// If !(*this)[sub].matched then returns -1. Otherwise returns std::distance(base, (*this)[sub].first),
+ /// where base is the start iterator of the sequence that was searched. [Note - unless this is part
+ /// of a repeated search with a regex_iterator then base is the same as prefix().first - end note]
+ difference_type position(size_type sub = 0) const
+ {
+ return this->sub_matches_[ sub ].matched ? std::distance(this->base_, this->sub_matches_[ sub ].first) : -1;
+ }
+
+ /// Returns (*this)[sub].str().
+ ///
+ string_type str(size_type sub = 0) const
+ {
+ return this->sub_matches_[ sub ].str();
+ }
+
+ /// Returns a reference to the sub_match object representing the sequence that
+ /// matched marked sub-expression sub. If sub == 0 then returns a reference to
+ /// a sub_match object representing the sequence that matched the whole regular
+ /// expression. If sub >= size() then returns a sub_match object representing an
+ /// unmatched sub-expression.
+ template<typename Sub>
+ const_reference operator [](Sub const &sub) const
+ {
+ return this->at_(sub);
+ }
+
+ /// Returns a reference to the sub_match object representing the character sequence from
+ /// the start of the string being matched/searched, to the start of the match found.
+ ///
+ const_reference prefix() const
+ {
+ return this->prefix_;
+ }
+
+ /// Returns a reference to the sub_match object representing the character sequence from
+ /// the end of the match found to the end of the string being matched/searched.
+ ///
+ const_reference suffix() const
+ {
+ return this->suffix_;
+ }
+
+ /// Returns a starting iterator that enumerates over all the marked sub-expression matches
+ /// stored in *this.
+ ///
+ const_iterator begin() const
+ {
+ return this->sub_matches_.begin();
+ }
+
+ /// Returns a terminating iterator that enumerates over all the marked sub-expression
+ /// matches stored in *this.
+ ///
+ const_iterator end() const
+ {
+ return this->sub_matches_.end();
+ }
+
+ /// Returns a true value if (*this)[0].matched, else returns a false value.
+ ///
+ operator bool_type() const
+ {
+ return this->sub_matches_[ 0 ].matched ? &dummy::i_ : 0;
+ }
+
+ /// Returns true if empty() || !(*this)[0].matched, else returns false.
+ ///
+ bool operator !() const
+ {
+ return this->empty() || !this->sub_matches_[ 0 ].matched;
+ }
+
+ /// Returns the id of the basic_regex object most recently used with this match_results object.
+ ///
+ regex_id_type regex_id() const
+ {
+ return this->regex_id_;
+ }
+
+ /// Returns a Sequence of nested match_results elements.
+ ///
+ nested_results_type const &nested_results() const
+ {
+ return this->nested_results_;
+ }
+
+ /// If \c Format models \c ForwardRange or is a null-terminated string, this function
+ /// copies the character sequence in \c fmt to \c OutputIterator \c out. For each format
+ /// specifier or escape sequence in \c fmt, replace that sequence with either the character(s) it
+ /// represents, or the sequence within <tt>*this</tt> to which it refers. The bitmasks specified in flags
+ /// determines what format specifiers or escape sequences are recognized. By default, this is the
+ /// format used by ECMA-262, ECMAScript Language Specification, Chapter 15 part 5.4.11 String.prototype.replace.
+ ///
+ /// Otherwise, if \c Format models <tt>Callable\<match_results\<BidiIter\>, OutputIterator, regex_constants::match_flag_type\></tt>,
+ /// this function returns <tt>fmt(*this, out, flags)</tt>.
+ ///
+ /// Otherwise, if \c Format models <tt>Callable\<match_results\<BidiIter\>, OutputIterator\></tt>, this function
+ /// returns <tt>fmt(*this, out)</tt>.
+ ///
+ /// Otherwise, if \c Format models <tt>Callable\<match_results\<BidiIter\> \></tt>, this function
+ /// returns <tt>std::copy(x.begin(), x.end(), out)</tt>, where \c x is the result of
+ /// calling <tt>fmt(*this)</tt>.
+ template<typename Format, typename OutputIterator>
+ OutputIterator format
+ (
+ OutputIterator out
+ , Format const &fmt
+ , regex_constants::match_flag_type flags = regex_constants::format_default
+ , typename disable_if<detail::is_char_ptr<Format> >::type * = 0
+ ) const
+ {
+ // Is this a formatter object, or a format string?
+ typedef
+ typename detail::formatter_arity<
+ Format
+ , match_results<BidiIter>
+ , OutputIterator
+ >::type
+ arity;
+
+ return this->format_(out, fmt, flags, arity());
+ }
+
+ /// \overload
+ ///
+ template<typename OutputIterator>
+ OutputIterator format
+ (
+ OutputIterator out
+ , char_type const *fmt
+ , regex_constants::match_flag_type flags = regex_constants::format_default
+ ) const
+ {
+ return this->format_(out, boost::as_literal(fmt), flags, mpl::size_t<0>());
+ }
+
+ /// If \c Format models \c ForwardRange or is a null-terminated string, this function
+ /// returns a copy of the character sequence \c fmt. For each format specifier or escape sequence in \c fmt,
+ /// replace that sequence with either the character(s) it represents, or the sequence within
+ /// <tt>*this</tt> to which it refers. The bitmasks specified in \c flags determines what format specifiers
+ /// or escape sequences are recognized. By default this is the format used by ECMA-262,
+ /// ECMAScript Language Specification, Chapter 15 part 5.4.11 String.prototype.replace.
+ ///
+ /// Otherwise, if \c Format models <tt>Callable\<match_results\<BidiIter\>, OutputIterator, regex_constants::match_flag_type\></tt>,
+ /// this function returns a \c string_type object \c x populated by calling <tt>fmt(*this, out, flags)</tt>,
+ /// where \c out is a \c back_insert_iterator into \c x.
+ ///
+ /// Otherwise, if \c Format models <tt>Callable\<match_results\<BidiIter\>, OutputIterator\></tt>, this function
+ /// returns a \c string_type object \c x populated by calling <tt>fmt(*this, out)</tt>,
+ /// where \c out is a \c back_insert_iterator into \c x.
+ ///
+ /// Otherwise, if \c Format models <tt>Callable\<match_results\<BidiIter\> \></tt>, this function
+ /// returns <tt>fmt(*this)</tt>.
+ template<typename Format, typename OutputIterator>
+ string_type format
+ (
+ Format const &fmt
+ , regex_constants::match_flag_type flags = regex_constants::format_default
+ , typename disable_if<detail::is_char_ptr<Format> >::type * = 0
+ ) const
+ {
+ string_type result;
+ this->format(std::back_inserter(result), fmt, flags);
+ return result;
+ }
+
+ /// \overload
+ ///
+ string_type format
+ (
+ char_type const *fmt
+ , regex_constants::match_flag_type flags = regex_constants::format_default
+ ) const
+ {
+ string_type result;
+ this->format(std::back_inserter(result), fmt, flags);
+ return result;
+ }
+
+ /// Swaps the contents of two match_results objects. Guaranteed not to throw.
+ /// \param that The match_results object to swap with.
+ /// \post *this contains the sequence of matched sub-expressions that were in that,
+ /// that contains the sequence of matched sub-expressions that were in *this.
+ /// \throw nothrow
+ void swap(match_results<BidiIter> &that) // throw()
+ {
+ std::swap(this->regex_id_, that.regex_id_);
+ this->sub_matches_.swap(that.sub_matches_);
+ std::swap(this->base_, that.base_);
+ std::swap(this->prefix_, that.prefix_);
+ std::swap(this->suffix_, that.suffix_);
+ this->nested_results_.swap(that.nested_results_);
+ this->extras_ptr_.swap(that.extras_ptr_);
+ this->traits_.swap(that.traits_);
+ this->args_.swap(that.args_);
+ }
+
+ /// TODO document me
+ ///
+ template<typename Arg>
+ match_results<BidiIter> &let(Arg const &arg)
+ {
+ typedef typename proto::result_of::left<Arg>::type left_type;
+ typedef typename proto::result_of::right<Arg>::type right_type;
+ typedef typename proto::result_of::arg<left_type>::type arg_left_type;
+ typedef typename proto::result_of::arg<right_type>::type arg_right_type;
+ BOOST_MPL_ASSERT((proto::matches<Arg, detail::ActionArgBinding>));
+ BOOST_MPL_ASSERT((is_same<typename arg_left_type::type, arg_right_type>));
+ this->args_[&typeid(proto::arg(proto::left(arg)))] = &proto::arg(proto::right(arg));
+ return *this;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ match_results<BidiIter> const &operator ()(regex_id_type regex_id, size_type index = 0) const
+ {
+ // BUGBUG this is linear, make it O(1)
+ static match_results<BidiIter> const s_null;
+
+ regex_id_filter_predicate<BidiIter> pred(regex_id);
+ typename nested_results_type::const_iterator
+ begin = this->nested_results_.begin()
+ , end = this->nested_results_.end()
+ , cur = detail::find_nth_if(begin, end, index, pred);
+
+ return (cur == end) ? s_null : *cur;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ match_results<BidiIter> const &operator ()(basic_regex<BidiIter> const &rex, std::size_t index = 0) const
+ {
+ return (*this)(rex.regex_id(), index);
+ }
+
+private:
+
+ friend struct detail::core_access<BidiIter>;
+ typedef detail::results_extras<BidiIter> extras_type;
+
+ /// INTERNAL ONLY
+ ///
+ void init_
+ (
+ regex_id_type regex_id
+ , intrusive_ptr<detail::traits<char_type> const> const &traits
+ , detail::sub_match_impl<BidiIter> *sub_matches
+ , size_type size
+ , std::vector<detail::named_mark<char_type> > const &named_marks
+ )
+ {
+ this->traits_ = traits;
+ this->regex_id_ = regex_id;
+ this->named_marks_ = named_marks;
+ detail::core_access<BidiIter>::init_sub_match_vector(this->sub_matches_, sub_matches, size);
+ }
+
+ /// INTERNAL ONLY
+ ///
+ extras_type &get_extras_()
+ {
+ if(!this->extras_ptr_)
+ {
+ this->extras_ptr_ = new extras_type;
+ }
+
+ return *this->extras_ptr_;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ void set_prefix_suffix_(BidiIter begin, BidiIter end)
+ {
+ this->base_ = begin;
+
+ this->prefix_.first = begin;
+ this->prefix_.second = this->sub_matches_[ 0 ].first;
+ this->prefix_.matched = this->prefix_.first != this->prefix_.second;
+
+ this->suffix_.first = this->sub_matches_[ 0 ].second;
+ this->suffix_.second = end;
+ this->suffix_.matched = this->suffix_.first != this->suffix_.second;
+
+ typename nested_results_type::iterator ibegin = this->nested_results_.begin();
+ typename nested_results_type::iterator iend = this->nested_results_.end();
+ for( ; ibegin != iend; ++ibegin )
+ {
+ ibegin->set_prefix_suffix_(begin, end);
+ }
+ }
+
+ /// INTERNAL ONLY
+ ///
+ void reset_()
+ {
+ detail::core_access<BidiIter>::init_sub_match_vector(this->sub_matches_, 0, 0);
+ }
+
+ /// INTERNAL ONLY
+ ///
+ void set_base_(BidiIter base)
+ {
+ this->base_ = base;
+
+ typename nested_results_type::iterator ibegin = this->nested_results_.begin();
+ typename nested_results_type::iterator iend = this->nested_results_.end();
+ for( ; ibegin != iend; ++ibegin )
+ {
+ ibegin->set_base_(base);
+ }
+ }
+
+ /// INTERNAL ONLY
+ ///
+ const_reference at_(size_type sub) const
+ {
+ return this->sub_matches_[ sub ];
+ }
+
+ /// INTERNAL ONLY
+ ///
+ const_reference at_(detail::basic_mark_tag const &mark) const
+ {
+ return this->sub_matches_[ detail::get_mark_number(mark) ];
+ }
+
+ /// INTERNAL ONLY
+ ///
+ const_reference at_(char_type const *name) const
+ {
+ for(std::size_t i = 0; i < this->named_marks_.size(); ++i)
+ {
+ if(this->named_marks_[i].name_ == name)
+ {
+ return this->sub_matches_[ this->named_marks_[i].mark_nbr_ ];
+ }
+ }
+ boost::throw_exception(
+ regex_error(regex_constants::error_badmark, "invalid named back-reference")
+ );
+ // Should never execute, but if it does, this returns
+ // a "null" sub_match.
+ return this->sub_matches_[this->sub_matches_.size()];
+ }
+
+ /// INTERNAL ONLY
+ ///
+ const_reference at_(string_type const &name) const
+ {
+ return (*this)[name.c_str()];
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename OutputIterator, typename ForwardRange>
+ OutputIterator format2_(OutputIterator out, ForwardRange const &result) const
+ {
+ return std::copy(boost::begin(result), boost::end(result), out);
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename OutputIterator, typename Char>
+ OutputIterator format2_(OutputIterator out, Char const *const &result) const
+ {
+ Char const *tmp = result;
+ BOOST_ASSERT(0 != tmp);
+ for(; 0 != *tmp; ++tmp, ++out)
+ {
+ *out = *tmp;
+ }
+ return out;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename OutputIterator, typename ForwardRange>
+ OutputIterator format_
+ (
+ OutputIterator out
+ , ForwardRange const &format
+ , regex_constants::match_flag_type flags
+ , mpl::size_t<0>
+ ) const
+ {
+ typedef typename range_const_iterator<ForwardRange>::type iterator;
+ iterator cur = boost::begin(format), end = boost::end(format);
+
+ if(0 != (regex_constants::format_literal & flags))
+ {
+ return std::copy(cur, end, out);
+ }
+ else if(0 != (regex_constants::format_perl & flags))
+ {
+ return this->format_perl_(cur, end, out);
+ }
+ else if(0 != (regex_constants::format_sed & flags))
+ {
+ return this->format_sed_(cur, end, out);
+ }
+ else if(0 != (regex_constants::format_all & flags))
+ {
+ return this->format_all_(cur, end, out);
+ }
+
+ return this->format_ecma_262_(cur, end, out);
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename OutputIterator, typename Callable1>
+ OutputIterator format_
+ (
+ OutputIterator out
+ , Callable1 const &format
+ , regex_constants::match_flag_type
+ , mpl::size_t<1>
+ ) const
+ {
+ #if BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 0)
+ return this->format2_(out, detail::as_callable(format)(*this));
+ #else
+ return this->format2_(out, format(*this));
+ #endif
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename OutputIterator, typename Callable2>
+ OutputIterator format_
+ (
+ OutputIterator out
+ , Callable2 const &format
+ , regex_constants::match_flag_type
+ , mpl::size_t<2>
+ ) const
+ {
+ #if BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 0)
+ return detail::as_callable(format)(*this, out);
+ #else
+ return format(*this, out);
+ #endif
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename OutputIterator, typename Callable3>
+ OutputIterator format_
+ (
+ OutputIterator out
+ , Callable3 const &format
+ , regex_constants::match_flag_type flags
+ , mpl::size_t<3>
+ ) const
+ {
+ #if BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 0)
+ return detail::as_callable(format)(*this, out, flags);
+ #else
+ return format(*this, out, flags);
+ #endif
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename OutputIterator, typename Expr>
+ OutputIterator format_
+ (
+ OutputIterator out
+ , Expr const &format
+ , regex_constants::match_flag_type flags
+ , mpl::size_t<4>
+ ) const
+ {
+ detail::replacement_context<BidiIter> ctx(*this);
+ return this->format2_(out, proto::eval(format, ctx));
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename ForwardIterator, typename OutputIterator>
+ OutputIterator format_ecma_262_(ForwardIterator cur, ForwardIterator end, OutputIterator out) const
+ {
+ while(cur != end)
+ {
+ switch(*cur)
+ {
+ case BOOST_XPR_CHAR_(char_type, '$'):
+ out = this->format_backref_(++cur, end, out);
+ break;
+
+ default:
+ *out++ = *cur++;
+ break;
+ }
+ }
+
+ return out;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename ForwardIterator, typename OutputIterator>
+ OutputIterator format_sed_(ForwardIterator cur, ForwardIterator end, OutputIterator out) const
+ {
+ while(cur != end)
+ {
+ switch(*cur)
+ {
+ case BOOST_XPR_CHAR_(char_type, '&'):
+ ++cur;
+ out = std::copy(this->sub_matches_[ 0 ].first, this->sub_matches_[ 0 ].second, out);
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, '\\'):
+ out = this->format_escape_(++cur, end, out);
+ break;
+
+ default:
+ *out++ = *cur++;
+ break;
+ }
+ }
+
+ return out;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename ForwardIterator, typename OutputIterator>
+ OutputIterator format_perl_(ForwardIterator cur, ForwardIterator end, OutputIterator out) const
+ {
+ detail::case_converting_iterator<OutputIterator, char_type> iout(out, this->traits_.get());
+
+ while(cur != end)
+ {
+ switch(*cur)
+ {
+ case BOOST_XPR_CHAR_(char_type, '$'):
+ iout = this->format_backref_(++cur, end, iout);
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, '\\'):
+ if(++cur != end && BOOST_XPR_CHAR_(char_type, 'g') == *cur)
+ {
+ iout = this->format_named_backref_(++cur, end, iout);
+ }
+ else
+ {
+ iout = this->format_escape_(cur, end, iout);
+ }
+ break;
+
+ default:
+ *iout++ = *cur++;
+ break;
+ }
+ }
+
+ return iout.base();
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename ForwardIterator, typename OutputIterator>
+ OutputIterator format_all_(ForwardIterator cur, ForwardIterator end, OutputIterator out) const
+ {
+ detail::case_converting_iterator<OutputIterator, char_type> iout(out, this->traits_.get());
+ iout = this->format_all_impl_(cur, end, iout);
+ detail::ensure(cur == end
+ , regex_constants::error_paren, "unbalanced parentheses in format string");
+ return iout.base();
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename ForwardIterator, typename OutputIterator>
+ OutputIterator format_all_impl_(ForwardIterator &cur, ForwardIterator end, OutputIterator out, bool metacolon = false) const
+ {
+ int max = 0, sub = 0;
+ detail::noop_output_iterator<char_type> noop;
+
+ while(cur != end)
+ {
+ switch(*cur)
+ {
+ case BOOST_XPR_CHAR_(char_type, '$'):
+ out = this->format_backref_(++cur, end, out);
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, '\\'):
+ if(++cur != end && BOOST_XPR_CHAR_(char_type, 'g') == *cur)
+ {
+ out = this->format_named_backref_(++cur, end, out);
+ }
+ else
+ {
+ out = this->format_escape_(cur, end, out);
+ }
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, '('):
+ out = this->format_all_impl_(++cur, end, out);
+ detail::ensure(BOOST_XPR_CHAR_(char_type, ')') == *(cur-1)
+ , regex_constants::error_paren, "unbalanced parentheses in format string");
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, '?'):
+ detail::ensure(++cur != end
+ , regex_constants::error_subreg, "malformed conditional in format string");
+ max = static_cast<int>(this->size() - 1);
+ sub = detail::toi(cur, end, *this->traits_, 10, max);
+ detail::ensure(0 != sub, regex_constants::error_subreg, "invalid back-reference");
+ if(this->sub_matches_[ sub ].matched)
+ {
+ out = this->format_all_impl_(cur, end, out, true);
+ if(BOOST_XPR_CHAR_(char_type, ':') == *(cur-1))
+ this->format_all_impl_(cur, end, noop);
+ }
+ else
+ {
+ this->format_all_impl_(cur, end, noop, true);
+ if(BOOST_XPR_CHAR_(char_type, ':') == *(cur-1))
+ out = this->format_all_impl_(cur, end, out);
+ }
+ return out;
+
+ case BOOST_XPR_CHAR_(char_type, ':'):
+ if(metacolon)
+ {
+ case BOOST_XPR_CHAR_(char_type, ')'):
+ ++cur;
+ return out;
+ }
+ // else fall-through
+
+ default:
+ *out++ = *cur++;
+ break;
+ }
+ }
+
+ return out;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename ForwardIterator, typename OutputIterator>
+ OutputIterator format_backref_
+ (
+ ForwardIterator &cur
+ , ForwardIterator end
+ , OutputIterator out
+ ) const
+ {
+ if(cur == end)
+ {
+ *out++ = BOOST_XPR_CHAR_(char_type, '$');
+ }
+ else if(BOOST_XPR_CHAR_(char_type, '$') == *cur)
+ {
+ *out++ = *cur++;
+ }
+ else if(BOOST_XPR_CHAR_(char_type, '&') == *cur) // whole match
+ {
+ ++cur;
+ out = std::copy(this->sub_matches_[ 0 ].first, this->sub_matches_[ 0 ].second, out);
+ }
+ else if(BOOST_XPR_CHAR_(char_type, '`') == *cur) // prefix
+ {
+ ++cur;
+ out = std::copy(this->prefix().first, this->prefix().second, out);
+ }
+ else if(BOOST_XPR_CHAR_(char_type, '\'') == *cur) // suffix
+ {
+ ++cur;
+ out = std::copy(this->suffix().first, this->suffix().second, out);
+ }
+ else if(-1 != this->traits_->value(*cur, 10)) // a sub-match
+ {
+ int max = static_cast<int>(this->size() - 1);
+ int sub = detail::toi(cur, end, *this->traits_, 10, max);
+ detail::ensure(0 != sub, regex_constants::error_subreg, "invalid back-reference");
+ if(this->sub_matches_[ sub ].matched)
+ out = std::copy(this->sub_matches_[ sub ].first, this->sub_matches_[ sub ].second, out);
+ }
+ else
+ {
+ *out++ = BOOST_XPR_CHAR_(char_type, '$');
+ *out++ = *cur++;
+ }
+
+ return out;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename ForwardIterator, typename OutputIterator>
+ OutputIterator format_escape_
+ (
+ ForwardIterator &cur
+ , ForwardIterator end
+ , OutputIterator out
+ ) const
+ {
+ using namespace regex_constants;
+ ForwardIterator tmp;
+ // define an unsigned type the same size as char_type
+ typedef typename boost::uint_t<CHAR_BIT * sizeof(char_type)>::least uchar_t;
+ BOOST_MPL_ASSERT_RELATION(sizeof(uchar_t), ==, sizeof(char_type));
+ typedef numeric::conversion_traits<uchar_t, int> converstion_traits;
+ numeric::converter<int, uchar_t, converstion_traits, detail::char_overflow_handler_> converter;
+
+ if(cur == end)
+ {
+ *out++ = BOOST_XPR_CHAR_(char_type, '\\');
+ return out;
+ }
+
+ char_type ch = *cur++;
+ switch(ch)
+ {
+ case BOOST_XPR_CHAR_(char_type, 'a'):
+ *out++ = BOOST_XPR_CHAR_(char_type, '\a');
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'e'):
+ *out++ = converter(27);
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'f'):
+ *out++ = BOOST_XPR_CHAR_(char_type, '\f');
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'n'):
+ *out++ = BOOST_XPR_CHAR_(char_type, '\n');
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'r'):
+ *out++ = BOOST_XPR_CHAR_(char_type, '\r');
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 't'):
+ *out++ = BOOST_XPR_CHAR_(char_type, '\t');
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'v'):
+ *out++ = BOOST_XPR_CHAR_(char_type, '\v');
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'x'):
+ detail::ensure(cur != end, error_escape, "unexpected end of format found");
+ if(BOOST_XPR_CHAR_(char_type, '{') == *cur)
+ {
+ detail::ensure(++cur != end, error_escape, "unexpected end of format found");
+ tmp = cur;
+ *out++ = converter(detail::toi(cur, end, *this->traits_, 16, 0xffff));
+ detail::ensure(4 == std::distance(tmp, cur) && cur != end && BOOST_XPR_CHAR_(char_type, '}') == *cur++
+ , error_escape, "invalid hex escape : must be \\x { HexDigit HexDigit HexDigit HexDigit }");
+ }
+ else
+ {
+ tmp = cur;
+ *out++ = converter(detail::toi(cur, end, *this->traits_, 16, 0xff));
+ detail::ensure(2 == std::distance(tmp, cur), error_escape
+ , "invalid hex escape : must be \\x HexDigit HexDigit");
+ }
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'c'):
+ detail::ensure(cur != end, error_escape, "unexpected end of format found");
+ detail::ensure
+ (
+ this->traits_->in_range(BOOST_XPR_CHAR_(char_type, 'a'), BOOST_XPR_CHAR_(char_type, 'z'), *cur)
+ || this->traits_->in_range(BOOST_XPR_CHAR_(char_type, 'A'), BOOST_XPR_CHAR_(char_type, 'Z'), *cur)
+ , error_escape
+ , "invalid escape control letter; must be one of a-z or A-Z"
+ );
+ // Convert to character according to ECMA-262, section 15.10.2.10:
+ *out++ = converter(*cur % 32);
+ ++cur;
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'l'):
+ if(!set_transform(out, detail::Lower, detail::Next))
+ {
+ *out++ = BOOST_XPR_CHAR_(char_type, 'l');
+ }
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'L'):
+ if(!set_transform(out, detail::Lower, detail::Rest))
+ {
+ *out++ = BOOST_XPR_CHAR_(char_type, 'L');
+ }
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'u'):
+ if(!set_transform(out, detail::Upper, detail::Next))
+ {
+ *out++ = BOOST_XPR_CHAR_(char_type, 'u');
+ }
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'U'):
+ if(!set_transform(out, detail::Upper, detail::Rest))
+ {
+ *out++ = BOOST_XPR_CHAR_(char_type, 'U');
+ }
+ break;
+
+ case BOOST_XPR_CHAR_(char_type, 'E'):
+ if(!set_transform(out, detail::None, detail::Rest))
+ {
+ *out++ = BOOST_XPR_CHAR_(char_type, 'E');
+ }
+ break;
+
+ default:
+ // BUGBUG what about backreferences like \12 ?
+ if(0 < this->traits_->value(ch, 10))
+ {
+ int sub = this->traits_->value(ch, 10);
+ if(this->sub_matches_[ sub ].matched)
+ out = std::copy(this->sub_matches_[ sub ].first, this->sub_matches_[ sub ].second, out);
+ }
+ else
+ {
+ *out++ = ch;
+ }
+ break;
+ }
+
+ return out;
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename ForwardIterator, typename OutputIterator>
+ OutputIterator format_named_backref_
+ (
+ ForwardIterator &cur
+ , ForwardIterator end
+ , OutputIterator out
+ ) const
+ {
+ using namespace regex_constants;
+ detail::ensure(cur != end && BOOST_XPR_CHAR_(char_type, '<') == *cur++
+ , error_badmark, "invalid named back-reference");
+ ForwardIterator begin = cur;
+ for(; cur != end && BOOST_XPR_CHAR_(char_type, '>') != *cur; ++cur)
+ {}
+ detail::ensure(cur != begin && cur != end && BOOST_XPR_CHAR_(char_type, '>') == *cur
+ , error_badmark, "invalid named back-reference");
+
+ string_type name(begin, cur++);
+ for(std::size_t i = 0; i < this->named_marks_.size(); ++i)
+ {
+ if(this->named_marks_[i].name_ == name)
+ {
+ std::size_t sub = this->named_marks_[i].mark_nbr_;
+ return std::copy(this->sub_matches_[ sub ].first, this->sub_matches_[ sub ].second, out);
+ }
+ }
+
+ boost::throw_exception(regex_error(error_badmark, "invalid named back-reference"));
+ // Should never get here
+ return out;
+ }
+
+ regex_id_type regex_id_;
+ detail::sub_match_vector<BidiIter> sub_matches_;
+ BidiIter base_;
+ sub_match<BidiIter> prefix_;
+ sub_match<BidiIter> suffix_;
+ nested_results_type nested_results_;
+ intrusive_ptr<extras_type> extras_ptr_;
+ intrusive_ptr<detail::traits<char_type> const> traits_;
+ detail::action_args_type args_;
+ std::vector<detail::named_mark<char_type> > named_marks_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_id_filter_predicate
+//
+template<typename BidiIter>
+struct regex_id_filter_predicate
+ : std::unary_function<match_results<BidiIter>, bool>
+{
+ regex_id_filter_predicate(regex_id_type regex_id)
+ : regex_id_(regex_id)
+ {
+ }
+
+ bool operator ()(match_results<BidiIter> const &res) const
+ {
+ return this->regex_id_ == res.regex_id();
+ }
+
+private:
+
+ regex_id_type regex_id_;
+};
+
+}} // namespace boost::xpressive
+
+#ifdef BOOST_HAS_CONCEPTS
+// Better living through concepts. :-P
+namespace std
+{
+ template<typename Iter_, typename Char_>
+ concept_map OutputIterator<
+ boost::xpressive::detail::case_converting_iterator<Iter_, Char_>
+ , Char_
+ >
+ {};
+
+ template<typename Char_>
+ concept_map OutputIterator<
+ boost::xpressive::detail::noop_output_iterator<Char_>
+ , Char_
+ >
+ {};
+}
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/args.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/args.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,83 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file args.hpp
+ /// Contains definition of args\<\> class template.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_ARGS_HPP_EAN_04_01_2005
+ #define BOOST_PROTO_ARGS_HPP_EAN_04_01_2005
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/arithmetic/dec.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
+ #include <boost/preprocessor/repetition/repeat_from_to.hpp>
+ #include <boost/mpl/void.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost { namespace proto
+ {
+ namespace argsns_
+ {
+ #define BOOST_PROTO_DEFINE_ARG_N(z, n, data)\
+ typedef BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(arg, n);
+
+ #define BOOST_PROTO_DEFINE_VOID_N(z, n, data)\
+ typedef mpl::void_ BOOST_PP_CAT(arg, n);
+
+ /// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
+ ///
+ /// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
+ /// The types in the sequence correspond to the children of a node in an expression tree.
+ template< typename Arg0 >
+ struct args0
+ {
+ BOOST_STATIC_CONSTANT(long, size = 0);
+ typedef Arg0 arg0;
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
+
+ /// INTERNAL ONLY
+ ///
+ typedef Arg0 back_;
+ };
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/args.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #undef BOOST_PROTO_DEFINE_ARG_N
+ #undef BOOST_PROTO_DEFINE_VOID_N
+ }
+
+ using namespace argsns_;
+ }}
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ /// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
+ ///
+ /// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
+ /// The types in the sequence correspond to the children of a node in an expression tree.
+ template< BOOST_PP_ENUM_PARAMS(N, typename Arg) >
+ struct BOOST_PP_CAT(args, N)
+ {
+ BOOST_STATIC_CONSTANT(long, size = N);
+ BOOST_PP_REPEAT(N, BOOST_PROTO_DEFINE_ARG_N, ~)
+ BOOST_PP_REPEAT_FROM_TO(N, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
+
+ /// INTERNAL ONLY
+ ///
+ typedef BOOST_PP_CAT(Arg, BOOST_PP_DEC(N)) back_;
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,18 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file context.hpp
+/// Includes all the context classes in the context/ sub-directory.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_CONTEXT_HPP_EAN_06_23_2007
+#define BOOST_PROTO_CONTEXT_HPP_EAN_06_23_2007
+
+#include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+#include <boost/xpressive/proto/context/null.hpp>
+#include <boost/xpressive/proto/context/default.hpp>
+#include <boost/xpressive/proto/context/callable.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/callable.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/callable.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,287 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file callable.hpp
+ /// Definintion of callable_context\<\>, an evaluation context for
+ /// proto::eval() that explodes each node and calls the derived context
+ /// type with the expressions constituents. If the derived context doesn't
+ /// have an overload that handles this node, fall back to some other
+ /// context.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_CONTEXT_CALLABLE_HPP_EAN_06_23_2007
+ #define BOOST_PROTO_CONTEXT_CALLABLE_HPP_EAN_06_23_2007
+
+ #include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+ #include <boost/config.hpp>
+ #include <boost/detail/workaround.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/facilities/intercept.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/preprocessor/arithmetic/inc.hpp>
+ #include <boost/preprocessor/selection/max.hpp>
+ #include <boost/mpl/if.hpp>
+ #include <boost/mpl/bool.hpp>
+ #include <boost/utility/result_of.hpp>
+ #include <boost/type_traits/remove_cv.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/traits.hpp> // for arg_c
+ #include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+
+ namespace boost { namespace proto
+ {
+ namespace detail
+ {
+ struct private_type_
+ {
+ private_type_ const &operator,(int) const;
+ };
+
+ template<typename T>
+ yes_type check_is_expr_handled(T const &);
+
+ no_type check_is_expr_handled(private_type_ const &);
+
+ template<typename Context, long Arity>
+ struct callable_context_wrapper;
+
+ template<typename Expr, typename Context, long Arity = Expr::proto_arity::value>
+ struct is_expr_handled;
+ }
+
+ namespace context
+ {
+ /// \brief A BinaryFunction that accepts a Proto expression and a
+ /// callable context and calls the context with the expression tag
+ /// and children as arguments, effectively fanning the expression
+ /// out.
+ ///
+ /// <tt>callable_eval\<\></tt> requires that \c Context is a
+ /// PolymorphicFunctionObject that can be invoked with \c Expr's
+ /// tag and children as expressions, as follows:
+ ///
+ /// \code
+ /// context(Expr::proto_tag(), arg_c<0>(expr), arg_c<1>(expr), ...)
+ /// \endcode
+ template<
+ typename Expr
+ , typename Context
+ , long Arity BOOST_PROTO_FOR_DOXYGEN_ONLY(= Expr::proto_arity::value)
+ >
+ struct callable_eval
+ {};
+
+ /// \brief An evaluation context adaptor that makes authoring a
+ /// context a simple matter of writing function overloads, rather
+ /// then writing template specializations.
+ ///
+ /// <tt>callable_context\<\></tt> is a base class that implements
+ /// the context protocol by passing fanned-out expression nodes to
+ /// the derived context, making it easy to customize the handling
+ /// of expression types by writing function overloads. Only those
+ /// expression types needing special handling require explicit
+ /// handling. All others are dispatched to a user-specified
+ /// default context, \c DefaultCtx.
+ ///
+ /// <tt>callable_context\<\></tt> is defined simply as:
+ ///
+ /// \code
+ /// template<typename Context, typename DefaultCtx = default_context>
+ /// struct callable_context
+ /// {
+ /// template<typename Expr, typename ThisContext = Context>
+ /// struct eval
+ /// : mpl::if_<
+ /// is_expr_handled_<Expr, Context> // For exposition
+ /// , callable_eval<Expr, ThisContext>
+ /// , typename DefaultCtx::template eval<Expr, Context>
+ /// >::type
+ /// {};
+ /// };
+ /// \endcode
+ ///
+ /// The Boolean metafunction <tt>is_expr_handled_\<\></tt> uses
+ /// metaprogramming tricks to determine whether \c Context has
+ /// an overloaded function call operator that accepts the
+ /// fanned-out constituents of an expression of type \c Expr.
+ /// If so, the handling of the expression is dispatched to
+ /// <tt>callable_eval\<\></tt>. If not, it is dispatched to
+ /// the user-specified \c DefaultCtx.
+ ///
+ /// Below is an example of how to use <tt>callable_context\<\></tt>:
+ ///
+ /// \code
+ /// // An evaluation context that increments all
+ /// // integer terminals in-place.
+ /// struct increment_ints
+ /// : callable_context<
+ /// increment_ints const // derived context
+ /// , null_context const // fall-back context
+ /// >
+ /// {
+ /// typedef void result_type;
+ ///
+ /// // Handle int terminals here:
+ /// void operator()(proto::tag::terminal, int &i) const
+ /// {
+ /// ++i;
+ /// }
+ /// };
+ /// \endcode
+ ///
+ /// With \c increment_ints, we can do the following:
+ ///
+ /// \code
+ /// literal<int> i = 0, j = 10;
+ /// proto::eval( i - j * 3.14, increment_ints() );
+ ///
+ /// assert( i.get() == 1 && j.get() == 11 );
+ /// \endcode
+ template<
+ typename Context
+ , typename DefaultCtx BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_context)
+ >
+ struct callable_context
+ {
+ /// A BinaryFunction that accepts an \c Expr and a
+ /// \c Context, and either fans out the expression and passes
+ /// it to the context, or else hands off the expression to
+ /// \c DefaultCtx.
+ ///
+ /// If \c Context is a PolymorphicFunctionObject such that
+ /// it can be invoked with the tag and children of \c Expr,
+ /// as <tt>ctx(Expr::proto_tag(), arg_c\<0\>(expr), arg_c\<1\>(expr)...)</tt>,
+ /// then <tt>eval\<Expr, ThisContext\></tt> inherits from
+ /// <tt>callable_eval\<Expr, ThisContext\></tt>. Otherwise,
+ /// <tt>eval\<Expr, ThisContext\></tt> inherits from
+ /// <tt>DefaultCtx::eval\<Expr, Context\></tt>.
+ template<typename Expr, typename ThisContext = Context>
+ struct eval
+ : mpl::if_<
+ detail::is_expr_handled<Expr, Context>
+ , callable_eval<Expr, ThisContext>
+ , typename DefaultCtx::template eval<Expr, Context>
+ >::type
+ {};
+ };
+ }
+
+ #define BOOST_PROTO_ARG_N_TYPE(Z, N, Expr) \
+ typedef typename proto::result_of::arg_c<Expr, N>::const_reference BOOST_PP_CAT(arg, N); \
+ /**/
+
+ #define BOOST_PROTO_ARG_N(Z, N, expr) \
+ proto::arg_c<N>(expr) \
+ /**/
+
+ #define BOOST_PP_ITERATION_PARAMS_1 \
+ (3, (0, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/context/callable.hpp>)) \
+ /**/
+
+ #include BOOST_PP_ITERATE()
+
+ #undef BOOST_PROTO_ARG_N_TYPE
+ #undef BOOST_PROTO_ARG_N
+
+ }}
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+ #define ARG_COUNT BOOST_PP_MAX(1, N)
+
+ namespace detail
+ {
+ #if N > 0
+ template<typename Context>
+ struct callable_context_wrapper<Context, N>
+ : remove_cv<Context>::type
+ {
+ callable_context_wrapper();
+ typedef
+ private_type_ const &fun_type(
+ BOOST_PP_ENUM_PARAMS(
+ BOOST_PP_INC(ARG_COUNT)
+ , detail::dont_care BOOST_PP_INTERCEPT
+ )
+ );
+ operator fun_type *() const;
+ };
+ #endif
+
+ template<typename Expr, typename Context>
+ struct is_expr_handled<Expr, Context, N>
+ {
+ static callable_context_wrapper<Context, ARG_COUNT> &sctx_;
+ static Expr &sexpr_;
+ static typename Expr::proto_tag &stag_;
+
+ BOOST_STATIC_CONSTANT(bool, value =
+ (
+ sizeof(yes_type) ==
+ sizeof(
+ detail::check_is_expr_handled(
+ (sctx_(
+ stag_
+ BOOST_PP_ENUM_TRAILING(ARG_COUNT, BOOST_PROTO_ARG_N, sexpr_)
+ ), 0)
+ )
+ )));
+
+ typedef mpl::bool_<value> type;
+ };
+ }
+
+ namespace context
+ {
+ /// \brief A BinaryFunction that accepts a Proto expression and a
+ /// callable context and calls the context with the expression tag
+ /// and children as arguments, effectively fanning the expression
+ /// out.
+ ///
+ /// <tt>callable_eval\<\></tt> requires that \c Context is a
+ /// PolymorphicFunctionObject that can be invoked with \c Expr's
+ /// tag and children as expressions, as follows:
+ ///
+ /// \code
+ /// context(Expr::proto_tag(), arg_c\<0\>(expr), arg_c\<1\>(expr), ...)
+ /// \endcode
+ template<typename Expr, typename Context>
+ struct callable_eval<Expr, Context, N>
+ {
+ BOOST_PP_REPEAT(ARG_COUNT, BOOST_PROTO_ARG_N_TYPE, Expr)
+
+ typedef
+ typename boost::result_of<
+ Context(
+ typename Expr::proto_tag
+ BOOST_PP_ENUM_TRAILING_PARAMS(ARG_COUNT, arg)
+ )
+ >::type
+ result_type;
+
+ /// \param expr The current expression
+ /// \param context The callable evaluation context
+ /// \return <tt>context(Expr::proto_tag(), arg_c\<0\>(expr), arg_c\<1\>(expr), ...)</tt>
+ result_type operator ()(Expr &expr, Context &context) const
+ {
+ return context(
+ typename Expr::proto_tag()
+ BOOST_PP_ENUM_TRAILING(ARG_COUNT, BOOST_PROTO_ARG_N, expr)
+ );
+ }
+ };
+ }
+
+ #undef N
+ #undef ARG_COUNT
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/default.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/default.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,394 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file default.hpp
+ /// Definintion of default_context, a default evaluation context for
+ /// proto::eval() that uses Boost.Typeof to deduce return types
+ /// of the built-in operators.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_CONTEXT_DEFAULT_HPP_EAN_01_08_2007
+ #define BOOST_PROTO_CONTEXT_DEFAULT_HPP_EAN_01_08_2007
+
+ #include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+ #include <boost/config.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/enum_shifted.hpp>
+ #include <boost/preprocessor/selection/max.hpp>
+ #include <boost/mpl/if.hpp>
+ #include <boost/typeof/typeof.hpp>
+ #include <boost/utility/result_of.hpp>
+ #include <boost/type_traits/is_const.hpp>
+ #include <boost/type_traits/is_function.hpp>
+ #include <boost/type_traits/remove_reference.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/tags.hpp>
+ #include <boost/xpressive/proto/eval.hpp>
+ #include <boost/xpressive/proto/traits.hpp> // for proto::arg_c()
+ #include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+
+ namespace boost { namespace proto
+ {
+ // If we're generating doxygen documentation, hide all the nasty
+ // Boost.Typeof gunk.
+ #ifndef BOOST_PROTO_DOXYGEN_INVOKED
+ #define BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL_(Nested, Expr)\
+ BOOST_TYPEOF_NESTED_TYPEDEF_TPL(BOOST_PP_CAT(nested_and_hidden_, Nested), Expr)\
+ static int const sz = sizeof(proto::detail::check_reference(Expr));\
+ struct Nested\
+ : mpl::if_c<\
+ 1==sz\
+ , typename BOOST_PP_CAT(nested_and_hidden_, Nested)::type &\
+ , typename BOOST_PP_CAT(nested_and_hidden_, Nested)::type\
+ >\
+ {};
+
+ #define BOOST_PROTO_DECLTYPE_(Expr, Type)\
+ BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL_(BOOST_PP_CAT(nested_, Type), (Expr))\
+ typedef typename BOOST_PP_CAT(nested_, Type)::type Type;
+ #else
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL_(Nested, Expr)
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_DECLTYPE_(Expr, Type)\
+ typedef detail::unspecified Type;
+ #endif
+
+ /// INTERNAL ONLY
+ ///
+ #define UNREF(x) typename boost::remove_reference<x>::type
+
+ namespace detail
+ {
+ template<typename T> T make();
+
+ template<typename T>
+ char check_reference(T &);
+
+ template<typename T>
+ char (&check_reference(T const &))[2];
+
+ template<typename A0, typename A1>
+ struct comma_result
+ {
+ BOOST_PROTO_DECLTYPE_((proto::detail::make<A0>(), proto::detail::make<A1>()), type)
+ };
+
+ template<typename A0>
+ struct comma_result<A0, void>
+ {
+ typedef void type;
+ };
+
+ template<typename A1>
+ struct comma_result<void, A1>
+ {
+ typedef A1 type;
+ };
+
+ template<>
+ struct comma_result<void, void>
+ {
+ typedef void type;
+ };
+
+ template<typename T, typename U = T>
+ struct result_of_fixup
+ : mpl::if_<is_function<T>, T *, U>
+ {};
+
+ template<typename T, typename U>
+ struct result_of_fixup<T &, U>
+ : result_of_fixup<T, T>
+ {};
+
+ template<typename T, typename U>
+ struct result_of_fixup<T *, U>
+ : result_of_fixup<T, U>
+ {};
+
+ template<typename T, typename U>
+ struct result_of_fixup<T const, U>
+ : result_of_fixup<T, U>
+ {};
+
+ //// Tests for result_of_fixup
+ //struct bar {};
+ //BOOST_MPL_ASSERT((is_same<bar, result_of_fixup<bar>::type>));
+ //BOOST_MPL_ASSERT((is_same<bar const, result_of_fixup<bar const>::type>));
+ //BOOST_MPL_ASSERT((is_same<bar, result_of_fixup<bar &>::type>));
+ //BOOST_MPL_ASSERT((is_same<bar const, result_of_fixup<bar const &>::type>));
+ //BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(*)()>::type>));
+ //BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(* const)()>::type>));
+ //BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(* const &)()>::type>));
+ //BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(&)()>::type>));
+
+ } // namespace detail
+
+ namespace context
+ {
+ template<
+ typename Expr
+ , typename Context
+ , typename Tag BOOST_PROTO_FOR_DOXYGEN_ONLY(= typename Expr::proto_tag)
+ , long Arity BOOST_PROTO_FOR_DOXYGEN_ONLY(= Expr::proto_arity::value)
+ >
+ struct default_eval
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_UNARY_OP_RESULT(Op, Tag) \
+ template<typename Expr, typename Context> \
+ struct default_eval<Expr, Context, Tag, 1> \
+ { \
+ private: \
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0; \
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0; \
+ public: \
+ BOOST_PROTO_DECLTYPE_(Op proto::detail::make<r0>(), result_type) \
+ result_type operator ()(Expr &expr, Context &ctx) const \
+ { \
+ return Op proto::eval(proto::arg_c<0>(expr), ctx); \
+ } \
+ }; \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_BINARY_OP_RESULT(Op, Tag) \
+ template<typename Expr, typename Context> \
+ struct default_eval<Expr, Context, Tag, 2> \
+ { \
+ private: \
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0; \
+ typedef typename proto::result_of::arg_c<Expr, 1>::type e1; \
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0; \
+ typedef typename proto::result_of::eval<UNREF(e1), Context>::type r1; \
+ public: \
+ BOOST_PROTO_DECLTYPE_(proto::detail::make<r0>() Op proto::detail::make<r1>(), result_type)\
+ result_type operator ()(Expr &expr, Context &ctx) const \
+ { \
+ return proto::eval(proto::arg_c<0>(expr), ctx) Op proto::eval(proto::arg_c<1>(expr), ctx);\
+ } \
+ }; \
+ /**/
+
+ BOOST_PROTO_UNARY_OP_RESULT(+, proto::tag::posit)
+ BOOST_PROTO_UNARY_OP_RESULT(-, proto::tag::negate)
+ BOOST_PROTO_UNARY_OP_RESULT(*, proto::tag::dereference)
+ BOOST_PROTO_UNARY_OP_RESULT(~, proto::tag::complement)
+ BOOST_PROTO_UNARY_OP_RESULT(&, proto::tag::address_of)
+ BOOST_PROTO_UNARY_OP_RESULT(!, proto::tag::logical_not)
+ BOOST_PROTO_UNARY_OP_RESULT(++, proto::tag::pre_inc)
+ BOOST_PROTO_UNARY_OP_RESULT(--, proto::tag::pre_dec)
+
+ BOOST_PROTO_BINARY_OP_RESULT(<<, proto::tag::shift_left)
+ BOOST_PROTO_BINARY_OP_RESULT(>>, proto::tag::shift_right)
+ BOOST_PROTO_BINARY_OP_RESULT(*, proto::tag::multiplies)
+ BOOST_PROTO_BINARY_OP_RESULT(/, proto::tag::divides)
+ BOOST_PROTO_BINARY_OP_RESULT(%, proto::tag::modulus)
+ BOOST_PROTO_BINARY_OP_RESULT(+, proto::tag::plus)
+ BOOST_PROTO_BINARY_OP_RESULT(-, proto::tag::minus)
+ BOOST_PROTO_BINARY_OP_RESULT(<, proto::tag::less)
+ BOOST_PROTO_BINARY_OP_RESULT(>, proto::tag::greater)
+ BOOST_PROTO_BINARY_OP_RESULT(<=, proto::tag::less_equal)
+ BOOST_PROTO_BINARY_OP_RESULT(>=, proto::tag::greater_equal)
+ BOOST_PROTO_BINARY_OP_RESULT(==, proto::tag::equal_to)
+ BOOST_PROTO_BINARY_OP_RESULT(!=, proto::tag::not_equal_to)
+ BOOST_PROTO_BINARY_OP_RESULT(||, proto::tag::logical_or)
+ BOOST_PROTO_BINARY_OP_RESULT(&&, proto::tag::logical_and)
+ BOOST_PROTO_BINARY_OP_RESULT(&, proto::tag::bitwise_and)
+ BOOST_PROTO_BINARY_OP_RESULT(|, proto::tag::bitwise_or)
+ BOOST_PROTO_BINARY_OP_RESULT(^, proto::tag::bitwise_xor)
+ BOOST_PROTO_BINARY_OP_RESULT(->*, proto::tag::mem_ptr)
+
+ BOOST_PROTO_BINARY_OP_RESULT(=, proto::tag::assign)
+ BOOST_PROTO_BINARY_OP_RESULT(<<=, proto::tag::shift_left_assign)
+ BOOST_PROTO_BINARY_OP_RESULT(>>=, proto::tag::shift_right_assign)
+ BOOST_PROTO_BINARY_OP_RESULT(*=, proto::tag::multiplies_assign)
+ BOOST_PROTO_BINARY_OP_RESULT(/=, proto::tag::divides_assign)
+ BOOST_PROTO_BINARY_OP_RESULT(%=, proto::tag::modulus_assign)
+ BOOST_PROTO_BINARY_OP_RESULT(+=, proto::tag::plus_assign)
+ BOOST_PROTO_BINARY_OP_RESULT(-=, proto::tag::minus_assign)
+ BOOST_PROTO_BINARY_OP_RESULT(&=, proto::tag::bitwise_and_assign)
+ BOOST_PROTO_BINARY_OP_RESULT(|=, proto::tag::bitwise_or_assign)
+ BOOST_PROTO_BINARY_OP_RESULT(^=, proto::tag::bitwise_xor_assign)
+
+ #undef BOOST_PROTO_UNARY_OP_RESULT
+ #undef BOOST_PROTO_BINARY_OP_RESULT
+
+ template<typename Expr, typename Context>
+ struct default_eval<Expr, Context, proto::tag::terminal, 0>
+ {
+ typedef
+ typename mpl::if_<
+ is_const<Expr>
+ , typename proto::result_of::arg<Expr>::const_reference
+ , typename proto::result_of::arg<Expr>::reference
+ >::type
+ result_type;
+
+ result_type operator ()(Expr &expr, Context &) const
+ {
+ return proto::arg(expr);
+ }
+ };
+
+ // Handle post-increment specially.
+ template<typename Expr, typename Context>
+ struct default_eval<Expr, Context, proto::tag::post_inc, 1>
+ {
+ private:
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
+ public:
+ BOOST_PROTO_DECLTYPE_(proto::detail::make<r0>() ++, result_type)
+ result_type operator ()(Expr &expr, Context &ctx) const
+ {
+ return proto::eval(proto::arg_c<0>(expr), ctx) ++;
+ }
+ };
+
+ // Handle post-decrement specially.
+ template<typename Expr, typename Context>
+ struct default_eval<Expr, Context, proto::tag::post_dec, 1>
+ {
+ private:
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
+ public:
+ BOOST_PROTO_DECLTYPE_(proto::detail::make<r0>() --, result_type)
+ result_type operator ()(Expr &expr, Context &ctx) const
+ {
+ return proto::eval(proto::arg_c<0>(expr), ctx) --;
+ }
+ };
+
+ // Handle subscript specially.
+ template<typename Expr, typename Context>
+ struct default_eval<Expr, Context, proto::tag::subscript, 2>
+ {
+ private:
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::arg_c<Expr, 1>::type e1;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
+ typedef typename proto::result_of::eval<UNREF(e1), Context>::type r1;
+ public:
+ BOOST_PROTO_DECLTYPE_(proto::detail::make<r0>()[proto::detail::make<r1>()], result_type)
+ result_type operator ()(Expr &expr, Context &ctx) const
+ {
+ return proto::eval(proto::arg_c<0>(expr), ctx)[proto::eval(proto::arg_c<1>(expr), ctx)];
+ }
+ };
+
+ // Handle if_else_ specially.
+ template<typename Expr, typename Context>
+ struct default_eval<Expr, Context, proto::tag::if_else_, 3>
+ {
+ private:
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::arg_c<Expr, 1>::type e1;
+ typedef typename proto::result_of::arg_c<Expr, 2>::type e2;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
+ typedef typename proto::result_of::eval<UNREF(e1), Context>::type r1;
+ typedef typename proto::result_of::eval<UNREF(e2), Context>::type r2;
+ public:
+ BOOST_PROTO_DECLTYPE_(
+ proto::detail::make<r0>()
+ ? proto::detail::make<r1>()
+ : proto::detail::make<r2>()
+ , result_type
+ )
+ result_type operator ()(Expr &expr, Context &ctx) const
+ {
+ return proto::eval(proto::arg_c<0>(expr), ctx)
+ ? proto::eval(proto::arg_c<1>(expr), ctx)
+ : proto::eval(proto::arg_c<2>(expr), ctx);
+ }
+ };
+
+ // Handle comma specially.
+ template<typename Expr, typename Context>
+ struct default_eval<Expr, Context, proto::tag::comma, 2>
+ {
+ private:
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::arg_c<Expr, 1>::type e1;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
+ typedef typename proto::result_of::eval<UNREF(e1), Context>::type r1;
+ public:
+ typedef typename proto::detail::comma_result<r0, r1>::type result_type;
+ result_type operator ()(Expr &expr, Context &ctx) const
+ {
+ return proto::eval(proto::arg_c<0>(expr), ctx), proto::eval(proto::arg_c<1>(expr), ctx);
+ }
+ };
+
+ // Handle function specially
+ #define EVAL_TYPE(Z, N, DATA) \
+ typename proto::result_of::eval< \
+ typename remove_reference<typename proto::result_of::arg_c<DATA, N>::type>::type\
+ , Context \
+ >::type
+
+ #define EVAL(Z, N, DATA) \
+ proto::eval(proto::arg_c<N>(DATA), context)
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/context/default.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #undef EVAL_TYPE
+ #undef EVAL
+
+ /// default_context
+ ///
+ struct default_context
+ {
+ /// default_context::eval
+ ///
+ template<typename Expr, typename ThisContext = default_context const>
+ struct eval
+ : default_eval<Expr, ThisContext>
+ {};
+ };
+
+ } // namespace context
+
+ }} // namespace boost::proto
+
+ #undef UNREF
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ template<typename Expr, typename Context>
+ struct default_eval<Expr, Context, proto::tag::function, N>
+ {
+ typedef
+ typename proto::detail::result_of_fixup<EVAL_TYPE(~, 0, Expr)>::type
+ function_type;
+
+ typedef
+ typename boost::result_of<
+ function_type(BOOST_PP_ENUM_SHIFTED(BOOST_PP_MAX(N, 1), EVAL_TYPE, Expr))
+ >::type
+ result_type;
+
+ result_type operator ()(Expr &expr, Context &context) const
+ {
+ return EVAL(~, 0, expr)(BOOST_PP_ENUM_SHIFTED(BOOST_PP_MAX(N, 1), EVAL, expr));
+ }
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/null.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/context/null.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,87 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file null.hpp
+ /// Definintion of null_context\<\>, an evaluation context for
+ /// proto::eval() that simply evaluates each child expression, doesn't
+ /// combine the results at all, and returns void.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
+ #define BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
+
+ #include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/eval.hpp>
+ #include <boost/xpressive/proto/traits.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+
+ namespace boost { namespace proto { namespace context
+ {
+
+ template<
+ typename Expr
+ , typename Context
+ , long Arity BOOST_PROTO_FOR_DOXYGEN_ONLY(= Expr::proto_arity::value)
+ >
+ struct null_eval
+ {};
+
+ template<typename Expr, typename Context>
+ struct null_eval<Expr, Context, 0>
+ {
+ typedef void result_type;
+ void operator()(Expr &, Context &) const
+ {}
+ };
+
+ #define BOOST_PROTO_EVAL_N(Z, N, DATA) \
+ proto::eval(proto::arg_c<N>(expr), ctx); \
+ /**/
+
+ #define BOOST_PP_ITERATION_PARAMS_1 \
+ (3, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/context/null.hpp>)) \
+ /**/
+
+ #include BOOST_PP_ITERATE()
+
+ #undef BOOST_PROTO_EVAL_N
+
+ /// null_context
+ ///
+ struct null_context
+ {
+ /// null_context::eval
+ ///
+ template<typename Expr, typename ThisContext = null_context const>
+ struct eval
+ : null_eval<Expr, ThisContext>
+ {};
+ };
+
+ }}}
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ template<typename Expr, typename Context>
+ struct null_eval<Expr, Context, N>
+ {
+ typedef void result_type;
+
+ void operator ()(Expr &expr, Context &ctx) const
+ {
+ BOOST_PP_REPEAT(N, BOOST_PROTO_EVAL_N, ~)
+ }
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/debug.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/debug.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,214 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file debug.hpp
+/// Utilities for debugging Proto expression trees
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_DEBUG_HPP_EAN_12_31_2006
+#define BOOST_PROTO_DEBUG_HPP_EAN_12_31_2006
+
+#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+
+#if !defined(__WAVE__) || !defined(BOOST_PROTO_DOXYGEN_INVOKED)
+#include <iomanip>
+#include <iostream>
+#include <typeinfo>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/expr.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+#else
+/// INTERNAL ONLY
+/// Needed to work around doxygen bug
+struct a_dummy_global;
+#endif
+
+namespace boost { namespace proto
+{
+ namespace tag
+ {
+ namespace hidden_detail_
+ {
+ typedef char (&not_ostream)[sizeof(std::ostream)+1];
+ not_ostream operator<<(std::ostream &, detail::dont_care);
+
+ template<typename Tag, std::size_t S>
+ struct printable_tag_
+ {
+ typedef char const *type;
+ static type call() { return typeid(Tag).name(); }
+ };
+
+ template<typename Tag>
+ struct printable_tag_<Tag, sizeof(std::ostream)>
+ {
+ typedef Tag type;
+ static type call() { return Tag(); }
+ };
+
+ template<typename Tag>
+ struct printable_tag
+ : printable_tag_<Tag, sizeof(std::cout << Tag())>
+ {};
+ }
+
+ /// INTERNAL ONLY
+ template<typename Tag>
+ inline typename hidden_detail_::printable_tag<Tag>::type proto_tag_name(Tag)
+ {
+ return hidden_detail_::printable_tag<Tag>::call();
+ }
+
+ #define BOOST_PROTO_DEFINE_TAG_NAME(Tag) \
+ /** \brief INTERNAL ONLY */ \
+ inline char const *proto_tag_name(tag::Tag) \
+ { \
+ return #Tag; \
+ } \
+ /**/
+
+ BOOST_PROTO_DEFINE_TAG_NAME(posit)
+ BOOST_PROTO_DEFINE_TAG_NAME(negate)
+ BOOST_PROTO_DEFINE_TAG_NAME(dereference)
+ BOOST_PROTO_DEFINE_TAG_NAME(complement)
+ BOOST_PROTO_DEFINE_TAG_NAME(address_of)
+ BOOST_PROTO_DEFINE_TAG_NAME(logical_not)
+ BOOST_PROTO_DEFINE_TAG_NAME(pre_inc)
+ BOOST_PROTO_DEFINE_TAG_NAME(pre_dec)
+ BOOST_PROTO_DEFINE_TAG_NAME(post_inc)
+ BOOST_PROTO_DEFINE_TAG_NAME(post_dec)
+ BOOST_PROTO_DEFINE_TAG_NAME(shift_left)
+ BOOST_PROTO_DEFINE_TAG_NAME(shift_right)
+ BOOST_PROTO_DEFINE_TAG_NAME(multiplies)
+ BOOST_PROTO_DEFINE_TAG_NAME(divides)
+ BOOST_PROTO_DEFINE_TAG_NAME(modulus)
+ BOOST_PROTO_DEFINE_TAG_NAME(plus)
+ BOOST_PROTO_DEFINE_TAG_NAME(minus)
+ BOOST_PROTO_DEFINE_TAG_NAME(less)
+ BOOST_PROTO_DEFINE_TAG_NAME(greater)
+ BOOST_PROTO_DEFINE_TAG_NAME(less_equal)
+ BOOST_PROTO_DEFINE_TAG_NAME(greater_equal)
+ BOOST_PROTO_DEFINE_TAG_NAME(equal_to)
+ BOOST_PROTO_DEFINE_TAG_NAME(not_equal_to)
+ BOOST_PROTO_DEFINE_TAG_NAME(logical_or)
+ BOOST_PROTO_DEFINE_TAG_NAME(logical_and)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_and)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_or)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_xor)
+ BOOST_PROTO_DEFINE_TAG_NAME(comma)
+ BOOST_PROTO_DEFINE_TAG_NAME(mem_ptr)
+ BOOST_PROTO_DEFINE_TAG_NAME(assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(shift_left_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(shift_right_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(multiplies_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(divides_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(modulus_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(plus_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(minus_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_and_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_or_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(bitwise_xor_assign)
+ BOOST_PROTO_DEFINE_TAG_NAME(subscript)
+ BOOST_PROTO_DEFINE_TAG_NAME(if_else_)
+ BOOST_PROTO_DEFINE_TAG_NAME(function)
+
+ #undef BOOST_PROTO_DEFINE_TAG_NAME
+ }
+
+ namespace functional
+ {
+ /// \brief Pretty-print a Proto expression tree.
+ ///
+ /// A PolymorphicFunctionObject which accepts a Proto expression
+ /// tree and pretty-prints it to an \c ostream for debugging
+ /// purposes.
+ struct display_expr
+ {
+ typedef void result_type;
+
+ /// \param depth The starting indentation depth for this node.
+ /// Children nodes will be displayed at a starting
+ /// depth of <tt>depth+4</tt>.
+ /// \param sout The \c ostream to which the expression tree
+ /// will be written.
+ display_expr(int depth = 0, std::ostream &sout = std::cout)
+ : depth_(depth)
+ , first_(true)
+ , sout_(sout)
+ {}
+
+ /// \brief Pretty-print the current node in a Proto expression
+ /// tree.
+ template<typename Args>
+ void operator()(proto::expr<tag::terminal, Args, 0> const &expr) const
+ {
+ this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ")
+ << "terminal(" << proto::arg(expr) << ")\n";
+ this->first_ = false;
+ }
+
+ #define BOOST_PROTO_ARG(z, n, data) \
+ display(proto::arg_c<n>(expr)); \
+ /**/
+
+ #define BOOST_PP_LOCAL_MACRO(N) \
+ /** \overload */ \
+ template<typename Tag, typename Args> \
+ void operator()(proto::expr<Tag, Args, N> const &expr) const \
+ { \
+ using namespace tag; \
+ this->sout_ << std::setw(this->depth_) << (this->first_? "" : ", ") \
+ << proto_tag_name(Tag()) << "(\n"; \
+ display_expr display(this->depth_ + 4, this->sout_); \
+ BOOST_PP_REPEAT(N, BOOST_PROTO_ARG, _) \
+ this->sout_ << std::setw(this->depth_) << "" << ")\n"; \
+ this->first_ = false; \
+ } \
+ /**/
+
+ #define BOOST_PP_LOCAL_LIMITS (1, BOOST_PROTO_MAX_ARITY)
+ #include BOOST_PP_LOCAL_ITERATE()
+ #undef BOOST_PROTO_ARG
+
+ /// \overload
+ ///
+ template<typename T>
+ void operator()(T const &t) const
+ {
+ (*this)(t.proto_base());
+ }
+
+ private:
+ display_expr &operator =(display_expr const &);
+ int depth_;
+ mutable bool first_;
+ std::ostream &sout_;
+ };
+ }
+
+ /// \brief Pretty-print a Proto expression tree.
+ ///
+ /// \note Equivalent to <tt>functional::display_expr(0, sout)(expr)</tt>
+ /// \param expr The Proto expression tree to pretty-print
+ /// \param sout The \c ostream to which the output should be
+ /// written. If not specified, defaults to
+ /// <tt>std::cout</tt>.
+ template<typename Expr>
+ void display_expr(Expr const &expr, std::ostream &sout)
+ {
+ functional::display_expr(0, sout)(expr);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr>
+ void display_expr(Expr const &expr)
+ {
+ functional::display_expr()(expr);
+ }
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/deep_copy.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/deep_copy.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,175 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file deep_copy.hpp
+ /// Replace all nodes stored by reference by nodes stored by value.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_DEEP_COPY_HPP_EAN_11_21_2006
+ #define BOOST_PROTO_DEEP_COPY_HPP_EAN_11_21_2006
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/mpl/if.hpp>
+ #include <boost/type_traits/is_function.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/expr.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost { namespace proto
+ {
+ namespace detail
+ {
+ template<typename Expr, long Arity = Expr::proto_arity::value>
+ struct deep_copy_impl;
+
+ template<typename Expr>
+ struct deep_copy_impl<Expr, 0>
+ {
+ typedef BOOST_PROTO_UNCVREF(typename Expr::proto_arg0) raw_terminal_type;
+ // can't store a function type in a terminal.
+ typedef
+ typename mpl::if_<
+ is_function<raw_terminal_type>
+ , typename Expr::proto_arg0
+ , raw_terminal_type
+ >::type
+ actual_terminal_type;
+ typedef typename terminal<actual_terminal_type>::type expr_type;
+ typedef typename Expr::proto_domain::template apply<expr_type>::type type;
+
+ template<typename Expr2>
+ static type call(Expr2 const &expr)
+ {
+ return Expr::proto_domain::make(expr_type::make(proto::arg(expr)));
+ }
+ };
+ }
+
+ namespace result_of
+ {
+ /// \brief A metafunction for calculating the return type
+ /// of \c proto::deep_copy().
+ ///
+ /// A metafunction for calculating the return type
+ /// of \c proto::deep_copy(). The type parameter \c Expr
+ /// should be the type of a Proto expression tree.
+ /// It should not be a reference type, nor should it
+ /// be cv-qualified.
+ template<typename Expr>
+ struct deep_copy
+ {
+ typedef typename detail::deep_copy_impl<Expr>::type type;
+ };
+ }
+
+ namespace functional
+ {
+ /// \brief A PolymorphicFunctionObject type for deep-copying
+ /// Proto expression trees.
+ ///
+ /// A PolymorphicFunctionObject type for deep-copying
+ /// Proto expression trees. When a tree is deep-copied,
+ /// all internal nodes and most terminals held by reference
+ /// are instead held by value.
+ ///
+ /// \attention Terminals of reference-to-function type are
+ /// left unchanged. Terminals of reference-to-array type are
+ /// stored by value, which can cause a large amount of data
+ /// to be passed by value and stored on the stack.
+ struct deep_copy
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef
+ typename result_of::deep_copy<BOOST_PROTO_UNCVREF(Expr)>::type
+ type;
+ };
+
+ /// \brief Deep-copies a Proto expression tree, turning all
+ /// nodes and terminals held by reference into ones held by
+ /// value.
+ template<typename Expr>
+ typename result_of::deep_copy<Expr>::type
+ operator()(Expr const &expr) const
+ {
+ return proto::detail::deep_copy_impl<Expr>::call(expr);
+ }
+ };
+ }
+
+ /// \brief A PolymorphicFunctionObject for deep-copying
+ /// Proto expression trees.
+ ///
+ /// A PolymorphicFunctionObject for deep-copying
+ /// Proto expression trees. When a tree is deep-copied,
+ /// all internal nodes and most terminals held by reference
+ /// are instead held by value.
+ ///
+ /// \attention Terminals of reference-to-array type and of
+ /// reference-to-function type are left unchanged.
+ ///
+ /// \sa proto::functional::deep_copy.
+ functional::deep_copy const deep_copy = {};
+
+ namespace detail
+ {
+ #define BOOST_PROTO_DEFINE_DEEP_COPY_TYPE(z, n, data)\
+ typename deep_copy_impl<typename Expr::BOOST_PP_CAT(proto_arg, n)>::type
+
+ #define BOOST_PROTO_DEFINE_DEEP_COPY_FUN(z, n, data)\
+ proto::deep_copy(expr.proto_base().BOOST_PP_CAT(arg, n))
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/deep_copy.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #undef BOOST_PROTO_DEFINE_DEEP_COPY_FUN
+ #undef BOOST_PROTO_DEFINE_DEEP_COPY_TYPE
+ }
+
+ }}
+
+ #endif // BOOST_PROTO_COMPILER_DEEP_COPY_HPP_EAN_11_21_2006
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ template<typename Expr>
+ struct deep_copy_impl<Expr, N>
+ {
+ typedef
+ proto::expr<
+ typename Expr::proto_tag
+ , BOOST_PP_CAT(args, N)<
+ BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_TYPE, ~)
+ >
+ >
+ expr_type;
+
+ typedef typename Expr::proto_domain::template apply<expr_type>::type type;
+
+ template<typename Expr2>
+ static type call(Expr2 const &expr)
+ {
+ expr_type that = {
+ BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_FUN, ~)
+ };
+
+ return Expr::proto_domain::make(that);
+ }
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/as_lvalue.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/as_lvalue.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,36 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file as_lvalue.hpp
+/// Contains definition the as_lvalue() and uncv() functions.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_TRANSFORM_AS_LVALUE_HPP_EAN_12_27_2007
+#define BOOST_PROTO_TRANSFORM_AS_LVALUE_HPP_EAN_12_27_2007
+
+namespace boost { namespace proto
+{
+ namespace detail
+ {
+ template<typename T>
+ T &as_lvalue(T &t)
+ {
+ return t;
+ }
+
+ template<typename T>
+ T const &as_lvalue(T const &t)
+ {
+ return t;
+ }
+
+ template<typename T>
+ T &uncv(T const &t)
+ {
+ return const_cast<T &>(t);
+ }
+ }
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/dont_care.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/dont_care.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file dont_care.hpp
+/// Definintion of dont_care, a dummy parameter
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_DETAIL_DONT_CARE_HPP_EAN_11_07_2007
+#define BOOST_PROTO_DETAIL_DONT_CARE_HPP_EAN_11_07_2007
+
+namespace boost { namespace proto
+{
+ namespace detail
+ {
+ struct dont_care
+ {
+ dont_care(...);
+ };
+ }
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/funop.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/funop.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,69 @@
+///////////////////////////////////////////////////////////////////////////////
+// funop.hpp
+// Contains definition of funop[n]\<\> class template.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PP_IS_ITERATING
+#error Do not include this file directly
+#endif
+
+ /// \brief A helper metafunction for computing the
+ /// return type of \c proto::expr\<\>::operator().
+ template<typename Expr BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename A)>
+ struct BOOST_PP_CAT(funop, BOOST_PP_ITERATION())
+ {
+ typedef proto::expr<
+ tag::function
+ , BOOST_PP_CAT(args, BOOST_PP_INC(BOOST_PP_ITERATION()))<
+ ref_<Expr>
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
+ BOOST_PP_ITERATION()
+ , typename result_of::as_arg<A
+ , >::type BOOST_PP_INTERCEPT
+ )
+ >
+ > type;
+
+ static type const call(
+ Expr &expr
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PP_ITERATION(), A, &a)
+ )
+ {
+ type that = {
+ {expr}
+ BOOST_PP_ENUM_TRAILING(BOOST_PP_ITERATION(), BOOST_PROTO_AS_OP, _)
+ };
+ return that;
+ }
+ };
+
+ /// \brief A helper metafunction for computing the
+ /// return type of \c proto::expr\<\>::operator().
+ template<typename Expr BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename A), typename This>
+ struct funop<Expr(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), This>
+ : BOOST_PP_CAT(funop, BOOST_PP_ITERATION())<
+ This
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
+ BOOST_PP_ITERATION()
+ , typename remove_reference<A
+ , >::type BOOST_PP_INTERCEPT
+ )
+ >
+ {};
+
+ /// \brief A helper metafunction for computing the
+ /// return type of \c proto::expr\<\>::operator().
+ template<typename Expr BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename A), typename This>
+ struct funop<Expr const(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), This>
+ : BOOST_PP_CAT(funop, BOOST_PP_ITERATION())<
+ This const
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
+ BOOST_PP_ITERATION()
+ , typename remove_reference<A
+ , >::type BOOST_PP_INTERCEPT
+ )
+ >
+ {};

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/ignore_unused.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/ignore_unused.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file ignore_unused.hpp
+/// Definintion of ignore_unused, a dummy function for suppressing compiler
+/// warnings
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_DETAIL_IGNORE_UNUSED_HPP_EAN_03_03_2008
+#define BOOST_PROTO_DETAIL_IGNORE_UNUSED_HPP_EAN_03_03_2008
+
+namespace boost { namespace proto
+{
+ namespace detail
+ {
+ template<typename T>
+ inline void ignore_unused(T const &)
+ {}
+ }
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/pop_front.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/pop_front.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,43 @@
+/*=============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2008 Eric Niebler
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#ifndef BOOST_PROTO_DETAIL_FUSION_POP_FRONT_EAH_01_22_2008
+#define BOOST_PROTO_DETAIL_FUSION_POP_FRONT_EAH_01_22_2008
+
+#include <boost/spirit/fusion/sequence/range.hpp>
+#include <boost/spirit/fusion/sequence/begin.hpp>
+#include <boost/spirit/fusion/sequence/end.hpp>
+#include <boost/spirit/fusion/iterator/next.hpp>
+
+namespace boost { namespace fusion
+{
+ namespace meta
+ {
+ template <typename Sequence>
+ struct pop_front
+ {
+ typedef
+ range<
+ typename next<
+ typename begin<Sequence>::type
+ >::type
+ , typename end<Sequence>::type
+ >
+ type;
+ };
+ }
+
+ template <typename Sequence>
+ inline typename meta::pop_front<Sequence const>::type
+ pop_front(Sequence const& seq)
+ {
+ typedef typename meta::pop_front<Sequence const>::type result;
+ return result(fusion::next(fusion::begin(seq)), fusion::end(seq));
+ }
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/prefix.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/prefix.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,10 @@
+#if defined(__WAVE__) && defined(BOOST_PROTO_DOXYGEN_INVOKED)
+#pragma wave option(output:push)
+#pragma wave option(output:null)
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+///////////////////////////////////////////////////////////////////////////////

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/reverse.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/reverse.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,189 @@
+/*=============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2008 Eric Niebler
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#ifndef BOOST_PROTO_DETAIL_FUSION_REVERSE_EAH_01_22_2008
+#define BOOST_PROTO_DETAIL_FUSION_REVERSE_EAH_01_22_2008
+
+#include <boost/spirit/fusion/detail/access.hpp>
+#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp>
+#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp>
+#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp>
+#include <boost/spirit/fusion/iterator/next.hpp>
+#include <boost/spirit/fusion/iterator/prior.hpp>
+#include <boost/spirit/fusion/iterator/deref.hpp>
+#include <boost/spirit/fusion/iterator/value_of.hpp>
+#include <boost/spirit/fusion/sequence/begin.hpp>
+#include <boost/spirit/fusion/sequence/end.hpp>
+
+namespace boost { namespace fusion
+{
+ struct reverse_view_tag;
+ struct reverse_view_iterator_tag;
+
+ template <typename First>
+ struct reverse_view_iterator
+ : iterator_base<reverse_view_iterator<First> >
+ {
+ typedef as_fusion_iterator<First> converter;
+ typedef typename converter::type first_type;
+ typedef reverse_view_iterator_tag tag;
+
+ reverse_view_iterator(First const& first)
+ : first(converter::convert(first)) {}
+
+ first_type first;
+ };
+
+ template <typename Sequence>
+ struct reverse_view : sequence_base<reverse_view<Sequence> >
+ {
+ typedef as_fusion_sequence<Sequence> seq_converter;
+ typedef typename seq_converter::type seq;
+
+ typedef reverse_view_tag tag;
+ typedef typename meta::begin<seq>::type first_type;
+ typedef typename meta::end<seq>::type last_type;
+
+ reverse_view(Sequence& seq)
+ : first(fusion::begin(seq))
+ , last(fusion::end(seq))
+ {}
+
+ first_type first;
+ last_type last;
+ };
+
+ namespace meta
+ {
+ template <>
+ struct deref_impl<reverse_view_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename
+ meta::deref<
+ typename meta::prior<
+ typename Iterator::first_type
+ >::type
+ >::type
+ type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return *fusion::prior(i.first);
+ }
+ };
+ };
+
+ template <>
+ struct prior_impl<reverse_view_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::first_type first_type;
+ typedef typename next_impl<typename first_type::tag>::
+ template apply<first_type>
+ wrapped;
+
+ typedef reverse_view_iterator<typename wrapped::type> type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(wrapped::call(i.first));
+ }
+ };
+ };
+
+ template <>
+ struct next_impl<reverse_view_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::first_type first_type;
+ typedef typename prior_impl<typename first_type::tag>::
+ template apply<first_type>
+ wrapped;
+
+ typedef reverse_view_iterator<typename wrapped::type> type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(wrapped::call(i.first));
+ }
+ };
+ };
+
+ template <>
+ struct value_impl<reverse_view_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename
+ meta::value_of<
+ typename meta::prior<
+ typename Iterator::first_type
+ >::type
+ >::type
+ type;
+ };
+ };
+
+ template <>
+ struct begin_impl<reverse_view_tag>
+ {
+ template <typename Sequence>
+ struct apply
+ {
+ typedef reverse_view_iterator<typename Sequence::last_type> type;
+
+ static type
+ call(Sequence const& s)
+ {
+ return type(s.last);
+ }
+ };
+ };
+
+ template <>
+ struct end_impl<reverse_view_tag>
+ {
+ template <typename Sequence>
+ struct apply
+ {
+ typedef reverse_view_iterator<typename Sequence::first_type> type;
+
+ static type
+ call(Sequence const& s)
+ {
+ return type(s.first);
+ }
+ };
+ };
+
+ template <typename Sequence>
+ struct reverse
+ {
+ typedef reverse_view<Sequence> type;
+ };
+ }
+
+ template <typename Sequence>
+ inline reverse_view<Sequence const>
+ reverse(Sequence const& view)
+ {
+ return reverse_view<Sequence const>(view);
+ }
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/suffix.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/detail/suffix.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+///////////////////////////////////////////////////////////////////////////////
+
+#if defined(__WAVE__) && defined(BOOST_PROTO_DOXYGEN_INVOKED)
+#pragma wave option(output:pop)
+#endif
+
+#ifndef BOOST_PROTO_SUFFIX_DUMMY_STRUCT_DEFINED
+#define BOOST_PROTO_SUFFIX_DUMMY_STRUCT_DEFINED
+/// INTERNAL ONLY
+///
+struct a_dummy_struct;
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/domain.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/domain.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,173 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file domain.hpp
+/// Contains definition of domain\<\> class template and helpers for
+/// defining domains with a generator and a grammar for controlling
+/// operator overloading.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_DOMAIN_HPP_EAN_02_13_2007
+#define BOOST_PROTO_DOMAIN_HPP_EAN_02_13_2007
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/ref.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/generate.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+namespace boost { namespace proto
+{
+
+ namespace detail
+ {
+ struct not_a_generator
+ {};
+
+ struct not_a_grammar
+ {};
+ }
+
+ namespace domainns_
+ {
+ /// \brief For use in defining domain tags to be used
+ /// with \c proto::extends\<\>. A \e Domain associates
+ /// an expression type with a \e Generator, and optionally
+ /// a \e Grammar.
+ ///
+ /// The Generator determines how new expressions in the
+ /// domain are constructed. Typically, a generator wraps
+ /// all new expressions in a wrapper that imparts
+ /// domain-specific behaviors to expressions within its
+ /// domain. (See \c proto::extends\<\>.)
+ ///
+ /// The Grammar determines whether a given expression is
+ /// valid within the domain, and automatically disables
+ /// any operator overloads which would cause an invalid
+ /// expression to be created. By default, the Grammar
+ /// parameter defaults to the wildcard, \c proto::_, which
+ /// makes all expressions valid within the domain.
+ ///
+ /// Example:
+ /// \code
+ /// template<typename Expr>
+ /// struct MyExpr;
+ ///
+ /// struct MyGrammar
+ /// : or_< terminal<_>, plus<MyGrammar, MyGrammar> >
+ /// {};
+ ///
+ /// // Define MyDomain, in which all expressions are
+ /// // wrapped in MyExpr<> and only expressions that
+ /// // conform to MyGrammar are allowed.
+ /// struct MyDomain
+ /// : domain<generator<MyExpr>, MyGrammar>
+ /// {};
+ ///
+ /// // Use MyDomain to define MyExpr
+ /// template<typename Expr>
+ /// struct MyExpr
+ /// : extends<Expr, MyExpr<Expr>, MyDomain>
+ /// {
+ /// // ...
+ /// };
+ /// \endcode
+ ///
+ template<
+ typename Generator BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_generator)
+ , typename Grammar BOOST_PROTO_FOR_DOXYGEN_ONLY(= proto::_)
+ >
+ struct domain
+ : Generator
+ {
+ typedef Grammar proto_grammar;
+ typedef void proto_is_domain_;
+ };
+
+ /// \brief The domain expressions have by default, if
+ /// \c proto::extends\<\> has not been used to associate
+ /// a domain with an expression.
+ ///
+ struct default_domain
+ : domain<>
+ {};
+
+ /// \brief A pseudo-domain for use in functions and
+ /// metafunctions that require a domain parameter. It
+ /// indicates that the domain of the parent node should
+ /// be inferred from the domains of the children nodes.
+ ///
+ /// \attention \c deduce_domain is not itself a valid domain.
+ ///
+ struct deduce_domain
+ : domain<detail::not_a_generator, detail::not_a_grammar>
+ {};
+ }
+
+ namespace result_of
+ {
+ /// A metafunction that returns \c mpl::true_
+ /// if the type \c T is the type of a Proto domain;
+ /// \c mpl::false_ otherwise. If \c T inherits from
+ /// \c proto::domain\<\>, \c is_domain\<T\> is
+ /// \c mpl::true_.
+ template<typename T, typename Void BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)>
+ struct is_domain
+ : mpl::false_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct is_domain<T, typename T::proto_is_domain_>
+ : mpl::true_
+ {};
+
+ /// A metafunction that returns the domain of
+ /// a given type. If \c T is a Proto expression
+ /// type, it returns that expression's associated
+ /// domain. If not, it returns
+ /// \c proto::default_domain.
+ template<typename T, typename Void BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)>
+ struct domain_of
+ {
+ typedef default_domain type;
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct domain_of<T, typename T::proto_is_expr_>
+ {
+ typedef typename T::proto_domain type;
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct domain_of<T &, void>
+ {
+ typedef typename domain_of<T>::type type;
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct domain_of<boost::reference_wrapper<T>, void>
+ {
+ typedef typename domain_of<T>::type type;
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct domain_of<boost::reference_wrapper<T> const, void>
+ {
+ typedef typename domain_of<T>::type type;
+ };
+ }
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/eval.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/eval.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,91 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file eval.hpp
+/// Contains the eval() expression evaluator.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_EVAL_HPP_EAN_03_29_2007
+#define BOOST_PROTO_EVAL_HPP_EAN_03_29_2007
+
+#include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+#include <boost/xpressive/proto/proto_fwd.hpp> // BOOST_PROTO_CALLABLE
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+
+namespace boost { namespace proto
+{
+
+ namespace result_of
+ {
+ /// \brief A metafunction for calculating the return type
+ /// of \c proto::eval() given a certain \c Expr and \c Context
+ /// types.
+ ///
+ /// \note The types \c Expr and \c Context should not be
+ /// reference types. They may be cv-qualified, but the
+ /// cv-qualification on the \c Context parameter is ignored.
+ template<typename Expr, typename Context>
+ struct eval
+ {
+ typedef typename Context::template eval<Expr>::result_type type;
+ };
+ }
+
+ namespace functional
+ {
+ /// \brief A PolymorphicFunctionObject type for
+ /// evaluating a given Proto expression with a given
+ /// context.
+ struct eval
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename Context>
+ struct result<This(Expr, Context)>
+ {
+ typedef
+ typename proto::result_of::eval<
+ typename remove_reference<Expr>::type
+ , typename remove_reference<Context>::type
+ >::type
+ type;
+ };
+
+ /// \brief Evaluate a given Proto expression with a given
+ /// context.
+ /// \param expr The Proto expression to evaluate
+ /// \param context The context in which the expression should be
+ /// evaluated.
+ /// \return <tt>typename Context::template eval<Expr>()(expr, context)</tt>
+ template<typename Expr, typename Context>
+ typename proto::result_of::eval<Expr, Context>::type
+ operator ()(Expr &expr, Context &context) const
+ {
+ return typename Context::template eval<Expr>()(expr, context);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr, typename Context>
+ typename proto::result_of::eval<Expr, Context>::type
+ operator ()(Expr &expr, Context const &context) const
+ {
+ return typename Context::template eval<Expr>()(expr, context);
+ }
+ };
+ }
+
+ /// \brief A PolymorphicFunctionObject for
+ /// evaluating a given Proto expression with
+ /// a given context.
+ ///
+ /// \sa proto::functional::eval.
+ functional::eval const eval = {};
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/expr.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/expr.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,407 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file expr.hpp
+ /// Contains definition of expr\<\> class template.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_EXPR_HPP_EAN_04_01_2005
+ #define BOOST_PROTO_EXPR_HPP_EAN_04_01_2005
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/arithmetic/dec.hpp>
+ #include <boost/preprocessor/selection/max.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
+ #include <boost/preprocessor/repetition/repeat_from_to.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/enum_binary_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
+ #include <boost/utility/addressof.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/ref.hpp>
+ #include <boost/xpressive/proto/args.hpp>
+ #include <boost/xpressive/proto/traits.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ #if defined(_MSC_VER) && (_MSC_VER >= 1020)
+ # pragma warning(push)
+ # pragma warning(disable : 4510) // default constructor could not be generated
+ # pragma warning(disable : 4512) // assignment operator could not be generated
+ # pragma warning(disable : 4610) // user defined constructor required
+ #endif
+
+ namespace boost { namespace proto
+ {
+
+ namespace detail
+ {
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_ARG(z, n, data) \
+ typedef typename Args::BOOST_PP_CAT(arg, n) BOOST_PP_CAT(proto_arg, n); \
+ BOOST_PP_CAT(proto_arg, n) BOOST_PP_CAT(arg, n); \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VOID(z, n, data) \
+ typedef void BOOST_PP_CAT(proto_arg, n); \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_AS_OP(z, n, data) \
+ proto::as_arg(BOOST_PP_CAT(a,n)) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_UNREF_ARG_TYPE(z, n, data) \
+ typename result_of::unref<typename Args::BOOST_PP_CAT(arg, n)>::const_reference \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_UNREF_ARG(z, n, data) \
+ proto::unref(this->BOOST_PP_CAT(arg, n)) \
+ /**/
+
+ template<typename Tag, typename Arg>
+ struct address_of_hack
+ {
+ typedef address_of_hack type;
+ };
+
+ template<typename Expr>
+ struct address_of_hack<proto::tag::address_of, ref_<Expr> >
+ {
+ typedef Expr *type;
+ };
+
+ template<typename X, std::size_t N, typename Y>
+ void checked_copy(X (&x)[N], Y (&y)[N])
+ {
+ for(std::size_t i = 0; i < N; ++i)
+ {
+ y[i] = x[i];
+ }
+ }
+
+ template<typename T, std::size_t N>
+ struct if_is_array
+ {};
+
+ template<typename T, std::size_t N>
+ struct if_is_array<T[N], N>
+ {
+ typedef int type;
+ };
+ }
+
+ namespace result_of
+ {
+ /// \brief A helper metafunction for computing the
+ /// return type of \c proto::expr\<\>::operator().
+ template<typename Sig, typename This>
+ struct funop;
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY), <boost/xpressive/proto/detail/funop.hpp>))
+ #include BOOST_PP_ITERATE()
+ }
+
+ namespace exprns_
+ {
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/expr.hpp>))
+ #include BOOST_PP_ITERATE()
+ }
+
+ #undef BOOST_PROTO_ARG
+ #undef BOOST_PROTO_VOID
+ #undef BOOST_PROTO_AS_OP
+ #undef BOOST_PROTO_UNREF_ARG_TYPE
+ #undef BOOST_PROTO_UNREF_ARG
+ }}
+
+ #if defined(_MSC_VER) && (_MSC_VER >= 1020)
+ # pragma warning(pop)
+ #endif
+
+ #endif // BOOST_PROTO_EXPR_HPP_EAN_04_01_2005
+
+#elif BOOST_PP_ITERATION_DEPTH() == 1
+
+ #define ARG_COUNT BOOST_PP_MAX(1, BOOST_PP_ITERATION())
+ #define IS_TERMINAL 0 == BOOST_PP_ITERATION()
+
+ /// \brief Representation of a node in an expression tree.
+ ///
+ /// \c proto::expr\<\> is a node in an expression template tree. It
+ /// is a container for its children sub-trees. It also serves as
+ /// the terminal nodes of the tree.
+ ///
+ /// \c Tag is type that represents the operation encoded by
+ /// this expression. It is typically one of the structs
+ /// in the \c boost::proto::tag namespace, but it doesn't
+ /// have to be. If the \c Tag type is \c boost::proto::tag::terminal
+ /// then this \c expr\<\> type represents a leaf in the
+ /// expression tree.
+ ///
+ /// \c Args is a type list representing the type of the children
+ /// of this expression. It is an instantiation of one
+ /// of \c proto::args1\<\>, \c proto::args2\<\>, etc. The
+ /// children types must all themselves be either \c expr\<\>
+ /// or \c proto::ref_\<proto::expr\<\>\>, unless the \c Tag
+ /// type is \c boost::proto::tag::terminal, in which case
+ /// \c Args must be \c proto::args0\<T\>, where \c T can be any
+ /// type.
+ ///
+ /// \c proto::expr\<\> is a valid Fusion random-access sequence, where
+ /// the elements of the sequence are the children expressions.
+ template<typename Tag, typename Args>
+ struct expr<Tag, Args, BOOST_PP_ITERATION() >
+ {
+ typedef Tag proto_tag;
+ typedef mpl::long_<BOOST_PP_ITERATION() > proto_arity;
+ typedef expr proto_base_expr;
+ typedef Args proto_args;
+ typedef default_domain proto_domain;
+ BOOST_PROTO_DEFINE_FUSION_TAG(proto::tag::proto_expr)
+ typedef void proto_is_expr_;
+ typedef expr proto_derived_expr;
+
+ BOOST_PP_REPEAT(ARG_COUNT, BOOST_PROTO_ARG, ~)
+ BOOST_PP_REPEAT_FROM_TO(ARG_COUNT, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_VOID, ~)
+
+ /// \return *this
+ ///
+ expr const &proto_base() const
+ {
+ return *this;
+ }
+
+ /// \overload
+ ///
+ expr &proto_base()
+ {
+ return *this;
+ }
+
+ /// \return A new \c expr\<\> object initialized with the specified
+ /// arguments.
+ ///
+ template<BOOST_PP_ENUM_PARAMS(ARG_COUNT, typename A)>
+ static expr make(BOOST_PP_ENUM_BINARY_PARAMS(ARG_COUNT, A, const &a))
+ {
+ expr that = {BOOST_PP_ENUM_PARAMS(ARG_COUNT, a)};
+ return that;
+ }
+
+ #if IS_TERMINAL
+ /// \overload
+ ///
+ template<typename A0>
+ static expr make(A0 &a0)
+ {
+ expr that = {a0};
+ return that;
+ }
+
+ /// \overload
+ ///
+ template<typename A0, std::size_t N>
+ static expr make(A0 (&a0)[N], typename detail::if_is_array<proto_arg0, N>::type = 0)
+ {
+ expr that;
+ detail::checked_copy(a0, that.arg0);
+ return that;
+ }
+
+ /// \overload
+ ///
+ template<typename A0, std::size_t N>
+ static expr make(A0 const (&a0)[N], typename detail::if_is_array<proto_arg0, N>::type = 0)
+ {
+ expr that;
+ detail::checked_copy(a0, that.arg0);
+ return that;
+ }
+ #endif
+
+ #if 1 == BOOST_PP_ITERATION()
+ /// If \c Tag is \c boost::proto::tag::address_of and \c proto_arg0 is
+ /// \c proto::ref_\<T\>, then \c address_of_hack_type_ is <tt>T*</tt>.
+ /// Otherwise, it is some undefined type.
+ typedef typename detail::address_of_hack<Tag, proto_arg0>::type address_of_hack_type_;
+
+ /// \return The address of <tt>this->arg0</tt> if \c Tag is
+ /// \c boost::proto::tag::address_of. Otherwise, this function will
+ /// fail to compile.
+ ///
+ /// \attention Proto overloads <tt>operator&</tt>, which means that
+ /// proto-ified objects cannot have their addresses taken, unless we use
+ /// the following hack to make \c &x implicitly convertible to \c X*.
+ operator address_of_hack_type_() const
+ {
+ return boost::addressof(this->arg0.expr);
+ }
+ #endif
+
+ /// Assignment
+ ///
+ /// \param a The rhs.
+ /// \return A new \c expr\<\> node representing an assignment of \c a to \c *this.
+ template<typename A>
+ proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
+ operator =(A &a) const
+ {
+ proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+
+ /// \overload
+ ///
+ template<typename A>
+ proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
+ operator =(A const &a) const
+ {
+ proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+
+ #if IS_TERMINAL
+ /// \overload
+ ///
+ template<typename A>
+ proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
+ operator =(A &a)
+ {
+ proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+
+ /// \overload
+ ///
+ template<typename A>
+ proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
+ operator =(A const &a)
+ {
+ proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+ #endif
+
+ /// Subscript
+ ///
+ /// \param a The rhs.
+ /// \return A new \c expr\<\> node representing \c *this subscripted with \c a.
+ template<typename A>
+ proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
+ operator [](A &a) const
+ {
+ proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+
+ /// \overload
+ ///
+ template<typename A>
+ proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
+ operator [](A const &a) const
+ {
+ proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+
+ #if IS_TERMINAL
+ /// \overload
+ ///
+ template<typename A>
+ proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
+ operator [](A &a)
+ {
+ proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+
+ /// \overload
+ ///
+ template<typename A>
+ proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
+ operator [](A const &a)
+ {
+ proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ return that;
+ }
+ #endif
+
+ /// Encodes the return type of \c expr\<\>::operator(), for use with \c boost::result_of\<\>
+ ///
+ template<typename Sig>
+ struct result
+ {
+ typedef typename result_of::funop<Sig, expr>::type type;
+ };
+
+ /// Function call
+ ///
+ /// \return A new \c expr\<\> node representing the function invocation of \c (*this)().
+ proto::expr<proto::tag::function, args1<ref_<expr const> > > const
+ operator ()() const
+ {
+ proto::expr<proto::tag::function, args1<ref_<expr const> > > that = {{*this}};
+ return that;
+ }
+
+ #if IS_TERMINAL
+ /// \overload
+ ///
+ proto::expr<proto::tag::function, args1<ref_<expr> > > const
+ operator ()()
+ {
+ proto::expr<proto::tag::function, args1<ref_<expr> > > that = {{*this}};
+ return that;
+ }
+ #endif
+
+ #define BOOST_PP_ITERATION_PARAMS_2 (3, (1, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY), <boost/xpressive/proto/expr.hpp>))
+ #include BOOST_PP_ITERATE()
+ };
+
+ #undef ARG_COUNT
+ #undef IS_TERMINAL
+
+#elif BOOST_PP_ITERATION_DEPTH() == 2
+
+ #define N BOOST_PP_ITERATION()
+
+ /// \overload
+ ///
+ template<BOOST_PP_ENUM_PARAMS(N, typename A)>
+ typename result_of::BOOST_PP_CAT(funop, N)<expr const BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>::type const
+ operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const &a)) const
+ {
+ return result_of::BOOST_PP_CAT(funop, N)<expr const BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>
+ ::call(*this BOOST_PP_ENUM_TRAILING_PARAMS(N, a));
+ }
+
+ #if IS_TERMINAL
+ /// \overload
+ ///
+ template<BOOST_PP_ENUM_PARAMS(N, typename A)>
+ typename result_of::BOOST_PP_CAT(funop, N)<expr BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>::type const
+ operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const &a))
+ {
+ return result_of::BOOST_PP_CAT(funop, N)<expr BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>
+ ::call(*this BOOST_PP_ENUM_TRAILING_PARAMS(N, a));
+ }
+ #endif
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/extends.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/extends.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,429 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file extends.hpp
+/// Macros and a base class for defining end-user expression types
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_EXTENDS_HPP_EAN_11_1_2006
+#define BOOST_PROTO_EXTENDS_HPP_EAN_11_1_2006
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/preprocessor/tuple/elem.hpp>
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto/expr.hpp>
+#include <boost/xpressive/proto/args.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto/generate.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+namespace boost { namespace proto
+{
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_CONST0
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_CONST1 const
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_TEMPLATE_YES_(Z, N) template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename A)>
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_TEMPLATE_NO_(Z, N)
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_DEFINE_FUN_OP_IMPL_(Z, N, Data, Const) \
+ BOOST_PP_IF(N, BOOST_PROTO_TEMPLATE_YES_, BOOST_PROTO_TEMPLATE_NO_)(Z, N) \
+ typename boost::mpl::apply_wrap1< \
+ BOOST_PP_TUPLE_ELEM(3, 2, Data) \
+ , typename boost::proto::result_of::BOOST_PP_CAT(funop, N)< \
+ BOOST_PP_TUPLE_ELEM(3, 1, Data) BOOST_PROTO_CONST ## Const \
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(Z, N, const A) \
+ >::type \
+ >::type const \
+ operator ()(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a)) BOOST_PROTO_CONST ## Const \
+ { \
+ typedef boost::proto::result_of::BOOST_PP_CAT(funop, N)< \
+ BOOST_PP_TUPLE_ELEM(3, 1, Data) BOOST_PROTO_CONST ## Const \
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(Z, N, const A) \
+ > funop; \
+ return BOOST_PP_TUPLE_ELEM(3, 2, Data)::make( \
+ funop::call( \
+ *static_cast<BOOST_PP_TUPLE_ELEM(3, 1, Data) BOOST_PROTO_CONST ## Const *>(this)\
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(Z, N, a) \
+ ) \
+ ); \
+ } \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_DEFINE_FUN_OP_CONST(Z, N, Data) \
+ BOOST_PROTO_DEFINE_FUN_OP_IMPL_(Z, N, Data, 1)
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_DEFINE_FUN_OP_NON_CONST(Z, N, Data) \
+ BOOST_PROTO_DEFINE_FUN_OP_IMPL_(Z, N, Data, 0)
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_DEFINE_FUN_OP(Z, N, Data) \
+ BOOST_PROTO_DEFINE_FUN_OP_CONST(Z, N, Data) \
+ BOOST_PROTO_DEFINE_FUN_OP_NON_CONST(Z, N, Data) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_EXTENDS_ARG(z, n, Expr) \
+ typedef \
+ typename Expr::BOOST_PP_CAT(proto_arg, n) \
+ BOOST_PP_CAT(proto_arg, n); \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS(Expr, Derived, Domain) \
+ Expr expr; \
+ \
+ typedef Expr proto_base_expr; \
+ typedef Domain proto_domain; \
+ typedef Derived proto_derived_expr; \
+ typedef typename Expr::proto_tag proto_tag; \
+ typedef typename Expr::proto_args proto_args; \
+ typedef typename Expr::proto_arity proto_arity; \
+ typedef void proto_is_expr_; \
+ BOOST_PROTO_DEFINE_FUSION_TAG(boost::proto::tag::proto_expr) \
+ BOOST_PP_REPEAT(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_EXTENDS_ARG, Expr) \
+ \
+ static Derived const make(Expr const &expr) \
+ { \
+ Derived that = {expr}; \
+ return that; \
+ } \
+ \
+ Expr &proto_base() \
+ { \
+ return this->expr; \
+ } \
+ \
+ Expr const &proto_base() const \
+ { \
+ return this->expr; \
+ } \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(Expr, Derived, Domain, Const) \
+ template<typename A> \
+ typename boost::mpl::apply_wrap1< \
+ Domain \
+ , boost::proto::expr< \
+ boost::proto::tag::assign \
+ , boost::proto::args2< \
+ boost::proto::ref_<Derived BOOST_PROTO_CONST ## Const> \
+ , typename boost::proto::result_of::as_arg<A>::type \
+ > \
+ > \
+ >::type const \
+ operator =(A &a) BOOST_PROTO_CONST ## Const \
+ { \
+ typedef boost::proto::expr< \
+ boost::proto::tag::assign \
+ , boost::proto::args2< \
+ boost::proto::ref_<Derived BOOST_PROTO_CONST ## Const> \
+ , typename boost::proto::result_of::as_arg<A>::type \
+ > \
+ > that_type; \
+ that_type that = { \
+ {*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this)} \
+ , boost::proto::as_arg(a) \
+ }; \
+ return Domain::make(that); \
+ } \
+ \
+ template<typename A> \
+ typename boost::mpl::apply_wrap1< \
+ Domain \
+ , boost::proto::expr< \
+ boost::proto::tag::assign \
+ , boost::proto::args2< \
+ boost::proto::ref_<Derived BOOST_PROTO_CONST ## Const> \
+ , typename boost::proto::result_of::as_arg<A const>::type \
+ > \
+ > \
+ >::type const \
+ operator =(A const &a) BOOST_PROTO_CONST ## Const \
+ { \
+ typedef boost::proto::expr< \
+ boost::proto::tag::assign \
+ , boost::proto::args2< \
+ boost::proto::ref_<Derived BOOST_PROTO_CONST ## Const> \
+ , typename boost::proto::result_of::as_arg<A const>::type \
+ > \
+ > that_type; \
+ that_type that = { \
+ {*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this)} \
+ , boost::proto::as_arg(a) \
+ }; \
+ return Domain::make(that); \
+ } \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_ASSIGN_CONST(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(Expr, Derived, Domain, 1)
+
+ #define BOOST_PROTO_EXTENDS_ASSIGN_NON_CONST(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(Expr, Derived, Domain, 0)
+
+ #define BOOST_PROTO_EXTENDS_ASSIGN(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_ASSIGN_CONST(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_ASSIGN_NON_CONST(Expr, Derived, Domain) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(Expr, Derived, Domain, Const) \
+ template<typename A> \
+ typename boost::mpl::apply_wrap1< \
+ Domain \
+ , boost::proto::expr< \
+ boost::proto::tag::subscript \
+ , boost::proto::args2< \
+ boost::proto::ref_<Derived BOOST_PROTO_CONST ## Const> \
+ , typename boost::proto::result_of::as_arg<A>::type \
+ > \
+ > \
+ >::type const \
+ operator [](A &a) BOOST_PROTO_CONST ## Const \
+ { \
+ typedef boost::proto::expr< \
+ boost::proto::tag::subscript \
+ , boost::proto::args2< \
+ boost::proto::ref_<Derived BOOST_PROTO_CONST ## Const> \
+ , typename boost::proto::result_of::as_arg<A>::type \
+ > \
+ > that_type; \
+ that_type that = { \
+ {*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this)} \
+ , boost::proto::as_arg(a) \
+ }; \
+ return Domain::make(that); \
+ } \
+ \
+ template<typename A> \
+ typename boost::mpl::apply_wrap1< \
+ Domain \
+ , boost::proto::expr< \
+ boost::proto::tag::subscript \
+ , boost::proto::args2< \
+ boost::proto::ref_<Derived BOOST_PROTO_CONST ## Const> \
+ , typename boost::proto::result_of::as_arg<A const>::type \
+ > \
+ > \
+ >::type const \
+ operator [](A const &a) BOOST_PROTO_CONST ## Const \
+ { \
+ typedef boost::proto::expr< \
+ boost::proto::tag::subscript \
+ , boost::proto::args2< \
+ boost::proto::ref_<Derived BOOST_PROTO_CONST ## Const> \
+ , typename boost::proto::result_of::as_arg<A const>::type \
+ > \
+ > that_type; \
+ that_type that = { \
+ {*static_cast<Derived BOOST_PROTO_CONST ## Const *>(this)} \
+ , boost::proto::as_arg(a) \
+ }; \
+ return Domain::make(that); \
+ } \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_SUBSCRIPT_CONST(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(Expr, Derived, Domain, 1)
+
+ #define BOOST_PROTO_EXTENDS_SUBSCRIPT_NON_CONST(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(Expr, Derived, Domain, 0)
+
+ #define BOOST_PROTO_EXTENDS_SUBSCRIPT(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_SUBSCRIPT_CONST(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_SUBSCRIPT_NON_CONST(Expr, Derived, Domain) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_EXTENDS_FUNCTION_(Expr, Derived, Domain) \
+ template<typename Sig> \
+ struct result \
+ { \
+ typedef \
+ typename boost::mpl::apply_wrap1< \
+ Domain \
+ , typename boost::proto::result_of::funop<Sig, Derived >::type \
+ >::type \
+ type; \
+ }; \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_FUNCTION_CONST(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_FUNCTION_(Expr, Derived, Domain) \
+ BOOST_PP_REPEAT_FROM_TO( \
+ 0 \
+ , BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY) \
+ , BOOST_PROTO_DEFINE_FUN_OP_CONST \
+ , (Expr, Derived, Domain) \
+ ) \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_FUNCTION_NON_CONST(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_FUNCTION_(Expr, Derived, Domain) \
+ BOOST_PP_REPEAT_FROM_TO( \
+ 0 \
+ , BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY) \
+ , BOOST_PROTO_DEFINE_FUN_OP_NON_CONST \
+ , (Expr, Derived, Domain) \
+ ) \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_FUNCTION(Expr, Derived, Domain) \
+ BOOST_PROTO_EXTENDS_FUNCTION_(Expr, Derived, Domain) \
+ BOOST_PP_REPEAT_FROM_TO( \
+ 0 \
+ , BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY) \
+ , BOOST_PROTO_DEFINE_FUN_OP \
+ , (Expr, Derived, Domain) \
+ ) \
+ /**/
+
+ namespace exprns_
+ {
+ /// \brief Empty type to be used as a dummy template parameter of
+ /// POD expression wrappers. It allows argument-dependent lookup
+ /// to find Proto's operator overloads.
+ ///
+ /// \c proto::is_proto_expr allows argument-dependent lookup
+ /// to find Proto's operator overloads. For example:
+ ///
+ /// \code
+ /// template<typename T, typename Dummy = proto::is_proto_expr>
+ /// struct my_terminal
+ /// {
+ /// BOOST_PROTO_EXTENDS(
+ /// typename proto::terminal<T>::type
+ /// , my_terminal<T>
+ /// , default_domain
+ /// )
+ /// };
+ ///
+ /// // ...
+ /// my_terminal<int> _1, _2;
+ /// _1 + _2; // OK, uses proto::operator+
+ /// \endcode
+ ///
+ /// Without the second \c Dummy template parameter, Proto's operator
+ /// overloads would not be considered by name lookup.
+ struct is_proto_expr
+ {};
+
+ /// \brief extends\<\> class template for adding behaviors to a Proto expression template
+ ///
+ template<
+ typename Expr
+ , typename Derived
+ , typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)
+ , typename Tag BOOST_PROTO_FOR_DOXYGEN_ONLY(= typename Expr::proto_tag)
+ >
+ struct extends
+ {
+ extends()
+ : expr()
+ {}
+
+ extends(extends const &that)
+ : expr(that.expr)
+ {}
+
+ extends(Expr const &expr_)
+ : expr(expr_)
+ {}
+
+ BOOST_PROTO_EXTENDS(Expr, Derived, Domain)
+ BOOST_PROTO_EXTENDS_ASSIGN_CONST(Expr, Derived, Domain)
+ BOOST_PROTO_EXTENDS_SUBSCRIPT_CONST(Expr, Derived, Domain)
+
+ // Instead of using BOOST_PROTO_EXTENDS_FUNCTION, which uses
+ // nested preprocessor loops, use file iteration here to generate
+ // the operator() overloads, which is more efficient.
+ BOOST_PROTO_EXTENDS_FUNCTION_(Expr, Derived, Domain)
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PP_LOCAL_MACRO(N) \
+ BOOST_PROTO_DEFINE_FUN_OP_CONST(1, N, (Expr, Derived, Domain)) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY))
+ #include BOOST_PP_LOCAL_ITERATE()
+ };
+
+ /// \brief extends\<\> class template for adding behaviors to a Proto expression template
+ ///
+ template<typename Expr, typename Derived, typename Domain>
+ struct extends<Expr, Derived, Domain, tag::terminal>
+ {
+ extends()
+ : expr()
+ {}
+
+ extends(extends const &that)
+ : expr(that.expr)
+ {}
+
+ extends(Expr const &expr_)
+ : expr(expr_)
+ {}
+
+ BOOST_PROTO_EXTENDS(Expr, Derived, Domain)
+ BOOST_PROTO_EXTENDS_ASSIGN(Expr, Derived, Domain)
+ BOOST_PROTO_EXTENDS_SUBSCRIPT(Expr, Derived, Domain)
+
+ // Instead of using BOOST_PROTO_EXTENDS_FUNCTION, which uses
+ // nested preprocessor loops, use file iteration here to generate
+ // the operator() overloads, which is more efficient.
+ BOOST_PROTO_EXTENDS_FUNCTION_(Expr, Derived, Domain)
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PP_LOCAL_MACRO(N) \
+ BOOST_PROTO_DEFINE_FUN_OP(1, N, (Expr, Derived, Domain)) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY))
+ #include BOOST_PP_LOCAL_ITERATE()
+ };
+
+ } // namespace exprns_
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/fusion.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/fusion.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,664 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file fusion.hpp
+/// Make any Proto expression a valid Fusion sequence
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_FUSION_HPP_EAN_11_04_2006
+#define BOOST_PROTO_FUSION_HPP_EAN_11_04_2006
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/config.hpp>
+#include <boost/version.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/long.hpp>
+#if BOOST_VERSION >= 103500
+#include <boost/fusion/include/is_view.hpp>
+#include <boost/fusion/include/tag_of_fwd.hpp>
+#include <boost/fusion/include/category_of.hpp>
+#include <boost/fusion/include/iterator_base.hpp>
+#include <boost/fusion/include/intrinsic.hpp>
+#include <boost/fusion/include/pop_front.hpp>
+#include <boost/fusion/include/reverse.hpp>
+#include <boost/fusion/include/single_view.hpp>
+#include <boost/fusion/include/transform_view.hpp>
+#include <boost/fusion/support/ext_/is_segmented.hpp>
+#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
+#include <boost/fusion/sequence/intrinsic/ext_/size_s.hpp>
+#include <boost/fusion/view/ext_/segmented_iterator.hpp>
+#else
+#include <boost/spirit/fusion/sequence/is_sequence.hpp>
+#include <boost/spirit/fusion/sequence/begin.hpp>
+#include <boost/spirit/fusion/sequence/end.hpp>
+#include <boost/spirit/fusion/sequence/at.hpp>
+#include <boost/spirit/fusion/sequence/value_at.hpp>
+#include <boost/spirit/fusion/sequence/single_view.hpp>
+#include <boost/spirit/fusion/sequence/transform_view.hpp>
+#include <boost/xpressive/proto/detail/reverse.hpp>
+#include <boost/xpressive/proto/detail/pop_front.hpp>
+#endif
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto/eval.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+#if BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable : 4510) // default constructor could not be generated
+#pragma warning(disable : 4512) // assignment operator could not be generated
+#pragma warning(disable : 4610) // can never be instantiated - user defined constructor required
+#endif
+
+namespace boost { namespace proto
+{
+
+/// INTERNAL ONLY
+///
+#define UNREF(x) typename boost::remove_reference<x>::type
+
+ namespace detail
+ {
+
+ template<typename Expr, long Pos>
+ struct expr_iterator
+ : fusion::iterator_base<expr_iterator<Expr, Pos> >
+ {
+ typedef Expr expr_type;
+ BOOST_STATIC_CONSTANT(long, index = Pos);
+ BOOST_PROTO_DEFINE_FUSION_CATEGORY(fusion::random_access_traversal_tag)
+ BOOST_PROTO_DEFINE_FUSION_TAG(tag::proto_expr_iterator)
+
+ expr_iterator(Expr const &e)
+ : expr(e)
+ {}
+
+ Expr const &expr;
+ };
+
+ template<typename Expr>
+ struct flat_view
+ {
+ typedef Expr expr_type;
+ typedef typename Expr::proto_tag proto_tag;
+ BOOST_PROTO_DEFINE_FUSION_CATEGORY(fusion::forward_traversal_tag)
+ BOOST_PROTO_DEFINE_FUSION_TAG(tag::proto_flat_view)
+
+ explicit flat_view(Expr &expr)
+ : expr_(expr)
+ {}
+
+ Expr &expr_;
+ };
+
+ template<typename Tag>
+ struct as_element
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ : mpl::if_<
+ is_same<Tag, UNREF(Expr)::proto_tag>
+ , flat_view<UNREF(Expr) const>
+ , fusion::single_view<UNREF(Expr) const &>
+ >
+ {};
+
+ template<typename Expr>
+ typename result<as_element(Expr const &)>::type
+ operator ()(Expr const &expr) const
+ {
+ return typename result<as_element(Expr const &)>::type(expr);
+ }
+ };
+
+ }
+
+ namespace functional
+ {
+ /// \brief A PolymorphicFunctionObject type that returns a "flattened"
+ /// view of a Proto expression tree.
+ ///
+ /// A PolymorphicFunctionObject type that returns a "flattened"
+ /// view of a Proto expression tree. For a tree with a top-most node
+ /// tag of type \c T, the elements of the flattened sequence are
+ /// determined by recursing into each child node with the same
+ /// tag type and returning those nodes of different type. So for
+ /// instance, the Proto expression tree corresponding to the
+ /// expression <tt>a | b | c</tt> has a flattened view with elements
+ /// [a, b, c], even though the tree is grouped as
+ /// <tt>((a | b) | c)</tt>.
+ struct flatten
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef proto::detail::flat_view<UNREF(Expr) const> type;
+ };
+
+ template<typename Expr>
+ proto::detail::flat_view<Expr const> operator ()(Expr const &expr) const
+ {
+ return proto::detail::flat_view<Expr const>(expr);
+ }
+ };
+
+ /// \brief A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::pop_front() algorithm on its argument.
+ ///
+ /// A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::pop_front() algorithm on its argument. This is
+ /// useful for defining a CallableTransform like \c pop_front(_)
+ /// which removes the first child from a Proto expression node.
+ /// Such a transform might be used as the first argument to the
+ /// \c proto::transform::fold\<\> transform; that is, fold all but
+ /// the first child.
+ struct pop_front
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::pop_front<UNREF(Expr) const>::type
+ type;
+ };
+
+ template<typename Expr>
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::pop_front<Expr const>::type
+ operator ()(Expr const &expr) const
+ {
+ return fusion::pop_front(expr);
+ }
+ };
+
+ /// \brief A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::reverse() algorithm on its argument.
+ ///
+ /// A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::reverse() algorithm on its argument. This is
+ /// useful for defining a CallableTransform like \c reverse(_)
+ /// which reverses the order of the children of a Proto
+ /// expression node.
+ struct reverse
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::reverse<UNREF(Expr) const>::type
+ type;
+ };
+
+ template<typename Expr>
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::reverse<Expr const>::type
+ operator ()(Expr const &expr) const
+ {
+ return fusion::reverse(expr);
+ }
+ };
+ }
+
+ /// \brief A PolymorphicFunctionObject type that returns a "flattened"
+ /// view of a Proto expression tree.
+ ///
+ /// \sa boost::proto::functional::flatten
+ functional::flatten const flatten = {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<functional::flatten>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<functional::pop_front>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<functional::reverse>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Context>
+ struct eval_fun
+ {
+ explicit eval_fun(Context &ctx)
+ : ctx_(ctx)
+ {}
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef
+ typename proto::result_of::eval<UNREF(Expr), Context>::type
+ type;
+ };
+
+ template<typename Expr>
+ typename proto::result_of::eval<Expr, Context>::type
+ operator ()(Expr &expr) const
+ {
+ return proto::eval(expr, this->ctx_);
+ }
+
+ private:
+ Context &ctx_;
+ };
+}}
+
+// Don't bother emitting all this into the Doxygen-generated
+// reference section. It's enough to say that Proto expressions
+// are valid Fusion sequence without showing all this gunk.
+#ifndef BOOST_PROTO_DOXYGEN_INVOKED
+
+namespace boost { namespace fusion
+{
+ #if BOOST_VERSION < 103500
+ template<typename Tag, typename Args, long Arity>
+ struct is_sequence<proto::expr<Tag, Args, Arity> >
+ : mpl::true_
+ {};
+
+ template<typename Tag, typename Args, long Arity>
+ struct is_sequence<proto::expr<Tag, Args, Arity> const>
+ : mpl::true_
+ {};
+ #endif
+
+ namespace BOOST_PROTO_FUSION_EXTENSION
+ {
+
+ template<typename Tag>
+ struct is_view_impl;
+
+ template<>
+ struct is_view_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::true_
+ {};
+ };
+
+ template<>
+ struct is_view_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::false_
+ {};
+ };
+
+ template<typename Tag>
+ struct value_of_impl;
+
+ template<>
+ struct value_of_impl<proto::tag::proto_expr_iterator>
+ {
+ template<
+ typename Iterator
+ , typename Value = typename proto::result_of::arg_c<
+ typename Iterator::expr_type
+ , Iterator::index
+ >::wrapped_type
+ >
+ struct apply
+ {
+ typedef Value type;
+ };
+
+ template<typename Iterator, typename Expr>
+ struct apply<Iterator, proto::ref_<Expr> >
+ {
+ typedef Expr &type;
+ };
+ };
+
+ #if BOOST_VERSION < 103500
+ template<typename Tag>
+ struct value_impl;
+
+ template<>
+ struct value_impl<proto::tag::proto_expr_iterator>
+ : value_of_impl<proto::tag::proto_expr_iterator>
+ {};
+ #endif
+
+ template<typename Tag>
+ struct deref_impl;
+
+ template<>
+ struct deref_impl<proto::tag::proto_expr_iterator>
+ {
+ template<typename Iterator>
+ struct apply
+ {
+ typedef
+ typename proto::result_of::arg_c<
+ typename Iterator::expr_type const
+ , Iterator::index
+ >::type const &
+ type;
+
+ static type call(Iterator const &iter)
+ {
+ return proto::arg_c<Iterator::index>(iter.expr);
+ }
+ };
+ };
+
+ template<typename Tag>
+ struct advance_impl;
+
+ template<>
+ struct advance_impl<proto::tag::proto_expr_iterator>
+ {
+ template<typename Iterator, typename N>
+ struct apply
+ {
+ typedef
+ typename proto::detail::expr_iterator<
+ typename Iterator::expr_type
+ , Iterator::index + N::value
+ >
+ type;
+
+ static type call(Iterator const &iter)
+ {
+ return type(iter.expr);
+ }
+ };
+ };
+
+ template<typename Tag>
+ struct distance_impl;
+
+ template<>
+ struct distance_impl<proto::tag::proto_expr_iterator>
+ {
+ template<typename IteratorFrom, typename IteratorTo>
+ struct apply
+ : mpl::long_<IteratorTo::index - IteratorFrom::index>
+ {};
+ };
+
+ template<typename Tag>
+ struct next_impl;
+
+ template<>
+ struct next_impl<proto::tag::proto_expr_iterator>
+ {
+ template<typename Iterator>
+ struct apply
+ : advance_impl<proto::tag::proto_expr_iterator>::template apply<Iterator, mpl::long_<1> >
+ {};
+ };
+
+ template<typename Tag>
+ struct prior_impl;
+
+ template<>
+ struct prior_impl<proto::tag::proto_expr_iterator>
+ {
+ template<typename Iterator>
+ struct apply
+ : advance_impl<proto::tag::proto_expr_iterator>::template apply<Iterator, mpl::long_<-1> >
+ {};
+ };
+
+ #if BOOST_VERSION >= 103500
+ template<typename Tag>
+ struct category_of_impl;
+
+ template<>
+ struct category_of_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef random_access_traversal_tag type;
+ };
+ };
+ #endif
+
+ template<typename Tag>
+ struct size_impl;
+
+ template<>
+ struct size_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::long_<0 == Sequence::proto_arity::value ? 1 : Sequence::proto_arity::value>
+ {};
+ };
+
+ template<typename Tag>
+ struct begin_impl;
+
+ template<>
+ struct begin_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef proto::detail::expr_iterator<Sequence, 0> type;
+
+ static type call(Sequence const &seq)
+ {
+ return type(seq);
+ }
+ };
+ };
+
+ template<typename Tag>
+ struct end_impl;
+
+ template<>
+ struct end_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef
+ proto::detail::expr_iterator<
+ Sequence
+ , 0 == Sequence::proto_arity::value ? 1 : Sequence::proto_arity::value
+ >
+ type;
+
+ static type call(Sequence const &seq)
+ {
+ return type(seq);
+ }
+ };
+ };
+
+ template<typename Tag>
+ struct value_at_impl;
+
+ template<>
+ struct value_at_impl<proto::tag::proto_expr>
+ {
+ template<
+ typename Sequence
+ , typename Index
+ , typename Value = typename proto::result_of::arg_c<
+ Sequence
+ , Index::value
+ >::wrapped_type
+ >
+ struct apply
+ {
+ typedef Value type;
+ };
+
+ template<typename Sequence, typename Index, typename Expr>
+ struct apply<Sequence, Index, proto::ref_<Expr> >
+ {
+ typedef Expr &type;
+ };
+
+ template<typename Sequence, typename Index, typename Expr>
+ struct apply<Sequence, Index, Expr &>
+ {
+ typedef Expr &type;
+ };
+ };
+
+ template<typename Tag>
+ struct at_impl;
+
+ template<>
+ struct at_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence, typename Index>
+ struct apply
+ {
+ typedef
+ typename proto::result_of::arg_c<
+ Sequence
+ , Index::value
+ >::reference
+ type;
+
+ static type call(Sequence &seq)
+ {
+ return proto::arg_c<Index::value>(seq);
+ }
+ };
+
+ template<typename Sequence, typename Index>
+ struct apply<Sequence const, Index>
+ {
+ typedef
+ typename proto::result_of::arg_c<
+ Sequence
+ , Index::value
+ >::const_reference
+ type;
+
+ static type call(Sequence const &seq)
+ {
+ return proto::arg_c<Index::value>(seq);
+ }
+ };
+ };
+
+ #if BOOST_VERSION >= 103500
+ template<typename Tag>
+ struct is_segmented_impl;
+
+ template<>
+ struct is_segmented_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Iterator>
+ struct apply
+ : mpl::true_
+ {};
+ };
+
+ template<typename Tag>
+ struct segments_impl;
+
+ template<>
+ struct segments_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef typename Sequence::proto_tag proto_tag;
+
+ typedef fusion::transform_view<
+ typename Sequence::expr_type
+ , proto::detail::as_element<proto_tag>
+ > type;
+
+ static type call(Sequence &sequence)
+ {
+ return type(sequence.expr_, proto::detail::as_element<proto_tag>());
+ }
+ };
+ };
+
+ template<>
+ struct category_of_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef forward_traversal_tag type;
+ };
+ };
+
+ template<>
+ struct begin_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ : fusion::segmented_begin<Sequence>
+ {};
+ };
+
+ template<>
+ struct end_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ : fusion::segmented_end<Sequence>
+ {};
+ };
+
+ template<>
+ struct size_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ : fusion::segmented_size<Sequence>
+ {};
+ };
+ #endif
+
+ }
+
+}}
+
+#endif // BOOST_PROTO_DOXYGEN_INVOKED
+
+#undef UNREF
+
+#if BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/generate.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/generate.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,219 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file generate.hpp
+ /// Contains definition of generate\<\> class template, which end users can
+ /// specialize for generating domain-specific expression wrappers.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_GENERATE_HPP_EAN_02_13_2007
+ #define BOOST_PROTO_GENERATE_HPP_EAN_02_13_2007
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/selection/max.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
+ #include <boost/utility/enable_if.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/matches.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost { namespace proto
+ {
+
+ namespace detail
+ {
+ template<typename Domain, typename Expr>
+ struct generate_if
+ : lazy_enable_if<
+ matches<Expr, typename Domain::proto_grammar>
+ , typename Domain::template apply<Expr>
+ >
+ {};
+
+ // Optimization, generate fewer templates...
+ template<typename Expr>
+ struct generate_if<proto::default_domain, Expr>
+ {
+ typedef Expr type;
+ };
+
+ template<typename Expr>
+ struct expr_traits;
+
+ template<typename Tag, typename Args, long N>
+ struct expr_traits<proto::expr<Tag, Args, N> >
+ {
+ typedef Tag tag;
+ typedef Args args;
+ BOOST_STATIC_CONSTANT(long, arity = N);
+ };
+
+ template<typename Expr, long Arity = expr_traits<Expr>::arity>
+ struct by_value_generator_;
+
+ #define BOOST_PROTO_DEFINE_BY_VALUE_TYPE(Z, N, Expr)\
+ typename result_of::unref<typename expr_traits<Expr>::args::BOOST_PP_CAT(arg, N) >::type
+
+ #define BOOST_PROTO_DEFINE_BY_VALUE(Z, N, expr)\
+ proto::unref(expr.BOOST_PP_CAT(arg, N))
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/generate.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #undef BOOST_PROTO_DEFINE_BY_VALUE
+ #undef BOOST_PROTO_DEFINE_BY_VALUE_TYPE
+
+ }
+
+ namespace generatorns_
+ {
+ /// \brief A simple generator that passes an expression
+ /// through unchanged.
+ ///
+ /// Generators are intended for use as the first template parameter
+ /// to the \c domain\<\> class template and control if and how
+ /// expressions within that domain are to be customized.
+ /// The \c default_generator makes no modifications to the expressions
+ /// passed to it.
+ struct default_generator
+ {
+ template<typename Expr>
+ struct apply
+ {
+ typedef Expr type;
+ };
+
+ /// \param expr A Proto expression
+ /// \return expr
+ template<typename Expr>
+ static Expr const &make(Expr const &expr)
+ {
+ return expr;
+ }
+ };
+
+ /// \brief A generator that wraps expressions passed
+ /// to it in the specified extension wrapper.
+ ///
+ /// Generators are intended for use as the first template parameter
+ /// to the \c domain\<\> class template and control if and how
+ /// expressions within that domain are to be customized.
+ /// \c generator\<\> wraps each expression passed to it in
+ /// the \c Extends\<\> wrapper.
+ template<template<typename> class Extends>
+ struct generator
+ {
+ template<typename Expr>
+ struct apply
+ {
+ typedef Extends<Expr> type;
+ };
+
+ /// \param expr A Proto expression
+ /// \return Extends<Expr>(expr)
+ template<typename Expr>
+ static Extends<Expr> make(Expr const &expr)
+ {
+ return Extends<Expr>(expr);
+ }
+ };
+
+ /// \brief A generator that wraps expressions passed
+ /// to it in the specified extension wrapper and uses
+ /// aggregate initialization for the wrapper.
+ ///
+ /// Generators are intended for use as the first template parameter
+ /// to the \c domain\<\> class template and control if and how
+ /// expressions within that domain are to be customized.
+ /// \c pod_generator\<\> wraps each expression passed to it in
+ /// the \c Extends\<\> wrapper, and uses aggregate initialzation
+ /// for the wrapped object.
+ template<template<typename> class Extends>
+ struct pod_generator
+ {
+ template<typename Expr>
+ struct apply
+ {
+ typedef Extends<Expr> type;
+ };
+
+ /// \param expr The expression to wrap
+ /// \return Extends<Expr> that = {expr}; return that;
+ template<typename Expr>
+ static Extends<Expr> make(Expr const &expr)
+ {
+ Extends<Expr> that = {expr};
+ return that;
+ }
+ };
+
+ /// \brief A composite generator that first replaces
+ /// child nodes held by reference with ones held by value
+ /// and then forwards the result on to another generator.
+ ///
+ /// Generators are intended for use as the first template parameter
+ /// to the \c domain\<\> class template and control if and how
+ /// expressions within that domain are to be customized.
+ /// \c by_value_generator\<\> ensures all children nodes are
+ /// held by value before forwarding the expression on to
+ /// another generator for further processing. The \c Generator
+ /// parameter defaults to \c default_generator.
+ template<typename Generator BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_generator)>
+ struct by_value_generator
+ {
+ template<typename Expr>
+ struct apply
+ {
+ typedef
+ typename Generator::template apply<
+ typename detail::by_value_generator_<Expr>::type
+ >::type
+ type;
+ };
+
+ /// \param expr The expression to modify.
+ /// \return Generator::make(deep_copy(expr))
+ template<typename Expr>
+ static typename apply<Expr>::type make(Expr const &expr)
+ {
+ return Generator::make(detail::by_value_generator_<Expr>::make(expr));
+ }
+ };
+ }
+
+ }}
+
+ #endif // BOOST_PROTO_GENERATE_HPP_EAN_02_13_2007
+
+#else // BOOST_PP_IS_ITERATING
+
+ #define N BOOST_PP_ITERATION()
+
+ template<typename Expr>
+ struct by_value_generator_<Expr, N>
+ {
+ typedef proto::expr<
+ typename expr_traits<Expr>::tag
+ , BOOST_PP_CAT(args, N)<
+ // typename result_of::unref<typename expr_traits<Expr>::args::arg0>::type, ...
+ BOOST_PP_ENUM(BOOST_PP_MAX(N, 1), BOOST_PROTO_DEFINE_BY_VALUE_TYPE, Expr)
+ >
+ > type;
+
+ static type const make(Expr const &expr)
+ {
+ type that = {
+ // proto::unref(expr.arg0), ...
+ BOOST_PP_ENUM(BOOST_PP_MAX(N, 1), BOOST_PROTO_DEFINE_BY_VALUE, expr)
+ };
+ return that;
+ }
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/literal.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/literal.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,109 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file literal.hpp
+/// The literal\<\> terminal wrapper, and the proto::lit() function for
+/// creating literal\<\> wrappers.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_LITERAL_HPP_EAN_01_03_2007
+#define BOOST_PROTO_LITERAL_HPP_EAN_01_03_2007
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/config.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/expr.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto/extends.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+namespace boost { namespace proto
+{
+ namespace utility
+ {
+ /// \brief A simple wrapper for a terminal, provided for
+ /// ease of use.
+ ///
+ /// A simple wrapper for a terminal, provided for
+ /// ease of use. In all cases, <tt>literal\<X\> l(x);</tt>
+ /// is equivalent to <tt>terminal\<X\>::::type l = {x};</tt>.
+ ///
+ /// The \c Domain template parameter defaults to
+ /// \c proto::default_domain.
+ template<
+ typename T
+ , typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)
+ >
+ struct literal
+ : extends<typename terminal<T>::type, literal<T, Domain>, Domain>
+ {
+ private:
+ typedef typename terminal<T>::type terminal_type;
+ typedef extends<terminal_type, literal<T, Domain>, Domain> base_type;
+
+ public:
+ typedef typename proto::result_of::arg<terminal_type>::type value_type;
+ typedef typename proto::result_of::arg<terminal_type>::reference reference;
+ typedef typename proto::result_of::arg<terminal_type>::const_reference const_reference;
+
+ template<typename U>
+ literal(U &u)
+ : base_type(terminal_type::make(u))
+ {}
+
+ template<typename U>
+ literal(U const &u)
+ : base_type(terminal_type::make(u))
+ {}
+
+ template<typename U>
+ literal(literal<U, Domain> const &u)
+ : base_type(terminal_type::make(proto::arg(u)))
+ {}
+
+ using base_type::operator =;
+
+ reference get()
+ {
+ return proto::arg(*this);
+ }
+
+ const_reference get() const
+ {
+ return proto::arg(*this);
+ }
+ };
+ }
+
+ /// \brief A helper function for creating a \c literal\<\> wrapper.
+ /// \param t The object to wrap.
+ /// \return literal\<T &\>(t)
+ /// \attention The returned value holds the argument by reference.
+ /// \throw nothrow
+ template<typename T>
+ inline literal<T &> lit(T &t)
+ {
+ return literal<T &>(t);
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ inline literal<T const &> lit(T const &t)
+ {
+ #ifdef BOOST_MSVC
+ #pragma warning(push)
+ #pragma warning(disable: 4180) // warning C4180: qualifier applied to function type has no meaning; ignored
+ #endif
+
+ return literal<T const &>(t);
+
+ #ifdef BOOST_MSVC
+ #pragma warning(pop)
+ #endif
+ }
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/make_expr.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/make_expr.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,1098 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file make_expr.hpp
+ /// Definition of the \c make_expr() and \c unpack_expr() utilities for
+ /// building Proto expression nodes from children nodes or from a Fusion
+ /// sequence of children nodes, respectively.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_MAKE_EXPR_HPP_EAN_04_01_2005
+ #define BOOST_PROTO_MAKE_EXPR_HPP_EAN_04_01_2005
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/version.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/control/if.hpp>
+ #include <boost/preprocessor/control/expr_if.hpp>
+ #include <boost/preprocessor/arithmetic/inc.hpp>
+ #include <boost/preprocessor/arithmetic/dec.hpp>
+ #include <boost/preprocessor/arithmetic/sub.hpp>
+ #include <boost/preprocessor/punctuation/comma_if.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/facilities/intercept.hpp>
+ #include <boost/preprocessor/comparison/greater.hpp>
+ #include <boost/preprocessor/tuple/elem.hpp>
+ #include <boost/preprocessor/tuple/to_list.hpp>
+ #include <boost/preprocessor/logical/and.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/preprocessor/repetition/enum_binary_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
+ #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
+ #include <boost/preprocessor/repetition/enum_shifted_binary_params.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
+ #include <boost/preprocessor/repetition/repeat_from_to.hpp>
+ #include <boost/preprocessor/seq/size.hpp>
+ #include <boost/preprocessor/seq/enum.hpp>
+ #include <boost/preprocessor/seq/seq.hpp>
+ #include <boost/preprocessor/seq/to_tuple.hpp>
+ #include <boost/preprocessor/seq/for_each_i.hpp>
+ #include <boost/preprocessor/seq/pop_back.hpp>
+ #include <boost/preprocessor/seq/push_back.hpp>
+ #include <boost/preprocessor/seq/push_front.hpp>
+ #include <boost/preprocessor/list/for_each_i.hpp>
+ #include <boost/ref.hpp>
+ #include <boost/mpl/if.hpp>
+ #include <boost/mpl/eval_if.hpp>
+ #include <boost/mpl/apply_wrap.hpp>
+ #include <boost/utility/enable_if.hpp>
+ #include <boost/type_traits/is_same.hpp>
+ #include <boost/type_traits/add_const.hpp>
+ #include <boost/type_traits/add_reference.hpp>
+ #include <boost/type_traits/remove_reference.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/traits.hpp>
+ #include <boost/xpressive/proto/domain.hpp>
+ #include <boost/xpressive/proto/generate.hpp>
+ #if BOOST_VERSION >= 103500
+ # include <boost/fusion/include/at.hpp>
+ # include <boost/fusion/include/value_at.hpp>
+ # include <boost/fusion/include/size.hpp>
+ #else
+ # include <boost/spirit/fusion/sequence/at.hpp>
+ # include <boost/spirit/fusion/sequence/value_at.hpp>
+ # include <boost/spirit/fusion/sequence/size.hpp>
+ #endif
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost
+ {
+ /// INTERNAL ONLY
+ ///
+ namespace fusion
+ {
+ /// INTERNAL ONLY
+ ///
+ template<typename Function>
+ class unfused_generic;
+ }
+ }
+
+ namespace boost { namespace proto
+ {
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_AS_ARG_TYPE(Z, N, DATA) \
+ typename boost::proto::detail::protoify_< \
+ BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 0, DATA), N) \
+ , BOOST_PP_TUPLE_ELEM(3, 2, DATA) \
+ >::type \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_AS_ARG(Z, N, DATA) \
+ boost::proto::detail::protoify_< \
+ BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 0, DATA), N) \
+ , BOOST_PP_TUPLE_ELEM(3, 2, DATA) \
+ >::call(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 1, DATA), N)) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ # define BOOST_PROTO_AT_TYPE(Z, N, DATA) \
+ typename add_const< \
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::value_at_c< \
+ BOOST_PP_TUPLE_ELEM(3, 0, DATA) \
+ , N \
+ >::type \
+ >::type \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ # define BOOST_PROTO_AT(Z, N, DATA) \
+ fusion::BOOST_PROTO_FUSION_AT_C(N, BOOST_PP_TUPLE_ELEM(3, 1, DATA)) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_AS_ARG_AT_TYPE(Z, N, DATA) \
+ typename boost::proto::detail::protoify_< \
+ BOOST_PROTO_AT_TYPE(Z, N, DATA) \
+ , BOOST_PP_TUPLE_ELEM(3, 2, DATA) \
+ >::type \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_AS_ARG_AT(Z, N, DATA) \
+ boost::proto::detail::protoify_< \
+ BOOST_PROTO_AT_TYPE(Z, N, DATA) \
+ , BOOST_PP_TUPLE_ELEM(3, 2, DATA) \
+ >::call(BOOST_PROTO_AT(Z, N, DATA)) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_TEMPLATE_AUX_(R, DATA, I, ELEM) \
+ (ELEM BOOST_PP_CAT(BOOST_PP_CAT(X, DATA), BOOST_PP_CAT(_, I))) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_TEMPLATE_YES_(R, DATA, I, ELEM) \
+ BOOST_PP_LIST_FOR_EACH_I_R( \
+ R \
+ , BOOST_PROTO_VARARG_TEMPLATE_AUX_ \
+ , I \
+ , BOOST_PP_TUPLE_TO_LIST( \
+ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
+ , BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(ELEM)) \
+ ) \
+ ) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_TEMPLATE_NO_(R, DATA, I, ELEM) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_TEMPLATE_(R, DATA, I, ELEM) \
+ BOOST_PP_IF( \
+ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
+ , BOOST_PROTO_VARARG_TEMPLATE_YES_ \
+ , BOOST_PROTO_VARARG_TEMPLATE_NO_ \
+ )(R, DATA, I, ELEM) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_TYPE_AUX_(R, DATA, I, ELEM) \
+ (BOOST_PP_CAT(BOOST_PP_CAT(X, DATA), BOOST_PP_CAT(_, I))) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_TEMPLATE_PARAMS_YES_(R, DATA, I, ELEM) \
+ < \
+ BOOST_PP_SEQ_ENUM( \
+ BOOST_PP_LIST_FOR_EACH_I_R( \
+ R \
+ , BOOST_PROTO_VARARG_TYPE_AUX_ \
+ , I \
+ , BOOST_PP_TUPLE_TO_LIST( \
+ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
+ , BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(ELEM)) \
+ ) \
+ ) \
+ ) \
+ > \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_TEMPLATE_PARAMS_NO_(R, DATA, I, ELEM) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_TYPE_(R, DATA, I, ELEM) \
+ BOOST_PP_COMMA_IF(I) \
+ BOOST_PP_SEQ_HEAD(ELEM) \
+ BOOST_PP_IF( \
+ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
+ , BOOST_PROTO_TEMPLATE_PARAMS_YES_ \
+ , BOOST_PROTO_TEMPLATE_PARAMS_NO_ \
+ )(R, DATA, I, ELEM) BOOST_PP_EXPR_IF(BOOST_PP_GREATER(I, 1), const) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_AS_EXPR_(R, DATA, I, ELEM) \
+ BOOST_PP_EXPR_IF( \
+ BOOST_PP_GREATER(I, 1) \
+ , (( \
+ BOOST_PP_SEQ_HEAD(ELEM) \
+ BOOST_PP_IF( \
+ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
+ , BOOST_PROTO_TEMPLATE_PARAMS_YES_ \
+ , BOOST_PROTO_TEMPLATE_PARAMS_NO_ \
+ )(R, DATA, I, ELEM)() \
+ )) \
+ ) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_AS_ARG_(Z, N, DATA) \
+ (BOOST_PP_CAT(DATA, N)) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_SEQ_PUSH_FRONT(SEQ, ELEM) \
+ BOOST_PP_SEQ_POP_BACK(BOOST_PP_SEQ_PUSH_FRONT(BOOST_PP_SEQ_PUSH_BACK(SEQ, _dummy_), ELEM)) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_AS_PARAM_(Z, N, DATA) \
+ (BOOST_PP_CAT(DATA, N)) \
+ /**/
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_VARARG_FUN_(Z, N, DATA) \
+ template< \
+ BOOST_PP_SEQ_ENUM( \
+ BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_PROTO_VARARG_TEMPLATE_, ~ \
+ , BOOST_PP_SEQ_PUSH_FRONT( \
+ BOOST_PROTO_SEQ_PUSH_FRONT( \
+ BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
+ , (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
+ ) \
+ , BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
+ ) \
+ ) \
+ BOOST_PP_REPEAT_ ## Z(N, BOOST_PROTO_VARARG_AS_PARAM_, typename A) \
+ ) \
+ > \
+ typename boost::proto::result_of::make_expr< \
+ BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_PROTO_VARARG_TYPE_, ~ \
+ , BOOST_PP_SEQ_PUSH_FRONT( \
+ BOOST_PROTO_SEQ_PUSH_FRONT( \
+ BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
+ , (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
+ ) \
+ , BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
+ ) \
+ ) \
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(Z, N, A, const & BOOST_PP_INTERCEPT) \
+ >::type const \
+ BOOST_PP_TUPLE_ELEM(4, 0, DATA)(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a)) \
+ { \
+ return boost::proto::detail::make_expr_< \
+ BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_PROTO_VARARG_TYPE_, ~ \
+ , BOOST_PP_SEQ_PUSH_FRONT( \
+ BOOST_PROTO_SEQ_PUSH_FRONT( \
+ BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
+ , (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
+ ) \
+ , BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
+ ) \
+ ) \
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(Z, N, A, const & BOOST_PP_INTERCEPT) \
+ >::call( \
+ BOOST_PP_SEQ_ENUM( \
+ BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_PROTO_VARARG_AS_EXPR_, ~ \
+ , BOOST_PP_SEQ_PUSH_FRONT( \
+ BOOST_PROTO_SEQ_PUSH_FRONT( \
+ BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
+ , (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
+ ) \
+ , BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
+ ) \
+ ) \
+ BOOST_PP_REPEAT_ ## Z(N, BOOST_PROTO_VARARG_AS_ARG_, a) \
+ ) \
+ ); \
+ } \
+ /**/
+
+ /// \code
+ /// BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ /// 1
+ /// , construct
+ /// , boost::proto::default_domain
+ /// , (boost::proto::tag::function)
+ /// , ((op::construct)(typename)(int))
+ /// )
+ /// \endcode
+ #define BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(ARGCOUNT, NAME, DOMAIN, TAG, BOUNDARGS) \
+ BOOST_PP_REPEAT_FROM_TO( \
+ ARGCOUNT \
+ , BOOST_PP_INC(ARGCOUNT) \
+ , BOOST_PROTO_VARARG_FUN_ \
+ , (NAME, TAG, BOUNDARGS, DOMAIN) \
+ )\
+ /**/
+
+ /// \code
+ /// BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
+ /// construct
+ /// , boost::proto::default_domain
+ /// , (boost::proto::tag::function)
+ /// , ((op::construct)(typename)(int))
+ /// )
+ /// \endcode
+ #define BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(NAME, DOMAIN, TAG, BOUNDARGS) \
+ BOOST_PP_REPEAT( \
+ BOOST_PP_SUB(BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), BOOST_PP_SEQ_SIZE(BOUNDARGS)) \
+ , BOOST_PROTO_VARARG_FUN_ \
+ , (NAME, TAG, BOUNDARGS, DOMAIN) \
+ ) \
+ /**/
+
+ namespace detail
+ {
+ template<typename T, typename Domain>
+ struct protoify_
+ {
+ typedef
+ typename boost::unwrap_reference<T>::type
+ unref_type;
+
+ typedef
+ typename mpl::eval_if<
+ boost::is_reference_wrapper<T>
+ , proto::result_of::as_arg<unref_type, Domain>
+ , proto::result_of::as_expr<unref_type, Domain>
+ >::type
+ type;
+
+ static type call(T &t)
+ {
+ return typename mpl::if_<
+ is_reference_wrapper<T>
+ , functional::as_arg<Domain>
+ , functional::as_expr<Domain>
+ >::type()(static_cast<unref_type &>(t));
+ }
+ };
+
+ template<typename T, typename Domain>
+ struct protoify_<T &, Domain>
+ {
+ typedef
+ typename boost::unwrap_reference<T>::type
+ unref_type;
+
+ typedef
+ typename proto::result_of::as_arg<unref_type, Domain>::type
+ type;
+
+ static type call(T &t)
+ {
+ return functional::as_arg<Domain>()(static_cast<unref_type &>(t));
+ }
+ };
+
+ template<
+ typename Domain
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
+ BOOST_PROTO_MAX_ARITY
+ , typename A
+ , = default_domain BOOST_PP_INTERCEPT
+ )
+ >
+ struct deduce_domain_
+ {
+ typedef Domain type;
+ };
+
+ template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, typename A)>
+ struct deduce_domain_<
+ default_domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, A)
+ >
+ : deduce_domain_<
+ typename domain_of<A0>::type
+ , BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PROTO_MAX_ARITY, A)
+ >
+ {};
+
+ template<>
+ struct deduce_domain_<default_domain>
+ {
+ typedef default_domain type;
+ };
+
+ template<typename Tag, typename Domain, typename Sequence, std::size_t Size>
+ struct unpack_expr_
+ {};
+
+ template<typename Domain, typename Sequence>
+ struct unpack_expr_<tag::terminal, Domain, Sequence, 1u>
+ {
+ typedef
+ typename add_const<
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::value_at_c<
+ Sequence
+ , 0
+ >::type
+ >::type
+ terminal_type;
+
+ typedef
+ typename proto::detail::protoify_<
+ terminal_type
+ , Domain
+ >::type
+ type;
+
+ static type const call(Sequence const &sequence)
+ {
+ return proto::detail::protoify_<terminal_type, Domain>::call(fusion::BOOST_PROTO_FUSION_AT_C(0, sequence));
+ }
+ };
+
+ template<typename Sequence>
+ struct unpack_expr_<tag::terminal, deduce_domain, Sequence, 1u>
+ : unpack_expr_<tag::terminal, default_domain, Sequence, 1u>
+ {};
+
+ template<
+ typename Tag
+ , typename Domain
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
+ BOOST_PROTO_MAX_ARITY
+ , typename A
+ , = void BOOST_PP_INTERCEPT
+ )
+ , typename _ = void
+ >
+ struct make_expr_
+ {};
+
+ template<typename Domain, typename A>
+ struct make_expr_<tag::terminal, Domain, A
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
+ {
+ typedef typename proto::detail::protoify_<A, Domain>::type type;
+
+ static type const call(typename add_reference<A>::type a)
+ {
+ return proto::detail::protoify_<A, Domain>::call(a);
+ }
+ };
+
+ template<typename A>
+ struct make_expr_<tag::terminal, deduce_domain, A
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
+ : make_expr_<tag::terminal, default_domain, A>
+ {};
+
+ #define BOOST_PP_ITERATION_PARAMS_1 \
+ (4, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/make_expr.hpp>, 1)) \
+ /**/
+
+ #include BOOST_PP_ITERATE()
+ }
+
+ namespace result_of
+ {
+ /// \brief Metafunction that computes the return type of the
+ /// \c make_expr() function, with a domain deduced from the
+ /// domains of the children.
+ ///
+ /// Use the <tt>result_of::make_expr\<\></tt> metafunction to
+ /// compute the return type of the \c make_expr() function.
+ ///
+ /// In this specialization, the domain is deduced from the
+ /// domains of the children types. (If
+ /// <tt>is_domain\<A0\>::::value</tt> is \c true, then another
+ /// specialization is selected.)
+ template<
+ typename Tag
+ , typename A0
+ , BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(
+ BOOST_PROTO_MAX_ARITY
+ , typename A
+ , BOOST_PROTO_FOR_DOXYGEN_ONLY(= void) BOOST_PP_INTERCEPT
+ )
+ , typename Void1 BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)
+ , typename Void2 BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)
+ >
+ struct make_expr
+ {
+ /// Same as <tt>result_of::make_expr\<Tag, D, A0, ... AN\>::::type</tt>
+ /// where \c D is the deduced domain, which is calculated as follows:
+ ///
+ /// For each \c x in <tt>[0,N)</tt> (proceeding in order beginning with
+ /// <tt>x=0</tt>), if <tt>domain_of\<Ax\>::::type</tt> is not
+ /// \c default_domain, then \c D is <tt>domain_of\<Ax\>::::type</tt>.
+ /// Otherwise, \c D is \c default_domain.
+ typedef
+ typename detail::make_expr_<
+ Tag
+ , deduce_domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, A)
+ >::type
+ type;
+ };
+
+ /// \brief Metafunction that computes the return type of the
+ /// \c make_expr() function, within the specified domain.
+ ///
+ /// Use the <tt>result_of::make_expr\<\></tt> metafunction to compute
+ /// the return type of the \c make_expr() function.
+ template<
+ typename Tag
+ , typename Domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, typename A)
+ >
+ struct make_expr<
+ Tag
+ , Domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, A)
+ , typename Domain::proto_is_domain_
+ >
+ {
+ /// If \c Tag is <tt>tag::terminal</tt>, then \c type is a
+ /// typedef for <tt>Domain::apply\<expr\<tag::terminal,
+ /// args0\<A0\> \> \>::::type</tt>.
+ ///
+ /// Otherwise, \c type is a typedef for <tt>Domain::apply\<expr\<Tag,
+ /// argsN\< as_child\<A0\>::::type, ... as_child\<AN\>::::type \>
+ /// \>::::type</tt>, where \c N is the number of non-void template
+ /// arguments, and <tt>as_child\<A\>::::type</tt> is evaluated as
+ /// follows:
+ ///
+ /// \li If <tt>is_expr\<A\>::::value</tt> is \c true, then the
+ /// child type is \c A.
+ /// \li If \c A is <tt>B &</tt> or <tt>cv boost::reference_wrapper\<B\></tt>,
+ /// and <tt>is_expr\<B\>::::value</tt> is \c true, then the
+ /// child type is <tt>ref_\<B\></tt>.
+ /// \li If <tt>is_expr\<A\>::::value</tt> is \c false, then the
+ /// child type is <tt>Domain::apply\<expr\<tag::terminal, args0\<A\> \>
+ /// \>::::type</tt>.
+ /// \li If \c A is <tt>B &</tt> or <tt>cv boost::reference_wrapper\<B\></tt>,
+ /// and <tt>is_expr\<B\>::::value</tt> is \c false, then the
+ /// child type is <tt>Domain::apply\<expr\<tag::terminal, args0\<B &\> \>
+ /// \>::::type</tt>.
+ typedef
+ typename detail::make_expr_<
+ Tag
+ , Domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, A)
+ >::type
+ type;
+ };
+
+ /// \brief Metafunction that computes the return type of the
+ /// \c unpack_expr() function, with a domain deduced from the
+ /// domains of the children.
+ ///
+ /// Use the <tt>result_of::unpack_expr\<\></tt> metafunction to
+ /// compute the return type of the \c unpack_expr() function.
+ ///
+ /// \c Sequence is a Fusion Random Access Sequence.
+ ///
+ /// In this specialization, the domain is deduced from the
+ /// domains of the children types. (If
+ /// <tt>is_domain\<Sequence>::::value</tt> is \c true, then another
+ /// specialization is selected.)
+ template<
+ typename Tag
+ , typename Sequence
+ , typename Void1 BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)
+ , typename Void2 BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)
+ >
+ struct unpack_expr
+ {
+ /// Same as <tt>result_of::make_expr\<Tag,
+ /// fusion::value_at\<Sequence, 0\>::::type, ...
+ /// fusion::value_at\<Sequence, N-1\>::::type\>::::type</tt>,
+ /// where \c N is the size of \c Sequence.
+ typedef
+ typename detail::unpack_expr_<
+ Tag
+ , deduce_domain
+ , Sequence
+ , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence>::type::value
+ >::type
+ type;
+ };
+
+ /// \brief Metafunction that computes the return type of the
+ /// \c unpack_expr() function, within the specified domain.
+ ///
+ /// Use the <tt>result_of::make_expr\<\></tt> metafunction to compute
+ /// the return type of the \c make_expr() function.
+ template<typename Tag, typename Domain, typename Sequence>
+ struct unpack_expr<Tag, Domain, Sequence, typename Domain::proto_is_domain_>
+ {
+ /// Same as <tt>result_of::make_expr\<Tag, Domain,
+ /// fusion::value_at\<Sequence, 0\>::::type, ...
+ /// fusion::value_at\<Sequence, N-1\>::::type\>::::type</tt>,
+ /// where \c N is the size of \c Sequence.
+ typedef
+ typename detail::unpack_expr_<
+ Tag
+ , Domain
+ , Sequence
+ , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence>::type::value
+ >::type
+ type;
+ };
+ }
+
+ namespace functional
+ {
+ /// \brief A callable function object equivalent to the
+ /// \c proto::make_expr() function.
+ ///
+ /// In all cases, <tt>functional::make_expr\<Tag, Domain\>()(a0, ... aN)</tt>
+ /// is equivalent to <tt>proto::make_expr\<Tag, Domain\>(a0, ... aN)</tt>.
+ ///
+ /// <tt>functional::make_expr\<Tag\>()(a0, ... aN)</tt>
+ /// is equivalent to <tt>proto::make_expr\<Tag\>(a0, ... aN)</tt>.
+ template<typename Tag, typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= deduce_domain)>
+ struct make_expr
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename A0>
+ struct result<This(A0)>
+ {
+ typedef
+ typename result_of::make_expr<
+ Tag
+ , Domain
+ , A0
+ >::type
+ type;
+ };
+
+ /// Construct an expression node with tag type \c Tag
+ /// and in the domain \c Domain.
+ ///
+ /// \return <tt>proto::make_expr\<Tag, Domain\>(a0,...aN)</tt>
+ template<typename A0>
+ typename result_of::make_expr<
+ Tag
+ , Domain
+ , A0 const
+ >::type const
+ operator ()(A0 const &a0) const
+ {
+ return proto::detail::make_expr_<
+ Tag
+ , Domain
+ , A0 const
+ >::call(a0);
+ }
+
+ // Additional overloads generated by the preprocessor ...
+
+ #define BOOST_PP_ITERATION_PARAMS_1 \
+ (4, (2, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/make_expr.hpp>, 2)) \
+ /**/
+
+ #include BOOST_PP_ITERATE()
+ };
+
+ /// \brief A callable function object equivalent to the
+ /// \c proto::unpack_expr() function.
+ ///
+ /// In all cases, <tt>functional::unpack_expr\<Tag, Domain\>()(seq)</tt>
+ /// is equivalent to <tt>proto::unpack_expr\<Tag, Domain\>(seq)</tt>.
+ ///
+ /// <tt>functional::unpack_expr\<Tag\>()(seq)</tt>
+ /// is equivalent to <tt>proto::unpack_expr\<Tag\>(seq)</tt>.
+ template<typename Tag, typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= deduce_domain)>
+ struct unpack_expr
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result
+ {};
+
+ template<typename This, typename Sequence>
+ struct result<This(Sequence)>
+ {
+ typedef
+ typename result_of::unpack_expr<
+ Tag
+ , Domain
+ , typename remove_reference<Sequence>::type
+ >::type
+ type;
+ };
+
+ /// Construct an expression node with tag type \c Tag
+ /// and in the domain \c Domain.
+ ///
+ /// \param sequence A Fusion Random Access Sequence
+ /// \return <tt>proto::unpack_expr\<Tag, Domain\>(sequence)</tt>
+ template<typename Sequence>
+ typename result_of::unpack_expr<Tag, Domain, Sequence const>::type const
+ operator ()(Sequence const &sequence) const
+ {
+ return proto::detail::unpack_expr_<
+ Tag
+ , Domain
+ , Sequence const
+ , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence>::type::value
+ >::call(sequence);
+ }
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Tag, typename Domain>
+ struct unfused_expr_fun
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Sequence>
+ struct result<This(Sequence)>
+ {
+ typedef
+ typename result_of::unpack_expr<
+ Tag
+ , Domain
+ , typename remove_reference<Sequence>::type
+ >::type
+ type;
+ };
+
+ template<typename Sequence>
+ typename proto::result_of::unpack_expr<Tag, Domain, Sequence const>::type const
+ operator ()(Sequence const &sequence) const
+ {
+ return proto::detail::unpack_expr_<
+ Tag
+ , Domain
+ , Sequence const
+ , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence>::type::value
+ >::call(sequence);
+ }
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Tag, typename Domain>
+ struct unfused_expr
+ : fusion::unfused_generic<unfused_expr_fun<Tag, Domain> >
+ {
+ BOOST_PROTO_CALLABLE()
+ };
+ }
+
+ /// \brief Construct an expression of the requested tag type
+ /// with a domain and with the specified arguments as children.
+ ///
+ /// This function template may be invoked either with or without
+ /// specifying a \c Domain argument. If no domain is specified,
+ /// the domain is deduced by examining in order the domains of
+ /// the given arguments and taking the first that is not
+ /// \c default_domain, if any such domain exists, or
+ /// \c default_domain otherwise.
+ ///
+ /// Let \c wrap_(x) be defined such that:
+ /// \li If \c x is a <tt>boost::reference_wrapper\<\></tt>,
+ /// \c wrap_(x) is equivalent to <tt>as_arg\<Domain\>(x.get())</tt>.
+ /// \li Otherwise, \c wrap_(x) is equivalent to
+ /// <tt>as_expr\<Domain\>(x)</tt>.
+ ///
+ /// Let <tt>make_\<Tag\>(b0,...bN)</tt> be defined as
+ /// <tt>expr\<Tag, argsN\<B0,...BN\> \>::::make(b0,...bN)</tt>
+ /// where \c Bx is the type of \c bx.
+ ///
+ /// \return <tt>Domain::make(make_\<Tag\>(wrap_(a0),...wrap_(aN)))</tt>.
+ template<typename Tag, typename A0>
+ typename lazy_disable_if<
+ is_domain<A0>
+ , result_of::make_expr<
+ Tag
+ , A0 const
+ >
+ >::type const
+ make_expr(A0 const &a0)
+ {
+ return proto::detail::make_expr_<
+ Tag
+ , deduce_domain
+ , A0 const
+ >::call(a0);
+ }
+
+ /// \overload
+ ///
+ template<typename Tag, typename Domain, typename B0>
+ typename result_of::make_expr<
+ Tag
+ , Domain
+ , B0 const
+ >::type const
+ make_expr(B0 const &b0)
+ {
+ return proto::detail::make_expr_<
+ Tag
+ , Domain
+ , B0 const
+ >::call(b0);
+ }
+
+ // Additional overloads generated by the preprocessor...
+
+ #define BOOST_PP_ITERATION_PARAMS_1 \
+ (4, (2, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/make_expr.hpp>, 3)) \
+ /**/
+
+ #include BOOST_PP_ITERATE()
+
+ /// \brief Construct an expression of the requested tag type
+ /// with a domain and with childres from the specified Fusion
+ /// Random Access Sequence.
+ ///
+ /// This function template may be invoked either with or without
+ /// specifying a \c Domain argument. If no domain is specified,
+ /// the domain is deduced by examining in order the domains of the
+ /// elements of \c sequence and taking the first that is not
+ /// \c default_domain, if any such domain exists, or
+ /// \c default_domain otherwise.
+ ///
+ /// Let <tt>wrap_\<N\>(s)</tt>, where \c s has type \c S, be defined
+ /// such that:
+ /// \li If <tt>fusion::value_at\<S,N\>::::type</tt> is a reference,
+ /// <tt>wrap_\<N\>(s)</tt> is equivalent to
+ /// <tt>as_arg\<Domain\>(fusion::at_c\<N\>(s))</tt>.
+ /// \li Otherwise, <tt>wrap_\<N\>(s)</tt> is equivalent to
+ /// <tt>as_expr\<Domain\>(fusion::at_c\<N\>(s))</tt>.
+ ///
+ /// Let <tt>make_\<Tag\>(b0,...bN)</tt> be defined as
+ /// <tt>expr\<Tag, argsN\<B0,...BN\> \>::::make(b0,...bN)</tt>
+ /// where \c Bx is the type of \c bx.
+ ///
+ /// \param sequence a Fusion Random Access Sequence.
+ /// \return <tt>Domain::make(make_\<Tag\>(wrap_\<0\>(s),...wrap_\<N-1\>(S)))</tt>,
+ /// where N is the size of \c Sequence.
+ template<typename Tag, typename Sequence>
+ typename lazy_disable_if<
+ is_domain<Sequence>
+ , result_of::unpack_expr<Tag, Sequence const>
+ >::type const
+ unpack_expr(Sequence const &sequence)
+ {
+ return proto::detail::unpack_expr_<
+ Tag
+ , deduce_domain
+ , Sequence const
+ , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence>::type::value
+ >::call(sequence);
+ }
+
+ /// \overload
+ ///
+ template<typename Tag, typename Domain, typename Sequence2>
+ typename result_of::unpack_expr<Tag, Domain, Sequence2 const>::type const
+ unpack_expr(Sequence2 const &sequence2)
+ {
+ return proto::detail::unpack_expr_<
+ Tag
+ , Domain
+ , Sequence2 const
+ , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence2>::type::value
+ >::call(sequence2);
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Tag, typename Domain>
+ struct is_callable<functional::make_expr<Tag, Domain> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Tag, typename Domain>
+ struct is_callable<functional::unpack_expr<Tag, Domain> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Tag, typename Domain>
+ struct is_callable<functional::unfused_expr<Tag, Domain> >
+ : mpl::true_
+ {};
+
+ }}
+
+ #undef BOOST_PROTO_AT
+ #undef BOOST_PROTO_AT_TYPE
+ #undef BOOST_PROTO_AS_ARG_AT
+ #undef BOOST_PROTO_AS_ARG_AT_TYPE
+
+ #endif // BOOST_PROTO_MAKE_EXPR_HPP_EAN_04_01_2005
+
+#elif BOOST_PP_ITERATION_FLAGS() == 1
+
+ #define N BOOST_PP_ITERATION()
+ #define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
+
+ template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct make_expr_<Tag, Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
+ BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
+ {
+ typedef proto::expr<
+ Tag
+ , BOOST_PP_CAT(args, N)<BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG_TYPE, (A, ~, Domain)) >
+ > expr_type;
+
+ typedef typename Domain::template apply<expr_type>::type type;
+
+ static type const call(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<A, >::type a))
+ {
+ expr_type that = {
+ BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG, (A, a, Domain))
+ };
+ return Domain::make(that);
+ }
+ };
+
+ template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct make_expr_<Tag, deduce_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
+ BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
+ : make_expr_<
+ Tag
+ , typename detail::deduce_domain_<
+ typename domain_of<
+ A0
+ >::type
+ BOOST_PP_COMMA_IF(BOOST_PP_DEC(N))
+ BOOST_PP_ENUM_SHIFTED_PARAMS(N, A)
+ >::type
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
+ >
+ {};
+
+ template<typename Tag, typename Domain, typename Sequence>
+ struct unpack_expr_<Tag, Domain, Sequence, N>
+ {
+ typedef proto::expr<
+ Tag
+ , BOOST_PP_CAT(args, N)<
+ BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG_AT_TYPE, (Sequence const, ~, Domain))
+ >
+ > expr_type;
+
+ typedef typename Domain::template apply<expr_type>::type type;
+
+ static type const call(Sequence const &sequence)
+ {
+ expr_type that = {
+ BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG_AT, (Sequence const, sequence, Domain))
+ };
+ return Domain::make(that);
+ }
+ };
+
+ template<typename Tag, typename Sequence>
+ struct unpack_expr_<Tag, deduce_domain, Sequence, N>
+ : unpack_expr_<
+ Tag
+ , typename detail::deduce_domain_<
+ typename domain_of<
+ BOOST_PROTO_AT_TYPE(~, 0, (Sequence const, ~, ~))
+ >::type
+ BOOST_PP_COMMA_IF(BOOST_PP_DEC(N))
+ BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_AT_TYPE, (Sequence const, ~, ~))
+ >::type
+ , Sequence
+ , N
+ >
+ {};
+
+ #undef N
+ #undef M
+
+#elif BOOST_PP_ITERATION_FLAGS() == 2
+
+ #define N BOOST_PP_ITERATION()
+
+ template<typename This BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct result<This(BOOST_PP_ENUM_PARAMS(N, A))>
+ {
+ typedef
+ typename result_of::make_expr<
+ Tag
+ , Domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
+ >::type
+ type;
+ };
+
+ /// \overload
+ ///
+ template<BOOST_PP_ENUM_PARAMS(N, typename A)>
+ typename result_of::make_expr<
+ Tag
+ , Domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
+ >::type const
+ operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, const A, &a)) const
+ {
+ return proto::detail::make_expr_<
+ Tag
+ , Domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
+ >::call(BOOST_PP_ENUM_PARAMS(N, a));
+ }
+
+ #undef N
+
+#elif BOOST_PP_ITERATION_FLAGS() == 3
+
+ #define N BOOST_PP_ITERATION()
+
+ /// \overload
+ ///
+ template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ typename lazy_disable_if<
+ is_domain<A0>
+ , result_of::make_expr<
+ Tag
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
+ >
+ >::type const
+ make_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, const A, &a))
+ {
+ return proto::detail::make_expr_<
+ Tag
+ , deduce_domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)
+ >::call(BOOST_PP_ENUM_PARAMS(N, a));
+ }
+
+ /// \overload
+ ///
+ template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename B)>
+ typename result_of::make_expr<
+ Tag
+ , Domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, const B)
+ >::type const
+ make_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, const B, &b))
+ {
+ return proto::detail::make_expr_<
+ Tag
+ , Domain
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, const B)
+ >::call(BOOST_PP_ENUM_PARAMS(N, b));
+ }
+
+ #undef N
+
+#endif // BOOST_PP_IS_ITERATING

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/matches.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/matches.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,995 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file matches.hpp
+ /// Contains definition of matches\<\> metafunction for determining if
+ /// a given expression matches a given pattern.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_MATCHES_HPP_EAN_11_03_2006
+ #define BOOST_PROTO_MATCHES_HPP_EAN_11_03_2006
+
+ #include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+ #include <boost/detail/workaround.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/arithmetic/dec.hpp>
+ #include <boost/preprocessor/arithmetic/sub.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/facilities/intercept.hpp>
+ #include <boost/preprocessor/punctuation/comma_if.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/enum_shifted.hpp>
+ #include <boost/preprocessor/repetition/enum_shifted_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+ #include <boost/config.hpp>
+ #include <boost/mpl/logical.hpp>
+ #include <boost/mpl/apply.hpp>
+ #include <boost/mpl/aux_/template_arity.hpp>
+ #include <boost/mpl/aux_/lambda_arity_param.hpp>
+ #include <boost/utility/enable_if.hpp>
+ #include <boost/type_traits/is_array.hpp>
+ #include <boost/type_traits/is_convertible.hpp>
+ #include <boost/type_traits/is_reference.hpp>
+ #include <boost/type_traits/is_pointer.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/traits.hpp>
+ #include <boost/xpressive/proto/transform/when.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+
+ // Some compilers (like GCC) need extra help figuring out a template's arity.
+ // I use MPL's BOOST_MPL_AUX_LAMBDA_ARITY_PARAM() macro to disambiguate, which
+ // which is controlled by the BOOST_MPL_LIMIT_METAFUNCTION_ARITY macro. If
+ // You define BOOST_PROTO_MAX_ARITY to be greater than
+ // BOOST_MPL_LIMIT_METAFUNCTION_ARITY on these compilers, things don't work.
+ // You must define BOOST_MPL_LIMIT_METAFUNCTION_ARITY to be greater.
+ #ifdef BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING
+ # if BOOST_PROTO_MAX_ARITY > BOOST_MPL_LIMIT_METAFUNCTION_ARITY
+ # error BOOST_MPL_LIMIT_METAFUNCTION_ARITY must be at least as large as BOOST_PROTO_MAX_ARITY
+ # endif
+ #endif
+
+ #if defined(_MSC_VER) && (_MSC_VER >= 1020)
+ # pragma warning(push)
+ # pragma warning(disable:4305) // 'specialization' : truncation from 'const int' to 'bool'
+ #endif
+
+ namespace boost { namespace proto
+ {
+
+ namespace detail
+ {
+ struct ignore;
+
+ template<typename Expr, typename Grammar>
+ struct matches_;
+
+ // and_ and or_ implementation
+ template<bool B, typename Expr, typename G0>
+ struct or1
+ : mpl::bool_<B>
+ {
+ typedef G0 which;
+ };
+
+ template<bool B>
+ struct and1
+ : mpl::bool_<B>
+ {};
+
+ template<bool B, typename Pred>
+ struct and2;
+
+ template<typename And>
+ struct last;
+
+ template<typename T, typename U>
+ struct array_matches
+ : mpl::false_
+ {};
+
+ template<typename T, std::size_t M>
+ struct array_matches<T[M], T *>
+ : mpl::true_
+ {};
+
+ template<typename T, std::size_t M>
+ struct array_matches<T[M], T const *>
+ : mpl::true_
+ {};
+
+ template<typename T, std::size_t M>
+ struct array_matches<T[M], T[proto::N]>
+ : mpl::true_
+ {};
+
+ template<typename T, typename U
+ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(long Arity = mpl::aux::template_arity<U>::value)
+ >
+ struct lambda_matches
+ : mpl::false_
+ {};
+
+ template<typename T>
+ struct lambda_matches<T, proto::_ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(-1)>
+ : mpl::true_
+ {};
+
+ template<typename T>
+ struct lambda_matches<T, T BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(-1)>
+ : mpl::true_
+ {};
+
+ template<typename T, std::size_t M, typename U>
+ struct lambda_matches<T[M], U BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(-1)>
+ : array_matches<T[M], U>
+ {};
+
+ template<typename T, std::size_t M>
+ struct lambda_matches<T[M], T[M] BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(-1)>
+ : mpl::true_
+ {};
+
+ template<template<typename> class T, typename Expr0, typename Grammar0>
+ struct lambda_matches<T<Expr0>, T<Grammar0> BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(1) >
+ : lambda_matches<Expr0, Grammar0>
+ {};
+
+ // vararg_matches_impl
+ template<typename Args1, typename Back, long From, long To>
+ struct vararg_matches_impl;
+
+ // vararg_matches
+ template<typename Args1, typename Args2, typename Back, bool Can, bool Zero, typename Void = void>
+ struct vararg_matches
+ : mpl::false_
+ {};
+
+ template<typename Args1, typename Args2, typename Back>
+ struct vararg_matches<Args1, Args2, Back, true, true, typename Back::proto_is_vararg_>
+ : matches_<proto::expr<ignore, Args1, Args1::size>, proto::expr<ignore, Args2, Args1::size> >
+ {};
+
+ template<typename Args1, typename Args2, typename Back>
+ struct vararg_matches<Args1, Args2, Back, true, false, typename Back::proto_is_vararg_>
+ : and2<
+ matches_<proto::expr<ignore, Args1, Args2::size>, proto::expr<ignore, Args2, Args2::size> >::value
+ , vararg_matches_impl<Args1, typename Back::proto_base_expr, Args2::size + 1, Args1::size>
+ >
+ {};
+
+ // How terminal_matches<> handles references and cv-qualifiers.
+ // The cv and ref_ matter *only* if the grammar has a top-level ref_.
+ //
+ // Expr | Grammar | Match
+ // ------------------------------
+ // T T yes
+ // T & T yes
+ // T const & T yes
+ // T T & no
+ // T & T & yes
+ // T const & T & no
+ // T T const & no
+ // T & T const & no
+ // T const & T const & yes
+
+ template<typename T, typename U>
+ struct is_cv_ref_compatible
+ : mpl::true_
+ {};
+
+ template<typename T, typename U>
+ struct is_cv_ref_compatible<T, U &>
+ : mpl::false_
+ {};
+
+ template<typename T, typename U>
+ struct is_cv_ref_compatible<T &, U &>
+ : mpl::bool_<is_const<T>::value == is_const<U>::value>
+ {};
+
+ #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+ // MSVC-7.1 has lots of problems with array types that have been
+ // deduced. Partially specializing terminal_matches<> on array types
+ // doesn't seem to work.
+ template<
+ typename T
+ , typename U
+ , bool B = is_array<BOOST_PROTO_UNCVREF(T)>::value
+ >
+ struct terminal_array_matches
+ : mpl::false_
+ {};
+
+ template<typename T, typename U, std::size_t M>
+ struct terminal_array_matches<T, U(&)[M], true>
+ : is_convertible<T, U(&)[M]>
+ {};
+
+ template<typename T, typename U>
+ struct terminal_array_matches<T, U(&)[proto::N], true>
+ : is_convertible<T, U *>
+ {};
+
+ template<typename T, typename U>
+ struct terminal_array_matches<T, U *, true>
+ : is_convertible<T, U *>
+ {};
+
+ // terminal_matches
+ template<typename T, typename U>
+ struct terminal_matches
+ : mpl::or_<
+ mpl::and_<
+ is_cv_ref_compatible<T, U>
+ , lambda_matches<
+ BOOST_PROTO_UNCVREF(T)
+ , BOOST_PROTO_UNCVREF(U)
+ >
+ >
+ , terminal_array_matches<T, U>
+ >
+ {};
+ #else
+ // terminal_matches
+ template<typename T, typename U>
+ struct terminal_matches
+ : mpl::and_<
+ is_cv_ref_compatible<T, U>
+ , lambda_matches<
+ BOOST_PROTO_UNCVREF(T)
+ , BOOST_PROTO_UNCVREF(U)
+ >
+ >
+ {};
+
+ template<typename T, std::size_t M>
+ struct terminal_matches<T(&)[M], T(&)[proto::N]>
+ : mpl::true_
+ {};
+
+ template<typename T, std::size_t M>
+ struct terminal_matches<T(&)[M], T *>
+ : mpl::true_
+ {};
+ #endif
+
+ template<typename T>
+ struct terminal_matches<T, T>
+ : mpl::true_
+ {};
+
+ template<typename T>
+ struct terminal_matches<T &, T>
+ : mpl::true_
+ {};
+
+ template<typename T>
+ struct terminal_matches<T const &, T>
+ : mpl::true_
+ {};
+
+ template<typename T>
+ struct terminal_matches<T, proto::_>
+ : mpl::true_
+ {};
+
+ template<typename T>
+ struct terminal_matches<T, exact<T> >
+ : mpl::true_
+ {};
+
+ template<typename T, typename U>
+ struct terminal_matches<T, proto::convertible_to<U> >
+ : is_convertible<T, U>
+ {};
+
+ // matches_
+ template<typename Expr, typename Grammar>
+ struct matches_
+ : mpl::false_
+ {};
+
+ template<typename Expr>
+ struct matches_< Expr, proto::_ >
+ : mpl::true_
+ {};
+
+ template<typename Tag, typename Args1, long N1, typename Args2, long N2>
+ struct matches_< proto::expr<Tag, Args1, N1>, proto::expr<Tag, Args2, N2> >
+ : vararg_matches< Args1, Args2, typename Args2::back_, (N1+2 > N2), (N2 > N1) >
+ {};
+
+ template<typename Tag, typename Args1, long N1, typename Args2, long N2>
+ struct matches_< proto::expr<Tag, Args1, N1>, proto::expr<proto::_, Args2, N2> >
+ : vararg_matches< Args1, Args2, typename Args2::back_, (N1+2 > N2), (N2 > N1) >
+ {};
+
+ template<typename Args1, typename Args2, long N2>
+ struct matches_< proto::expr<tag::terminal, Args1, 0>, proto::expr<proto::_, Args2, N2> >
+ : mpl::false_
+ {};
+
+ template<typename Tag, typename Args1, typename Args2>
+ struct matches_< proto::expr<Tag, Args1, 1>, proto::expr<Tag, Args2, 1> >
+ : matches_<typename Args1::arg0::proto_base_expr, typename Args2::arg0::proto_base_expr>
+ {};
+
+ template<typename Tag, typename Args1, typename Args2>
+ struct matches_< proto::expr<Tag, Args1, 1>, proto::expr<proto::_, Args2, 1> >
+ : matches_<typename Args1::arg0::proto_base_expr, typename Args2::arg0::proto_base_expr>
+ {};
+
+ template<typename Args1, typename Args2>
+ struct matches_< proto::expr<tag::terminal, Args1, 0>, proto::expr<tag::terminal, Args2, 0> >
+ : terminal_matches<typename Args1::arg0, typename Args2::arg0>
+ {};
+
+ #define BOOST_PROTO_MATCHES_N_FUN(z, n, data)\
+ matches_<\
+ typename Args1::BOOST_PP_CAT(arg, n)::proto_base_expr\
+ , typename Args2::BOOST_PP_CAT(arg, n)::proto_base_expr\
+ >
+
+ #define BOOST_PROTO_DEFINE_MATCHES(z, n, data)\
+ matches_<\
+ typename Expr::proto_base_expr\
+ , typename BOOST_PP_CAT(G, n)::proto_base_expr\
+ >
+
+ #define BOOST_PROTO_DEFINE_LAMBDA_MATCHES(z, n, data)\
+ lambda_matches<\
+ BOOST_PP_CAT(Expr, n)\
+ , BOOST_PP_CAT(Grammar, n)\
+ >
+
+ #if BOOST_PROTO_MAX_LOGICAL_ARITY > BOOST_PROTO_MAX_ARITY
+ #define BOOST_PP_ITERATION_PARAMS_1 (4, (2, BOOST_PROTO_MAX_LOGICAL_ARITY, <boost/xpressive/proto/matches.hpp>, 1))
+ #else
+ #define BOOST_PP_ITERATION_PARAMS_1 (4, (2, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/matches.hpp>, 1))
+ #endif
+ #include BOOST_PP_ITERATE()
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (4, (2, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/matches.hpp>, 2))
+ #include BOOST_PP_ITERATE()
+
+ #undef BOOST_PROTO_MATCHES_N_FUN
+ #undef BOOST_PROTO_DEFINE_MATCHES
+ #undef BOOST_PROTO_DEFINE_LAMBDA_MATCHES
+
+ // handle proto::if_
+ template<typename Expr, typename If, typename Then, typename Else>
+ struct matches_<Expr, proto::if_<If, Then, Else> >
+ : mpl::eval_if<
+ typename when<_, If>::template result<void(Expr, int, int)>::type
+ , matches_<Expr, typename Then::proto_base_expr>
+ , matches_<Expr, typename Else::proto_base_expr>
+ >::type
+ {};
+
+ template<typename Expr, typename If>
+ struct matches_<Expr, proto::if_<If> >
+ : when<_, If>::template result<void(Expr, int, int)>::type
+ {};
+
+ // handle proto::not_
+ template<typename Expr, typename Grammar>
+ struct matches_<Expr, not_<Grammar> >
+ : mpl::not_<matches_<Expr, typename Grammar::proto_base_expr> >
+ {};
+
+ // handle proto::switch_
+ template<typename Expr, typename Cases>
+ struct matches_<Expr, switch_<Cases> >
+ : matches_<
+ Expr
+ , typename Cases::template case_<typename Expr::proto_tag>::proto_base_expr
+ >
+ {};
+ }
+
+ namespace result_of
+ {
+ /// \brief A Boolean metafunction that evaluates whether a given
+ /// expression type matches a grammar.
+ ///
+ /// <tt>matches\<Expr,Grammar\></tt> inherits (indirectly) from
+ /// \c mpl::true_ if <tt>Expr::proto_base_expr</tt> matches
+ /// <tt>Grammar::proto_base_expr</tt>, and from \c mpl::false_
+ /// otherwise.
+ ///
+ /// Non-terminal expressions are matched against a grammar
+ /// according to the following rules:
+ ///
+ /// \li The wildcard pattern, \c _, matches any expression.
+ /// \li An expression <tt>expr\<AT, argsN\<A0,A1,...An\> \></tt>
+ /// matches a grammar <tt>expr\<BT, argsN\<B0,B1,...Bn\> \></tt>
+ /// if \c BT is \c _ or \c AT, and if \c Ax matches \c Bx for
+ /// each \c x in <tt>[0,n)</tt>.
+ /// \li An expression <tt>expr\<AT, argsN\<A0,...An,U0,...Um\> \></tt>
+ /// matches a grammar <tt>expr\<BT, argsM\<B0,...Bn,vararg\<V\> \> \></tt>
+ /// if \c BT is \c _ or \c AT, and if \c Ax matches \c Bx
+ /// for each \c x in <tt>[0,n)</tt> and if \c Ux matches \c V
+ /// for each \c x in <tt>[0,m)</tt>.
+ /// \li An expression \c E matches <tt>or_\<B0,B1,...Bn\></tt> if \c E
+ /// matches some \c Bx for \c x in <tt>[0,n)</tt>.
+ /// \li An expression \c E matches <tt>and_\<B0,B1,...Bn\></tt> if \c E
+ /// matches all \c Bx for \c x in <tt>[0,n)</tt>.
+ /// \li An expression \c E matches <tt>if_\<T,U,V\></tt> if
+ /// <tt>when\<_,T\>::::result\<void(E,int,int)\>::::type::value</tt>
+ /// is \c true and \c E matches \c U; or, if
+ /// <tt>when\<_,T\>::::result\<void(E,int,int)\>::::type::value</tt>
+ /// is \c false and \c E matches \c V. (Note: \c U defaults to \c _
+ /// and \c V defaults to \c not_\<_\>.)
+ /// \li An expression \c E matches <tt>not_\<T\></tt> if \c E does
+ /// not match \c T.
+ /// \li An expression \c E matches <tt>switch_\<C\></tt> if
+ /// \c E matches <tt>C::case_\<E::proto_tag\></tt>.
+ ///
+ /// A terminal expression <tt>expr\<tag::terminal,args0\<A\> \></tt> matches
+ /// a grammar <tt>expr\<BT,args0\<B\> \></tt> if \c BT is \c _ or
+ /// \c tag::terminal and one of the following is true:
+ ///
+ /// \li \c B is the wildcard pattern, \c _
+ /// \li \c A is \c B
+ /// \li \c A is <tt>B &</tt>
+ /// \li \c A is <tt>B const &</tt>
+ /// \li \c B is <tt>exact\<A\></tt>
+ /// \li \c B is <tt>convertible_to\<X\></tt> and
+ /// <tt>is_convertible\<A,X\>::::value</tt> is \c true.
+ /// \li \c A is <tt>X[M]</tt> or <tt>X(&)[M]</tt> and
+ /// \c B is <tt>X[proto::N]</tt>.
+ /// \li \c A is <tt>X(&)[M]</tt> and \c B is <tt>X(&)[proto::N]</tt>.
+ /// \li \c A is <tt>X[M]</tt> or <tt>X(&)[M]</tt> and
+ /// \c B is <tt>X*</tt>.
+ /// \li \c B lambda-matches \c A (see below).
+ ///
+ /// A type \c B lambda-matches \c A if one of the following is true:
+ ///
+ /// \li \c B is \c A
+ /// \li \c B is the wildcard pattern, \c _
+ /// \li \c B is <tt>T\<B0,B1,...Bn\></tt> and \c A is
+ /// <tt>T\<A0,A1,...An\></tt> and for each \c x in
+ /// <tt>[0,n)</tt>, \c Ax and \c Bx are types
+ /// such that \c Ax lambda-matches \c Bx
+ template<typename Expr, typename Grammar>
+ struct matches
+ : detail::matches_<
+ typename Expr::proto_base_expr
+ , typename Grammar::proto_base_expr
+ >
+ {};
+ }
+
+ namespace wildcardns_
+ {
+ /// \brief A wildcard grammar element that matches any expression,
+ /// and a transform that returns the current expression unchanged.
+ ///
+ /// The wildcard type, \c _, is a grammar element such that
+ /// <tt>matches\<E,_\>::::value</tt> is \c true for any expression
+ /// type \c E.
+ ///
+ /// The wildcard can also be used as a stand-in for a template
+ /// argument when matching terminals. For instance, the following
+ /// is a grammar that will match any <tt>std::complex\<\></tt>
+ /// terminal:
+ ///
+ /// \code
+ /// BOOST_MPL_ASSERT((
+ /// matches<
+ /// terminal<std::complex<double> >::type
+ /// , terminal<std::complex< _ > >
+ /// >
+ /// ));
+ /// \endcode
+ ///
+ /// When used as a transform, \c _ returns the current expression
+ /// unchanged. For instance, in the following, \c _ is used with
+ /// the \c fold\<\> transform to fold the children of a node:
+ ///
+ /// \code
+ /// struct CountChildren
+ /// : or_<
+ /// // Terminals have no children
+ /// when<terminal<_>, mpl::int_<0>()>
+ /// // Use fold<> to count the children of non-terminals
+ /// , otherwise<
+ /// fold<
+ /// _ // <-- fold the current expression
+ /// , mpl::int_<0>()
+ /// , mpl::plus<_state, mpl::int_<1> >()
+ /// >
+ /// >
+ /// >
+ /// {};
+ /// \endcode
+ struct _ : proto::callable
+ {
+ typedef _ proto_base_expr;
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef Expr type;
+ };
+
+ /// \param expr An expression
+ /// \return \c expr
+ template<typename Expr, typename State, typename Visitor>
+ Expr const &operator ()(Expr const &expr, State const &, Visitor &) const
+ {
+ return expr;
+ }
+ };
+ }
+
+ namespace control
+ {
+ /// \brief Inverts the set of expressions matched by a grammar. When
+ /// used as a transform, \c not_\<\> returns the current expression
+ /// unchanged.
+ ///
+ /// If an expression type \c E does not match a grammar \c G, then
+ /// \c E \e does match <tt>not_\<G\></tt>. For example,
+ /// <tt>not_\<terminal\<_\> \></tt> will match any non-terminal.
+ template<typename Grammar>
+ struct not_ : proto::callable
+ {
+ typedef not_ proto_base_expr;
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef Expr type;
+ };
+
+ /// \param expr An expression
+ /// \pre <tt>matches\<Expr,not_\>::::value</tt> is \c true.
+ /// \return \c expr
+ template<typename Expr, typename State, typename Visitor>
+ Expr const &operator ()(Expr const &expr, State const &, Visitor &) const
+ {
+ return expr;
+ }
+ };
+
+ /// \brief Used to select one grammar or another based on the result
+ /// of a compile-time Boolean. When used as a transform, \c if_\<\>
+ /// selects between two transforms based on a compile-time Boolean.
+ ///
+ /// When <tt>if_\<If,Then,Else\></tt> is used as a grammar, \c If
+ /// must be a Proto transform and \c Then and \c Else must be grammars.
+ /// An expression type \c E matches <tt>if_\<If,Then,Else\></tt> if
+ /// <tt>when\<_,If\>::::result\<void(E,int,int)\>::::type::value</tt>
+ /// is \c true and \c E matches \c U; or, if
+ /// <tt>when\<_,If\>::::result\<void(E,int,int)\>::::type::value</tt>
+ /// is \c false and \c E matches \c V.
+ ///
+ /// The template parameter \c Then defaults to \c _
+ /// and \c Else defaults to \c not\<_\>, so an expression type \c E
+ /// will match <tt>if_\<If\></tt> if and only if
+ /// <tt>when\<_,If\>::::result\<void(E,int,int)\>::::type::value</tt>
+ /// is \c true.
+ ///
+ /// \code
+ /// // A grammar that only matches integral terminals,
+ /// // using is_integral<> from Boost.Type_traits.
+ /// struct IsIntegral
+ /// : and_<
+ /// terminal<_>
+ /// , if_< is_integral<_arg>() >
+ /// >
+ /// {};
+ /// \endcode
+ ///
+ /// When <tt>if_\<If,Then,Else\></tt> is used as a transform, \c If,
+ /// \c Then and \c Else must be Proto transforms. When applying
+ /// the transform to an expression \c E, state \c S and visitor \c V,
+ /// if <tt>when\<_,If\>::::result\<void(E,S,V)\>::::type::value</tt>
+ /// is \c true then the \c Then transform is applied; otherwise
+ /// the \c Else transform is applied.
+ ///
+ /// \code
+ /// // Match a terminal. If the terminal is integral, return
+ /// // mpl::true_; otherwise, return mpl::false_.
+ /// struct IsIntegral2
+ /// : when<
+ /// terminal<_>
+ /// , if_<
+ /// is_integral<_arg>()
+ /// , mpl::true_()
+ /// , mpl::false_()
+ /// >
+ /// >
+ /// {};
+ /// \endcode
+ template<
+ typename If
+ , typename Then BOOST_PROTO_FOR_DOXYGEN_ONLY(= _)
+ , typename Else BOOST_PROTO_FOR_DOXYGEN_ONLY(= not_<_>)
+ >
+ struct if_ : proto::callable
+ {
+ typedef if_ proto_base_expr;
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename when<_, If>::template result<void(Expr, State, Visitor)>::type
+ condition;
+
+ typedef
+ typename mpl::if_<
+ condition
+ , when<_, Then>
+ , when<_, Else>
+ >::type
+ which;
+
+ typedef typename which::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ /// \param expr An expression
+ /// \param state The current state
+ /// \param visitor A visitor of arbitrary type
+ /// \return <tt>result\<void(Expr, State, Visitor)\>::::which()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef
+ typename result<void(Expr, State, Visitor)>::which
+ which;
+
+ return which()(expr, state, visitor);
+ }
+ };
+
+ /// \brief For matching one of a set of alternate grammars. Alternates
+ /// tried in order to avoid ambiguity. When used as a transform, \c or_\<\>
+ /// applies the transform associated with the first grammar that matches
+ /// the expression.
+ ///
+ /// An expression type \c E matches <tt>or_\<B0,B1,...Bn\></tt> if \c E
+ /// matches any \c Bx for \c x in <tt>[0,n)</tt>.
+ ///
+ /// When applying <tt>or_\<B0,B1,...Bn\></tt> as a transform with an
+ /// expression \c e of type \c E, state \c s and visitor \c v, it is
+ /// equivalent to <tt>Bx()(e, s, v)</tt>, where \c x is the lowest
+ /// number such that <tt>matches\<E,Bx\>::::value</tt> is \c true.
+ template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G)>
+ struct or_ : proto::callable
+ {
+ typedef or_ proto_base_expr;
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename detail::matches_<Expr, or_>::which which;
+ typedef typename which::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ /// \param expr An expression
+ /// \param state The current state
+ /// \param visitor A visitor of arbitrary type
+ /// \pre <tt>matches\<Expr,or_\>::::value</tt> is \c true.
+ /// \return <tt>result\<void(Expr, State, Visitor)\>::::which()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef typename detail::matches_<Expr, or_>::which which;
+ return which()(expr, state, visitor);
+ }
+ };
+
+ /// \brief For matching all of a set of grammars. When used as a
+ /// transform, \c and_\<\> applies the transform associated with
+ /// the last grammar in the set.
+ ///
+ /// An expression type \c E matches <tt>and_\<B0,B1,...Bn\></tt> if \c E
+ /// matches all \c Bx for \c x in <tt>[0,n)</tt>.
+ ///
+ /// When applying <tt>and_\<B0,B1,...Bn\></tt> as a transform with an
+ /// expression \c e, state \c s and visitor \c v, it is
+ /// equivalent to <tt>Bn()(e, s, v)</tt>.
+ template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G)>
+ struct and_ : proto::callable
+ {
+ typedef and_ proto_base_expr;
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename detail::last<and_>::type which;
+ typedef typename which::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ /// \param expr An expression
+ /// \param state The current state
+ /// \param visitor A visitor of arbitrary type
+ /// \pre <tt>matches\<Expr,and_\>::::value</tt> is \c true.
+ /// \return <tt>result\<void(Expr, State, Visitor)\>::::which()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef typename detail::last<and_>::type which;
+ return which()(expr, state, visitor);
+ }
+ };
+
+ /// \brief For matching one of a set of alternate grammars, which
+ /// are looked up based on an expression's tag type. When used as a
+ /// transform, \c switch_\<\> applies the transform associated with
+ /// the grammar that matches the expression.
+ ///
+ /// \note \c switch_\<\> is functionally identical to \c or_\<\> but
+ /// is often more efficient. It does a fast, O(1) lookup based on an
+ /// expression's tag type to find a sub-grammar that may potentially
+ /// match the expression.
+ ///
+ /// An expression type \c E matches <tt>switch_\<C\></tt> if \c E
+ /// matches <tt>C::case_\<E::proto_tag\></tt>.
+ ///
+ /// When applying <tt>switch_\<C\></tt> as a transform with an
+ /// expression \c e of type \c E, state \c s and visitor \c v, it is
+ /// equivalent to <tt>C::case_\<E::proto_tag\>()(e, s, v)</tt>.
+ template<typename Cases>
+ struct switch_ : proto::callable
+ {
+ typedef switch_ proto_base_expr;
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename Cases::template case_<typename Expr::proto_tag> which;
+ typedef typename which::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ /// \param expr An expression
+ /// \param state The current state
+ /// \param visitor A visitor of arbitrary type
+ /// \pre <tt>matches\<Expr,switch_\>::::value</tt> is \c true.
+ /// \return <tt>result\<void(Expr, State, Visitor)\>::::which()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef typename Cases::template case_<typename Expr::proto_tag> which;
+ return which()(expr, state, visitor);
+ }
+ };
+
+ /// \brief For forcing exact matches of terminal types.
+ ///
+ /// By default, matching terminals ignores references and
+ /// cv-qualifiers. For instance, a terminal expression of
+ /// type <tt>terminal\<int const &\>::::type</tt> will match
+ /// the grammar <tt>terminal\<int\></tt>. If that is not
+ /// desired, you can force an exact match with
+ /// <tt>terminal\<exact\<int\> \></tt>. This will only
+ /// match integer terminals where the terminal is held by
+ /// value.
+ template<typename T>
+ struct exact
+ {};
+
+ /// \brief For matching terminals that are convertible to
+ /// a type.
+ ///
+ /// Use \c convertible_to\<\> to match a terminal that is
+ /// convertible to some type. For example, the grammar
+ /// <tt>terminal\<convertible_to\<int\> \></tt> will match
+ /// any terminal whose argument is convertible to an integer.
+ ///
+ /// \note The trait \c is_convertible\<\> from Boost.Type_traits
+ /// is used to determinal convertibility.
+ template<typename T>
+ struct convertible_to
+ {};
+
+ /// \brief For matching a Grammar to a variable number of
+ /// sub-expressions.
+ ///
+ /// An expression type <tt>expr\<AT, argsN\<A0,...An,U0,...Um\> \></tt>
+ /// matches a grammar <tt>expr\<BT, argsM\<B0,...Bn,vararg\<V\> \> \></tt>
+ /// if \c BT is \c _ or \c AT, and if \c Ax matches \c Bx
+ /// for each \c x in <tt>[0,n)</tt> and if \c Ux matches \c V
+ /// for each \c x in <tt>[0,m)</tt>.
+ ///
+ /// For example:
+ ///
+ /// \code
+ /// // Match any function call expression, irregardless
+ /// // of the number of function arguments:
+ /// struct Function
+ /// : function< vararg<_> >
+ /// {};
+ /// \endcode
+ ///
+ /// When used as a transform, <tt>vararg\<G\></tt> applies
+ /// <tt>G</tt>'s transform.
+ template<typename Grammar>
+ struct vararg
+ : Grammar
+ {
+ typedef void proto_is_vararg_;
+ };
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G)>
+ struct is_callable<or_<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, G)> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G)>
+ struct is_callable<and_<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, G)> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Grammar>
+ struct is_callable<not_<Grammar> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename If, typename Then, typename Else>
+ struct is_callable<if_<If, Then, Else> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Grammar>
+ struct is_callable<vararg<Grammar> >
+ : mpl::true_
+ {};
+
+ }}
+
+ #if defined(_MSC_VER) && (_MSC_VER >= 1020)
+ # pragma warning(pop)
+ #endif
+
+ #endif
+
+#elif BOOST_PP_ITERATION_FLAGS() == 1
+
+ #define N BOOST_PP_ITERATION()
+
+ template<bool B, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
+ struct BOOST_PP_CAT(and, N)
+ : BOOST_PP_CAT(and, BOOST_PP_DEC(N))<
+ P0::value BOOST_PP_COMMA_IF(BOOST_PP_SUB(N,2))
+ BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_DEC(N), P)
+ >
+ {};
+
+ template<BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), typename P)>
+ struct BOOST_PP_CAT(and, N)<false, BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), P)>
+ : mpl::false_
+ {};
+
+ #if N <= BOOST_PROTO_MAX_LOGICAL_ARITY
+ template<BOOST_PP_ENUM_PARAMS(N, typename G)>
+ struct last<proto::and_<BOOST_PP_ENUM_PARAMS(N, G)> >
+ {
+ typedef BOOST_PP_CAT(G, BOOST_PP_DEC(N)) type;
+ };
+
+ template<bool B, typename Expr, BOOST_PP_ENUM_PARAMS(N, typename G)>
+ struct BOOST_PP_CAT(or, N)
+ : BOOST_PP_CAT(or, BOOST_PP_DEC(N))<
+ matches_<Expr, typename G1::proto_base_expr>::value
+ , Expr, BOOST_PP_ENUM_SHIFTED_PARAMS(N, G)
+ >
+ {};
+
+ template<typename Expr BOOST_PP_ENUM_TRAILING_PARAMS(N, typename G)>
+ struct BOOST_PP_CAT(or, N)<true, Expr, BOOST_PP_ENUM_PARAMS(N, G)>
+ : mpl::true_
+ {
+ typedef G0 which;
+ };
+
+ // handle proto::or_
+ template<typename Expr, BOOST_PP_ENUM_PARAMS(N, typename G)>
+ struct matches_<Expr, proto::or_<BOOST_PP_ENUM_PARAMS(N, G)> >
+ : BOOST_PP_CAT(or, N)<
+ matches_<typename Expr::proto_base_expr, typename G0::proto_base_expr>::value,
+ typename Expr::proto_base_expr, BOOST_PP_ENUM_PARAMS(N, G)
+ >
+ {};
+
+ // handle proto::and_
+ template<typename Expr, BOOST_PP_ENUM_PARAMS(N, typename G)>
+ struct matches_<Expr, proto::and_<BOOST_PP_ENUM_PARAMS(N, G)> >
+ : detail::BOOST_PP_CAT(and, N)<
+ BOOST_PROTO_DEFINE_MATCHES(~, 0, ~)::value,
+ BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFINE_MATCHES, ~)
+ >
+ {};
+ #endif
+
+ #undef N
+
+#elif BOOST_PP_ITERATION_FLAGS() == 2
+
+ #define N BOOST_PP_ITERATION()
+
+ template<typename Args, typename Back, long To>
+ struct vararg_matches_impl<Args, Back, N, To>
+ : and2<
+ matches_<typename Args::BOOST_PP_CAT(arg, BOOST_PP_DEC(N))::proto_base_expr, Back>::value
+ , vararg_matches_impl<Args, Back, N + 1, To>
+ >
+ {};
+
+ template<typename Args, typename Back>
+ struct vararg_matches_impl<Args, Back, N, N>
+ : matches_<typename Args::BOOST_PP_CAT(arg, BOOST_PP_DEC(N))::proto_base_expr, Back>
+ {};
+
+ template<
+ template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class T
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, typename Expr)
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, typename Grammar)
+ >
+ struct lambda_matches<T<BOOST_PP_ENUM_PARAMS(N, Expr)>, T<BOOST_PP_ENUM_PARAMS(N, Grammar)> BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(N) >
+ : BOOST_PP_CAT(and, N)<
+ BOOST_PROTO_DEFINE_LAMBDA_MATCHES(~, 0, ~)::value,
+ BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFINE_LAMBDA_MATCHES, ~)
+ >
+ {};
+
+ template<typename Tag, typename Args1, typename Args2>
+ struct matches_< proto::expr<Tag, Args1, N>, proto::expr<Tag, Args2, N> >
+ : BOOST_PP_CAT(and, N)<
+ BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value,
+ BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~)
+ >
+ {};
+
+ template<typename Tag, typename Args1, typename Args2>
+ struct matches_< proto::expr<Tag, Args1, N>, proto::expr<proto::_, Args2, N> >
+ : BOOST_PP_CAT(and, N)<
+ BOOST_PROTO_MATCHES_N_FUN(~, 0, ~)::value,
+ BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_MATCHES_N_FUN, ~)
+ >
+ {};
+
+ #undef N
+
+#endif
+

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/operators.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/operators.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,403 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file operators.hpp
+/// Contains all the overloaded operators that make it possible to build
+/// Proto expression trees.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_OPERATORS_HPP_EAN_04_01_2005
+#define BOOST_PROTO_OPERATORS_HPP_EAN_04_01_2005
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/preprocessor/punctuation/comma.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/tags.hpp>
+#include <boost/xpressive/proto/expr.hpp>
+#include <boost/xpressive/proto/generate.hpp>
+#include <boost/xpressive/proto/make_expr.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+namespace boost { namespace proto
+{
+ namespace detail
+ {
+ template<typename Tag, typename Left, typename Right, typename Enable1 = void, typename Enable2 = void>
+ struct as_expr_if2
+ {};
+
+ template<typename Tag, typename Left, typename Right>
+ struct as_expr_if2<Tag, Left, Right, typename Left::proto_is_expr_, void>
+ : generate_if<
+ typename Left::proto_domain
+ , proto::expr<
+ Tag
+ , args2<
+ ref_<Left>
+ , typename Left::proto_domain::template apply<proto::expr<tag::terminal, args0<Right &> > >::type
+ >
+ >
+ >
+ {
+ typedef proto::expr<tag::terminal, args0<Right &> > term_type;
+ typedef proto::expr<Tag, args2<ref_<Left>, typename Left::proto_domain::template apply<term_type>::type> > expr_type;
+
+ static typename Left::proto_domain::template apply<expr_type>::type
+ make(Left &left, Right &right)
+ {
+ term_type term = {right};
+ expr_type that = {{left}, Left::proto_domain::make(term)};
+ return Left::proto_domain::make(that);
+ }
+ };
+
+ template<typename Tag, typename Left, typename Right>
+ struct as_expr_if2<Tag, Left, Right, void, typename Right::proto_is_expr_>
+ : generate_if<
+ typename Right::proto_domain
+ , proto::expr<
+ Tag
+ , args2<
+ typename Right::proto_domain::template apply<proto::expr<tag::terminal, args0<Left &> > >::type
+ , ref_<Right>
+ >
+ >
+ >
+ {
+ typedef proto::expr<tag::terminal, args0<Left &> > term_type;
+ typedef proto::expr<Tag, args2<typename Right::proto_domain::template apply<term_type>::type, ref_<Right> > > expr_type;
+
+ static typename Right::proto_domain::template apply<expr_type>::type
+ make(Left &left, Right &right)
+ {
+ term_type term = {left};
+ expr_type that = {Right::proto_domain::make(term), {right}};
+ return Right::proto_domain::make(that);
+ }
+ };
+
+ template<typename Tag, typename Left, typename Right, typename Enable1 = void, typename Enable2 = void>
+ struct as_expr_if
+ : as_expr_if2<Tag, Left, Right>
+ {};
+
+ template<typename Tag, typename Left, typename Right>
+ struct as_expr_if<Tag, Left, Right, typename Left::proto_is_expr_, typename Right::proto_is_expr_>
+ : generate_if<
+ typename Left::proto_domain
+ , proto::expr<Tag, args2<ref_<Left>, ref_<Right> > >
+ >
+ {
+ typedef proto::expr<Tag, args2<ref_<Left>, ref_<Right> > > expr_type;
+ BOOST_MPL_ASSERT((is_same<typename Left::proto_domain, typename Right::proto_domain>));
+
+ static typename Left::proto_domain::template apply<expr_type>::type
+ make(Left &left, Right &right)
+ {
+ expr_type that = {{left}, {right}};
+ return Left::proto_domain::make(that);
+ }
+ };
+
+ template<typename Arg, typename Trait, typename Enable = void>
+ struct arg_weight
+ {
+ BOOST_STATIC_CONSTANT(int, value = 1 + Trait::value);
+ };
+
+ template<typename Arg, typename Trait>
+ struct arg_weight<Arg, Trait, typename Arg::proto_is_expr_>
+ {
+ BOOST_STATIC_CONSTANT(int, value = 0);
+ };
+
+ template<typename Domain, typename Trait, typename Arg, typename Expr>
+ struct enable_unary
+ : boost::enable_if<
+ boost::mpl::and_<Trait, boost::proto::matches<Expr, typename Domain::proto_grammar> >
+ , Expr
+ >
+ {};
+
+ template<typename Trait, typename Arg, typename Expr>
+ struct enable_unary<deduce_domain, Trait, Arg, Expr>
+ : boost::enable_if<
+ boost::mpl::and_<
+ Trait
+ , boost::proto::matches<Expr, typename domain_of<Arg>::type::proto_grammar>
+ >
+ , Expr
+ >
+ {};
+
+ template<typename Trait, typename Arg, typename Expr>
+ struct enable_unary<default_domain, Trait, Arg, Expr>
+ : boost::enable_if<Trait, Expr>
+ {};
+
+ template<typename Domain, typename Trait1, typename Arg1, typename Trait2, typename Arg2, typename Expr>
+ struct enable_binary
+ : boost::enable_if<
+ boost::mpl::and_<
+ mpl::bool_<(3 <= (arg_weight<Arg1, Trait1>::value + arg_weight<Arg2, Trait2>::value))>
+ , boost::proto::matches<Expr, typename Domain::proto_grammar>
+ >
+ , Expr
+ >
+ {};
+
+ template<typename Trait1, typename Arg1, typename Trait2, typename Arg2, typename Expr>
+ struct enable_binary<deduce_domain, Trait1, Arg1, Trait2, Arg2, Expr>
+ : boost::enable_if<
+ boost::mpl::and_<
+ mpl::bool_<(3 <= (arg_weight<Arg1, Trait1>::value + arg_weight<Arg2, Trait2>::value))>
+ , boost::proto::matches<Expr, typename deduce_domain_<typename domain_of<Arg1>::type, Arg2>::type::proto_grammar>
+ >
+ , Expr
+ >
+ {};
+
+ template<typename Trait1, typename Arg1, typename Trait2, typename Arg2, typename Expr>
+ struct enable_binary<default_domain, Trait1, Arg1, Trait2, Arg2, Expr>
+ : boost::enable_if_c<
+ (3 <= (arg_weight<Arg1, Trait1>::value + arg_weight<Arg2, Trait2>::value))
+ , Expr
+ >
+ {};
+
+ } // detail
+
+#define BOOST_PROTO_UNARY_OP_IS_POSTFIX_0
+#define BOOST_PROTO_UNARY_OP_IS_POSTFIX_1 , int
+
+#define BOOST_PROTO_DEFINE_UNARY_OPERATOR(OP, TAG, POST) \
+ template<typename Arg> \
+ typename detail::generate_if< \
+ typename Arg::proto_domain \
+ , proto::expr<TAG, args1<ref_<typename Arg::proto_derived_expr> > > \
+ >::type const \
+ operator OP(Arg &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
+ { \
+ typedef proto::expr<TAG, args1<ref_<typename Arg::proto_derived_expr> > > that_type; \
+ that_type that = {{arg}}; \
+ return Arg::proto_domain::make(that); \
+ } \
+ template<typename Arg> \
+ typename detail::generate_if< \
+ typename Arg::proto_domain \
+ , proto::expr<TAG, args1<ref_<typename Arg::proto_derived_expr const> > > \
+ >::type const \
+ operator OP(Arg const &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
+ { \
+ typedef proto::expr<TAG, args1<ref_<typename Arg::proto_derived_expr const> > > that_type; \
+ that_type that = {{arg}}; \
+ return Arg::proto_domain::make(that); \
+ } \
+ /**/
+
+#define BOOST_PROTO_DEFINE_BINARY_OPERATOR(OP, TAG) \
+ template<typename Left, typename Right> \
+ inline typename detail::as_expr_if<TAG, Left, Right>::type const \
+ operator OP(Left &left, Right &right) \
+ { \
+ return detail::as_expr_if<TAG, Left, Right>::make(left, right); \
+ } \
+ template<typename Left, typename Right> \
+ inline typename detail::as_expr_if<TAG, Left, Right const>::type const \
+ operator OP(Left &left, Right const &right) \
+ { \
+ return detail::as_expr_if<TAG, Left, Right const>::make(left, right); \
+ } \
+ template<typename Left, typename Right> \
+ inline typename detail::as_expr_if<TAG, Left const, Right>::type const \
+ operator OP(Left const &left, Right &right) \
+ { \
+ return detail::as_expr_if<TAG, Left const, Right>::make(left, right); \
+ } \
+ template<typename Left, typename Right> \
+ inline typename detail::as_expr_if<TAG, Left const, Right const>::type const \
+ operator OP(Left const &left, Right const &right) \
+ { \
+ return detail::as_expr_if<TAG, Left const, Right const>::make(left, right); \
+ } \
+ /**/
+
+ namespace exprns_
+ {
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(+, tag::posit, 0)
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(-, tag::negate, 0)
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(*, tag::dereference, 0)
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(~, tag::complement, 0)
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(&, tag::address_of, 0)
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(!, tag::logical_not, 0)
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, tag::pre_inc, 0)
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, tag::pre_dec, 0)
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, tag::post_inc, 1)
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, tag::post_dec, 1)
+
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<, tag::shift_left)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>, tag::shift_right)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(*, tag::multiplies)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(/, tag::divides)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(%, tag::modulus)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(+, tag::plus)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(-, tag::minus)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<, tag::less)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>, tag::greater)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<=, tag::less_equal)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>=, tag::greater_equal)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(==, tag::equal_to)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(!=, tag::not_equal_to)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(||, tag::logical_or)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&&, tag::logical_and)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&, tag::bitwise_and)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(|, tag::bitwise_or)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(^, tag::bitwise_xor)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(BOOST_PP_COMMA(), tag::comma)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(->*, tag::mem_ptr)
+
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<=, tag::shift_left_assign)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>=, tag::shift_right_assign)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(*=, tag::multiplies_assign)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(/=, tag::divides_assign)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(%=, tag::modulus_assign)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(+=, tag::plus_assign)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(-=, tag::minus_assign)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&=, tag::bitwise_and_assign)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(|=, tag::bitwise_or_assign)
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(^=, tag::bitwise_xor_assign)
+
+ /// if_else
+ ///
+ BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ 3
+ , if_else
+ , deduce_domain
+ , (tag::if_else_)
+ , BOOST_PP_SEQ_NIL
+ )
+ } // exprns_
+
+ using exprns_::if_else;
+
+#undef BOOST_PROTO_DEFINE_UNARY_OPERATOR
+#undef BOOST_PROTO_DEFINE_BINARY_OPERATOR
+
+#define BOOST_PROTO_DEFINE_UNARY_OPERATOR(OP, TAG, TRAIT, DOMAIN, POST) \
+ template<typename Arg> \
+ typename boost::proto::detail::enable_unary<DOMAIN, TRAIT<Arg>, Arg \
+ , typename boost::proto::result_of::make_expr<TAG, DOMAIN, Arg &>::type \
+ >::type const \
+ operator OP(Arg &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
+ { \
+ return boost::proto::make_expr<TAG, DOMAIN>(boost::ref(arg)); \
+ } \
+ template<typename Arg> \
+ typename boost::proto::detail::enable_unary<DOMAIN, TRAIT<Arg>, Arg \
+ , typename boost::proto::result_of::make_expr<TAG, DOMAIN, Arg const &>::type \
+ >::type const \
+ operator OP(Arg const &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
+ { \
+ return boost::proto::make_expr<TAG, DOMAIN>(boost::ref(arg)); \
+ } \
+ /**/
+
+#define BOOST_PROTO_DEFINE_BINARY_OPERATOR(OP, TAG, TRAIT, DOMAIN) \
+ template<typename Left, typename Right> \
+ typename boost::proto::detail::enable_binary<DOMAIN, TRAIT<Left>, Left, TRAIT<Right>, Right \
+ , typename boost::proto::result_of::make_expr<TAG, DOMAIN, Left &, Right &>::type \
+ >::type const \
+ operator OP(Left &left, Right &right) \
+ { \
+ return boost::proto::make_expr<TAG, DOMAIN>(boost::ref(left), boost::ref(right)); \
+ } \
+ template<typename Left, typename Right> \
+ typename boost::proto::detail::enable_binary<DOMAIN, TRAIT<Left>, Left, TRAIT<Right>, Right \
+ , typename boost::proto::result_of::make_expr<TAG, DOMAIN, Left &, Right const &>::type \
+ >::type const \
+ operator OP(Left &left, Right const &right) \
+ { \
+ return boost::proto::make_expr<TAG, DOMAIN>(boost::ref(left), boost::ref(right)); \
+ } \
+ template<typename Left, typename Right> \
+ typename boost::proto::detail::enable_binary<DOMAIN, TRAIT<Left>, Left, TRAIT<Right>, Right \
+ , typename boost::proto::result_of::make_expr<TAG, DOMAIN, Left const &, Right &>::type \
+ >::type const \
+ operator OP(Left const &left, Right &right) \
+ { \
+ return boost::proto::make_expr<TAG, DOMAIN>(boost::ref(left), boost::ref(right)); \
+ } \
+ template<typename Left, typename Right> \
+ typename boost::proto::detail::enable_binary<DOMAIN, TRAIT<Left>, Left, TRAIT<Right>, Right \
+ , typename boost::proto::result_of::make_expr<TAG, DOMAIN, Left const &, Right const &>::type\
+ >::type const \
+ operator OP(Left const &left, Right const &right) \
+ { \
+ return boost::proto::make_expr<TAG, DOMAIN>(boost::ref(left), boost::ref(right)); \
+ } \
+ /**/
+
+#define BOOST_PROTO_DEFINE_OPERATORS(TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(+, boost::proto::tag::posit, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(-, boost::proto::tag::negate, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(*, boost::proto::tag::dereference, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(~, boost::proto::tag::complement, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(&, boost::proto::tag::address_of, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(!, boost::proto::tag::logical_not, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, boost::proto::tag::pre_inc, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, boost::proto::tag::pre_dec, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, boost::proto::tag::post_inc, TRAIT, DOMAIN, 1) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, boost::proto::tag::post_dec, TRAIT, DOMAIN, 1) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<, boost::proto::tag::shift_left, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>, boost::proto::tag::shift_right, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(*, boost::proto::tag::multiplies, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(/, boost::proto::tag::divides, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(%, boost::proto::tag::modulus, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(+, boost::proto::tag::plus, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(-, boost::proto::tag::minus, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<, boost::proto::tag::less, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>, boost::proto::tag::greater, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<=, boost::proto::tag::less_equal, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>=, boost::proto::tag::greater_equal, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(==, boost::proto::tag::equal_to, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(!=, boost::proto::tag::not_equal_to, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(||, boost::proto::tag::logical_or, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&&, boost::proto::tag::logical_and, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&, boost::proto::tag::bitwise_and, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(|, boost::proto::tag::bitwise_or, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(^, boost::proto::tag::bitwise_xor, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(BOOST_PP_COMMA(), boost::proto::tag::comma, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(->*, boost::proto::tag::mem_ptr, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<=, boost::proto::tag::shift_left_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>=, boost::proto::tag::shift_right_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(*=, boost::proto::tag::multiplies_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(/=, boost::proto::tag::divides_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(%=, boost::proto::tag::modulus_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(+=, boost::proto::tag::plus_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(-=, boost::proto::tag::minus_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&=, boost::proto::tag::bitwise_and_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(|=, boost::proto::tag::bitwise_or_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(^=, boost::proto::tag::bitwise_xor_assign, TRAIT, DOMAIN) \
+ /**/
+
+ template<typename T>
+ struct is_extension
+ : mpl::false_
+ {};
+
+ #ifndef BOOST_PROTO_DOXYGEN_INVOKED
+ namespace exops
+ {
+ BOOST_PROTO_DEFINE_OPERATORS(is_extension, default_domain)
+ using proto::if_else;
+ }
+ #endif
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/proto.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/proto.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,32 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file proto.hpp
+/// Includes the core of Proto. Not included are the contexts, transforms and
+/// debugging utilities.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_HPP_EAN_04_01_2005
+#define BOOST_PROTO_HPP_EAN_04_01_2005
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/ref.hpp>
+#include <boost/xpressive/proto/args.hpp>
+#include <boost/xpressive/proto/tags.hpp>
+#include <boost/xpressive/proto/eval.hpp>
+#include <boost/xpressive/proto/expr.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto/domain.hpp>
+#include <boost/xpressive/proto/fusion.hpp>
+#include <boost/xpressive/proto/matches.hpp>
+#include <boost/xpressive/proto/extends.hpp>
+#include <boost/xpressive/proto/literal.hpp>
+#include <boost/xpressive/proto/generate.hpp>
+#include <boost/xpressive/proto/operators.hpp>
+#include <boost/xpressive/proto/deep_copy.hpp>
+#include <boost/xpressive/proto/make_expr.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/proto_fwd.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/proto_fwd.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,722 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file proto_fwd.hpp
+/// Forward declarations of all of proto's public types and functions.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_FWD_HPP_EAN_04_01_2005
+#define BOOST_PROTO_FWD_HPP_EAN_04_01_2005
+
+#include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+#include <cstddef>
+#include <climits>
+#include <boost/config.hpp>
+#include <boost/version.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/punctuation/comma.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
+#include <boost/mpl/long.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+
+#ifndef BOOST_PROTO_MAX_ARITY
+# define BOOST_PROTO_MAX_ARITY 5
+#endif
+
+#ifndef BOOST_PROTO_MAX_LOGICAL_ARITY
+# define BOOST_PROTO_MAX_LOGICAL_ARITY 8
+#endif
+
+#ifndef BOOST_PROTO_MAX_FUNCTION_CALL_ARITY
+# define BOOST_PROTO_MAX_FUNCTION_CALL_ARITY BOOST_PROTO_MAX_ARITY
+#endif
+
+#if BOOST_PROTO_MAX_FUNCTION_CALL_ARITY > BOOST_PROTO_MAX_ARITY
+# error BOOST_PROTO_MAX_FUNCTION_CALL_ARITY cannot be larger than BOOST_PROTO_MAX_ARITY
+#endif
+
+#if BOOST_WORKAROUND(__GNUC__, == 3) \
+ || BOOST_WORKAROUND(__EDG_VERSION__, BOOST_TESTED_AT(306))
+# define BOOST_PROTO_BROKEN_CONST_OVERLOADS
+#endif
+
+#ifdef BOOST_PROTO_BROKEN_CONST_OVERLOADS
+# include <boost/utility/enable_if.hpp>
+# include <boost/type_traits/is_const.hpp>
+# define BOOST_PROTO_DISABLE_IF_IS_CONST(T)\
+ , typename boost::disable_if<boost::is_const<T>, boost::proto::detail::undefined>::type * = 0
+#else
+# define BOOST_PROTO_DISABLE_IF_IS_CONST(T)
+#endif
+
+#if BOOST_VERSION < 103500
+#define BOOST_PROTO_DEFINE_FUSION_TAG(X) typedef X tag;
+#define BOOST_PROTO_DEFINE_FUSION_CATEGORY(X)
+#define BOOST_PROTO_FUSION_RESULT_OF meta
+#define BOOST_PROTO_FUSION_EXTENSION meta
+#define BOOST_PROTO_FUSION_AT_C(N, X) at<N>(X)
+#else
+#define BOOST_PROTO_DEFINE_FUSION_TAG(X) typedef X fusion_tag;
+#define BOOST_PROTO_DEFINE_FUSION_CATEGORY(X) typedef X category;
+#define BOOST_PROTO_FUSION_RESULT_OF result_of
+#define BOOST_PROTO_FUSION_EXTENSION extension
+#define BOOST_PROTO_FUSION_AT_C(N, X) at_c<N>(X)
+#endif
+
+#include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+
+#ifdef BOOST_PROTO_DOXYGEN_INVOKED
+// HACKHACK so Doxygen shows inheritance from mpl::true_ and mpl::false_
+namespace boost
+{
+ /// INTERNAL ONLY
+ ///
+ namespace mpl
+ {
+ /// INTERNAL ONLY
+ ///
+ struct true_ {};
+ /// INTERNAL ONLY
+ ///
+ struct false_ {};
+ }
+
+ /// INTERNAL ONLY
+ ///
+ namespace fusion
+ {
+ /// INTERNAL ONLY
+ ///
+ template<typename Function>
+ class unfused_generic {};
+ }
+}
+#define BOOST_PROTO_FOR_DOXYGEN_ONLY(x) x
+#else
+#define BOOST_PROTO_FOR_DOXYGEN_ONLY(x)
+#endif
+
+namespace boost { namespace proto
+{
+ namespace detail
+ {
+ typedef char yes_type;
+ typedef char (&no_type)[2];
+
+ struct dont_care;
+ struct undefined; // leave this undefined
+
+ /// INTERNAL ONLY
+ ///
+ #define BOOST_PROTO_UNCVREF(X) \
+ typename boost::remove_const<typename boost::remove_reference<X>::type>::type
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Operator tags
+ namespace tag
+ {
+ struct terminal;
+ struct posit;
+ struct negate;
+ struct dereference;
+ struct complement;
+ struct address_of;
+ struct logical_not;
+ struct pre_inc;
+ struct pre_dec;
+ struct post_inc;
+ struct post_dec;
+
+ struct shift_left;
+ struct shift_right;
+ struct multiplies;
+ struct divides;
+ struct modulus;
+ struct plus;
+ struct minus;
+ struct less;
+ struct greater;
+ struct less_equal;
+ struct greater_equal;
+ struct equal_to;
+ struct not_equal_to;
+ struct logical_or;
+ struct logical_and;
+ struct bitwise_and;
+ struct bitwise_or;
+ struct bitwise_xor;
+ struct comma;
+ struct mem_ptr;
+
+ struct assign;
+ struct shift_left_assign;
+ struct shift_right_assign;
+ struct multiplies_assign;
+ struct divides_assign;
+ struct modulus_assign;
+ struct plus_assign;
+ struct minus_assign;
+ struct bitwise_and_assign;
+ struct bitwise_or_assign;
+ struct bitwise_xor_assign;
+ struct subscript;
+ struct if_else_;
+ struct function;
+
+ // Fusion tags
+ struct proto_expr;
+ struct proto_expr_iterator;
+ struct proto_flat_view;
+ }
+
+ namespace wildcardns_
+ {
+ struct _;
+ }
+
+ using wildcardns_::_;
+
+ namespace generatorns_
+ {
+ struct default_generator;
+
+ template<template<typename> class Extends>
+ struct generator;
+
+ template<template<typename> class Extends>
+ struct pod_generator;
+
+ template<typename Generator = default_generator>
+ struct by_value_generator;
+ }
+
+ using generatorns_::default_generator;
+ using generatorns_::generator;
+ using generatorns_::pod_generator;
+ using generatorns_::by_value_generator;
+
+ namespace domainns_
+ {
+ template<typename Generator = default_generator, typename Grammar = proto::_>
+ struct domain;
+
+ struct default_domain;
+
+ struct deduce_domain;
+ }
+
+ using domainns_::domain;
+ using domainns_::default_domain;
+ using domainns_::deduce_domain;
+
+ namespace exprns_
+ {
+ template<typename Tag, typename Args, long Arity = Args::size>
+ struct expr;
+
+ template<
+ typename Expr
+ , typename Derived
+ , typename Domain = default_domain
+ , typename Tag = typename Expr::proto_tag
+ >
+ struct extends;
+
+ struct is_proto_expr;
+ }
+
+ using exprns_::expr;
+ using exprns_::extends;
+ using exprns_::is_proto_expr;
+
+ namespace refns_
+ {
+ template<typename Expr>
+ struct ref_;
+ }
+
+ using refns_::ref_;
+
+ namespace control
+ {
+ template<
+ typename Grammar0
+ , typename Grammar1
+ , BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_PP_SUB(BOOST_PROTO_MAX_LOGICAL_ARITY,2)
+ , typename G
+ , void
+ )
+ >
+ struct or_;
+
+ template<
+ typename Grammar0
+ , typename Grammar1
+ , BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_PP_SUB(BOOST_PROTO_MAX_LOGICAL_ARITY,2)
+ , typename G
+ , void
+ )
+ >
+ struct and_;
+
+ template<typename Grammar>
+ struct not_;
+
+ template<typename Condition, typename Then = _, typename Else = not_<_> >
+ struct if_;
+
+ template<typename Cases>
+ struct switch_;
+
+ template<typename T>
+ struct exact;
+
+ template<typename T>
+ struct convertible_to;
+
+ template<typename Grammar>
+ struct vararg;
+
+ int const N = INT_MAX;
+ }
+
+ using control::if_;
+ using control::or_;
+ using control::and_;
+ using control::not_;
+ using control::switch_;
+ using control::exact;
+ using control::convertible_to;
+ using control::vararg;
+ using control::N;
+
+ namespace context
+ {
+ struct null_context;
+
+ template<typename Expr, typename Context, long Arity = Expr::proto_arity::value>
+ struct null_eval;
+
+ struct default_context;
+
+ template<typename Expr, typename Context, typename Tag = typename Expr::proto_tag, long Arity = Expr::proto_arity::value>
+ struct default_eval;
+
+ template<typename Derived, typename DefaultCtx = default_context>
+ struct callable_context;
+
+ template<typename Expr, typename Context, long Arity = Expr::proto_arity::value>
+ struct callable_eval;
+ }
+
+ using context::null_context;
+ using context::null_eval;
+ using context::default_context;
+ using context::default_eval;
+ using context::callable_context;
+ using context::callable_eval;
+
+ namespace utility
+ {
+ template<typename T, typename Domain = default_domain>
+ struct literal;
+ }
+
+ using utility::literal;
+
+ namespace result_of
+ {
+ template<typename T, typename Domain = default_domain, typename Void = void>
+ struct as_expr;
+
+ template<typename T, typename Domain = default_domain, typename Void = void>
+ struct as_arg;
+
+ template<typename Expr, typename N = mpl::long_<0> >
+ struct arg;
+
+ template<typename Expr, long N>
+ struct arg_c;
+
+ template<typename Expr>
+ struct left;
+
+ template<typename Expr>
+ struct right;
+
+ template<typename Expr>
+ struct deep_copy;
+
+ template<typename T>
+ struct unref;
+
+ template<typename Expr, typename Context>
+ struct eval;
+
+ template<
+ typename Tag
+ , typename DomainOrA0
+ BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
+ BOOST_PROTO_MAX_ARITY
+ , typename A
+ , = void BOOST_PP_INTERCEPT
+ )
+ , typename Void = void
+ >
+ struct make_expr;
+
+ template<typename Tag, typename DomainOrSequence, typename SequenceOrVoid = void, typename Void = void>
+ struct unpack_expr;
+
+ template<typename T, typename Void = void>
+ struct is_ref;
+
+ template<typename T, typename Void = void>
+ struct is_expr;
+
+ template<typename T, typename Void = void>
+ struct is_domain;
+
+ template<typename Expr>
+ struct tag_of;
+
+ template<typename T, typename Void = void>
+ struct domain_of;
+
+ template<typename Expr, typename Grammar>
+ struct matches;
+ }
+
+ using proto::result_of::is_ref;
+ using proto::result_of::is_expr;
+ using proto::result_of::is_domain;
+ using proto::result_of::tag_of;
+ using proto::result_of::domain_of;
+ using proto::result_of::matches;
+
+ namespace op
+ {
+ // Generic expression generators
+ template<typename Tag, typename Arg>
+ struct unary_expr;
+
+ template<typename Tag, typename Left, typename Right>
+ struct binary_expr;
+
+ template<typename Tag, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_ARITY, typename A, void), typename Dummy = void>
+ struct nary_expr;
+
+ // Specific expression generators, for convenience
+ template<typename T> struct terminal;
+ template<typename T> struct posit;
+ template<typename T> struct negate;
+ template<typename T> struct dereference;
+ template<typename T> struct complement;
+ template<typename T> struct address_of;
+ template<typename T> struct logical_not;
+ template<typename T> struct pre_inc;
+ template<typename T> struct pre_dec;
+ template<typename T> struct post_inc;
+ template<typename T> struct post_dec;
+
+ template<typename T, typename U> struct shift_left;
+ template<typename T, typename U> struct shift_right;
+ template<typename T, typename U> struct multiplies;
+ template<typename T, typename U> struct divides;
+ template<typename T, typename U> struct modulus;
+ template<typename T, typename U> struct plus;
+ template<typename T, typename U> struct minus;
+ template<typename T, typename U> struct less;
+ template<typename T, typename U> struct greater;
+ template<typename T, typename U> struct less_equal;
+ template<typename T, typename U> struct greater_equal;
+ template<typename T, typename U> struct equal_to;
+ template<typename T, typename U> struct not_equal_to;
+ template<typename T, typename U> struct logical_or;
+ template<typename T, typename U> struct logical_and;
+ template<typename T, typename U> struct bitwise_and;
+ template<typename T, typename U> struct bitwise_or;
+ template<typename T, typename U> struct bitwise_xor;
+ template<typename T, typename U> struct comma;
+ template<typename T, typename U> struct mem_ptr;
+
+ template<typename T, typename U> struct assign;
+ template<typename T, typename U> struct shift_left_assign;
+ template<typename T, typename U> struct shift_right_assign;
+ template<typename T, typename U> struct multiplies_assign;
+ template<typename T, typename U> struct divides_assign;
+ template<typename T, typename U> struct modulus_assign;
+ template<typename T, typename U> struct plus_assign;
+ template<typename T, typename U> struct minus_assign;
+ template<typename T, typename U> struct bitwise_and_assign;
+ template<typename T, typename U> struct bitwise_or_assign;
+ template<typename T, typename U> struct bitwise_xor_assign;
+ template<typename T, typename U> struct subscript;
+ template<typename T, typename U, typename V> struct if_else_;
+
+ template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_ARITY, typename A, void), typename Dummy = void>
+ struct function;
+ }
+
+ using namespace op;
+
+ namespace functional
+ {
+ struct left;
+ struct right;
+ struct unref;
+ struct eval;
+ struct deep_copy;
+
+ template<typename Domain = default_domain>
+ struct as_expr;
+
+ template<typename Domain = default_domain>
+ struct as_arg;
+
+ template<typename N = mpl::long_<0> >
+ struct arg;
+
+ template<long N>
+ struct arg_c;
+
+ template<typename Tag, typename Domain = deduce_domain>
+ struct make_expr;
+
+ template<typename Tag, typename Domain = deduce_domain>
+ struct unpack_expr;
+
+ template<typename Tag, typename Domain = deduce_domain>
+ struct unfused_expr_fun;
+
+ template<typename Tag, typename Domain = deduce_domain>
+ struct unfused_expr;
+
+ typedef make_expr<tag::terminal> make_terminal;
+ typedef make_expr<tag::posit> make_posit;
+ typedef make_expr<tag::negate> make_negate;
+ typedef make_expr<tag::dereference> make_dereference;
+ typedef make_expr<tag::complement> make_complement;
+ typedef make_expr<tag::address_of> make_address_of;
+ typedef make_expr<tag::logical_not> make_logical_not;
+ typedef make_expr<tag::pre_inc> make_pre_inc;
+ typedef make_expr<tag::pre_dec> make_pre_dec;
+ typedef make_expr<tag::post_inc> make_post_inc;
+ typedef make_expr<tag::post_dec> make_post_dec;
+ typedef make_expr<tag::shift_left> make_shift_left;
+ typedef make_expr<tag::shift_right> make_shift_right;
+ typedef make_expr<tag::multiplies> make_multiplies;
+ typedef make_expr<tag::divides> make_divides;
+ typedef make_expr<tag::modulus> make_modulus;
+ typedef make_expr<tag::plus> make_plus;
+ typedef make_expr<tag::minus> make_minus;
+ typedef make_expr<tag::less> make_less;
+ typedef make_expr<tag::greater> make_greater;
+ typedef make_expr<tag::less_equal> make_less_equal;
+ typedef make_expr<tag::greater_equal> make_greater_equal;
+ typedef make_expr<tag::equal_to> make_equal_to;
+ typedef make_expr<tag::not_equal_to> make_not_equal_to;
+ typedef make_expr<tag::logical_or> make_logical_or;
+ typedef make_expr<tag::logical_and> make_logical_and;
+ typedef make_expr<tag::bitwise_and> make_bitwise_and;
+ typedef make_expr<tag::bitwise_or> make_bitwise_or;
+ typedef make_expr<tag::bitwise_xor> make_bitwise_xor;
+ typedef make_expr<tag::comma> make_comma;
+ typedef make_expr<tag::mem_ptr> make_mem_ptr;
+ typedef make_expr<tag::assign> make_assign;
+ typedef make_expr<tag::shift_left_assign> make_shift_left_assign;
+ typedef make_expr<tag::shift_right_assign> make_shift_right_assign;
+ typedef make_expr<tag::multiplies_assign> make_multiplies_assign;
+ typedef make_expr<tag::divides_assign> make_divides_assign;
+ typedef make_expr<tag::modulus_assign> make_modulus_assign;
+ typedef make_expr<tag::plus_assign> make_plus_assign;
+ typedef make_expr<tag::minus_assign> make_minus_assign;
+ typedef make_expr<tag::bitwise_and_assign> make_bitwise_and_assign;
+ typedef make_expr<tag::bitwise_or_assign> make_bitwise_or_assign;
+ typedef make_expr<tag::bitwise_xor_assign> make_bitwise_xor_assign;
+ typedef make_expr<tag::subscript> make_subscript;
+ typedef make_expr<tag::if_else_> make_if_else;
+ typedef make_expr<tag::function> make_function;
+
+ struct flatten;
+ struct pop_front;
+ struct reverse;
+ }
+
+ typedef functional::make_terminal _make_terminal;
+ typedef functional::make_posit _make_posit;
+ typedef functional::make_negate _make_negate;
+ typedef functional::make_dereference _make_dereference;
+ typedef functional::make_complement _make_complement;
+ typedef functional::make_address_of _make_address_of;
+ typedef functional::make_logical_not _make_logical_not;
+ typedef functional::make_pre_inc _make_pre_inc;
+ typedef functional::make_pre_dec _make_pre_dec;
+ typedef functional::make_post_inc _make_post_inc;
+ typedef functional::make_post_dec _make_post_dec;
+ typedef functional::make_shift_left _make_shift_left;
+ typedef functional::make_shift_right _make_shift_right;
+ typedef functional::make_multiplies _make_multiplies;
+ typedef functional::make_divides _make_divides;
+ typedef functional::make_modulus _make_modulus;
+ typedef functional::make_plus _make_plus;
+ typedef functional::make_minus _make_minus;
+ typedef functional::make_less _make_less;
+ typedef functional::make_greater _make_greater;
+ typedef functional::make_less_equal _make_less_equal;
+ typedef functional::make_greater_equal _make_greater_equal;
+ typedef functional::make_equal_to _make_equal_to;
+ typedef functional::make_not_equal_to _make_not_equal_to;
+ typedef functional::make_logical_or _make_logical_or;
+ typedef functional::make_logical_and _make_logical_and;
+ typedef functional::make_bitwise_and _make_bitwise_and;
+ typedef functional::make_bitwise_or _make_bitwise_or;
+ typedef functional::make_bitwise_xor _make_bitwise_xor;
+ typedef functional::make_comma _make_comma;
+ typedef functional::make_mem_ptr _make_mem_ptr;
+ typedef functional::make_assign _make_assign;
+ typedef functional::make_shift_left_assign _make_shift_left_assign;
+ typedef functional::make_shift_right_assign _make_shift_right_assign;
+ typedef functional::make_multiplies_assign _make_multiplies_assign;
+ typedef functional::make_divides_assign _make_divides_assign;
+ typedef functional::make_modulus_assign _make_modulus_assign;
+ typedef functional::make_plus_assign _make_plus_assign;
+ typedef functional::make_minus_assign _make_minus_assign;
+ typedef functional::make_bitwise_and_assign _make_bitwise_and_assign;
+ typedef functional::make_bitwise_or_assign _make_bitwise_or_assign;
+ typedef functional::make_bitwise_xor_assign _make_bitwise_xor_assign;
+ typedef functional::make_subscript _make_subscript;
+ typedef functional::make_if_else _make_if_else;
+ typedef functional::make_function _make_function;
+
+ typedef functional::flatten _flatten;
+ typedef functional::pop_front _pop_front;
+ typedef functional::reverse _reverse;
+ typedef functional::deep_copy _eval;
+ typedef functional::deep_copy _deep_copy;
+
+ template<typename T>
+ struct is_callable;
+
+ template<typename T>
+ struct is_aggregate;
+
+ namespace transform
+ {
+ #define BOOST_PROTO_CALLABLE() typedef void proto_is_callable_;
+
+ struct callable
+ {
+ BOOST_PROTO_CALLABLE()
+ };
+
+ template<typename Grammar, typename Fun = Grammar>
+ struct when;
+
+ template<typename Fun>
+ struct otherwise;
+
+ template<typename Fun>
+ struct call;
+
+ template<typename Fun>
+ struct make;
+
+ template<typename Fun>
+ struct bind;
+
+ template<typename Sequence, typename State, typename Fun>
+ struct fold;
+
+ template<typename Sequence, typename State, typename Fun>
+ struct reverse_fold;
+
+ // BUGBUG can we replace fold_tree with fold<flatten(_), state, fun> ?
+ template<typename Sequence, typename State, typename Fun>
+ struct fold_tree;
+
+ template<typename Sequence, typename State, typename Fun>
+ struct reverse_fold_tree;
+
+ template<typename Grammar>
+ struct pass_through;
+
+ struct expr;
+ struct state;
+ struct visitor;
+
+ template<int I>
+ struct arg_c;
+
+ typedef arg_c<0> arg0;
+ typedef arg_c<1> arg1;
+ typedef arg_c<2> arg2;
+ typedef arg_c<3> arg3;
+ typedef arg_c<4> arg4;
+ typedef arg_c<5> arg5;
+ typedef arg_c<6> arg6;
+ typedef arg_c<7> arg7;
+ typedef arg_c<8> arg8;
+ typedef arg_c<9> arg9;
+
+ typedef arg0 arg;
+ typedef arg0 left;
+ typedef arg1 right;
+
+ struct _ref;
+ }
+
+ using transform::when;
+ using transform::call;
+ using transform::make;
+ using transform::bind;
+ using transform::fold;
+ using transform::otherwise;
+ using transform::reverse_fold;
+ using transform::fold_tree;
+ using transform::reverse_fold_tree;
+ using transform::callable;
+ using transform::pass_through;
+
+ typedef transform::expr _expr;
+ typedef transform::state _state;
+ typedef transform::visitor _visitor;
+ typedef transform::arg0 _arg0;
+ typedef transform::arg1 _arg1;
+ typedef transform::arg2 _arg2;
+ typedef transform::arg3 _arg3;
+ typedef transform::arg4 _arg4;
+ typedef transform::arg5 _arg5;
+ typedef transform::arg6 _arg6;
+ typedef transform::arg7 _arg7;
+ typedef transform::arg8 _arg8;
+ typedef transform::arg9 _arg9;
+ typedef transform::arg _arg;
+ typedef transform::left _left;
+ typedef transform::right _right;
+
+ template<int I>
+ struct _arg_c;
+
+ using transform::_ref;
+
+ template<typename T>
+ struct is_extension;
+
+ namespace exops
+ {}
+
+ typedef void ignore_();
+ inline void ignore()
+ {}
+
+}} // namespace boost::proto
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/proto_typeof.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/proto_typeof.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,135 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file proto_typeof.hpp
+/// Type registrations so that proto expression templates can be used together
+/// with the Boost.Typeof library.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_PROTO_PROTO_TYPEOF_H
+#define BOOST_XPRESSIVE_PROTO_PROTO_TYPEOF_H
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/config.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/deep_copy.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::terminal)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::posit)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::negate)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::dereference)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::complement)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::address_of)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::logical_not)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::pre_inc)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::pre_dec)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::post_inc)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::post_dec)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::shift_left)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::shift_right)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::multiplies)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::divides)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::modulus)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::plus)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::minus)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::less)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::greater)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::less_equal)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::greater_equal)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::equal_to)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::not_equal_to)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::logical_or)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::logical_and)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::bitwise_and)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::bitwise_or)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::bitwise_xor)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::comma)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::mem_ptr)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::shift_left_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::shift_right_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::multiplies_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::divides_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::modulus_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::plus_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::minus_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::bitwise_and_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::bitwise_or_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::bitwise_xor_assign)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::subscript)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::if_else_)
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::tag::function)
+
+BOOST_TYPEOF_REGISTER_TYPE(boost::proto::exprns_::is_proto_expr)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::refns_::ref_, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::exprns_::expr, (typename)(typename)(long))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::utility::literal, (typename)(typename))
+
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args0, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args1, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args2, 2)
+// can't use PP metaprogramming here because all typeof registrations
+// must be on separate lines.
+#if BOOST_PROTO_MAX_ARITY >= 3
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args3, 3)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 4
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args4, 4)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 5
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args5, 5)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 6
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args6, 6)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 7
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args7, 7)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 8
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args8, 8)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 9
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args9, 9)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 10
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args10, 10)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 11
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args11, 11)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 12
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args12, 12)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 13
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args13, 13)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 14
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args14, 14)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 15
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args15, 15)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 16
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args16, 16)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 17
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args17, 17)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 18
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args18, 18)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 19
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args19, 19)
+#endif
+#if BOOST_PROTO_MAX_ARITY >= 20
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::proto::argsns_::args20, 20)
+#endif
+
+#define BOOST_PROTO_AUTO(Var, Expr) BOOST_AUTO(Var, boost::proto::deep_copy(Expr))
+#define BOOST_PROTO_AUTO_TPL(Var, Expr) BOOST_AUTO_TPL(Var, boost::proto::deep_copy(Expr))
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/ref.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/ref.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,260 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file ref.hpp
+/// Utility for storing a sub-expr by reference
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_REF_HPP_EAN_04_01_2005
+#define BOOST_PROTO_REF_HPP_EAN_04_01_2005
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(push)
+# pragma warning(disable : 4510) // default constructor could not be generated
+# pragma warning(disable : 4512) // assignment operator could not be generated
+# pragma warning(disable : 4610) // user defined constructor required
+#endif
+
+namespace boost { namespace proto
+{
+
+#define BOOST_PROTO_ARG(z, n, data) \
+ typedef \
+ typename Expr::BOOST_PP_CAT(proto_arg, n) \
+ BOOST_PP_CAT(proto_arg, n); \
+ /**/
+
+ namespace refns_
+ {
+ /// \brief A simple reference wrapper for a Proto expression type,
+ /// used by <tt>expr\<\></tt> to hold children expressions by reference.
+ ///
+ /// <tt>ref_\<\></tt> is used by <tt>expr\<\></tt> to hold children
+ /// expression types by reference. It forwards enough of the child
+ /// expression's interface so that <tt>expr\<\></tt> can handle children
+ /// uniformly regardless of whether it is stored by reference or by
+ /// value.
+ ///
+ /// This type is largely an implementation detail.
+ template<typename Expr>
+ struct ref_
+ {
+ typedef typename Expr::proto_base_expr proto_base_expr;
+ typedef typename Expr::proto_tag proto_tag;
+ typedef typename Expr::proto_args proto_args;
+ typedef typename Expr::proto_arity proto_arity;
+ typedef typename Expr::proto_domain proto_domain;
+ typedef void proto_is_ref_;
+ typedef void proto_is_expr_;
+ typedef Expr proto_derived_expr;
+
+ BOOST_PP_REPEAT(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_ARG, _)
+
+ typename mpl::if_c<
+ is_const<Expr>::value
+ , proto_base_expr const &
+ , proto_base_expr &
+ >::type
+ proto_base() const
+ {
+ return this->expr.proto_base();
+ }
+
+ static ref_<Expr> make(Expr &expr)
+ {
+ ref_<Expr> that = {expr};
+ return that;
+ }
+
+ Expr &expr;
+ };
+
+ // ref_-to-ref_ is not allowed. this will cause a compile error.
+ /// INTERNAL ONLY
+ template<typename Expr>
+ struct ref_<ref_<Expr> >
+ {};
+ }
+
+#undef BOOST_PROTO_ARG
+
+ namespace result_of
+ {
+ /// \brief Trait for stripping top-level references
+ /// and reference wrappers.
+ template<typename T>
+ struct unref
+ {
+ typedef T type; ///< Suitable for return by value
+ typedef T &reference; ///< Suitable for return by reference
+ typedef T const &const_reference; ///< Suitable for return by const reference
+ };
+
+ /// \brief Trait for stripping top-level references
+ /// and reference wrappers.
+ template<typename T>
+ struct unref<ref_<T> >
+ {
+ typedef T type; ///< Suitable for return by value
+ typedef T &reference; ///< Suitable for return by reference
+ typedef T &const_reference; ///< Suitable for return by const reference
+ };
+
+ /// \brief Trait for stripping top-level references
+ /// and reference wrappers.
+ template<typename T>
+ struct unref<ref_<T const> >
+ {
+ typedef T type; ///< Suitable for return by value
+ typedef T const &reference; ///< Suitable for return by reference
+ typedef T const &const_reference; ///< Suitable for return by const reference
+ };
+
+ /// \brief Trait for stripping top-level references
+ /// and reference wrappers.
+ template<typename T>
+ struct unref<T &>
+ {
+ typedef T type; ///< Suitable for return by value
+ typedef T &reference; ///< Suitable for return by reference
+ typedef T &const_reference; ///< Suitable for return by const reference
+ };
+
+ /// \brief Trait for stripping top-level references
+ /// and reference wrappers.
+ template<typename T>
+ struct unref<T const &>
+ {
+ typedef T type; ///< Suitable for return by value
+ typedef T const &reference; ///< Suitable for return by reference
+ typedef T const &const_reference; ///< Suitable for return by const reference
+ };
+
+ /// \brief Trait for stripping top-level references
+ /// and reference wrappers.
+ template<typename T, std::size_t N>
+ struct unref<T (&)[N]>
+ {
+ typedef T (&type)[N]; ///< Suitable for return by value
+ typedef T (&reference)[N]; ///< Suitable for return by reference
+ typedef T (&const_reference)[N]; ///< Suitable for return by const reference
+ };
+
+ /// \brief Trait for stripping top-level references
+ /// and reference wrappers.
+ template<typename T, std::size_t N>
+ struct unref<T const (&)[N]>
+ {
+ typedef T const (&type)[N]; ///< Suitable for return by value
+ typedef T const (&reference)[N]; ///< Suitable for return by reference
+ typedef T const (&const_reference)[N]; ///< Suitable for return by const reference
+ };
+ }
+
+ namespace functional
+ {
+ /// \brief A callable PolymorphicFunctionObject equivalent
+ /// to the <tt>proto::unref()</tt> function that removes
+ /// top-level reference wrappers.
+ struct unref
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename T>
+ struct result;
+
+ template<typename This, typename T>
+ struct result<This(T)>
+ {
+ typedef BOOST_PROTO_UNCVREF(T) uncvref_type;
+ typedef typename result_of::unref<uncvref_type>::type type;
+ };
+
+ /// \brief Remove a top-level <tt>ref_\<\></tt> reference wrapper,
+ /// if it exists.
+ /// \param t The object to unwrap
+ /// \return If \c T t is a <tt>ref_\<\></tt>, return <tt>t.expr</tt>.
+ /// Otherwise, return \c t.
+ template<typename T>
+ T &operator()(T &t) const
+ {
+ return t;
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ T const &operator()(T const &t) const
+ {
+ return t;
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ T &operator()(ref_<T> &t) const
+ {
+ return t.expr;
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ T &operator()(ref_<T> const &t) const
+ {
+ return t.expr;
+ }
+ };
+ }
+
+ /// \brief Remove a top-level <tt>ref_\<\></tt> reference wrapper, if
+ /// it exists.
+ /// \param t The object to unwrap
+ /// \throw nothrow
+ /// \return If \c T t is a <tt>ref_\<\></tt>, return <tt>t.expr</tt>.
+ /// Otherwise, return \c t.
+ template<typename T>
+ T &unref(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T))
+ {
+ return t;
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ T const &unref(T const &t)
+ {
+ return t;
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ T &unref(ref_<T> &t)
+ {
+ return t.expr;
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ T &unref(ref_<T> const &t)
+ {
+ return t.expr;
+ }
+}}
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/tags.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/tags.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,156 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file tags.hpp
+/// Contains the tags for all the overloadable operators in C++
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_TAGS_HPP_EAN_04_01_2005
+#define BOOST_PROTO_TAGS_HPP_EAN_04_01_2005
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+namespace boost { namespace proto { namespace tag
+{
+
+ /// Tag type for terminals; aka, leaves in the expression tree.
+ struct terminal {};
+
+ /// Tag type for the unary + operator.
+ struct posit {};
+
+ /// Tag type for the unary - operator.
+ struct negate {};
+
+ /// Tag type for the unary * operator.
+ struct dereference {};
+
+ /// Tag type for the unary ~ operator.
+ struct complement {};
+
+ /// Tag type for the unary & operator.
+ struct address_of {};
+
+ /// Tag type for the unary ! operator.
+ struct logical_not {};
+
+ /// Tag type for the unary prefix ++ operator.
+ struct pre_inc {};
+
+ /// Tag type for the unary prefix -- operator.
+ struct pre_dec {};
+
+ /// Tag type for the unary postfix ++ operator.
+ struct post_inc {};
+
+ /// Tag type for the unary postfix -- operator.
+ struct post_dec {};
+
+ /// Tag type for the binary \<\< operator.
+ struct shift_left {};
+
+ /// Tag type for the binary \>\> operator.
+ struct shift_right {};
+
+ /// Tag type for the binary * operator.
+ struct multiplies {};
+
+ /// Tag type for the binary / operator.
+ struct divides {};
+
+ /// Tag type for the binary % operator.
+ struct modulus {};
+
+ /// Tag type for the binary + operator.
+ struct plus {};
+
+ /// Tag type for the binary - operator.
+ struct minus {};
+
+ /// Tag type for the binary \< operator.
+ struct less {};
+
+ /// Tag type for the binary \> operator.
+ struct greater {};
+
+ /// Tag type for the binary \<= operator.
+ struct less_equal {};
+
+ /// Tag type for the binary \>= operator.
+ struct greater_equal {};
+
+ /// Tag type for the binary == operator.
+ struct equal_to {};
+
+ /// Tag type for the binary != operator.
+ struct not_equal_to {};
+
+ /// Tag type for the binary || operator.
+ struct logical_or {};
+
+ /// Tag type for the binary && operator.
+ struct logical_and {};
+
+ /// Tag type for the binary & operator.
+ struct bitwise_and {};
+
+ /// Tag type for the binary | operator.
+ struct bitwise_or {};
+
+ /// Tag type for the binary ^ operator.
+ struct bitwise_xor {};
+
+ /// Tag type for the binary , operator.
+ struct comma {};
+
+ /// Tag type for the binary ->* operator.
+ struct mem_ptr {};
+
+ /// Tag type for the binary = operator.
+ struct assign {};
+
+ /// Tag type for the binary \<\<= operator.
+ struct shift_left_assign {};
+
+ /// Tag type for the binary \>\>= operator.
+ struct shift_right_assign {};
+
+ /// Tag type for the binary *= operator.
+ struct multiplies_assign {};
+
+ /// Tag type for the binary /= operator.
+ struct divides_assign {};
+
+ /// Tag type for the binary %= operator.
+ struct modulus_assign {};
+
+ /// Tag type for the binary += operator.
+ struct plus_assign {};
+
+ /// Tag type for the binary -= operator.
+ struct minus_assign {};
+
+ /// Tag type for the binary &= operator.
+ struct bitwise_and_assign {};
+
+ /// Tag type for the binary |= operator.
+ struct bitwise_or_assign {};
+
+ /// Tag type for the binary ^= operator.
+ struct bitwise_xor_assign {};
+
+ /// Tag type for the binary subscript operator.
+ struct subscript {};
+
+ /// Tag type for the ternary ?: conditional operator.
+ struct if_else_ {};
+
+ /// Tag type for the nary function call operator.
+ struct function {};
+
+}}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/traits.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/traits.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,2856 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file traits.hpp
+ /// Contains definitions for arg\<\>, arg_c\<\>, left\<\>,
+ /// right\<\>, tag_of\<\>, and the helper functions arg(), arg_c(),
+ /// left() and right().
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_ARG_TRAITS_HPP_EAN_04_01_2005
+ #define BOOST_PROTO_ARG_TRAITS_HPP_EAN_04_01_2005
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/config.hpp>
+ #include <boost/detail/workaround.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
+ #include <boost/preprocessor/repetition/repeat_from_to.hpp>
+ #include <boost/preprocessor/facilities/intercept.hpp>
+ #include <boost/preprocessor/arithmetic/sub.hpp>
+ #include <boost/ref.hpp>
+ #include <boost/mpl/if.hpp>
+ #include <boost/mpl/or.hpp>
+ #include <boost/mpl/bool.hpp>
+ #include <boost/mpl/eval_if.hpp>
+ #include <boost/mpl/aux_/template_arity.hpp>
+ #include <boost/mpl/aux_/lambda_arity_param.hpp>
+ #include <boost/static_assert.hpp>
+ #include <boost/utility/result_of.hpp>
+ #include <boost/type_traits/is_pod.hpp>
+ #include <boost/type_traits/is_same.hpp>
+ #include <boost/type_traits/is_array.hpp>
+ #include <boost/type_traits/is_function.hpp>
+ #include <boost/type_traits/remove_cv.hpp>
+ #include <boost/type_traits/remove_const.hpp>
+ #include <boost/type_traits/add_reference.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/ref.hpp>
+ #include <boost/xpressive/proto/args.hpp>
+ #include <boost/xpressive/proto/tags.hpp>
+ #include <boost/xpressive/proto/transform/pass_through.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ #if BOOST_WORKAROUND( BOOST_MSVC, == 1310 )
+ #define BOOST_PROTO_IS_ARRAY_(T) boost::is_array<typename boost::remove_const<T>::type>
+ #else
+ #define BOOST_PROTO_IS_ARRAY_(T) boost::is_array<T>
+ #endif
+
+ #if BOOST_WORKAROUND( BOOST_MSVC, >= 1400 )
+ #pragma warning(push)
+ #pragma warning(disable: 4180) // warning C4180: qualifier applied to function type has no meaning; ignored
+ #endif
+
+ namespace boost { namespace proto
+ {
+ namespace detail
+ {
+ template<typename T, typename Void = void>
+ struct if_vararg
+ {};
+
+ template<typename T>
+ struct if_vararg<T, typename T::proto_is_vararg_>
+ : T
+ {};
+
+ template<typename T, typename Void = void>
+ struct is_callable2_
+ : mpl::false_
+ {};
+
+ template<typename T>
+ struct is_callable2_<T, typename T::proto_is_callable_>
+ : mpl::true_
+ {};
+
+ template<typename T BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(long Arity = mpl::aux::template_arity<T>::value)>
+ struct is_callable_
+ : is_callable2_<T>
+ {};
+ }
+
+ /// \brief Boolean metafunction which detects whether a type is
+ /// a callable function object type or not.
+ ///
+ /// <tt>is_callable\<\></tt> is used by the <tt>when\<\></tt> transform
+ /// to determine whether a function type <tt>R(A1,A2,...AN)</tt> is a
+ /// callable transform or an object transform. (The former are evaluated
+ /// using <tt>call\<\></tt> and the later with <tt>make\<\></tt>.) If
+ /// <tt>is_callable\<R\>::::value</tt> is \c true, the function type is
+ /// a callable transform; otherwise, it is an object transform.
+ ///
+ /// Unless specialized for a type \c T, <tt>is_callable\<T\>::::value</tt>
+ /// is computed as follows:
+ ///
+ /// \li If \c T is a template type <tt>X\<Y0,Y1,...YN\></tt>, where all \c Yx
+ /// are types for \c x in <tt>[0,N]</tt>, <tt>is_callable\<T\>::::value</tt>
+ /// is <tt>is_same\<YN, proto::callable\>::::value</tt>.
+ /// \li If \c T has a nested type \c proto_is_callable_ that is a typedef
+ /// for \c void, <tt>is_callable\<T\>::::value</tt> is \c true. (Note: this is
+ /// the case for any type that derives from \c proto::callable.)
+ /// \li Otherwise, <tt>is_callable\<T\>::::value</tt> is \c false.
+ template<typename T>
+ struct is_callable
+ : proto::detail::is_callable_<T>
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<proto::_>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<proto::callable>
+ : mpl::false_
+ {};
+
+ #if BOOST_WORKAROUND(__GNUC__, == 3)
+ // work around GCC bug
+ template<typename Tag, typename Args, long N>
+ struct is_callable<proto::expr<Tag, Args, N> >
+ : mpl::false_
+ {};
+ #endif
+
+ /// \brief A Boolean metafunction that indicates whether a type requires
+ /// aggregate initialization.
+ ///
+ /// <tt>is_aggregate\<\></tt> is used by the <tt>make\<\></tt> transform
+ /// to determine how to construct an object of some type \c T, given some
+ /// initialization arguments <tt>a0,a1,...aN</tt>.
+ /// If <tt>is_aggregate\<T\>::::value</tt> is \c true, then an object of
+ /// type T will be initialized as <tt>T t = {a0,a1,...aN};</tt>. Otherwise,
+ /// it will be initialized as <tt>T t(a0,a1,...aN)</tt>.
+ template<typename T>
+ struct is_aggregate
+ : is_pod<T>
+ {};
+
+ /// \brief Specialization of <tt>is_aggregate\<\></tt> that indicates
+ /// that objects of <tt>expr\<\></tt> type require aggregate initialization.
+ template<typename Tag, typename Args, long N>
+ struct is_aggregate<proto::expr<Tag, Args, N> >
+ : mpl::true_
+ {};
+
+ namespace result_of
+ {
+ /// \brief A Boolean metafunction that indicates whether a given
+ /// type \c T is a Proto expression type.
+ ///
+ /// If \c T has a nested type \c proto_is_expr_ that is a typedef
+ /// for \c void, <tt>is_expr\<T\>::::value</tt> is \c true. (Note, this
+ /// is the case for <tt>proto::expr\<\></tt>, any type that is derived
+ /// from <tt>proto::extends\<\></tt> or that uses the
+ /// <tt>BOOST_PROTO_EXTENDS()</tt> macro.) Otherwise,
+ /// <tt>is_expr\<T\>::::value</tt> is \c false.
+ template<typename T, typename Void BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)>
+ struct is_expr
+ : mpl::false_
+ {};
+
+ /// \brief A Boolean metafunction that indicates whether a given
+ /// type \c T is a Proto expression type.
+ ///
+ /// If \c T has a nested type \c proto_is_expr_ that is a typedef
+ /// for \c void, <tt>is_expr\<T\>::::value</tt> is \c true. (Note, this
+ /// is the case for <tt>proto::expr\<\></tt>, any type that is derived
+ /// from <tt>proto::extends\<\></tt> or that uses the
+ /// <tt>BOOST_PROTO_EXTENDS()</tt> macro.) Otherwise,
+ /// <tt>is_expr\<T\>::::value</tt> is \c false.
+ template<typename T>
+ struct is_expr<T, typename T::proto_is_expr_>
+ : mpl::true_
+ {};
+
+ /// \brief A metafunction that returns the tag type of a
+ /// Proto expression.
+ template<typename Expr>
+ struct tag_of
+ {
+ typedef typename Expr::proto_tag type;
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T, typename Void BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)>
+ struct is_ref
+ : mpl::false_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T>
+ struct is_ref<T, typename T::proto_is_ref_>
+ : mpl::true_
+ {};
+
+ /// \brief A metafunction that computes the return type of the \c as_expr()
+ /// function.
+ ///
+ /// The <tt>as_expr\<\></tt> metafunction turns types into Proto types, if
+ /// they are not already, by making them Proto terminals held by value if
+ /// possible. Types which are already Proto types are left alone.
+ ///
+ /// This specialization is selected when the type is not yet a Proto type.
+ /// The resulting terminal type is calculated as follows:
+ ///
+ /// If \c T is an array type or a function type, let \c A be <tt>T &</tt>.
+ /// Otherwise, let \c A be the type \c T stripped of cv-qualifiers.
+ /// Then, the result type <tt>as_expr\<T, Domain\>::::type</tt> is
+ /// <tt>Domain::apply\< expr\< tag::terminal, args0\<A\> \> \>::::type</tt>.
+ template<
+ typename T
+ , typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)
+ , typename Void BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)
+ >
+ struct as_expr
+ {
+ typedef mpl::or_<BOOST_PROTO_IS_ARRAY_(T), is_function<T> > is_unstorable_;
+ typedef typename mpl::eval_if<is_unstorable_, add_reference<T>, remove_cv<T> >::type arg0_;
+ typedef proto::expr<proto::tag::terminal, args0<arg0_> > expr_;
+ typedef typename Domain::template apply<expr_>::type type;
+ typedef type const reference;
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T2>
+ static reference call(T2 &t)
+ {
+ return Domain::make(expr_::make(t));
+ }
+ };
+
+ /// \brief A metafunction that computes the return type of the \c as_expr()
+ /// function.
+ ///
+ /// The <tt>as_expr\<\></tt> metafunction turns types into Proto types, if
+ /// they are not already, by making them Proto terminals held by value if
+ /// possible. Types which are already Proto types are left alone.
+ ///
+ /// This specialization is selected when the type is already a Proto type.
+ /// The result type <tt>as_expr\<T, Domain\>::::type</tt> is \c T stripped
+ /// of cv-qualifiers.
+ template<typename T, typename Domain>
+ struct as_expr<T, Domain, typename T::proto_is_expr_>
+ {
+ typedef typename T::proto_derived_expr type;
+ typedef T &reference;
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T2>
+ static reference call(T2 &t)
+ {
+ return t;
+ }
+ };
+
+ /// \brief A metafunction that computes the return type of the \c as_arg()
+ /// function.
+ ///
+ /// The <tt>as_arg\<\></tt> metafunction turns types into Proto types, if
+ /// they are not already, by making them Proto terminals held by reference.
+ /// Types which are already Proto types are wrapped in <tt>proto::ref_\<\></tt>.
+ ///
+ /// This specialization is selected when the type is not yet a Proto type.
+ /// The result type <tt>as_arg\<T, Domain\>::::type</tt> is
+ /// <tt>Domain::apply\< expr\< tag::terminal, args0\<T &\> \> \>::::type</tt>.
+ template<
+ typename T
+ , typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)
+ , typename Void BOOST_PROTO_FOR_DOXYGEN_ONLY(= void)
+ >
+ struct as_arg
+ {
+ typedef proto::expr<proto::tag::terminal, args0<T &> > expr_;
+ typedef typename Domain::template apply<expr_>::type type;
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T2>
+ static type call(T2 &t)
+ {
+ return Domain::make(expr_::make(t));
+ }
+ };
+
+ /// \brief A metafunction that computes the return type of the \c as_arg()
+ /// function.
+ ///
+ /// The <tt>as_arg\<\></tt> metafunction turns types into Proto types, if
+ /// they are not already, by making them Proto terminals held by reference.
+ /// Types which are already Proto types are wrapped in <tt>proto::ref_\<\></tt>.
+ ///
+ /// This specialization is selected when the type is already a Proto type.
+ /// The result type <tt>as_arg\<T, Domain\>::::type</tt> is
+ /// <tt>proto::ref_\<T\></tt>.
+ template<typename T, typename Domain>
+ struct as_arg<T, Domain, typename T::proto_is_expr_>
+ {
+ typedef ref_<T> type;
+
+ /// INTERNAL ONLY
+ ///
+ template<typename T2>
+ static type call(T2 &t)
+ {
+ return type::make(t);
+ }
+ };
+
+ /// \brief A metafunction that returns the type of the Nth child
+ /// of a Proto expression, where N is an MPL Integral Constant.
+ ///
+ /// <tt>result_of::arg\<Expr, N\></tt> is equivalent to
+ /// <tt>result_of::arg_c\<Expr, N::value\></tt>.
+ template<typename Expr, typename N BOOST_PROTO_FOR_DOXYGEN_ONLY(= mpl::long_<0>) >
+ struct arg
+ : arg_c<Expr, N::value>
+ {};
+
+ // TODO left<> and right<> force the instantiation of Expr.
+ // Couldn't we partially specialize them on proto::expr< T, A >
+ // and ref_< proto::expr< T, A > > and return A::arg0 / A::arg1?
+
+ /// \brief A metafunction that returns the type of the left child
+ /// of a binary Proto expression.
+ ///
+ /// <tt>result_of::left\<Expr\></tt> is equivalent to
+ /// <tt>result_of::arg_c\<Expr, 0\></tt>.
+ template<typename Expr>
+ struct left
+ {
+ typedef typename Expr::proto_arg0 wrapped_type;
+ typedef typename unref<wrapped_type>::type type;
+ typedef typename unref<wrapped_type>::reference reference;
+ typedef typename unref<wrapped_type>::const_reference const_reference;
+ };
+
+ /// \brief A metafunction that returns the type of the right child
+ /// of a binary Proto expression.
+ ///
+ /// <tt>result_of::right\<Expr\></tt> is equivalent to
+ /// <tt>result_of::arg_c\<Expr, 1\></tt>.
+ template<typename Expr>
+ struct right
+ {
+ typedef typename Expr::proto_arg1 wrapped_type;
+ typedef typename unref<wrapped_type>::type type;
+ typedef typename unref<wrapped_type>::reference reference;
+ typedef typename unref<wrapped_type>::const_reference const_reference;
+ };
+
+ } // namespace result_of
+
+ namespace op
+ {
+ /// \brief A metafunction for generating terminal expression types,
+ /// a grammar element for matching terminal expressions, and a
+ /// PrimitiveTransform that returns the current expression unchanged.
+ template<typename T>
+ struct terminal
+ {
+ typedef proto::expr<proto::tag::terminal, args0<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef Expr type;
+ };
+
+ /// \param expr The current expression
+ /// \pre <tt>matches\<Expr, terminal\<T\> \>::::value</tt> is \c true.
+ /// \return \c expr
+ /// \throw nothrow
+ template<typename Expr, typename State, typename Visitor>
+ Expr const &operator ()(Expr const &expr, State const &, Visitor &) const
+ {
+ return expr;
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::terminal proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating ternary conditional expression types,
+ /// a grammar element for matching ternary conditional expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U, typename V>
+ struct if_else_
+ {
+ typedef proto::expr<proto::tag::if_else_, args3<T, U, V> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<if_else_>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, if_else_\<T,U,V\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<if_else_\<T,U,V\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<if_else_>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::if_else_ proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ /// INTERNAL ONLY
+ typedef V proto_arg2;
+ };
+
+ /// \brief A metafunction for generating unary expression types with a
+ /// specified tag type,
+ /// a grammar element for matching unary expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ ///
+ /// Use <tt>unary_expr\<_, _\></tt> as a grammar element to match any
+ /// unary expression.
+ template<typename Tag, typename T>
+ struct unary_expr
+ {
+ typedef proto::expr<Tag, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<unary_expr>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, unary_expr\<Tag, T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<unary_expr\<Tag, T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<unary_expr>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef Tag proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating binary expression types with a
+ /// specified tag type,
+ /// a grammar element for matching binary expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ ///
+ /// Use <tt>binary_expr\<_, _, _\></tt> as a grammar element to match any
+ /// binary expression.
+ template<typename Tag, typename T, typename U>
+ struct binary_expr
+ {
+ typedef proto::expr<Tag, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<binary_expr>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, binary_expr\<Tag,T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<binary_expr\<Tag,T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<binary_expr>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef Tag proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating unary plus expression types,
+ /// a grammar element for matching unary plus expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct posit
+ {
+ typedef proto::expr<proto::tag::posit, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<posit>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, posit\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<posit\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<posit>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::posit proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating unary minus expression types,
+ /// a grammar element for matching unary minus expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct negate
+ {
+ typedef proto::expr<proto::tag::negate, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<negate>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, negate\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<negate\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<negate>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::negate proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating defereference expression types,
+ /// a grammar element for matching dereference expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct dereference
+ {
+ typedef proto::expr<proto::tag::dereference, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<dereference>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, dereference\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<dereference\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<dereference>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::dereference proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating complement expression types,
+ /// a grammar element for matching complement expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct complement
+ {
+ typedef proto::expr<proto::tag::complement, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<complement>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, complement\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<complement\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<complement>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::complement proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating address_of expression types,
+ /// a grammar element for matching address_of expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct address_of
+ {
+ typedef proto::expr<proto::tag::address_of, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<address_of>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, address_of\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<address_of\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<address_of>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::address_of proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating logical_not expression types,
+ /// a grammar element for matching logical_not expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct logical_not
+ {
+ typedef proto::expr<proto::tag::logical_not, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<logical_not>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, logical_not\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<logical_not\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<logical_not>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::logical_not proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating pre-increment expression types,
+ /// a grammar element for matching pre-increment expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct pre_inc
+ {
+ typedef proto::expr<proto::tag::pre_inc, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<pre_inc>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, pre_inc\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<pre_inc\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<pre_inc>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::pre_inc proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating pre-decrement expression types,
+ /// a grammar element for matching pre-decrement expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct pre_dec
+ {
+ typedef proto::expr<proto::tag::pre_dec, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<pre_dec>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, pre_dec\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<pre_dec\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<pre_dec>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::pre_dec proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating post-increment expression types,
+ /// a grammar element for matching post-increment expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct post_inc
+ {
+ typedef proto::expr<proto::tag::post_inc, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<post_inc>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, post_inc\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<post_inc\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<post_inc>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::post_inc proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating post-decrement expression types,
+ /// a grammar element for matching post-decrement expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T>
+ struct post_dec
+ {
+ typedef proto::expr<proto::tag::post_dec, args1<T> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<post_dec>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, post_dec\<T\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<post_dec\<T\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<post_dec>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::post_dec proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ };
+
+ /// \brief A metafunction for generating left-shift expression types,
+ /// a grammar element for matching left-shift expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct shift_left
+ {
+ typedef proto::expr<proto::tag::shift_left, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<shift_left>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, shift_left\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<shift_left\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<shift_left>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::shift_left proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating right-shift expression types,
+ /// a grammar element for matching right-shift expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct shift_right
+ {
+ typedef proto::expr<proto::tag::shift_right, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<shift_right>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, shift_right\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<shift_right\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<shift_right>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::shift_right proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating multiplies expression types,
+ /// a grammar element for matching multiplies expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct multiplies
+ {
+ typedef proto::expr<proto::tag::multiplies, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<multiplies>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, multiplies\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<multiplies\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<multiplies>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::multiplies proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating divides expression types,
+ /// a grammar element for matching divides expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct divides
+ {
+ typedef proto::expr<proto::tag::divides, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<divides>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, divides\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<divides\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<divides>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::divides proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating modulus expression types,
+ /// a grammar element for matching modulus expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct modulus
+ {
+ typedef proto::expr<proto::tag::modulus, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<modulus>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, modulus\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<modulus\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<modulus>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::modulus proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating binary plus expression types,
+ /// a grammar element for matching binary plus expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct plus
+ {
+ typedef proto::expr<proto::tag::plus, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<plus>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, plus\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<plus\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<plus>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::plus proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating binary minus expression types,
+ /// a grammar element for matching binary minus expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct minus
+ {
+ typedef proto::expr<proto::tag::minus, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<minus>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, minus\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<minus\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<minus>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::minus proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating less expression types,
+ /// a grammar element for matching less expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct less
+ {
+ typedef proto::expr<proto::tag::less, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<less>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, less\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<less\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<less>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::less proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating greater expression types,
+ /// a grammar element for matching greater expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct greater
+ {
+ typedef proto::expr<proto::tag::greater, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<greater>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, greater\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<greater\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<greater>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::greater proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating less-or-equal expression types,
+ /// a grammar element for matching less-or-equal expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct less_equal
+ {
+ typedef proto::expr<proto::tag::less_equal, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<less_equal>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, less_equal\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<less_equal\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<less_equal>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::less_equal proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating greater-or-equal expression types,
+ /// a grammar element for matching greater-or-equal expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct greater_equal
+ {
+ typedef proto::expr<proto::tag::greater_equal, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<greater_equal>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, greater_equal\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<greater_equal\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<greater_equal>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::greater_equal proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating equal-to expression types,
+ /// a grammar element for matching equal-to expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct equal_to
+ {
+ typedef proto::expr<proto::tag::equal_to, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<equal_to>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, equal_to\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<equal_to\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<equal_to>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::equal_to proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating not-equal-to expression types,
+ /// a grammar element for matching not-equal-to expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct not_equal_to
+ {
+ typedef proto::expr<proto::tag::not_equal_to, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<not_equal_to>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, not_equal_to\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<not_equal_to\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<not_equal_to>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::not_equal_to proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating logical-or expression types,
+ /// a grammar element for matching logical-or expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct logical_or
+ {
+ typedef proto::expr<proto::tag::logical_or, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<logical_or>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, logical_or\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<logical_or\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<logical_or>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::logical_or proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating logical-and expression types,
+ /// a grammar element for matching logical-and expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct logical_and
+ {
+ typedef proto::expr<proto::tag::logical_and, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<logical_and>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, logical_and\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<logical_and\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<logical_and>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::logical_and proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating bitwise-and expression types,
+ /// a grammar element for matching bitwise-and expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct bitwise_and
+ {
+ typedef proto::expr<proto::tag::bitwise_and, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<bitwise_and>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, bitwise_and\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<bitwise_and\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<bitwise_and>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::bitwise_and proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating bitwise-or expression types,
+ /// a grammar element for matching bitwise-or expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct bitwise_or
+ {
+ typedef proto::expr<proto::tag::bitwise_or, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<bitwise_or>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, bitwise_or\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<bitwise_or\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<bitwise_or>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::bitwise_or proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating bitwise-xor expression types,
+ /// a grammar element for matching bitwise-xor expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct bitwise_xor
+ {
+ typedef proto::expr<proto::tag::bitwise_xor, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<bitwise_xor>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, bitwise_xor\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<bitwise_xor\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<bitwise_xor>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::bitwise_xor proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating comma expression types,
+ /// a grammar element for matching comma expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct comma
+ {
+ typedef proto::expr<proto::tag::comma, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<comma>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, comma\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<comma\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<comma>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::comma proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ template<typename T, typename U>
+ struct mem_ptr
+ {
+ typedef proto::expr<proto::tag::mem_ptr, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<mem_ptr>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, mem_ptr\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<mem_ptr\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<mem_ptr>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::mem_ptr proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating assignment expression types,
+ /// a grammar element for matching assignment expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct assign
+ {
+ typedef proto::expr<proto::tag::assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating left-shift-assign expression types,
+ /// a grammar element for matching left-shift-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct shift_left_assign
+ {
+ typedef proto::expr<proto::tag::shift_left_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<shift_left_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, shift_left_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<shift_left_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<shift_left_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::shift_left_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating right-shift-assign expression types,
+ /// a grammar element for matching right-shift-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct shift_right_assign
+ {
+ typedef proto::expr<proto::tag::shift_right_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<shift_right_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, shift_right_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<shift_right_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<shift_right_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::shift_right_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating multiplies-assign expression types,
+ /// a grammar element for matching multiplies-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct multiplies_assign
+ {
+ typedef proto::expr<proto::tag::multiplies_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<multiplies_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, multiplies_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<multiplies_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<multiplies_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::multiplies_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating divides-assign expression types,
+ /// a grammar element for matching divides-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct divides_assign
+ {
+ typedef proto::expr<proto::tag::divides_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<divides_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, divides_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<divides_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<divides_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::divides_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating modulus-assign expression types,
+ /// a grammar element for matching modulus-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct modulus_assign
+ {
+ typedef proto::expr<proto::tag::modulus_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<modulus_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, modulus_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<modulus_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<modulus_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::modulus_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating plus-assign expression types,
+ /// a grammar element for matching plus-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct plus_assign
+ {
+ typedef proto::expr<proto::tag::plus_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<plus_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, plus_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<plus_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<plus_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::plus_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating minus-assign expression types,
+ /// a grammar element for matching minus-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct minus_assign
+ {
+ typedef proto::expr<proto::tag::minus_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<minus_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, minus_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<minus_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<minus_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::minus_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating bitwise-and-assign expression types,
+ /// a grammar element for matching bitwise-and-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct bitwise_and_assign
+ {
+ typedef proto::expr<proto::tag::bitwise_and_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<bitwise_and_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, bitwise_and_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<bitwise_and_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<bitwise_and_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::bitwise_and_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating bitwise-or-assign expression types,
+ /// a grammar element for matching bitwise-or-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct bitwise_or_assign
+ {
+ typedef proto::expr<proto::tag::bitwise_or_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<bitwise_or_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, bitwise_or_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<bitwise_or_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<bitwise_or_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::bitwise_or_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating bitwise-xor-assign expression types,
+ /// a grammar element for matching bitwise-xor-assign expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct bitwise_xor_assign
+ {
+ typedef proto::expr<proto::tag::bitwise_xor_assign, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<bitwise_xor_assign>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, bitwise_xor_assign\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<bitwise_xor_assign\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<bitwise_xor_assign>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::bitwise_xor_assign proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ /// \brief A metafunction for generating subscript expression types,
+ /// a grammar element for matching subscript expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<typename T, typename U>
+ struct subscript
+ {
+ typedef proto::expr<proto::tag::subscript, args2<T, U> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<subscript>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, subscript\<T,U\> \>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<subscript\<T,U\> \>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<subscript>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::subscript proto_tag;
+ /// INTERNAL ONLY
+ typedef T proto_arg0;
+ /// INTERNAL ONLY
+ typedef U proto_arg1;
+ };
+
+ } // namespace op
+
+ #define BOOST_PROTO_ARG(z, n, data) \
+ /** INTERNAL ONLY */ \
+ typedef BOOST_PP_CAT(data, n) BOOST_PP_CAT(proto_arg, n); \
+ /**/
+
+ #define BOOST_PROTO_IMPLICIT_ARG(z, n, data) \
+ BOOST_PP_CAT(data, n) &BOOST_PP_CAT(a, n); \
+ /**/
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/traits.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #undef BOOST_PROTO_ARG
+ #undef BOOST_PROTO_IMPLICIT_ARG
+
+ namespace functional
+ {
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c as_expr() function.
+ template<typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)>
+ struct as_expr
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename T>
+ struct result<This(T)>
+ {
+ typedef typename remove_reference<T>::type unref_type;
+ typedef typename result_of::as_expr<unref_type, Domain>::type type;
+ };
+
+ /// \brief Wrap an object in a Proto terminal if it isn't a
+ /// Proto expression already.
+ /// \param t The object to wrap.
+ /// \return <tt>proto::as_expr\<Domain\>(t)</tt>
+ template<typename T>
+ typename result_of::as_expr<T, Domain>::reference
+ operator ()(T &t) const
+ {
+ return result_of::as_expr<T, Domain>::call(t);
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ typename result_of::as_expr<T const, Domain>::reference
+ operator ()(T const &t) const
+ {
+ return result_of::as_expr<T const, Domain>::call(t);
+ }
+
+ #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+ template<typename T, std::size_t N_>
+ typename result_of::as_expr<T(&)[N_], Domain>::reference
+ operator ()(T (&t)[N_]) const
+ {
+ return result_of::as_expr<T(&)[N_], Domain>::call(t);
+ }
+
+ template<typename T, std::size_t N_>
+ typename result_of::as_expr<T const(&)[N_], Domain>::reference
+ operator ()(T const (&t)[N_]) const
+ {
+ return result_of::as_expr<T const(&)[N_], Domain>::call(t);
+ }
+ #endif
+ };
+
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c as_arg() function.
+ template<typename Domain BOOST_PROTO_FOR_DOXYGEN_ONLY(= default_domain)>
+ struct as_arg
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename T>
+ struct result<This(T)>
+ {
+ typedef typename remove_reference<T>::type unref_type;
+ typedef typename result_of::as_arg<unref_type, Domain>::type type;
+ };
+
+ /// \brief Wrap an object in a Proto terminal if it isn't a
+ /// Proto expression already.
+ /// \param t The object to wrap.
+ /// \return <tt>proto::as_arg\<Domain\>(t)</tt>
+ template<typename T>
+ typename result_of::as_arg<T, Domain>::type
+ operator ()(T &t) const
+ {
+ return result_of::as_arg<T, Domain>::call(t);
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ typename result_of::as_arg<T const, Domain>::type
+ operator ()(T const &t) const
+ {
+ return result_of::as_arg<T const, Domain>::call(t);
+ }
+ };
+
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c arg_c() function.
+ template<long N>
+ struct arg_c
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef BOOST_PROTO_UNCVREF(Expr) uncvref_type;
+ typedef typename result_of::arg_c<uncvref_type, N>::type type;
+ };
+
+ /// \brief Return the Nth child of the given expression.
+ /// \param expr The expression node.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true
+ /// \pre <tt>N == 0 || N \< Expr::proto_arity::value</tt>
+ /// \return <tt>proto::arg_c\<N\>(expr)</tt>
+ /// \throw nothrow
+ template<typename Expr>
+ typename result_of::arg_c<Expr, N>::reference
+ operator ()(Expr &expr) const
+ {
+ return result_of::arg_c<Expr, N>::call(expr);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr>
+ typename result_of::arg_c<Expr, N>::const_reference
+ operator ()(Expr const &expr) const
+ {
+ return result_of::arg_c<Expr, N>::call(expr);
+ }
+ };
+
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c arg() function.
+ ///
+ /// A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c arg() function. \c N is required
+ /// to be an MPL Integral Constant.
+ template<typename N BOOST_PROTO_FOR_DOXYGEN_ONLY(= mpl::long_<0>) >
+ struct arg
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef BOOST_PROTO_UNCVREF(Expr) uncvref_type;
+ typedef typename result_of::arg<uncvref_type, N>::type type;
+ };
+
+ /// \brief Return the Nth child of the given expression.
+ /// \param expr The expression node.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true
+ /// \pre <tt>N::value == 0 || N::value \< Expr::proto_arity::value</tt>
+ /// \return <tt>proto::arg\<N\>(expr)</tt>
+ /// \throw nothrow
+ template<typename Expr>
+ typename result_of::arg<Expr, N>::reference
+ operator ()(Expr &expr) const
+ {
+ return result_of::arg<Expr, N>::call(expr);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr>
+ typename result_of::arg<Expr, N>::const_reference operator ()(Expr const &expr) const
+ {
+ return result_of::arg<Expr, N>::call(expr);
+ }
+ };
+
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c left() function.
+ struct left
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef BOOST_PROTO_UNCVREF(Expr) uncvref_type;
+ typedef typename result_of::left<uncvref_type>::type type;
+ };
+
+ /// \brief Return the left child of the given binary expression.
+ /// \param expr The expression node.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true
+ /// \pre <tt>2 == Expr::proto_arity::value</tt>
+ /// \return <tt>proto::left(expr)</tt>
+ /// \throw nothrow
+ template<typename Expr>
+ typename result_of::left<Expr>::reference
+ operator ()(Expr &expr) const
+ {
+ return proto::unref(expr.proto_base().arg0);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr>
+ typename result_of::left<Expr>::const_reference
+ operator ()(Expr const &expr) const
+ {
+ return proto::unref(expr.proto_base().arg0);
+ }
+ };
+
+ /// \brief A callable PolymorphicFunctionObject that is
+ /// equivalent to the \c right() function.
+ struct right
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef BOOST_PROTO_UNCVREF(Expr) uncvref_type;
+ typedef typename result_of::right<uncvref_type>::type type;
+ };
+
+ /// \brief Return the right child of the given binary expression.
+ /// \param expr The expression node.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true
+ /// \pre <tt>2 == Expr::proto_arity::value</tt>
+ /// \return <tt>proto::right(expr)</tt>
+ /// \throw nothrow
+ template<typename Expr>
+ typename result_of::right<Expr>::reference
+ operator ()(Expr &expr) const
+ {
+ return proto::unref(expr.proto_base().arg1);
+ }
+
+ template<typename Expr>
+ typename result_of::right<Expr>::const_reference
+ operator ()(Expr const &expr) const
+ {
+ return proto::unref(expr.proto_base().arg1);
+ }
+ };
+
+ }
+
+ /// \brief A function that wraps non-Proto expression types in Proto
+ /// terminals and leaves Proto expression types alone.
+ ///
+ /// The <tt>as_expr()</tt> function turns objects into Proto terminals if
+ /// they are not Proto expression types already. Non-Proto types are
+ /// held by value, if possible. Types which are already Proto types are
+ /// left alone and returned by reference.
+ ///
+ /// This function can be called either with an explicitly specified
+ /// \c Domain parameter (i.e., <tt>as_expr\<Domain\>(t)</tt>), or
+ /// without (i.e., <tt>as_expr(t)</tt>). If no domain is
+ /// specified, \c default_domain is assumed.
+ ///
+ /// If <tt>is_expr\<T\>::::value</tt> is \c true, then the argument is
+ /// returned unmodified, by reference. Otherwise, the argument is wrapped
+ /// in a Proto terminal expression node according to the following rules.
+ /// If \c T is an array type or a function type, let \c A be <tt>T &</tt>.
+ /// Otherwise, let \c A be the type \c T stripped of cv-qualifiers.
+ /// Then, \c as_expr() returns
+ /// <tt>Domain::make(terminal\<A\>::::type::make(t))</tt>.
+ ///
+ /// \param t The object to wrap.
+ template<typename T>
+ typename result_of::as_expr<T>::reference
+ as_expr(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T))
+ {
+ return result_of::as_expr<T>::call(t);
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ typename result_of::as_expr<T const>::reference
+ as_expr(T const &t)
+ {
+ return result_of::as_expr<T const>::call(t);
+ }
+
+ /// \overload
+ ///
+ template<typename Domain, typename T>
+ typename result_of::as_expr<T, Domain>::reference
+ as_expr(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T))
+ {
+ return result_of::as_expr<T, Domain>::call(t);
+ }
+
+ /// \overload
+ ///
+ template<typename Domain, typename T>
+ typename result_of::as_expr<T const, Domain>::reference
+ as_expr(T const &t)
+ {
+ return result_of::as_expr<T const, Domain>::call(t);
+ }
+
+ /// \brief A function that wraps non-Proto expression types in Proto
+ /// terminals (by reference) and wraps Proto expression types in
+ /// <tt>ref_\<\></tt>.
+ ///
+ /// The <tt>as_arg()</tt> function turns objects into Proto terminals if
+ /// they are not Proto expression types already. Non-Proto types are
+ /// held by reference. Types which are already Proto types are wrapped
+ /// in <tt>ref_\<\></tt>.
+ ///
+ /// This function can be called either with an explicitly specified
+ /// \c Domain parameter (i.e., <tt>as_arg\<Domain\>(t)</tt>), or
+ /// without (i.e., <tt>as_arg(t)</tt>). If no domain is
+ /// specified, \c default_domain is assumed.
+ ///
+ /// If <tt>is_expr\<T\>::::value</tt> is \c true, then the argument is
+ /// wrapped in <tt>ref_\<\></tt>, which holds the argument by reference.
+ /// Otherwise, \c as_arg() returns
+ /// <tt>Domain::make(terminal\<T &\>::::type::make(t))</tt>.
+ ///
+ /// \param t The object to wrap.
+ template<typename T>
+ typename result_of::as_arg<T>::type
+ as_arg(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T))
+ {
+ return result_of::as_arg<T>::call(t);
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ typename result_of::as_arg<T const>::type
+ as_arg(T const &t)
+ {
+ return result_of::as_arg<T const>::call(t);
+ }
+
+ /// \overload
+ ///
+ template<typename Domain, typename T>
+ typename result_of::as_arg<T, Domain>::type
+ as_arg(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T))
+ {
+ return result_of::as_arg<T, Domain>::call(t);
+ }
+
+ /// \overload
+ ///
+ template<typename Domain, typename T>
+ typename result_of::as_arg<T const, Domain>::type
+ as_arg(T const &t)
+ {
+ return result_of::as_arg<T const, Domain>::call(t);
+ }
+
+ /// \brief Return the Nth child of the specified Proto expression.
+ ///
+ /// Return the Nth child of the specified Proto expression. If
+ /// \c N is not specified, as in \c arg(expr), then \c N is assumed
+ /// to be <tt>mpl::long_\<0\></tt>. The child is returned by
+ /// reference. If the expression is holding the child in a
+ /// <tt>ref_\<\></tt> wrapper, it is unwrapped before it is returned.
+ ///
+ /// \param expr The Proto expression.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true.
+ /// \pre \c N is an MPL Integral Constant.
+ /// \pre <tt>N::value == 0 || N::value \< Expr::proto_arity::value</tt>
+ /// \throw nothrow
+ /// \return A reference to the Nth child
+ template<typename N, typename Expr>
+ typename result_of::arg<Expr, N>::reference
+ arg(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+ {
+ return result_of::arg<Expr, N>::call(expr);
+ }
+
+ /// \overload
+ ///
+ template<typename N, typename Expr>
+ typename result_of::arg<Expr, N>::const_reference
+ arg(Expr const &expr)
+ {
+ return result_of::arg<Expr, N>::call(expr);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr2>
+ typename result_of::unref<typename Expr2::proto_base_expr::proto_arg0>::reference
+ arg(Expr2 &expr2 BOOST_PROTO_DISABLE_IF_IS_CONST(Expr2))
+ {
+ return proto::unref(expr2.proto_base().arg0);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr2>
+ typename result_of::unref<typename Expr2::proto_base_expr::proto_arg0>::const_reference
+ arg(Expr2 const &expr2)
+ {
+ return proto::unref(expr2.proto_base().arg0);
+ }
+
+ /// \brief Return the Nth child of the specified Proto expression.
+ ///
+ /// Return the Nth child of the specified Proto expression. The child
+ /// is returned by reference. If the expression is holding the child in
+ /// a <tt>ref_\<\></tt> wrapper, it is unwrapped before it is returned.
+ ///
+ /// \param expr The Proto expression.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true.
+ /// \pre <tt>N == 0 || N \< Expr::proto_arity::value</tt>
+ /// \throw nothrow
+ /// \return A reference to the Nth child
+ template<long N, typename Expr>
+ typename result_of::arg_c<Expr, N>::reference
+ arg_c(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+ {
+ return result_of::arg_c<Expr, N>::call(expr);
+ }
+
+ /// \overload
+ ///
+ template<long N, typename Expr>
+ typename result_of::arg_c<Expr, N>::const_reference
+ arg_c(Expr const &expr)
+ {
+ return result_of::arg_c<Expr, N>::call(expr);
+ }
+
+ /// \brief Return the left child of the specified binary Proto
+ /// expression.
+ ///
+ /// Return the left child of the specified binary Proto expression. The
+ /// child is returned by reference. If the expression is holding the
+ /// child in a <tt>ref_\<\></tt> wrapper, it is unwrapped before it is
+ /// returned.
+ ///
+ /// \param expr The Proto expression.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true.
+ /// \pre <tt>2 == Expr::proto_arity::value</tt>
+ /// \throw nothrow
+ /// \return A reference to the left child
+ template<typename Expr>
+ typename result_of::left<Expr>::reference
+ left(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+ {
+ return proto::unref(expr.proto_base().arg0);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr>
+ typename result_of::left<Expr>::const_reference
+ left(Expr const &expr)
+ {
+ return proto::unref(expr.proto_base().arg0);
+ }
+
+ /// \brief Return the right child of the specified binary Proto
+ /// expression.
+ ///
+ /// Return the right child of the specified binary Proto expression. The
+ /// child is returned by reference. If the expression is holding the
+ /// child in a <tt>ref_\<\></tt> wrapper, it is unwrapped before it is
+ /// returned.
+ ///
+ /// \param expr The Proto expression.
+ /// \pre <tt>is_expr\<Expr\>::::value</tt> is \c true.
+ /// \pre <tt>2 == Expr::proto_arity::value</tt>
+ /// \throw nothrow
+ /// \return A reference to the right child
+ template<typename Expr>
+ typename result_of::right<Expr>::reference
+ right(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+ {
+ return proto::unref(expr.proto_base().arg1);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr>
+ typename result_of::right<Expr>::const_reference
+ right(Expr const &expr)
+ {
+ return proto::unref(expr.proto_base().arg1);
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Domain>
+ struct is_callable<functional::as_expr<Domain> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Domain>
+ struct is_callable<functional::as_arg<Domain> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<long N>
+ struct is_callable<functional::arg_c<N> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename N>
+ struct is_callable<functional::arg<N> >
+ : mpl::true_
+ {};
+
+ }}
+
+ #if BOOST_WORKAROUND( BOOST_MSVC, >= 1400 )
+ #pragma warning(pop)
+ #endif
+
+ #endif
+
+#else // PP_IS_ITERATING
+
+ #define N BOOST_PP_ITERATION()
+ #if N > 0
+ namespace op
+ {
+ /// \brief A metafunction for generating function-call expression types,
+ /// a grammar element for matching function-call expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ template<BOOST_PP_ENUM_PARAMS(N, typename A)>
+ struct function<
+ BOOST_PP_ENUM_PARAMS(N, A)
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT), void
+ >
+ {
+ typedef proto::expr<proto::tag::function, BOOST_PP_CAT(args, N)<BOOST_PP_ENUM_PARAMS(N, A)> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<function>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, function\>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<function\>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<function>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef proto::tag::function proto_tag;
+ BOOST_PP_REPEAT(N, BOOST_PROTO_ARG, A)
+ BOOST_PP_REPEAT_FROM_TO(
+ N
+ , BOOST_PROTO_MAX_ARITY
+ , BOOST_PROTO_ARG
+ , detail::if_vararg<BOOST_PP_CAT(A, BOOST_PP_DEC(N))> BOOST_PP_INTERCEPT
+ )
+ };
+
+ /// \brief A metafunction for generating n-ary expression types with a
+ /// specified tag type,
+ /// a grammar element for matching n-ary expressions, and a
+ /// PrimitiveTransform that dispatches to the <tt>pass_through\<\></tt>
+ /// transform.
+ ///
+ /// Use <tt>nary_expr\<_, vararg\<_\> \></tt> as a grammar element to match any
+ /// n-ary expression; that is, any non-terminal.
+ template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct nary_expr<
+ Tag
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N), void BOOST_PP_INTERCEPT), void
+ >
+ {
+ typedef proto::expr<Tag, BOOST_PP_CAT(args, N)<BOOST_PP_ENUM_PARAMS(N, A)> > type;
+ typedef type proto_base_expr;
+
+ template<typename Sig>
+ struct result
+ {
+ typedef
+ typename pass_through<nary_expr>::template result<Sig>::type
+ type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, nary_expr\>::::value</tt> is \c true.
+ /// \return <tt>pass_through\<nary_expr\>()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return pass_through<nary_expr>()(expr, state, visitor);
+ }
+
+ /// INTERNAL ONLY
+ typedef Tag proto_tag;
+ BOOST_PP_REPEAT(N, BOOST_PROTO_ARG, A)
+ BOOST_PP_REPEAT_FROM_TO(
+ N
+ , BOOST_PROTO_MAX_ARITY
+ , BOOST_PROTO_ARG
+ , detail::if_vararg<BOOST_PP_CAT(A, BOOST_PP_DEC(N))> BOOST_PP_INTERCEPT
+ )
+ };
+
+ } // namespace op
+
+ namespace detail
+ {
+ template<BOOST_PP_ENUM_PARAMS(N, typename A)>
+ struct BOOST_PP_CAT(implicit_expr_, N)
+ {
+ BOOST_PP_REPEAT(N, BOOST_PROTO_IMPLICIT_ARG, A)
+
+ template<typename Tag, typename Args, long Arity>
+ operator proto::expr<Tag, Args, Arity> () const
+ {
+ proto::expr<Tag, Args, Arity> that = {BOOST_PP_ENUM_PARAMS(N, a)};
+ return that;
+ }
+ };
+
+ template<
+ template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class T
+ , BOOST_PP_ENUM_PARAMS(N, typename A)
+ >
+ struct is_callable_<T<BOOST_PP_ENUM_PARAMS(N, A)> BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(N)>
+ : is_same<BOOST_PP_CAT(A, BOOST_PP_DEC(N)), callable>
+ {};
+ }
+
+ /// INTERNAL ONLY
+ template<BOOST_PP_ENUM_PARAMS(N, typename A)>
+ detail::BOOST_PP_CAT(implicit_expr_, N)<BOOST_PP_ENUM_PARAMS(N, A)>
+ implicit_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, A, &a))
+ {
+ detail::BOOST_PP_CAT(implicit_expr_, N)<BOOST_PP_ENUM_PARAMS(N, A)> that
+ = {BOOST_PP_ENUM_PARAMS(N, a)};
+ return that;
+ }
+
+ #endif
+
+ namespace result_of
+ {
+ /// \brief A metafunction that returns the type of the Nth child
+ /// of a Proto expression.
+ ///
+ /// A metafunction that returns the type of the Nth child
+ /// of a Proto expression. \c N must be 0 or less than
+ /// \c Expr::proto_arity::value.
+ template<typename Expr>
+ struct arg_c<Expr, N>
+ {
+ /// The raw type of the Nth child as it is stored within
+ /// \c Expr. This may be a value, a reference, or a Proto
+ /// <tt>ref_\<\></tt> wrapper.
+ typedef typename Expr::BOOST_PP_CAT(proto_arg, N) wrapped_type;
+
+ /// The "value" type of the child, suitable for return by value,
+ /// computed as follows:
+ /// \li <tt>ref_\<T const\></tt> becomes <tt>T</tt>
+ /// \li <tt>ref_\<T\></tt> becomes <tt>T</tt>
+ /// \li <tt>T const(&)[N]</tt> becomes <tt>T const(&)[N]</tt>
+ /// \li <tt>T(&)[N]</tt> becomes <tt>T(&)[N]</tt>
+ /// \li <tt>R(&)(A0,...)</tt> becomes <tt>R(&)(A0,...)</tt>
+ /// \li <tt>T const &</tt> becomes <tt>T</tt>
+ /// \li <tt>T &</tt> becomes <tt>T</tt>
+ /// \li <tt>T</tt> becomes <tt>T</tt>
+ typedef typename unref<wrapped_type>::type type;
+
+ /// The "reference" type of the child, suitable for return by
+ /// reference, computed as follows:
+ /// \li <tt>ref_\<T const\></tt> becomes <tt>T const &</tt>
+ /// \li <tt>ref_\<T\></tt> becomes <tt>T &</tt>
+ /// \li <tt>T const(&)[N]</tt> becomes <tt>T const(&)[N]</tt>
+ /// \li <tt>T(&)[N]</tt> becomes <tt>T(&)[N]</tt>
+ /// \li <tt>R(&)(A0,...)</tt> becomes <tt>R(&)(A0,...)</tt>
+ /// \li <tt>T const &</tt> becomes <tt>T const &</tt>
+ /// \li <tt>T &</tt> becomes <tt>T &</tt>
+ /// \li <tt>T</tt> becomes <tt>T &</tt>
+ typedef typename unref<wrapped_type>::reference reference;
+
+ /// The "const reference" type of the child, suitable for return by
+ /// const reference, computed as follows:
+ /// \li <tt>ref_\<T const\></tt> becomes <tt>T const &</tt>
+ /// \li <tt>ref_\<T\></tt> becomes <tt>T &</tt>
+ /// \li <tt>T const(&)[N]</tt> becomes <tt>T const(&)[N]</tt>
+ /// \li <tt>T(&)[N]</tt> becomes <tt>T(&)[N]</tt>
+ /// \li <tt>R(&)(A0,...)</tt> becomes <tt>R(&)(A0,...)</tt>
+ /// \li <tt>T const &</tt> becomes <tt>T const &</tt>
+ /// \li <tt>T &</tt> becomes <tt>T &</tt>
+ /// \li <tt>T</tt> becomes <tt>T const &</tt>
+ typedef typename unref<wrapped_type>::const_reference const_reference;
+
+ /// INTERNAL ONLY
+ ///
+ static reference call(typename Expr::proto_derived_expr &expr)
+ {
+ return proto::unref(expr.proto_base().BOOST_PP_CAT(arg, N));
+ }
+
+ /// INTERNAL ONLY
+ ///
+ static const_reference call(typename Expr::proto_derived_expr const &expr)
+ {
+ return proto::unref(expr.proto_base().BOOST_PP_CAT(arg, N));
+ }
+ };
+ }
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file transform.hpp
+/// Includes all the transforms in the transform/ sub-directory.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_TRANSFORM_HPP_EAN_06_23_2007
+#define BOOST_PROTO_TRANSFORM_HPP_EAN_06_23_2007
+
+#include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+#include <boost/xpressive/proto/transform/arg.hpp>
+#include <boost/xpressive/proto/transform/bind.hpp>
+#include <boost/xpressive/proto/transform/call.hpp>
+#include <boost/xpressive/proto/transform/fold.hpp>
+#include <boost/xpressive/proto/transform/fold_tree.hpp>
+#include <boost/xpressive/proto/transform/make.hpp>
+#include <boost/xpressive/proto/transform/pass_through.hpp>
+#include <boost/xpressive/proto/transform/when.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/arg.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/arg.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,211 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file arg.hpp
+/// Contains definition of the argN transforms.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_TRANSFORM_ARG_HPP_EAN_11_01_2007
+#define BOOST_PROTO_TRANSFORM_ARG_HPP_EAN_11_01_2007
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+namespace boost { namespace proto
+{
+
+ namespace transform
+ {
+
+ /// \brief A PrimitiveTransform that returns the current expression
+ /// unmodified
+ struct expr : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef Expr type;
+ };
+
+ /// \param expr_ The current expression.
+ /// \return \c expr_
+ /// \throw nothrow
+ template<typename Expr, typename State, typename Visitor>
+ Expr const &
+ operator ()(Expr const &expr_, State const &, Visitor &) const
+ {
+ return expr_;
+ }
+ };
+
+ /// \brief A PrimitiveTransform that returns the current state
+ /// unmodified
+ struct state : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef State type;
+ };
+
+ /// \param state_ The current state.
+ /// \return \c state_
+ /// \throw nothrow
+ template<typename Expr, typename State, typename Visitor>
+ State const &
+ operator ()(Expr const &, State const &state_, Visitor &) const
+ {
+ return state_;
+ }
+ };
+
+ /// \brief A PrimitiveTransform that returns the current visitor
+ /// unmodified
+ struct visitor : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef Visitor type;
+ };
+
+ /// \param visitor_ The current visitor
+ /// \return \c visitor_
+ /// \throw nothrow
+ template<typename Expr, typename State, typename Visitor>
+ Visitor &
+ operator ()(Expr const &, State const &, Visitor &visitor_) const
+ {
+ return visitor_;
+ }
+ };
+
+ /// \brief A PrimitiveTransform that returns I-th child of the current
+ /// expression.
+ template<int I>
+ struct arg_c : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename proto::result_of::arg_c<Expr, I>::type type;
+ };
+
+ /// \param expr The current expression.
+ /// \return <tt>proto::arg_c\<I\>(expr)</tt>
+ /// \throw nothrow
+ template<typename Expr, typename State, typename Visitor>
+ typename proto::result_of::arg_c<Expr, I>::const_reference
+ operator ()(Expr const &expr, State const &, Visitor &) const
+ {
+ return proto::arg_c<I>(expr);
+ }
+ };
+
+ /// \brief A unary CallableTransform that wraps its argument
+ /// in a \c boost::reference_wrapper\<\>.
+ struct _ref : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename T>
+ struct result<This(T)>
+ {
+ typedef boost::reference_wrapper<T const> type;
+ };
+
+ template<typename This, typename T>
+ struct result<This(T &)>
+ {
+ typedef boost::reference_wrapper<T> type;
+ };
+
+ /// \param t The object to wrap
+ /// \return <tt>boost::ref(t)</tt>
+ /// \throw nothrow
+ template<typename T>
+ boost::reference_wrapper<T>
+ operator ()(T &t) const
+ {
+ return boost::reference_wrapper<T>(t);
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ boost::reference_wrapper<T const>
+ operator ()(T const &t) const
+ {
+ return boost::reference_wrapper<T const>(t);
+ }
+ };
+ }
+
+ /// \brief A PrimitiveTransform that returns I-th child of the current
+ /// expression.
+ template<int I>
+ struct _arg_c
+ : transform::arg_c<I>
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<transform::expr>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<transform::state>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<transform::visitor>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<int I>
+ struct is_callable<transform::arg_c<I> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<int I>
+ struct is_callable<_arg_c<I> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<transform::_ref>
+ : mpl::true_
+ {};
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/bind.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/bind.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,123 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file bind.hpp
+ /// Contains definition of the bind<> transform.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_TRANSFORM_BIND_HPP_EAN_12_02_2007
+ #define BOOST_PROTO_TRANSFORM_BIND_HPP_EAN_12_02_2007
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/transform/make.hpp>
+ #include <boost/xpressive/proto/transform/call.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost { namespace proto
+ {
+
+ namespace transform
+ {
+ /// \brief A PrimitiveTransform that uses <tt>make\<\></tt> to build
+ /// a CallableTransform, and then uses <tt>call\<\></tt> to apply it.
+ ///
+ /// <tt>bind\<\></tt> is useful as a higher-order transform, when the
+ /// transform to be applied depends on the current state of the
+ /// transformation. The invocation of the <tt>make\<\></tt> transform
+ /// evaluates any nested transforms, and the resulting type is treated
+ /// as a CallableTransform, which is evaluated with <tt>call\<\></tt>.
+ template<typename Object>
+ struct bind : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename make<Object>::template result<void(Expr, State, Visitor)>::type fun;
+ typedef call<fun> impl;
+ typedef typename impl::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ /// Build a CallableTransform by applying <tt>make\<\></tt>
+ /// and evaluate it with <tt>call\<\></tt>
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \return <tt>result\<void(Expr, State, Visitor)\>::::impl()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return typename result<void(Expr, State, Visitor)>::impl()(expr, state, visitor);
+ }
+ };
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/transform/bind.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Object>
+ struct is_callable<transform::bind<Object> >
+ : mpl::true_
+ {};
+
+ }}
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ /// \brief A PrimitiveTransform that uses <tt>make\<\></tt> to build
+ /// a CallableTransform, and then uses <tt>call\<\></tt> to apply it.
+ ///
+ /// <tt>bind\<\></tt> is useful as a higher-order transform, when the
+ /// transform to be applied depends on the current state of the
+ /// transformation. The invocation of the <tt>make\<\></tt> transform
+ /// evaluates any nested transforms, and the resulting type is treated
+ /// as a CallableTransform, which is evaluated with <tt>call\<\></tt>.
+ template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct bind<Object(BOOST_PP_ENUM_PARAMS(N, A))> : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename make<Object>::template result<void(Expr, State, Visitor)>::type fun;
+ typedef call<fun(BOOST_PP_ENUM_PARAMS(N, A))> impl;
+ typedef typename impl::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ /// Build a CallableTransform by applying <tt>make\<\></tt>
+ /// and evaluate it with <tt>call\<\></tt>
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \return <tt>result\<void(Expr, State, Visitor)\>::::impl()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return typename result<void(Expr, State, Visitor)>::impl()(expr, state, visitor);
+ }
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/call.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/call.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,525 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file call.hpp
+ /// Contains definition of the call<> transform.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007
+ #define BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/utility/result_of.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/traits.hpp>
+ #include <boost/xpressive/proto/detail/dont_care.hpp>
+ #include <boost/xpressive/proto/detail/as_lvalue.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost { namespace proto
+ {
+
+ namespace transform
+ {
+ namespace detail
+ {
+ using proto::detail::uncv;
+ using proto::detail::as_lvalue;
+ using proto::detail::dont_care;
+ typedef char (&yes_type)[2];
+ typedef char no_type;
+
+ struct private_type_
+ {
+ private_type_ const &operator ,(int) const;
+ };
+
+ template<typename T>
+ yes_type check_fun_arity(T const &);
+
+ no_type check_fun_arity(private_type_ const &);
+
+ template<typename Fun>
+ struct callable0_wrap : Fun
+ {
+ callable0_wrap();
+ typedef private_type_ const &(*pfun0)();
+ operator pfun0() const;
+ };
+
+ template<typename Fun>
+ struct callable1_wrap : Fun
+ {
+ callable1_wrap();
+ typedef private_type_ const &(*pfun1)(dont_care);
+ operator pfun1() const;
+ };
+
+ template<typename Fun>
+ struct callable2_wrap : Fun
+ {
+ callable2_wrap();
+ typedef private_type_ const &(*pfun2)(dont_care, dont_care);
+ operator pfun2() const;
+ };
+
+ template<typename Fun>
+ struct arity0
+ {
+ static callable0_wrap<Fun> &fun;
+
+ static int const value =
+ sizeof(yes_type) == sizeof(check_fun_arity((fun(), 0)))
+ ? 0
+ : 3;
+ };
+
+ template<typename Fun, typename A0>
+ struct arity1
+ {
+ static callable1_wrap<Fun> &fun;
+ static A0 &a0;
+
+ static int const value =
+ sizeof(yes_type) == sizeof(check_fun_arity((fun(a0), 0)))
+ ? 1
+ : 3;
+ };
+
+ template<typename Fun, typename A0, typename A1>
+ struct arity2
+ {
+ static callable2_wrap<Fun> &fun;
+ static A0 &a0;
+ static A1 &a1;
+
+ static int const value =
+ sizeof(yes_type) == sizeof(check_fun_arity((fun(a0, a1), 0)))
+ ? 2
+ : 3;
+ };
+
+ template<typename Fun, typename Expr, typename State, typename Visitor>
+ struct call3
+ {
+ typedef typename boost::result_of<Fun(Expr, State, Visitor)>::type type;
+
+ template<typename Expr2, typename State2, typename Visitor2>
+ static type call(Expr2 &expr, State2 &state, Visitor2 &visitor)
+ {
+ Fun f;
+ return f(expr, state, visitor);
+ }
+ };
+
+ template<typename Fun, typename Expr, typename State, typename Visitor
+ , int Arity = arity0<Fun>::value>
+ struct call0
+ : call3<Fun, Expr, State, Visitor>
+ {};
+
+ template<typename Fun, typename Expr, typename State, typename Visitor>
+ struct call0<Fun, Expr, State, Visitor, 0>
+ {
+ typedef typename boost::result_of<Fun()>::type type;
+
+ template<typename Expr2, typename State2, typename Visitor2>
+ static type call(Expr2 &, State2 &, Visitor2 &)
+ {
+ Fun f;
+ return f();
+ }
+ };
+
+ template<typename Fun, typename Expr, typename State, typename Visitor
+ , int Arity = arity1<Fun, Expr>::value>
+ struct call1
+ : call3<Fun, Expr, State, Visitor>
+ {};
+
+ template<typename Fun, typename Expr, typename State, typename Visitor>
+ struct call1<Fun, Expr, State, Visitor, 1>
+ {
+ typedef typename boost::result_of<Fun(Expr)>::type type;
+
+ template<typename Expr2, typename State2, typename Visitor2>
+ static type call(Expr2 &expr, State2 &, Visitor2 &)
+ {
+ Fun f;
+ return f(expr);
+ }
+ };
+
+ template<typename Fun, typename Expr, typename State, typename Visitor
+ , int Arity = arity2<Fun, Expr, State>::value>
+ struct call2
+ : call3<Fun, Expr, State, Visitor>
+ {};
+
+ template<typename Fun, typename Expr, typename State, typename Visitor>
+ struct call2<Fun, Expr, State, Visitor, 2>
+ {
+ typedef typename boost::result_of<Fun(Expr, State)>::type type;
+
+ template<typename Expr2, typename State2, typename Visitor2>
+ static type call(Expr2 &expr, State2 &state, Visitor2 &)
+ {
+ Fun f;
+ return f(expr, state);
+ }
+ };
+ } // namespace detail
+
+ /// \brief Wrap \c PrimitiveTransform so that <tt>when\<\></tt> knows
+ /// it is callable. Requires that the parameter is actually a
+ /// PrimitiveTransform.
+ ///
+ /// This form of <tt>call\<\></tt> is useful for annotating an
+ /// arbitrary PrimitiveTransform as callable when using it with
+ /// <tt>when\<\></tt>. Consider the following transform, which
+ /// is parameterized with another transform.
+ ///
+ /// \code
+ /// template<typename Grammar>
+ /// struct Foo
+ /// : when<
+ /// posit<Grammar>
+ /// , Grammar(_arg) // May or may not work.
+ /// >
+ /// {};
+ /// \endcode
+ ///
+ /// The problem with the above is that <tt>when\<\></tt> may or
+ /// may not recognize \c Grammar as callable, depending on how
+ /// \c Grammar is implemented. (See <tt>is_callable\<\></tt> for
+ /// a discussion of this issue.) The above code can guard against
+ /// the issue by wrapping \c Grammar in <tt>call\<\></tt>, such
+ /// as:
+ ///
+ /// \code
+ /// template<typename Grammar>
+ /// struct Foo
+ /// : when<
+ /// posit<Grammar>
+ /// , call<Grammar>(_arg) // OK, this works
+ /// >
+ /// {};
+ /// \endcode
+ ///
+ /// The above could also have been written as:
+ ///
+ /// \code
+ /// template<typename Grammar>
+ /// struct Foo
+ /// : when<
+ /// posit<Grammar>
+ /// , call<Grammar(_arg)> // OK, this works, too
+ /// >
+ /// {};
+ /// \endcode
+ template<typename PrimitiveTransform>
+ struct call : PrimitiveTransform
+ {
+ BOOST_PROTO_CALLABLE()
+ };
+
+ /// \brief Either call the PolymorphicFunctionObject with 0
+ /// arguments, or invoke the PrimitiveTransform with 3
+ /// arguments.
+ template<typename Fun>
+ struct call<Fun()> : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ /// If \c Fun is a nullary PolymorphicFunctionObject, \c type is a typedef
+ /// for <tt>boost::result_of\<Fun()\>::::type</tt>. Otherwise, it is
+ /// a typedef for <tt>boost::result_of\<Fun(Expr, State, Visitor)\>::::type</tt>.
+ typedef
+ typename detail::call0<
+ Fun
+ , Expr
+ , State
+ , Visitor
+ >::type
+ type;
+ };
+
+ /// Either call the PolymorphicFunctionObject \c Fun with 0 arguments; or
+ /// invoke the PrimitiveTransform \c Fun with 3 arguments: the current
+ /// expression, state, and visitor.
+ ///
+ /// If \c Fun is a nullary PolymorphicFunctionObject, return <tt>Fun()()</tt>.
+ /// Otherwise, return <tt>Fun()(expr, state, visitor)</tt>.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef
+ detail::call0<
+ Fun
+ , Expr
+ , State
+ , Visitor
+ >
+ impl;
+
+ return impl::call(expr, state, visitor);
+ }
+ };
+
+ /// \brief Either call the PolymorphicFunctionObject with 1
+ /// argument, or invoke the PrimitiveTransform with 3
+ /// arguments.
+ template<typename Fun, typename A0>
+ struct call<Fun(A0)> : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ /// Let \c x be <tt>when\<_, A0\>()(expr, state, visitor)</tt> and \c X
+ /// be the type of \c x.
+ /// If \c Fun is a unary PolymorphicFunctionObject that accepts \c x,
+ /// then \c type is a typedef for <tt>boost::result_of\<Fun(X)\>::::type</tt>.
+ /// Otherwise, it is a typedef for <tt>boost::result_of\<Fun(X, State, Visitor)\>::::type</tt>.
+ typedef
+ typename detail::call1<
+ Fun
+ , typename when<_, A0>::template result<void(Expr, State, Visitor)>::type
+ , State
+ , Visitor
+ >::type
+ type;
+ };
+
+ /// Either call the PolymorphicFunctionObject with 1 argument:
+ /// the result of applying the \c A0 transform; or
+ /// invoke the PrimitiveTransform with 3 arguments:
+ /// result of applying the \c A0 transform, the state, and the
+ /// visitor.
+ ///
+ /// Let \c x be <tt>when\<_, A0\>()(expr, state, visitor)</tt>.
+ /// If \c Fun is a unary PolymorphicFunctionObject that accepts \c x,
+ /// then return <tt>Fun()(x)</tt>. Otherwise, return
+ /// <tt>Fun()(x, state, visitor)</tt>.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef
+ detail::call1<
+ Fun
+ , typename when<_, A0>::template result<void(Expr, State, Visitor)>::type
+ , State
+ , Visitor
+ >
+ impl;
+
+ return impl::call(
+ detail::as_lvalue(when<_, A0>()(expr, state, visitor))
+ , state
+ , visitor
+ );
+ }
+ };
+
+ /// \brief Either call the PolymorphicFunctionObject with 2
+ /// arguments, or invoke the PrimitiveTransform with 3
+ /// arguments.
+ template<typename Fun, typename A0, typename A1>
+ struct call<Fun(A0, A1)> : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ /// Let \c x be <tt>when\<_, A0\>()(expr, state, visitor)</tt> and \c X
+ /// be the type of \c x.
+ /// Let \c y be <tt>when\<_, A1\>()(expr, state, visitor)</tt> and \c Y
+ /// be the type of \c y.
+ /// If \c Fun is a binary PolymorphicFunction object that accepts \c x
+ /// and \c y, then \c type is a typedef for
+ /// <tt>boost::result_of\<Fun(X, Y)\>::::type</tt>. Otherwise, it is
+ /// a typedef for <tt>boost::result_of\<Fun(X, Y, Visitor)\>::::type</tt>.
+ typedef
+ typename detail::call2<
+ Fun
+ , typename when<_, A0>::template result<void(Expr, State, Visitor)>::type
+ , typename when<_, A1>::template result<void(Expr, State, Visitor)>::type
+ , Visitor
+ >::type
+ type;
+ };
+
+ /// Either call the PolymorphicFunctionObject with 2 arguments:
+ /// the result of applying the \c A0 transform, and the
+ /// result of applying the \c A1 transform; or invoke the
+ /// PrimitiveTransform with 3 arguments: the result of applying
+ /// the \c A0 transform, the result of applying the \c A1
+ /// transform, and the visitor.
+ ///
+ /// Let \c x be <tt>when\<_, A0\>()(expr, state, visitor)</tt>.
+ /// Let \c y be <tt>when\<_, A1\>()(expr, state, visitor)</tt>.
+ /// If \c Fun is a binary PolymorphicFunction object that accepts \c x
+ /// and \c y, return <tt>Fun()(x, y)</tt>. Otherwise, return
+ /// <tt>Fun()(x, y, visitor)</tt>.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef
+ detail::call2<
+ Fun
+ , typename when<_, A0>::template result<void(Expr, State, Visitor)>::type
+ , typename when<_, A1>::template result<void(Expr, State, Visitor)>::type
+ , Visitor
+ >
+ impl;
+
+ return impl::call(
+ detail::as_lvalue(when<_, A0>()(expr, state, visitor))
+ , detail::as_lvalue(when<_, A1>()(expr, state, visitor))
+ , visitor
+ );
+ }
+ };
+
+ /// \brief Call the PolymorphicFunctionObject or the
+ /// PrimitiveTransform with the current expression, state
+ /// and visitor, transformed according to \c A0, \c A1, and
+ /// \c A2, respectively.
+ template<typename Fun, typename A0, typename A1, typename A2>
+ struct call<Fun(A0, A1, A2)> : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename when<_, A0>::template result<void(Expr, State, Visitor)>::type a0;
+ typedef typename when<_, A1>::template result<void(Expr, State, Visitor)>::type a1;
+ typedef typename when<_, A2>::template result<void(Expr, State, Visitor)>::type a2;
+ typedef typename boost::result_of<Fun(a0, a1, a2)>::type type;
+ };
+
+ /// Let \c x be <tt>when\<_, A0\>()(expr, state, visitor)</tt>.
+ /// Let \c y be <tt>when\<_, A1\>()(expr, state, visitor)</tt>.
+ /// Let \c z be <tt>when\<_, A2\>()(expr, state, visitor)</tt>.
+ /// Return <tt>Fun()(x, y, z)</tt>.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ Fun f;
+ return f(
+ detail::as_lvalue(when<_, A0>()(expr, state, visitor))
+ , detail::as_lvalue(when<_, A1>()(expr, state, visitor))
+ , detail::uncv(when<_, A2>()(expr, state, visitor)) // HACK
+ );
+ }
+ };
+
+ #if BOOST_PROTO_MAX_ARITY > 3
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (4, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/transform/call.hpp>))
+ #include BOOST_PP_ITERATE()
+ #endif
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Fun>
+ struct is_callable<transform::call<Fun> >
+ : mpl::true_
+ {};
+
+ }}
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ /// \brief Call the PolymorphicFunctionObject \c Fun with the
+ /// current expression, state and visitor, transformed according
+ /// to \c A0 through \c AN.
+ template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct call<Fun(BOOST_PP_ENUM_PARAMS(N, A))> : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ #define TMP(Z, M, DATA) \
+ typedef \
+ typename when<_, BOOST_PP_CAT(A, M)> \
+ ::template result<void(Expr, State, Visitor)> \
+ ::type \
+ BOOST_PP_CAT(a, M); \
+ /**/
+ BOOST_PP_REPEAT(N, TMP, ~)
+ #undef TMP
+
+ typedef
+ typename boost::result_of<
+ Fun(BOOST_PP_ENUM_PARAMS(N, a))
+ >::type
+ type;
+ };
+
+ /// Let \c ax be <tt>when\<_, Ax\>()(expr, state, visitor)</tt>
+ /// for each \c x in <tt>[0,N]</tt>.
+ /// Return <tt>Fun()(a0, a1,... aN)</tt>.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ Fun f;
+ #define TMP(Z, M, DATA) when<_, BOOST_PP_CAT(A, M)>()(expr, state, visitor)
+ return f(BOOST_PP_ENUM(N, TMP, ~));
+ #undef TMP
+ }
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/fold.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/fold.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,372 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file fold.hpp
+ /// Contains definition of the fold<> and reverse_fold<> transforms.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_TRANSFORM_FOLD_HPP_EAN_11_04_2007
+ #define BOOST_PROTO_TRANSFORM_FOLD_HPP_EAN_11_04_2007
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/version.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/arithmetic/inc.hpp>
+ #include <boost/preprocessor/arithmetic/sub.hpp>
+ #include <boost/preprocessor/repetition/repeat.hpp>
+ #if BOOST_VERSION >= 103500
+ #include <boost/fusion/include/fold.hpp>
+ #else
+ #include <boost/spirit/fusion/algorithm/fold.hpp>
+ #endif
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/fusion.hpp>
+ #include <boost/xpressive/proto/traits.hpp>
+ #include <boost/xpressive/proto/transform/call.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost { namespace proto
+ {
+ namespace transform
+ {
+
+ namespace detail
+ {
+
+ template<typename Transform, typename Visitor>
+ struct as_callable
+ {
+ as_callable(Visitor &v)
+ : v_(v)
+ {}
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State>
+ struct result<This(Expr, State)>
+ {
+ typedef
+ typename when<_, Transform>::template result<void(
+ BOOST_PROTO_UNCVREF(Expr)
+ , BOOST_PROTO_UNCVREF(State)
+ , Visitor
+ )>::type
+ type;
+ };
+
+ #if BOOST_VERSION < 103500
+ template<typename Expr, typename State>
+ struct apply : result<void(Expr, State)> {};
+ #endif
+
+ template<typename Expr, typename State>
+ typename when<_, Transform>::template result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state) const
+ {
+ return when<_, Transform>()(expr, state, this->v_);
+ }
+
+ private:
+ Visitor &v_;
+ };
+
+ #if BOOST_VERSION < 103500
+ template<typename Sequence, typename Void = void>
+ struct as_fusion_sequence_type
+ {
+ typedef Sequence const type;
+ };
+
+ template<typename Sequence>
+ Sequence const &as_fusion_sequence(Sequence const &sequence, ...)
+ {
+ return sequence;
+ }
+
+ template<typename Sequence>
+ struct as_fusion_sequence_type<Sequence, typename Sequence::proto_is_expr_>
+ {
+ typedef typename Sequence::proto_base_expr const type;
+ };
+
+ template<typename Sequence>
+ typename Sequence::proto_base_expr const &as_fusion_sequence(Sequence const &sequence, int)
+ {
+ return sequence.proto_base();
+ }
+
+ #define BOOST_PROTO_AS_FUSION_SEQUENCE_TYPE(X) typename detail::as_fusion_sequence_type<X>::type
+ #define BOOST_PROTO_AS_FUSION_SEQUENCE(X) detail::as_fusion_sequence(X, 0)
+ #else
+ #define BOOST_PROTO_AS_FUSION_SEQUENCE_TYPE(X) X
+ #define BOOST_PROTO_AS_FUSION_SEQUENCE(X) X
+ #endif
+
+ template<typename Fun, typename Expr, typename State, typename Visitor, long Arity = Expr::proto_arity::value>
+ struct fold_impl
+ {};
+
+ template<typename Fun, typename Expr, typename State, typename Visitor, long Arity = Expr::proto_arity::value>
+ struct reverse_fold_impl
+ {};
+
+ #define BOOST_PROTO_ARG_N_TYPE(n)\
+ BOOST_PP_CAT(proto_arg, n)\
+ /**/
+
+ #define BOOST_PROTO_FOLD_STATE_TYPE(z, n, data)\
+ typedef\
+ typename when<_, Fun>::template result<void(\
+ typename Expr::BOOST_PROTO_ARG_N_TYPE(n)::proto_base_expr\
+ , BOOST_PP_CAT(state, n)\
+ , Visitor\
+ )>::type\
+ BOOST_PP_CAT(state, BOOST_PP_INC(n));\
+ /**/
+
+ #define BOOST_PROTO_FOLD_STATE(z, n, data)\
+ BOOST_PP_CAT(state, BOOST_PP_INC(n)) const &BOOST_PP_CAT(s, BOOST_PP_INC(n)) =\
+ when<_, Fun>()(expr.BOOST_PP_CAT(arg, n).proto_base(), BOOST_PP_CAT(s, n), visitor);\
+ /**/
+
+ #define BOOST_PROTO_REVERSE_FOLD_STATE_TYPE(z, n, data)\
+ typedef\
+ typename when<_, Fun>::template result<void(\
+ typename Expr::BOOST_PROTO_ARG_N_TYPE(BOOST_PP_SUB(data, BOOST_PP_INC(n)))::proto_base_expr\
+ , BOOST_PP_CAT(state, BOOST_PP_SUB(data, n))\
+ , Visitor\
+ )>::type\
+ BOOST_PP_CAT(state, BOOST_PP_SUB(data, BOOST_PP_INC(n)));\
+ /**/
+
+ #define BOOST_PROTO_REVERSE_FOLD_STATE(z, n, data)\
+ BOOST_PP_CAT(state, BOOST_PP_SUB(data, BOOST_PP_INC(n))) const &BOOST_PP_CAT(s, BOOST_PP_SUB(data, BOOST_PP_INC(n))) =\
+ when<_, Fun>()(expr.BOOST_PP_CAT(arg, BOOST_PP_SUB(data, BOOST_PP_INC(n))).proto_base(), BOOST_PP_CAT(s, BOOST_PP_SUB(data, n)), visitor);\
+ /**/
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/transform/fold.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #undef BOOST_PROTO_REVERSE_FOLD_STATE
+ #undef BOOST_PROTO_REVERSE_FOLD_STATE_TYPE
+ #undef BOOST_PROTO_FOLD_STATE
+ #undef BOOST_PROTO_FOLD_STATE_TYPE
+ #undef BOOST_PROTO_ARG_N_TYPE
+
+ } // namespace detail
+
+ /// \brief A PrimitiveTransform that invokes the <tt>fusion::fold\<\></tt>
+ /// algorithm to accumulate
+ template<typename Sequence, typename State0, typename Fun>
+ struct fold : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ /// \brief A Fusion sequence.
+ typedef
+ typename when<_, Sequence>::template result<void(Expr, State, Visitor)>::type
+ sequence;
+
+ /// \brief An initial state for the fold.
+ typedef
+ typename when<_, State0>::template result<void(Expr, State, Visitor)>::type
+ state0;
+
+ /// \brief <tt>fun(v)(e,s) == when\<_,Fun\>()(e,s,v)</tt>
+ typedef
+ detail::as_callable<Fun, Visitor>
+ fun;
+
+ typedef
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::fold<
+ BOOST_PROTO_AS_FUSION_SEQUENCE_TYPE(sequence)
+ , state0
+ , fun
+ >::type
+ type;
+ };
+
+ /// Let \c seq be <tt>when\<_, Sequence\>()(expr, state, visitor)</tt>, let
+ /// \c state0 be <tt>when\<_, State0\>()(expr, state, visitor)</tt>, and
+ /// let \c fun(visitor) be an object such that <tt>fun(visitor)(expr, state)</tt>
+ /// is equivalent to <tt>when\<_, Fun\>()(expr, state, visitor)</tt>. Then, this
+ /// function returns <tt>fusion::fold(seq, state0, fun(visitor))</tt>.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ when<_, Sequence> sequence;
+ detail::as_callable<Fun, Visitor> fun(visitor);
+ return fusion::fold(
+ BOOST_PROTO_AS_FUSION_SEQUENCE(sequence(expr, state, visitor))
+ , when<_, State0>()(expr, state, visitor)
+ , fun
+ );
+ }
+ };
+
+ /// \brief A PrimitiveTransform that is the same as the
+ /// <tt>fold\<\></tt> transform, except that it folds
+ /// back-to-front instead of front-to-back. It uses
+ /// the \c _reverse callable PolymorphicFunctionObject
+ /// to create a <tt>fusion::reverse_view\<\></tt> of the
+ /// sequence before invoking <tt>fusion::fold\<\></tt>.
+ template<typename Sequence, typename State0, typename Fun>
+ struct reverse_fold
+ : fold<call<_reverse(Sequence)>, State0, Fun>
+ {};
+
+ // This specialization is only for improved compile-time performance
+ // in the commom case when the Sequence transform is \c proto::_.
+ //
+ /// INTERNAL ONLY
+ ///
+ template<typename State0, typename Fun>
+ struct fold<_, State0, Fun> : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename detail::fold_impl<
+ Fun
+ , typename Expr::proto_base_expr
+ , typename when<_, State0>::template result<void(Expr, State, Visitor)>::type
+ , Visitor
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef
+ detail::fold_impl<
+ Fun
+ , typename Expr::proto_base_expr
+ , typename when<_, State0>::template result<void(Expr, State, Visitor)>::type
+ , Visitor
+ >
+ impl;
+
+ return impl::call(
+ expr.proto_base()
+ , when<_, State0>()(expr, state, visitor)
+ , visitor
+ );
+ }
+ };
+
+ // This specialization is only for improved compile-time performance
+ // in the commom case when the Sequence transform is \c proto::_.
+ //
+ /// INTERNAL ONLY
+ ///
+ template<typename State0, typename Fun>
+ struct reverse_fold<_, State0, Fun> : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename detail::reverse_fold_impl<
+ Fun
+ , typename Expr::proto_base_expr
+ , typename when<_, State0>::template result<void(Expr, State, Visitor)>::type
+ , Visitor
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef
+ detail::reverse_fold_impl<
+ Fun
+ , typename Expr::proto_base_expr
+ , typename when<_, State0>::template result<void(Expr, State, Visitor)>::type
+ , Visitor
+ >
+ impl;
+
+ return impl::call(
+ expr.proto_base()
+ , when<_, State0>()(expr, state, visitor)
+ , visitor
+ );
+ }
+ };
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Sequence, typename State, typename Fun>
+ struct is_callable<transform::fold<Sequence, State, Fun> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Sequence, typename State, typename Fun>
+ struct is_callable<transform::reverse_fold<Sequence, State, Fun> >
+ : mpl::true_
+ {};
+
+ }}
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ template<typename Fun, typename Expr, typename state0, typename Visitor>
+ struct fold_impl<Fun, Expr, state0, Visitor, N>
+ {
+ BOOST_PP_REPEAT(N, BOOST_PROTO_FOLD_STATE_TYPE, N)
+ typedef BOOST_PP_CAT(state, N) type;
+
+ static type call(Expr const &expr, state0 const &s0, Visitor &visitor)
+ {
+ BOOST_PP_REPEAT(N, BOOST_PROTO_FOLD_STATE, N)
+ return BOOST_PP_CAT(s, N);
+ }
+ };
+
+ template<typename Fun, typename Expr, typename BOOST_PP_CAT(state, N), typename Visitor>
+ struct reverse_fold_impl<Fun, Expr, BOOST_PP_CAT(state, N), Visitor, N>
+ {
+ BOOST_PP_REPEAT(N, BOOST_PROTO_REVERSE_FOLD_STATE_TYPE, N)
+ typedef state0 type;
+
+ static type call(Expr const &expr, BOOST_PP_CAT(state, N) const &BOOST_PP_CAT(s, N), Visitor &visitor)
+ {
+ BOOST_PP_REPEAT(N, BOOST_PROTO_REVERSE_FOLD_STATE, N)
+ return s0;
+ }
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/fold_tree.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/fold_tree.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,205 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file fold_tree.hpp
+/// Contains definition of the fold_tree<> and reverse_fold_tree<> transforms.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_TRANSFORM_FOLD_TREE_HPP_EAN_11_05_2007
+#define BOOST_PROTO_TRANSFORM_FOLD_TREE_HPP_EAN_11_05_2007
+
+#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto/matches.hpp>
+#include <boost/xpressive/proto/transform/fold.hpp>
+#include <boost/xpressive/proto/detail/suffix.hpp>
+
+namespace boost { namespace proto
+{
+ namespace transform
+ {
+ namespace detail
+ {
+ template<typename Tag>
+ struct has_tag : proto::callable
+ {
+ template<typename Sig, typename EnableIf = Tag>
+ struct result
+ : mpl::false_
+ {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor), typename Expr::proto_tag>
+ : mpl::true_
+ {};
+ };
+
+ template<typename Tag, typename Fun>
+ struct fold_tree_
+ : if_<has_tag<Tag>, fold<_, _state, fold_tree_<Tag, Fun> >, Fun>
+ {};
+
+ template<typename Tag, typename Fun>
+ struct reverse_fold_tree_
+ : if_<has_tag<Tag>, reverse_fold<_, _state, reverse_fold_tree_<Tag, Fun> >, Fun>
+ {};
+ }
+
+ /// \brief A PrimitiveTransform that recursively applies the
+ /// <tt>fold\<\></tt> transform to sub-trees that all share a common
+ /// tag type.
+ ///
+ /// <tt>fold_tree\<\></tt> is useful for flattening trees into lists;
+ /// for example, you might use <tt>fold_tree\<\></tt> to flatten an
+ /// expression tree like <tt>a | b | c</tt> into a Fusion list like
+ /// <tt>cons(c, cons(b, cons(a)))</tt>.
+ ///
+ /// <tt>fold_tree\<\></tt> is easily understood in terms of a
+ /// <tt>recurse_if_\<\></tt> helper, defined as follows:
+ ///
+ /// \code
+ /// template<typename Tag, typename Fun>
+ /// struct recurse_if_
+ /// : if_<
+ /// // If the current node has type type "Tag" ...
+ /// is_same<tag_of<_>, Tag>()
+ /// // ... recurse, otherwise ...
+ /// , fold<_, _state, recurse_if_<Tag, Fun> >
+ /// // ... apply the Fun transform.
+ /// , Fun
+ /// >
+ /// {};
+ /// \endcode
+ ///
+ /// With <tt>recurse_if_\<\></tt> as defined above,
+ /// <tt>fold_tree\<Sequence, State0, Fun\>()(expr, state, visitor)</tt> is
+ /// equivalent to
+ /// <tt>fold<Sequence, State0, recurse_if_<Expr::proto_tag, Fun> >()(expr, state, visitor).</tt>
+ /// It has the effect of folding a tree front-to-back, recursing into
+ /// child nodes that share a tag type with the parent node.
+ template<typename Sequence, typename State0, typename Fun>
+ struct fold_tree
+ : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ /// \brief <tt>recurse_if_\<Expr::proto_tag, Fun\></tt>, as described below.
+ typedef
+ detail::fold_tree_<typename Expr::proto_tag, Fun>
+ recurse_if_;
+
+ typedef fold<Sequence, State0, recurse_if_> impl;
+ typedef typename impl::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ /// Let \c R be <tt>recurse_if_\<Expr::proto_tag,Fun\></tt> as described below.
+ /// This function returns <tt>fold\<Sequence, State0, R\>()(expr, state, visitor)</tt>.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef
+ detail::fold_tree_<typename Expr::proto_tag, Fun>
+ recurse_if_;
+
+ return fold<Sequence, State0, recurse_if_>()(expr, state, visitor);
+ }
+ };
+
+ /// \brief A PrimitiveTransform that recursively applies the
+ /// <tt>reverse_fold\<\></tt> transform to sub-trees that all share
+ /// a common tag type.
+ ///
+ /// <tt>reverse_fold_tree\<\></tt> is useful for flattening trees into
+ /// lists; for example, you might use <tt>reverse_fold_tree\<\></tt> to
+ /// flatten an expression tree like <tt>a | b | c</tt> into a Fusion list
+ /// like <tt>cons(a, cons(b, cons(c)))</tt>.
+ ///
+ /// <tt>reverse_fold_tree\<\></tt> is easily understood in terms of a
+ /// <tt>recurse_if_\<\></tt> helper, defined as follows:
+ ///
+ /// \code
+ /// template<typename Tag, typename Fun>
+ /// struct recurse_if_
+ /// : if_<
+ /// // If the current node has type type "Tag" ...
+ /// is_same<tag_of<_>, Tag>()
+ /// // ... recurse, otherwise ...
+ /// , reverse_fold<_, _state, recurse_if_<Tag, Fun> >
+ /// // ... apply the Fun transform.
+ /// , Fun
+ /// >
+ /// {};
+ /// \endcode
+ ///
+ /// With <tt>recurse_if_\<\></tt> as defined above,
+ /// <tt>reverse_fold_tree\<Sequence, State0, Fun\>()(expr, state, visitor)</tt> is
+ /// equivalent to
+ /// <tt>reverse_fold<Sequence, State0, recurse_if_<Expr::proto_tag, Fun> >()(expr, state, visitor).</tt>
+ /// It has the effect of folding a tree back-to-front, recursing into
+ /// child nodes that share a tag type with the parent node.
+ template<typename Sequence, typename State0, typename Fun>
+ struct reverse_fold_tree
+ : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ /// \brief <tt>recurse_if_\<Expr::proto_tag, Fun\></tt>, as described below.
+ typedef
+ detail::reverse_fold_tree_<typename Expr::proto_tag, Fun>
+ recurse_if_;
+
+ typedef reverse_fold<Sequence, State0, recurse_if_> impl;
+ typedef typename impl::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ /// Let \c R be <tt>recurse_if_\<Expr::proto_tag,Fun\></tt> as described below.
+ /// This function returns <tt>reverse_fold\<Sequence, State0, R\>()(expr, state, visitor)</tt>.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef
+ detail::reverse_fold_tree_<typename Expr::proto_tag, Fun>
+ recurse_if_;
+
+ return reverse_fold<Sequence, State0, recurse_if_>()(expr, state, visitor);
+ }
+ };
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Sequence, typename State0, typename Fun>
+ struct is_callable<transform::fold_tree<Sequence, State0, Fun> >
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Sequence, typename State0, typename Fun>
+ struct is_callable<transform::reverse_fold_tree<Sequence, State0, Fun> >
+ : mpl::true_
+ {};
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/make.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/make.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,366 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file make.hpp
+ /// Contains definition of the make<> transform.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_TRANSFORM_MAKE_HPP_EAN_12_02_2007
+ #define BOOST_PROTO_TRANSFORM_MAKE_HPP_EAN_12_02_2007
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/detail/workaround.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/preprocessor/repetition/enum_binary_params.hpp>
+ #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+ #include <boost/preprocessor/repetition/repeat_from_to.hpp>
+ #include <boost/preprocessor/facilities/intercept.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/preprocessor/selection/max.hpp>
+ #include <boost/preprocessor/arithmetic/inc.hpp>
+ #include <boost/mpl/aux_/has_type.hpp>
+ #include <boost/mpl/aux_/template_arity.hpp>
+ #include <boost/mpl/aux_/lambda_arity_param.hpp>
+ #include <boost/utility/result_of.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/traits.hpp>
+ #include <boost/xpressive/proto/args.hpp>
+ #include <boost/xpressive/proto/detail/as_lvalue.hpp>
+ #include <boost/xpressive/proto/detail/ignore_unused.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost { namespace proto
+ {
+
+ namespace transform
+ {
+ namespace detail
+ {
+ using proto::detail::as_lvalue;
+
+ template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PROTO_MAX_ARITY, typename A, void)>
+ struct typelist
+ {
+ typedef void type;
+ };
+
+ template<typename T, bool HasType = mpl::aux::has_type<T>::value>
+ struct nested_type
+ {
+ typedef typename T::type type;
+ };
+
+ template<typename T>
+ struct nested_type<T, false>
+ {
+ typedef T type;
+ };
+
+ template<typename T, typename Args, typename Void = void>
+ struct nested_type_if
+ : nested_type<T>
+ {};
+
+ template<typename R, typename Expr, typename State, typename Visitor
+ , bool IsTransform = is_callable<R>::value
+ >
+ struct make_if_;
+
+ template<typename R, typename Expr, typename State, typename Visitor
+ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(long Arity = mpl::aux::template_arity<R>::value)
+ >
+ struct make_
+ {
+ typedef R type;
+ typedef void not_applied_;
+ };
+
+ template<typename R, typename Expr, typename State, typename Visitor>
+ struct make_if_<R, Expr, State, Visitor, false>
+ : make_<R, Expr, State, Visitor>
+ {};
+
+ #if BOOST_WORKAROUND(__GNUC__, == 3)
+ // work around GCC bug
+ template<typename Tag, typename Args, long N, typename Expr, typename State, typename Visitor>
+ struct make_if_<proto::expr<Tag, Args, N>, Expr, State, Visitor, false>
+ {
+ typedef proto::expr<Tag, Args, N> type;
+ typedef void not_applied_;
+ };
+ #endif
+
+ template<typename R, typename Expr, typename State, typename Visitor>
+ struct make_if_<R, Expr, State, Visitor, true>
+ : boost::result_of<R(Expr, State, Visitor)>
+ {};
+
+ template<typename Type, bool IsAggregate = is_aggregate<Type>::value>
+ struct construct_
+ {
+ typedef Type result_type;
+
+ Type operator ()() const
+ {
+ return Type();
+ }
+
+ #define TMP(Z, N, DATA) \
+ template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename A)> \
+ Type operator ()(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, &a)) const \
+ { \
+ return Type(BOOST_PP_ENUM_PARAMS_Z(Z, N, a)); \
+ }
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), TMP, ~)
+ #undef TMP
+ };
+
+ template<typename Type>
+ struct construct_<Type, true>
+ {
+ typedef Type result_type;
+
+ Type operator ()() const
+ {
+ return Type();
+ }
+
+ #define TMP(Z, N, DATA) \
+ template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename A)> \
+ Type operator ()(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, &a)) const \
+ { \
+ Type that = {BOOST_PP_ENUM_PARAMS_Z(Z, N, a)}; \
+ return that; \
+ }
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), TMP, ~)
+ #undef TMP
+ };
+
+ #define TMP(Z, N, DATA) \
+ template<typename Type BOOST_PP_ENUM_TRAILING_PARAMS_Z(Z, N, typename A)> \
+ Type construct(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, &a)) \
+ { \
+ return construct_<Type>()(BOOST_PP_ENUM_PARAMS_Z(Z, N, a)); \
+ }
+ BOOST_PP_REPEAT(BOOST_PROTO_MAX_ARITY, TMP, ~)
+ #undef TMP
+ }
+
+ /// \brief A PrimitiveTransform which computes a type by evaluating any
+ /// nested transforms and then constructs an object of that type.
+ ///
+ /// The <tt>make\<\></tt> transform checks to see if \c Object is a template.
+ /// If it is, the template type is disassembled to find nested transforms.
+ /// Proto considers the following types to represent transforms:
+ ///
+ /// \li Function types
+ /// \li Function pointer types
+ /// \li Types for which <tt>proto::is_callable\< type \>::::value</tt> is \c true
+ ///
+ /// <tt>make\<T\<X0,X1,...\> \>::::result\<void(Expr, State, Visitor)\>::::type</tt>
+ /// is evaluated as follows. For each \c X in <tt>X0,X1,...</tt>, do:
+ ///
+ /// \li If \c X is a template like <tt>U\<Y0,Y1,...\></tt>, then let <tt>X'</tt>
+ /// be <tt>make\<U\<Y0,Y1,...\> \>::::result\<void(Expr, State, Visitor)\>::::type</tt>
+ /// (which evaluates this procedure recursively). Note whether any
+ /// substitutions took place during this operation.
+ /// \li Otherwise, if \c X is a transform, then let <tt>X'</tt> be
+ /// <tt>when\<_, X\>::::result\<void(Expr, State, Visitor)\>::::type</tt>.
+ /// Note that a substitution took place.
+ /// \li Otherwise, let <tt>X'</tt> be \c X, and note that no substitution
+ /// took place.
+ /// \li If any substitutions took place in any of the above steps and
+ /// <tt>T\<X0',X1',...\></tt> has a nested <tt>::type</tt> typedef,
+ /// the result type is <tt>T\<X0',X1',...\>::::type</tt>.
+ /// \li Otherwise, the result type is <tt>T\<X0',X1',...\></tt>.
+ ///
+ /// Note that <tt>when\<\></tt> is implemented in terms of <tt>call\<\></tt>
+ /// and <tt>make\<\></tt>, so the above procedure is evaluated recursively.
+ template<typename Object>
+ struct make : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef typename detail::make_if_<Object, Expr, State, Visitor>::type type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \return <tt>result\<void(Expr, State, Visitor)\>::::type()</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &, State const &, Visitor &) const
+ {
+ typedef typename result<void(Expr, State, Visitor)>::type result_type;
+ return result_type();
+ }
+ };
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/transform/make.hpp>))
+ #include BOOST_PP_ITERATE()
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Object>
+ struct is_callable<transform::make<Object> >
+ : mpl::true_
+ {};
+
+ }}
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ namespace detail
+ {
+ #if N > 0
+ template<typename T BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct nested_type_if<
+ T
+ , typelist<BOOST_PP_ENUM_PARAMS(N, A)>
+ , typename typelist<
+ BOOST_PP_ENUM_BINARY_PARAMS(N, typename A, ::not_applied_ BOOST_PP_INTERCEPT)
+ >::type
+ >
+ {
+ typedef T type;
+ typedef void not_applied_;
+ };
+
+ template<
+ template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class R
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
+ , typename Expr, typename State, typename Visitor
+ >
+ struct make_<R<BOOST_PP_ENUM_PARAMS(N, A)>, Expr, State, Visitor
+ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(N)
+ >
+ : nested_type_if<
+ #define TMP0(Z, M, DATA) make_if_<BOOST_PP_CAT(A, M), Expr, State, Visitor>
+ #define TMP1(Z, M, DATA) typename TMP0(Z, M, DATA) ::type
+ R<BOOST_PP_ENUM(N, TMP1, ~)>
+ , typelist<BOOST_PP_ENUM(N, TMP0, ~) >
+ #undef TMP0
+ #undef TMP1
+ >
+ {};
+ #endif
+
+ template<
+ typename R
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
+ , typename Expr, typename State, typename Visitor
+ >
+ struct make_if_<R(BOOST_PP_ENUM_PARAMS(N, A)), Expr, State, Visitor, false>
+ {
+ typedef typename when<_, R(BOOST_PP_ENUM_PARAMS(N, A))>::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ template<
+ typename R
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
+ , typename Expr, typename State, typename Visitor
+ >
+ struct make_if_<R(*)(BOOST_PP_ENUM_PARAMS(N, A)), Expr, State, Visitor, false>
+ {
+ typedef typename when<_, R(BOOST_PP_ENUM_PARAMS(N, A))>::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ template<typename T, typename A>
+ struct construct_<proto::expr<T, A, N>, true>
+ {
+ typedef proto::expr<T, A, N> result_type;
+
+ template<BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), typename A)>
+ result_type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_MAX(N, 1), A, &a)) const
+ {
+ return result_type::make(BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), a));
+ }
+ };
+ }
+
+ /// \brief A PrimitiveTransform which computes a type by evaluating any
+ /// nested transforms and then constructs an object of that type with the
+ /// current expression, state and visitor, transformed according
+ /// to \c A0 through \c AN.
+ template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct make<Object(BOOST_PP_ENUM_PARAMS(N, A))> : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ /// \brief <tt>make\<Object\>::::result\<void(Expr, State, Visitor)\>::::type</tt>
+ typedef typename detail::make_if_<Object, Expr, State, Visitor>::type type;
+ };
+
+ /// Let \c ax be <tt>when\<_, Ax\>()(expr, state, visitor)</tt>
+ /// for each \c x in <tt>[0,N]</tt>.
+ /// Let \c T be <tt>result\<void(Expr, State, Visitor)\>::::type</tt>.
+ /// Return <tt>T(a0, a1,... aN)</tt>.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ typedef typename result<void(Expr, State, Visitor)>::type result_type;
+ proto::detail::ignore_unused(expr);
+ proto::detail::ignore_unused(state);
+ proto::detail::ignore_unused(visitor);
+ return detail::construct<result_type>(
+ #define TMP(Z, M, DATA) detail::as_lvalue(when<_, BOOST_PP_CAT(A, M)>()(expr, state, visitor))
+ BOOST_PP_ENUM(N, TMP, DATA)
+ #undef TMP
+ );
+ }
+ };
+
+ #if BOOST_WORKAROUND(__GNUC__, == 3)
+ // work around GCC bug
+ template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))>
+ : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef proto::expr<Tag, Args, Arity> type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ proto::expr<Tag, Args, Arity> operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return proto::expr<Tag, Args, Arity>::make(
+ #define TMP(Z, M, DATA) detail::as_lvalue(when<_, BOOST_PP_CAT(A, M)>()(expr, state, visitor))
+ BOOST_PP_ENUM(N, TMP, DATA)
+ #undef TMP
+ );
+ }
+ };
+ #endif
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/pass_through.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/pass_through.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,205 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file pass_through.hpp
+ ///
+ /// Definition of the pass_through transform, which is the default transform
+ /// of all of the expression generator metafunctions such as posit<>, plus<>
+ /// and nary_expr<>.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_TRANSFORM_PASS_THROUGH_HPP_EAN_12_26_2006
+ #define BOOST_PROTO_TRANSFORM_PASS_THROUGH_HPP_EAN_12_26_2006
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/repetition/enum.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/mpl/bool.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/args.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost { namespace proto { namespace transform
+ {
+ namespace detail
+ {
+ template<
+ typename Grammar
+ , typename Expr
+ , typename State
+ , typename Visitor
+ , long Arity = Expr::proto_arity::value
+ >
+ struct pass_through_impl
+ {};
+
+ #define BOOST_PROTO_DEFINE_TRANSFORM_TYPE(z, n, data) \
+ typename Grammar::BOOST_PP_CAT(proto_arg, n)::template result<void( \
+ typename Expr::BOOST_PP_CAT(proto_arg, n)::proto_base_expr \
+ , State \
+ , Visitor \
+ )>::type
+
+ #define BOOST_PROTO_DEFINE_TRANSFORM(z, n, data) \
+ typename Grammar::BOOST_PP_CAT(proto_arg, n)()( \
+ expr.BOOST_PP_CAT(arg, n).proto_base(), state, visitor \
+ )
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/transform/pass_through.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #undef BOOST_PROTO_DEFINE_TRANSFORM
+ #undef BOOST_PROTO_DEFINE_TRANSFORM_TYPE
+
+ template<typename Grammar, typename Expr, typename State, typename Visitor>
+ struct pass_through_impl<Grammar, Expr, State, Visitor, 0>
+ {
+ typedef Expr type;
+
+ static Expr const &call(Expr const &expr, State const &, Visitor &)
+ {
+ return expr;
+ }
+ };
+
+ } // namespace detail
+
+ /// \brief A PrimitiveTransform that transforms the children expressions
+ /// of an expression node according to the corresponding children of
+ /// a Grammar.
+ ///
+ /// Given a Grammar such as <tt>plus\<T0, T1\></tt>, an expression type
+ /// that matches the grammar such as <tt>plus\<E0, E1\>::::type</tt>, a
+ /// state \c S and a visitor \c V, the result of applying the
+ /// <tt>pass_through\<plus\<T0, T1\> \></tt> transform is:
+ ///
+ /// \code
+ /// plus<
+ /// T0::result<void(E0, S, V)>::type
+ /// , T1::result<void(E1, S, V)>::type
+ /// >::type
+ /// \endcode
+ ///
+ /// The above demonstrates how children transforms and children expressions
+ /// are applied pairwise, and how the results are reassembled into a new
+ /// expression node with the same tag type as the original.
+ ///
+ /// The explicit use of <tt>pass_through\<\></tt> is not usually needed,
+ /// since the expression generator metafunctions such as
+ /// <tt>plus\<\></tt> have <tt>pass_through\<\></tt> as their default
+ /// transform. So, for instance, these are equivalent:
+ ///
+ /// \code
+ /// // Within a grammar definition, these are equivalent:
+ /// when< plus<X, Y>, pass_through< plus<X, Y> > >
+ /// when< plus<X, Y>, plus<X, Y> >
+ /// when< plus<X, Y> > // because of when<class X, class Y=X>
+ /// plus<X, Y> // because plus<> is both a
+ /// // grammar and a transform
+ /// \endcode
+ ///
+ /// For example, consider the following transform that promotes all
+ /// \c float terminals in an expression to \c double.
+ ///
+ /// \code
+ /// // This transform finds all float terminals in an expression and promotes
+ /// // them to doubles.
+ /// struct Promote
+ /// : or_<
+ /// when<terminal<float>, terminal<double>::type(_arg) >
+ /// // terminal<>'s default transform is a no-op:
+ /// , terminal<_>
+ /// // nary_expr<> has a pass_through<> transform:
+ /// , nary_expr<_, vararg<Promote> >
+ /// >
+ /// {};
+ /// \endcode
+ template<typename Grammar>
+ struct pass_through
+ : proto::callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ transform::detail::pass_through_impl<
+ Grammar
+ , typename Expr::proto_base_expr
+ , State
+ , Visitor
+ , Expr::proto_arity::value
+ >
+ impl;
+
+ typedef typename impl::type type;
+ };
+
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, Grammar\>::::value</tt> is \c true.
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return result<void(Expr, State, Visitor)>::impl
+ ::call(expr.proto_base(), state, visitor);
+ }
+ };
+
+ } // namespace transform
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Grammar>
+ struct is_callable<transform::pass_through<Grammar> >
+ : mpl::true_
+ {};
+
+ }} // namespace boost::proto
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ template<typename Grammar, typename Expr, typename State, typename Visitor>
+ struct pass_through_impl<Grammar, Expr, State, Visitor, N>
+ {
+ typedef proto::expr<
+ typename Expr::proto_tag
+ , BOOST_PP_CAT(args, N)<
+ BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM_TYPE, ~)
+ >
+ > type;
+
+ #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+ template<typename Expr2, typename State2, typename Visitor2>
+ static type call(Expr2 const &expr, State2 const &state, Visitor2 &visitor)
+ #else
+ static type call(Expr const &expr, State const &state, Visitor &visitor)
+ #endif
+ {
+ type that = {
+ BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM, ~)
+ };
+ #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
+ // Without this, MSVC complains that "that" is uninitialized,
+ // and it actually triggers a runtime check in debug mode when
+ // built with VC8.
+ &that;
+ #endif
+ return that;
+ }
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/when.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/proto/transform/when.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,189 @@
+#ifndef BOOST_PP_IS_ITERATING
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file when.hpp
+ /// Definition of when transform.
+ //
+ // Copyright 2008 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #ifndef BOOST_PROTO_TRANSFORM_WHEN_HPP_EAN_10_29_2007
+ #define BOOST_PROTO_TRANSFORM_WHEN_HPP_EAN_10_29_2007
+
+ #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/preprocessor/cat.hpp>
+ #include <boost/preprocessor/repetition/enum_params.hpp>
+ #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/mpl/if.hpp>
+ #include <boost/xpressive/proto/proto_fwd.hpp>
+ #include <boost/xpressive/proto/traits.hpp>
+ #include <boost/xpressive/proto/transform/call.hpp>
+ #include <boost/xpressive/proto/transform/make.hpp>
+ #include <boost/xpressive/proto/detail/suffix.hpp>
+
+ namespace boost { namespace proto { namespace transform
+ {
+ /// \brief A grammar element and a PrimitiveTransform that associates
+ /// a transform with the grammar.
+ ///
+ /// Use <tt>when\<\></tt> to override a grammar's default transform
+ /// with a custom transform. It is for used when composing larger
+ /// transforms by associating smaller transforms with individual
+ /// rules in your grammar, as in the following transform which
+ /// counts the number of terminals in an expression.
+ ///
+ /// \code
+ /// // Count the terminals in an expression tree.
+ /// // Must be invoked with initial state == mpl::int_<0>().
+ /// struct CountLeaves
+ /// : or_<
+ /// when<terminal<_>, mpl::next<_state>()>
+ /// , otherwise<fold<_, _state, CountLeaves> >
+ /// >
+ /// {};
+ /// \endcode
+ ///
+ /// In <tt>when\<G, T\></tt>, when \c T is a class type it is a
+ /// PrimitiveTransform and the following equivalencies hold:
+ ///
+ /// <tt>when\<G,T\>::::result\<void(E,S,V)\>::::type</tt> is the same as
+ /// <tt>T::result\<void(E,S,V)\>::::type</tt>.
+ ///
+ /// <tt>when\<G,T\>()(e,s,v)</tt> is the same as
+ /// <tt>T()(e,s,v)</tt>.
+ template<typename Grammar, typename PrimitiveTransform BOOST_PROTO_FOR_DOXYGEN_ONLY(= Grammar)>
+ struct when
+ : PrimitiveTransform
+ {
+ typedef typename Grammar::proto_base_expr proto_base_expr;
+ };
+
+ /// \brief A specialization that treats function pointer Transforms as
+ /// if they were function type Transforms.
+ ///
+ /// This specialization requires that \c Fun is actually a function type.
+ ///
+ /// This specialization is required for nested transforms such as
+ /// <tt>when\<G, T0(T1(_))\></tt>. In C++, functions that are used as
+ /// parameters to other functions automatically decay to funtion
+ /// pointer types. In other words, the type <tt>T0(T1(_))</tt> is
+ /// indistinguishable from <tt>T0(T1(*)(_))</tt>. This specialization
+ /// is required to handle these nested function pointer type transforms
+ /// properly.
+ template<typename Grammar, typename Fun>
+ struct when<Grammar, Fun *>
+ : when<Grammar, Fun>
+ {};
+
+ /// \brief Syntactic sugar for <tt>when\<_, Fun\></tt>, for use
+ /// in grammars to handle all the cases not yet handled.
+ ///
+ /// Use <tt>otherwise\<T\></tt> in your grammars as a synonym for
+ /// <tt>when\<_, T\></tt> as in the following transform which
+ /// counts the number of terminals in an expression.
+ ///
+ /// \code
+ /// // Count the terminals in an expression tree.
+ /// // Must be invoked with initial state == mpl::int_<0>().
+ /// struct CountLeaves
+ /// : or_<
+ /// when<terminal<_>, mpl::next<_state>()>
+ /// , otherwise<fold<_, _state, CountLeaves> >
+ /// >
+ /// {};
+ /// \endcode
+ template<typename Fun>
+ struct otherwise
+ : when<_, Fun>
+ {};
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/transform/when.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ }}} // namespace boost::proto::transform
+
+ #endif
+
+#else
+
+ #define N BOOST_PP_ITERATION()
+
+ /// \brief A grammar element and a PrimitiveTransform that associates
+ /// a transform with the grammar.
+ ///
+ /// Use <tt>when\<\></tt> to override a grammar's default transform
+ /// with a custom transform. It is for used when composing larger
+ /// transforms by associating smaller transforms with individual
+ /// rules in your grammar, as in the following transform which
+ /// counts the number of terminals in an expression.
+ ///
+ /// \code
+ /// // Count the terminals in an expression tree.
+ /// // Must be invoked with initial state == mpl::int_<0>().
+ /// struct CountLeaves
+ /// : or_<
+ /// when<terminal<_>, mpl::next<_state>()>
+ /// , otherwise<fold<_, _state, CountLeaves> >
+ /// >
+ /// {};
+ /// \endcode
+ ///
+ /// The <tt>when\<G, R(A0,A1,...)\></tt> form accepts either a
+ /// CallableTransform or an ObjectTransform as its second parameter.
+ /// <tt>when\<\></tt> uses <tt>is_callable\<R\>::::value</tt> to
+ /// distinguish between the two, and uses <tt>call\<\></tt> to
+ /// evaluate CallableTransforms and <tt>make\<\></tt> to evaluate
+ /// ObjectTransforms.
+ template<typename Grammar, typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A))>
+ : proto::callable
+ {
+ typedef typename Grammar::proto_base_expr proto_base_expr;
+
+ // Note: do not evaluate is_callable<R> in this scope.
+ // R may be an incomplete type at this point.
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef call<R(BOOST_PP_ENUM_PARAMS(N, A))> call_;
+ typedef make<R(BOOST_PP_ENUM_PARAMS(N, A))> make_;
+
+ typedef
+ typename mpl::if_c<
+ // OK to evaluate is_callable<R> here.
+ // R should be compete by now.
+ is_callable<R>::value
+ , call_ // "R" is a function to call
+ , make_ // "R" is an object to construct
+ >::type
+ impl;
+
+ typedef typename impl::template result<void(Expr, State, Visitor)>::type type;
+ };
+
+ /// Evaluate <tt>R(A0,A1,...)</tt> as a transform either with
+ /// <tt>call\<\></tt> or with <tt>make\<\></tt> depending on
+ /// whether <tt>is_callable\<R\>::::value</tt> is \c true or
+ /// \c false.
+ ///
+ /// \param expr The current expression
+ /// \param state The current state
+ /// \param visitor An arbitrary visitor
+ /// \pre <tt>matches\<Expr, Grammar\>::::value</tt> is \c true
+ /// \return <tt>result\<void(Expr, State, Visitor)\>::::impl()(expr, state, visitor)</tt>
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return typename result<void(Expr, State, Visitor)>::impl()(expr, state, visitor);
+ }
+ };
+
+ #undef N
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_actions.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_actions.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,881 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file regex_actions.hpp
+/// Defines the syntax elements of xpressive's action expressions.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_ACTIONS_HPP_EAN_03_22_2007
+#define BOOST_XPRESSIVE_ACTIONS_HPP_EAN_03_22_2007
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+#include <boost/ref.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/core/matcher/attr_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/attr_end_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/attr_begin_matcher.hpp>
+#include <boost/xpressive/detail/core/matcher/predicate_matcher.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+
+// These are very often needed by client code.
+#include <boost/typeof/std/map.hpp>
+#include <boost/typeof/std/string.hpp>
+
+// Doxygen can't handle proto :-(
+#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
+# include <boost/xpressive/proto/transform.hpp>
+# include <boost/xpressive/detail/core/matcher/action_matcher.hpp>
+#endif
+
+/// INTERNAL ONLY
+///
+#define UNREF(x) typename remove_reference<x>::type
+
+/// INTERNAL ONLY
+///
+#define UNCVREF(x) typename remove_cv<typename remove_reference<x>::type>::type
+
+#if BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable : 4510) // default constructor could not be generated
+#pragma warning(disable : 4512) // assignment operator could not be generated
+#pragma warning(disable : 4610) // can never be instantiated - user defined constructor required
+#endif
+
+namespace boost { namespace xpressive
+{
+
+ namespace detail
+ {
+ template<typename T, typename U>
+ struct action_arg
+ {
+ typedef T type;
+ typedef typename add_reference<T>::type reference;
+
+ reference cast(void *pv) const
+ {
+ return *static_cast<UNREF(T) *>(pv);
+ }
+ };
+
+ template<typename T>
+ struct value_wrapper
+ {
+ value_wrapper()
+ : value()
+ {}
+
+ value_wrapper(T const &t)
+ : value(t)
+ {}
+
+ T value;
+ };
+
+ struct check_tag
+ {};
+
+ struct BindArg : proto::callable
+ {
+ typedef int result_type;
+
+ template<typename Visitor, typename Expr>
+ int operator ()(Visitor &visitor, Expr const &expr) const
+ {
+ visitor.let(expr);
+ return 0;
+ }
+ };
+
+ struct let_tag
+ {};
+
+ struct BindArgs
+ : proto::when<
+ // let(_a = b, _c = d)
+ proto::function<
+ proto::terminal<let_tag>
+ , proto::vararg<proto::assign<proto::_, proto::_> >
+ >
+ , proto::function<
+ proto::_state // no-op
+ , proto::vararg<proto::call<BindArg(proto::_visitor, proto::_)> >
+ >
+ >
+ {};
+
+ struct let_domain
+ : boost::proto::domain<boost::proto::pod_generator<let_> >
+ {};
+
+ template<typename Expr>
+ struct let_
+ {
+ BOOST_PROTO_EXTENDS(Expr, let_<Expr>, let_domain)
+ BOOST_PROTO_EXTENDS_FUNCTION(Expr, let_<Expr>, let_domain)
+ };
+
+ template<typename Args, typename BidiIter>
+ void bind_args(let_<Args> const &args, match_results<BidiIter> &what)
+ {
+ BindArgs()(args, 0, what);
+ }
+
+ template<typename BidiIter>
+ struct replacement_context
+ : proto::callable_context<replacement_context<BidiIter> const>
+ {
+ replacement_context(match_results<BidiIter> const &what)
+ : what_(what)
+ {}
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This>
+ struct result<This(proto::tag::terminal, mark_placeholder const &)>
+ {
+ typedef sub_match<BidiIter> const &type;
+ };
+
+ template<typename This>
+ struct result<This(proto::tag::terminal, any_matcher const &)>
+ {
+ typedef sub_match<BidiIter> const &type;
+ };
+
+ template<typename This, typename T>
+ struct result<This(proto::tag::terminal, reference_wrapper<T> const &)>
+ {
+ typedef T &type;
+ };
+
+ sub_match<BidiIter> const &operator ()(proto::tag::terminal, mark_placeholder m) const
+ {
+ return this->what_[m.mark_number_];
+ }
+
+ sub_match<BidiIter> const &operator ()(proto::tag::terminal, any_matcher) const
+ {
+ return this->what_[0];
+ }
+
+ template<typename T>
+ T &operator ()(proto::tag::terminal, reference_wrapper<T> r) const
+ {
+ return r;
+ }
+ private:
+ match_results<BidiIter> const &what_;
+ };
+ }
+
+ namespace op
+ {
+ struct push
+ {
+ typedef void result_type;
+
+ template<typename Sequence, typename Value>
+ void operator()(Sequence &seq, Value const &val) const
+ {
+ seq.push(val);
+ }
+ };
+
+ struct push_back
+ {
+ typedef void result_type;
+
+ template<typename Sequence, typename Value>
+ void operator()(Sequence &seq, Value const &val) const
+ {
+ seq.push_back(val);
+ }
+ };
+
+ struct push_front
+ {
+ typedef void result_type;
+
+ template<typename Sequence, typename Value>
+ void operator()(Sequence &seq, Value const &val) const
+ {
+ seq.push_front(val);
+ }
+ };
+
+ struct pop
+ {
+ typedef void result_type;
+
+ template<typename Sequence>
+ void operator()(Sequence &seq) const
+ {
+ seq.pop();
+ }
+ };
+
+ struct pop_back
+ {
+ typedef void result_type;
+
+ template<typename Sequence>
+ void operator()(Sequence &seq) const
+ {
+ seq.pop_back();
+ }
+ };
+
+ struct pop_front
+ {
+ typedef void result_type;
+
+ template<typename Sequence>
+ void operator()(Sequence &seq) const
+ {
+ seq.pop_front();
+ }
+ };
+
+ struct front
+ {
+ template<typename Sig>
+ struct result {};
+
+ template<typename This, typename Sequence>
+ struct result<This(Sequence)>
+ {
+ typedef UNREF(Sequence) sequence_type;
+ typedef
+ typename mpl::if_<
+ is_const<sequence_type>
+ , typename sequence_type::const_reference
+ , typename sequence_type::reference
+ >::type
+ type;
+ };
+
+ template<typename Sequence>
+ typename result<front(Sequence &)>::type operator()(Sequence &seq) const
+ {
+ return seq.front();
+ }
+ };
+
+ struct back
+ {
+ template<typename Sig>
+ struct result {};
+
+ template<typename This, typename Sequence>
+ struct result<This(Sequence)>
+ {
+ typedef UNREF(Sequence) sequence_type;
+ typedef
+ typename mpl::if_<
+ is_const<sequence_type>
+ , typename sequence_type::const_reference
+ , typename sequence_type::reference
+ >::type
+ type;
+ };
+
+ template<typename Sequence>
+ typename result<back(Sequence &)>::type operator()(Sequence &seq) const
+ {
+ return seq.back();
+ }
+ };
+
+ struct top
+ {
+ template<typename Sig>
+ struct result {};
+
+ template<typename This, typename Sequence>
+ struct result<This(Sequence)>
+ {
+ typedef UNREF(Sequence) sequence_type;
+ typedef
+ typename mpl::if_<
+ is_const<sequence_type>
+ , typename sequence_type::value_type const &
+ , typename sequence_type::value_type &
+ >::type
+ type;
+ };
+
+ template<typename Sequence>
+ typename result<top(Sequence &)>::type operator()(Sequence &seq) const
+ {
+ return seq.top();
+ }
+ };
+
+ struct first
+ {
+ template<typename Sig>
+ struct result {};
+
+ template<typename This, typename Pair>
+ struct result<This(Pair)>
+ {
+ typedef UNREF(Pair)::first_type type;
+ };
+
+ template<typename Pair>
+ typename Pair::first_type operator()(Pair const &p) const
+ {
+ return p.first;
+ }
+ };
+
+ struct second
+ {
+ template<typename Sig>
+ struct result {};
+
+ template<typename This, typename Pair>
+ struct result<This(Pair)>
+ {
+ typedef UNREF(Pair)::second_type type;
+ };
+
+ template<typename Pair>
+ typename Pair::second_type operator()(Pair const &p) const
+ {
+ return p.second;
+ }
+ };
+
+ struct matched
+ {
+ typedef bool result_type;
+
+ template<typename Sub>
+ bool operator()(Sub const &sub) const
+ {
+ return sub.matched;
+ }
+ };
+
+ struct length
+ {
+ template<typename Sig>
+ struct result {};
+
+ template<typename This, typename Sub>
+ struct result<This(Sub)>
+ {
+ typedef UNREF(Sub)::difference_type type;
+ };
+
+ template<typename Sub>
+ typename Sub::difference_type operator()(Sub const &sub) const
+ {
+ return sub.length();
+ }
+ };
+
+ struct str
+ {
+ template<typename Sig>
+ struct result {};
+
+ template<typename This, typename Sub>
+ struct result<This(Sub)>
+ {
+ typedef UNREF(Sub)::string_type type;
+ };
+
+ template<typename Sub>
+ typename Sub::string_type operator()(Sub const &sub) const
+ {
+ return sub.str();
+ }
+ };
+
+ // This codifies the return types of the various insert member
+ // functions found in sequence containers, the 2 flavors of
+ // associative containers, and strings.
+ struct insert
+ {
+ template<typename Sig, typename EnableIf = void>
+ struct result
+ {};
+
+ // assoc containers
+ template<typename This, typename Cont, typename Value>
+ struct result<This(Cont, Value), void>
+ {
+ typedef UNREF(Cont) cont_type;
+ typedef UNREF(Value) value_type;
+ static cont_type &scont_;
+ static value_type &svalue_;
+ typedef char yes_type;
+ typedef char (&no_type)[2];
+ static yes_type check_insert_return(typename cont_type::iterator);
+ static no_type check_insert_return(std::pair<typename cont_type::iterator, bool>);
+ BOOST_STATIC_CONSTANT(bool, is_iterator = (sizeof(yes_type) == sizeof(check_insert_return(scont_.insert(svalue_)))));
+ typedef
+ typename mpl::if_c<
+ is_iterator
+ , typename cont_type::iterator
+ , std::pair<typename cont_type::iterator, bool>
+ >::type
+ type;
+ };
+
+ // sequence containers, assoc containers, strings
+ template<typename This, typename Cont, typename It, typename Value>
+ struct result<This(Cont, It, Value),
+ typename disable_if<mpl::or_<is_integral<UNCVREF(It)>, is_same<UNCVREF(It), UNCVREF(Value)> > >::type>
+ {
+ typedef UNREF(Cont)::iterator type;
+ };
+
+ // strings
+ template<typename This, typename Cont, typename Size, typename T>
+ struct result<This(Cont, Size, T),
+ typename enable_if<is_integral<UNCVREF(Size)> >::type>
+ {
+ typedef UNREF(Cont) &type;
+ };
+
+ // assoc containers
+ template<typename This, typename Cont, typename It>
+ struct result<This(Cont, It, It), void>
+ {
+ typedef void type;
+ };
+
+ // sequence containers, strings
+ template<typename This, typename Cont, typename It, typename Size, typename Value>
+ struct result<This(Cont, It, Size, Value),
+ typename disable_if<is_integral<UNCVREF(It)> >::type>
+ {
+ typedef void type;
+ };
+
+ // strings
+ template<typename This, typename Cont, typename Size, typename A0, typename A1>
+ struct result<This(Cont, Size, A0, A1),
+ typename enable_if<is_integral<UNCVREF(Size)> >::type>
+ {
+ typedef UNREF(Cont) &type;
+ };
+
+ /// operator()
+ ///
+ template<typename Cont, typename A0>
+ typename result<insert(Cont &, A0 const &)>::type
+ operator()(Cont &cont, A0 const &a0) const
+ {
+ return cont.insert(a0);
+ }
+
+ /// \overload
+ ///
+ template<typename Cont, typename A0, typename A1>
+ typename result<insert(Cont &, A0 const &, A1 const &)>::type
+ operator()(Cont &cont, A0 const &a0, A1 const &a1) const
+ {
+ return cont.insert(a0, a1);
+ }
+
+ /// \overload
+ ///
+ template<typename Cont, typename A0, typename A1, typename A2>
+ typename result<insert(Cont &, A0 const &, A1 const &, A2 const &)>::type
+ operator()(Cont &cont, A0 const &a0, A1 const &a1, A2 const &a2) const
+ {
+ return cont.insert(a0, a1, a2);
+ }
+ };
+
+ struct make_pair
+ {
+ template<typename Sig>
+ struct result {};
+
+ template<typename This, typename First, typename Second>
+ struct result<This(First, Second)>
+ {
+ typedef std::pair<UNCVREF(First), UNCVREF(Second)> type;
+ };
+
+ template<typename First, typename Second>
+ std::pair<First, Second> operator()(First const &first, Second const &second) const
+ {
+ return std::make_pair(first, second);
+ }
+ };
+
+ template<typename T>
+ struct as
+ {
+ typedef T result_type;
+
+ template<typename Value>
+ T operator()(Value const &val) const
+ {
+ return lexical_cast<T>(val);
+ }
+ };
+
+ template<typename T>
+ struct static_cast_
+ {
+ typedef T result_type;
+
+ template<typename Value>
+ T operator()(Value const &val) const
+ {
+ return static_cast<T>(val);
+ }
+ };
+
+ template<typename T>
+ struct dynamic_cast_
+ {
+ typedef T result_type;
+
+ template<typename Value>
+ T operator()(Value const &val) const
+ {
+ return dynamic_cast<T>(val);
+ }
+ };
+
+ template<typename T>
+ struct const_cast_
+ {
+ typedef T result_type;
+
+ template<typename Value>
+ T operator()(Value const &val) const
+ {
+ return const_cast<T>(val);
+ }
+ };
+
+ template<typename T>
+ struct construct
+ {
+ typedef T result_type;
+
+ T operator()() const
+ {
+ return T();
+ }
+
+ template<typename A0>
+ T operator()(A0 const &a0) const
+ {
+ return T(a0);
+ }
+
+ template<typename A0, typename A1>
+ T operator()(A0 const &a0, A1 const &a1) const
+ {
+ return T(a0, a1);
+ }
+
+ template<typename A0, typename A1, typename A2>
+ T operator()(A0 const &a0, A1 const &a1, A2 const &a2) const
+ {
+ return T(a0, a1, a2);
+ }
+ };
+
+ template<typename Except>
+ struct throw_
+ {
+ typedef void result_type;
+
+ void operator()() const
+ {
+ boost::throw_exception(Except());
+ }
+
+ template<typename A0>
+ void operator()(A0 const &a0) const
+ {
+ boost::throw_exception(Except(a0));
+ }
+
+ template<typename A0, typename A1>
+ void operator()(A0 const &a0, A1 const &a1) const
+ {
+ boost::throw_exception(Except(a0, a1));
+ }
+
+ template<typename A0, typename A1, typename A2>
+ void operator()(A0 const &a0, A1 const &a1, A2 const &a2) const
+ {
+ boost::throw_exception(Except(a0, a1, a2));
+ }
+ };
+ }
+
+ template<typename Fun>
+ struct function
+ {
+ typedef typename proto::terminal<Fun>::type type;
+ };
+
+ function<op::push>::type const push = {{}};
+ function<op::push_back>::type const push_back = {{}};
+ function<op::push_front>::type const push_front = {{}};
+ function<op::pop>::type const pop = {{}};
+ function<op::pop_back>::type const pop_back = {{}};
+ function<op::pop_front>::type const pop_front = {{}};
+ function<op::top>::type const top = {{}};
+ function<op::back>::type const back = {{}};
+ function<op::front>::type const front = {{}};
+ function<op::first>::type const first = {{}};
+ function<op::second>::type const second = {{}};
+ function<op::matched>::type const matched = {{}};
+ function<op::length>::type const length = {{}};
+ function<op::str>::type const str = {{}};
+ function<op::insert>::type const insert = {{}};
+ function<op::make_pair>::type const make_pair = {{}};
+
+ template<typename T>
+ struct value
+ : proto::extends<typename proto::terminal<T>::type, value<T> >
+ {
+ typedef proto::extends<typename proto::terminal<T>::type, value<T> > base_type;
+
+ value()
+ : base_type()
+ {}
+
+ explicit value(T const &t)
+ : base_type(base_type::proto_base_expr::make(t))
+ {}
+
+ using base_type::operator =;
+
+ T &get()
+ {
+ return proto::arg(*this);
+ }
+
+ T const &get() const
+ {
+ return proto::arg(*this);
+ }
+ };
+
+ template<typename T>
+ struct reference
+ : proto::extends<typename proto::terminal<reference_wrapper<T> >::type, reference<T> >
+ {
+ typedef proto::extends<typename proto::terminal<reference_wrapper<T> >::type, reference<T> > base_type;
+
+ explicit reference(T &t)
+ : base_type(base_type::proto_base_expr::make(boost::ref(t)))
+ {}
+
+ using base_type::operator =;
+
+ T &get() const
+ {
+ return proto::arg(*this).get();
+ }
+ };
+
+ template<typename T>
+ struct local
+ : private noncopyable
+ , detail::value_wrapper<T>
+ , proto::terminal<reference_wrapper<T> >::type
+ {
+ typedef typename proto::terminal<reference_wrapper<T> >::type base_type;
+
+ local()
+ : noncopyable()
+ , detail::value_wrapper<T>()
+ , base_type(base_type::make(boost::ref(detail::value_wrapper<T>::value)))
+ {}
+
+ explicit local(T const &t)
+ : noncopyable()
+ , detail::value_wrapper<T>(t)
+ , base_type(base_type::make(boost::ref(detail::value_wrapper<T>::value)))
+ {}
+
+ using base_type::operator =;
+
+ T &get()
+ {
+ return proto::arg(*this);
+ }
+
+ T const &get() const
+ {
+ return proto::arg(*this);
+ }
+ };
+
+ /// as (a.k.a., lexical_cast)
+ ///
+ BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ 1
+ , as
+ , boost::proto::default_domain
+ , (boost::proto::tag::function)
+ , ((op::as)(typename))
+ )
+
+ /// static_cast_
+ ///
+ BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ 1
+ , static_cast_
+ , boost::proto::default_domain
+ , (boost::proto::tag::function)
+ , ((op::static_cast_)(typename))
+ )
+
+ /// dynamic_cast_
+ ///
+ BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ 1
+ , dynamic_cast_
+ , boost::proto::default_domain
+ , (boost::proto::tag::function)
+ , ((op::dynamic_cast_)(typename))
+ )
+
+ /// const_cast_
+ ///
+ BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ 1
+ , const_cast_
+ , boost::proto::default_domain
+ , (boost::proto::tag::function)
+ , ((op::const_cast_)(typename))
+ )
+
+ /// val()
+ ///
+ template<typename T>
+ value<T> const val(T const &t)
+ {
+ return value<T>(t);
+ }
+
+ /// ref()
+ ///
+ template<typename T>
+ reference<T> const ref(T &t)
+ {
+ return reference<T>(t);
+ }
+
+ /// cref()
+ ///
+ template<typename T>
+ reference<T const> const cref(T const &t)
+ {
+ return reference<T const>(t);
+ }
+
+ /// check(), for testing custom assertions
+ ///
+ proto::terminal<detail::check_tag>::type const check = {{}};
+
+ /// let(), for binding references to non-local variables
+ ///
+ detail::let_<proto::terminal<detail::let_tag>::type> const let = {{{}}};
+
+ /// placeholder<T>, for defining a placeholder to stand in fo
+ /// a variable of type T in a semantic action.
+ ///
+ template<typename T, int I, typename Dummy>
+ struct placeholder
+ {
+ typedef placeholder<T, I, Dummy> this_type;
+ typedef typename proto::terminal<detail::action_arg<T, mpl::int_<I> > >::type action_arg_type;
+
+ BOOST_PROTO_EXTENDS(action_arg_type, this_type, proto::default_domain)
+ BOOST_PROTO_EXTENDS_ASSIGN(action_arg_type, this_type, proto::default_domain)
+ BOOST_PROTO_EXTENDS_SUBSCRIPT(action_arg_type, this_type, proto::default_domain)
+ BOOST_PROTO_EXTENDS_FUNCTION(action_arg_type, this_type, proto::default_domain)
+ };
+
+ /// Usage: construct\<Type\>(arg1, arg2)
+ ///
+ BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
+ construct
+ , boost::proto::default_domain
+ , (boost::proto::tag::function)
+ , ((op::construct)(typename))
+ )
+
+ /// Usage: throw_\<Exception\>(arg1, arg2)
+ ///
+ BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
+ throw_
+ , boost::proto::default_domain
+ , (boost::proto::tag::function)
+ , ((op::throw_)(typename))
+ )
+
+ namespace detail
+ {
+ inline void ignore_unused_regex_actions()
+ {
+ ignore_unused(xpressive::push);
+ ignore_unused(xpressive::push_back);
+ ignore_unused(xpressive::push_front);
+ ignore_unused(xpressive::pop);
+ ignore_unused(xpressive::pop_back);
+ ignore_unused(xpressive::pop_front);
+ ignore_unused(xpressive::top);
+ ignore_unused(xpressive::back);
+ ignore_unused(xpressive::front);
+ ignore_unused(xpressive::first);
+ ignore_unused(xpressive::second);
+ ignore_unused(xpressive::matched);
+ ignore_unused(xpressive::length);
+ ignore_unused(xpressive::str);
+ ignore_unused(xpressive::insert);
+ ignore_unused(xpressive::make_pair);
+ ignore_unused(xpressive::check);
+ ignore_unused(xpressive::let);
+ }
+ }
+
+}}
+
+#undef UNREF
+#undef UNCVREF
+
+#if BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+#endif // BOOST_XPRESSIVE_ACTIONS_HPP_EAN_03_22_2007

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_algorithms.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_algorithms.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,738 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file regex_algorithms.hpp
+/// Contains the regex_match(), regex_search() and regex_replace() algorithms.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_ALGORITHMS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_ALGORITHMS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <string>
+#include <iterator>
+#include <boost/mpl/or.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/begin.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/xpressive/match_results.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/state.hpp>
+#include <boost/xpressive/detail/utility/save_restore.hpp>
+
+/// INTERNAL ONLY
+///
+#define BOOST_XPR_NONDEDUCED_TYPE_(x) typename mpl::identity<x>::type
+
+namespace boost { namespace xpressive
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_match
+///////////////////////////////////////////////////////////////////////////////
+
+/// \brief See if a regex matches a sequence from beginning to end.
+///
+/// Determines whether there is an exact match between the regular expression \c re,
+/// and all of the sequence <tt>[begin, end)</tt>.
+///
+/// \pre Type \c BidiIter meets the requirements of a Bidirectional Iterator (24.1.4).
+/// \pre <tt>[begin,end)</tt> denotes a valid iterator range.
+/// \param begin The beginning of the sequence.
+/// \param end The end of the sequence.
+/// \param what The \c match_results struct into which the sub_matches will be written
+/// \param re The regular expression object to use
+/// \param flags Optional match flags, used to control how the expression is matched
+/// against the sequence. (See \c match_flag_type.)
+/// \return \c true if a match is found, \c false otherwise
+/// \throw \c regex_error on stack exhaustion
+template<typename BidiIter>
+inline bool regex_match
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) begin
+ , BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) end
+ , match_results<BidiIter> &what
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ typedef detail::core_access<BidiIter> access;
+
+ // an invlid regex matches nothing
+ if(!access::invalid(re))
+ {
+ // the state object holds matching state and
+ // is passed by reference to all the matchers
+ detail::match_state<BidiIter> state(begin, end, what, *access::get_regex_impl(re), flags);
+ state.flags_.match_all_ = true;
+ state.sub_match(0).begin_ = begin;
+
+ if(access::match(re, state))
+ {
+ access::set_prefix_suffix(what, begin, end);
+ return true;
+ }
+
+ // handle partial matches
+ else if(state.found_partial_match_ && 0 != (flags & regex_constants::match_partial))
+ {
+ state.set_partial_match();
+ return true;
+ }
+ }
+
+ access::reset(what);
+ return false;
+}
+
+/// \overload
+///
+template<typename BidiIter>
+inline bool regex_match
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) begin
+ , BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) end
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ // BUGBUG this is inefficient
+ match_results<BidiIter> what;
+ return xpressive::regex_match(begin, end, what, re, flags);
+}
+
+/// \overload
+///
+template<typename Char>
+inline bool regex_match
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(Char) *begin
+ , match_results<Char *> &what
+ , basic_regex<Char *> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ // BUGBUG this is inefficient
+ typedef typename remove_const<Char>::type char_type;
+ Char *end = begin + std::char_traits<char_type>::length(begin);
+ return xpressive::regex_match(begin, end, what, re, flags);
+}
+
+/// \overload
+///
+template<typename BidiRange, typename BidiIter>
+inline bool regex_match
+(
+ BidiRange &rng
+ , match_results<BidiIter> &what
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiRange> >::type * = 0
+)
+{
+ // Note that the result iterator of the range must be convertible
+ // to BidiIter here.
+ BidiIter begin = boost::begin(rng), end = boost::end(rng);
+ return xpressive::regex_match(begin, end, what, re, flags);
+}
+
+/// \overload
+///
+template<typename BidiRange, typename BidiIter>
+inline bool regex_match
+(
+ BidiRange const &rng
+ , match_results<BidiIter> &what
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiRange> >::type * = 0
+)
+{
+ // Note that the result iterator of the range must be convertible
+ // to BidiIter here.
+ BidiIter begin = boost::begin(rng), end = boost::end(rng);
+ return xpressive::regex_match(begin, end, what, re, flags);
+}
+
+/// \overload
+///
+template<typename Char>
+inline bool regex_match
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(Char) *begin
+ , basic_regex<Char *> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ // BUGBUG this is inefficient
+ match_results<Char *> what;
+ return xpressive::regex_match(begin, what, re, flags);
+}
+
+/// \overload
+///
+template<typename BidiRange, typename BidiIter>
+inline bool regex_match
+(
+ BidiRange &rng
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiRange> >::type * = 0
+)
+{
+ // BUGBUG this is inefficient
+ match_results<BidiIter> what;
+ return xpressive::regex_match(rng, what, re, flags);
+}
+
+/// \overload
+///
+template<typename BidiRange, typename BidiIter>
+inline bool regex_match
+(
+ BidiRange const &rng
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiRange> >::type * = 0
+)
+{
+ // BUGBUG this is inefficient
+ match_results<BidiIter> what;
+ return xpressive::regex_match(rng, what, re, flags);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_search
+///////////////////////////////////////////////////////////////////////////////
+
+namespace detail
+{
+///////////////////////////////////////////////////////////////////////////////
+// regex_search_impl
+template<typename BidiIter>
+inline bool regex_search_impl
+(
+ match_state<BidiIter> &state
+ , basic_regex<BidiIter> const &re
+ , bool not_initial_null = false
+)
+{
+ typedef core_access<BidiIter> access;
+ typedef typename iterator_value<BidiIter>::type char_type;
+ match_results<BidiIter> &what = *state.context_.results_ptr_;
+
+ // an invlid regex matches nothing
+ if(!access::invalid(re))
+ {
+ bool const partial_ok = state.flags_.match_partial_;
+ save_restore<bool> not_null(state.flags_.match_not_null_, state.flags_.match_not_null_ || not_initial_null);
+ state.flags_.match_prev_avail_ = state.flags_.match_prev_avail_ || !state.bos();
+
+ regex_impl<BidiIter> const &impl = *access::get_regex_impl(re);
+ BidiIter const begin = state.cur_, end = state.end_;
+ BidiIter &sub0begin = state.sub_match(0).begin_;
+ sub0begin = state.cur_;
+
+ // If match_continuous is set, we only need to check for a match at the current position
+ if(state.flags_.match_continuous_)
+ {
+ if(access::match(re, state))
+ {
+ access::set_prefix_suffix(what, begin, end);
+ return true;
+ }
+
+ // handle partial matches
+ else if(partial_ok && state.found_partial_match_)
+ {
+ state.set_partial_match();
+ return true;
+ }
+ }
+
+ // If we have a finder, use it to find where a potential match can start
+ else if(impl.finder_ && (!partial_ok || impl.finder_->ok_for_partial_matches()))
+ {
+ finder<BidiIter> const &find = *impl.finder_;
+ if(find(state))
+ {
+ if(state.cur_ != begin)
+ {
+ not_null.restore();
+ }
+
+ do
+ {
+ sub0begin = state.cur_;
+ if(access::match(re, state))
+ {
+ access::set_prefix_suffix(what, begin, end);
+ return true;
+ }
+
+ // handle partial matches
+ else if(partial_ok && state.found_partial_match_)
+ {
+ state.set_partial_match();
+ return true;
+ }
+
+ BOOST_ASSERT(state.cur_ == sub0begin);
+ not_null.restore();
+ }
+ while(state.cur_ != state.end_ && (++state.cur_, find(state)));
+ }
+ }
+
+ // Otherwise, use brute force search at every position.
+ else
+ {
+ for(;;)
+ {
+ if(access::match(re, state))
+ {
+ access::set_prefix_suffix(what, begin, end);
+ return true;
+ }
+
+ // handle partial matches
+ else if(partial_ok && state.found_partial_match_)
+ {
+ state.set_partial_match();
+ return true;
+ }
+
+ else if(end == sub0begin)
+ {
+ break;
+ }
+
+ BOOST_ASSERT(state.cur_ == sub0begin);
+ state.cur_ = ++sub0begin;
+ not_null.restore();
+ }
+ }
+ }
+
+ access::reset(what);
+ return false;
+}
+} // namespace detail
+
+
+/// \brief Determines whether there is some sub-sequence within <tt>[begin,end)</tt>
+/// that matches the regular expression \c re.
+///
+/// Determines whether there is some sub-sequence within <tt>[begin,end)</tt> that matches
+/// the regular expression \c re.
+///
+/// \pre Type \c BidiIter meets the requirements of a Bidirectional Iterator (24.1.4).
+/// \pre <tt>[begin,end)</tt> denotes a valid iterator range.
+/// \param begin The beginning of the sequence
+/// \param end The end of the sequence
+/// \param what The \c match_results struct into which the sub_matches will be written
+/// \param re The regular expression object to use
+/// \param flags Optional match flags, used to control how the expression is matched against
+/// the sequence. (See \c match_flag_type.)
+/// \return \c true if a match is found, \c false otherwise
+/// \throw \c regex_error on stack exhaustion
+template<typename BidiIter>
+inline bool regex_search
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) begin
+ , BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) end
+ , match_results<BidiIter> &what
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ typedef detail::core_access<BidiIter> access;
+
+ // an invlid regex matches nothing
+ if(!access::invalid(re))
+ {
+ // the state object holds matching state and
+ // is passed by reference to all the matchers
+ detail::match_state<BidiIter> state(begin, end, what, *access::get_regex_impl(re), flags);
+ return detail::regex_search_impl(state, re);
+ }
+
+ access::reset(what);
+ return false;
+}
+
+/// \overload
+///
+template<typename BidiIter>
+inline bool regex_search
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) begin
+ , BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) end
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ // BUGBUG this is inefficient
+ match_results<BidiIter> what;
+ return xpressive::regex_search(begin, end, what, re, flags);
+}
+
+/// \overload
+///
+template<typename Char>
+inline bool regex_search
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(Char) *begin
+ , match_results<Char *> &what
+ , basic_regex<Char *> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ // BUGBUG this is inefficient
+ typedef typename remove_const<Char>::type char_type;
+ Char *end = begin + std::char_traits<char_type>::length(begin);
+ return xpressive::regex_search(begin, end, what, re, flags);
+}
+
+/// \overload
+///
+template<typename BidiRange, typename BidiIter>
+inline bool regex_search
+(
+ BidiRange &rng
+ , match_results<BidiIter> &what
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiRange> >::type * = 0
+)
+{
+ // Note that the result iterator of the range must be convertible
+ // to BidiIter here.
+ BidiIter begin = boost::begin(rng), end = boost::end(rng);
+ return xpressive::regex_search(begin, end, what, re, flags);
+}
+
+/// \overload
+///
+template<typename BidiRange, typename BidiIter>
+inline bool regex_search
+(
+ BidiRange const &rng
+ , match_results<BidiIter> &what
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiRange> >::type * = 0
+)
+{
+ // Note that the result iterator of the range must be convertible
+ // to BidiIter here.
+ BidiIter begin = boost::begin(rng), end = boost::end(rng);
+ return xpressive::regex_search(begin, end, what, re, flags);
+}
+
+/// \overload
+///
+template<typename Char>
+inline bool regex_search
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(Char) *begin
+ , basic_regex<Char *> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ // BUGBUG this is inefficient
+ match_results<Char *> what;
+ return xpressive::regex_search(begin, what, re, flags);
+}
+
+/// \overload
+///
+template<typename BidiRange, typename BidiIter>
+inline bool regex_search
+(
+ BidiRange &rng
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiRange> >::type * = 0
+)
+{
+ // BUGBUG this is inefficient
+ match_results<BidiIter> what;
+ return xpressive::regex_search(rng, what, re, flags);
+}
+
+/// \overload
+///
+template<typename BidiRange, typename BidiIter>
+inline bool regex_search
+(
+ BidiRange const &rng
+ , basic_regex<BidiIter> const &re
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiRange> >::type * = 0
+)
+{
+ // BUGBUG this is inefficient
+ match_results<BidiIter> what;
+ return xpressive::regex_search(rng, what, re, flags);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_replace
+///////////////////////////////////////////////////////////////////////////////
+
+namespace detail
+{
+///////////////////////////////////////////////////////////////////////////////
+// regex_replace_impl
+template<typename OutIter, typename BidiIter, typename Formatter>
+inline OutIter regex_replace_impl
+(
+ OutIter out
+ , BidiIter begin
+ , BidiIter end
+ , basic_regex<BidiIter> const &re
+ , Formatter const &format
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ using namespace regex_constants;
+ typedef detail::core_access<BidiIter> access;
+
+ BidiIter cur = begin;
+ match_results<BidiIter> what;
+ detail::match_state<BidiIter> state(begin, end, what, *access::get_regex_impl(re), flags);
+ bool const yes_copy = (0 == (flags & format_no_copy));
+
+ if(detail::regex_search_impl(state, re))
+ {
+ if(yes_copy)
+ {
+ out = std::copy(cur, what[0].first, out);
+ }
+
+ out = what.format(out, format, flags);
+ cur = state.cur_ = state.next_search_ = what[0].second;
+
+ if(0 == (flags & format_first_only))
+ {
+ bool not_null = (0 == what.length());
+ state.reset(what, *access::get_regex_impl(re));
+ while(detail::regex_search_impl(state, re, not_null))
+ {
+ if(yes_copy)
+ {
+ out = std::copy(cur, what[0].first, out);
+ }
+
+ access::set_prefix_suffix(what, begin, end);
+ out = what.format(out, format, flags);
+ cur = state.cur_ = state.next_search_ = what[0].second;
+ not_null = (0 == what.length());
+ state.reset(what, *access::get_regex_impl(re));
+ }
+ }
+ }
+
+ if(yes_copy)
+ {
+ out = std::copy(cur, end, out);
+ }
+
+ return out;
+}
+} // namespace detail
+
+/// \brief Build an output sequence given an input sequence, a regex, and a format string or
+/// a formatter object, function, or expression.
+///
+/// Constructs a \c regex_iterator object: <tt>regex_iterator\< BidiIter \> i(begin, end, re, flags)</tt>,
+/// and uses \c i to enumerate through all of the matches m of type <tt>match_results\< BidiIter \></tt> that
+/// occur within the sequence <tt>[begin, end)</tt>. If no such matches are found and <tt>!(flags \& format_no_copy)</tt>
+/// then calls <tt>std::copy(begin, end, out)</tt>. Otherwise, for each match found, if <tt>!(flags \& format_no_copy)</tt>
+/// calls <tt>std::copy(m.prefix().first, m.prefix().second, out)</tt>, and then calls <tt>m.format(out, format, flags)</tt>.
+/// Finally if <tt>!(flags \& format_no_copy)</tt> calls <tt>std::copy(last_m.suffix().first, last_m.suffix().second, out)</tt>
+/// where \c last_m is a copy of the last match found.
+///
+/// If <tt>flags \& format_first_only</tt> is non-zero then only the first match found is replaced.
+///
+/// \pre Type \c BidiIter meets the requirements of a Bidirectional Iterator (24.1.4).
+/// \pre Type \c OutIter meets the requirements of an Output Iterator (24.1.2).
+/// \pre Type \c Formatter models \c ForwardRange, <tt>Callable\<match_results\<BidiIter\> \></tt>,
+/// <tt>Callable\<match_results\<BidiIter\>, OutIter\></tt>, or
+/// <tt>Callable\<match_results\<BidiIter\>, OutIter, regex_constants::match_flag_type\></tt>;
+/// or else it is a null-terminated format string, or an expression template
+/// representing a formatter lambda expression.
+/// \pre <tt>[begin,end)</tt> denotes a valid iterator range.
+/// \param out An output iterator into which the output sequence is written.
+/// \param begin The beginning of the input sequence.
+/// \param end The end of the input sequence.
+/// \param re The regular expression object to use.
+/// \param format The format string used to format the replacement sequence,
+/// or a formatter function, function object, or expression.
+/// \param flags Optional match flags, used to control how the expression is matched against
+/// the sequence. (See \c match_flag_type.)
+/// \return The value of the output iterator after the output sequence has been written to it.
+/// \throw \c regex_error on stack exhaustion or invalid format string.
+template<typename OutIter, typename BidiIter, typename Formatter>
+inline OutIter regex_replace
+(
+ OutIter out
+ , BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) begin
+ , BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) end
+ , basic_regex<BidiIter> const &re
+ , Formatter const &format
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<Formatter> >::type * = 0
+)
+{
+ return detail::regex_replace_impl(out, begin, end, re, format, flags);
+}
+
+/// \overload
+///
+template<typename OutIter, typename BidiIter>
+inline OutIter regex_replace
+(
+ OutIter out
+ , BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) begin
+ , BOOST_XPR_NONDEDUCED_TYPE_(BidiIter) end
+ , basic_regex<BidiIter> const &re
+ , typename iterator_value<BidiIter>::type const *format
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ return detail::regex_replace_impl(out, begin, end, re, format, flags);
+}
+
+/// \overload
+///
+template<typename BidiContainer, typename BidiIter, typename Formatter>
+inline BidiContainer regex_replace
+(
+ BidiContainer &str
+ , basic_regex<BidiIter> const &re
+ , Formatter const &format
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<mpl::or_<detail::is_char_ptr<BidiContainer>, detail::is_char_ptr<Formatter> > >::type * = 0
+)
+{
+ BidiContainer result;
+ // Note that the result iterator of the range must be convertible
+ // to BidiIter here.
+ BidiIter begin = boost::begin(str), end = boost::end(str);
+ xpressive::regex_replace(std::back_inserter(result), begin, end, re, format, flags);
+ return result;
+}
+
+/// \overload
+///
+template<typename BidiContainer, typename BidiIter, typename Formatter>
+inline BidiContainer regex_replace
+(
+ BidiContainer const &str
+ , basic_regex<BidiIter> const &re
+ , Formatter const &format
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<mpl::or_<detail::is_char_ptr<BidiContainer>, detail::is_char_ptr<Formatter> > >::type * = 0
+)
+{
+ BidiContainer result;
+ // Note that the result iterator of the range must be convertible
+ // to BidiIter here.
+ BidiIter begin = boost::begin(str), end = boost::end(str);
+ xpressive::regex_replace(std::back_inserter(result), begin, end, re, format, flags);
+ return result;
+}
+
+/// \overload
+///
+template<typename Char, typename Formatter>
+inline std::basic_string<typename remove_const<Char>::type> regex_replace
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(Char) *str
+ , basic_regex<Char *> const &re
+ , Formatter const &format
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<Formatter> >::type * = 0
+)
+{
+ typedef typename remove_const<Char>::type char_type;
+ std::basic_string<char_type> result;
+ Char *end = str + std::char_traits<char_type>::length(str);
+ xpressive::regex_replace(std::back_inserter(result), str, end, re, format, flags);
+ return result;
+}
+
+/// \overload
+///
+template<typename BidiContainer, typename BidiIter>
+inline BidiContainer regex_replace
+(
+ BidiContainer &str
+ , basic_regex<BidiIter> const &re
+ , typename iterator_value<BidiIter>::type const *format
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiContainer> >::type * = 0
+)
+{
+ BidiContainer result;
+ // Note that the result iterator of the range must be convertible
+ // to BidiIter here.
+ BidiIter begin = boost::begin(str), end = boost::end(str);
+ xpressive::regex_replace(std::back_inserter(result), begin, end, re, format, flags);
+ return result;
+}
+
+/// \overload
+///
+template<typename BidiContainer, typename BidiIter>
+inline BidiContainer regex_replace
+(
+ BidiContainer const &str
+ , basic_regex<BidiIter> const &re
+ , typename iterator_value<BidiIter>::type const *format
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , typename disable_if<detail::is_char_ptr<BidiContainer> >::type * = 0
+)
+{
+ BidiContainer result;
+ // Note that the result iterator of the range must be convertible
+ // to BidiIter here.
+ BidiIter begin = boost::begin(str), end = boost::end(str);
+ xpressive::regex_replace(std::back_inserter(result), begin, end, re, format, flags);
+ return result;
+}
+
+/// \overload
+///
+template<typename Char>
+inline std::basic_string<typename remove_const<Char>::type> regex_replace
+(
+ BOOST_XPR_NONDEDUCED_TYPE_(Char) *str
+ , basic_regex<Char *> const &re
+ , typename add_const<Char>::type *format
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+)
+{
+ typedef typename remove_const<Char>::type char_type;
+ std::basic_string<char_type> result;
+ Char *end = str + std::char_traits<char_type>::length(str);
+ xpressive::regex_replace(std::back_inserter(result), str, end, re, format, flags);
+ return result;
+}
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_compiler.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_compiler.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,738 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file regex_compiler.hpp
+/// Contains the definition of regex_compiler, a factory for building regex objects
+/// from strings.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_REGEX_COMPILER_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_REGEX_COMPILER_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <map>
+#include <boost/assert.hpp>
+#include <boost/next_prior.hpp>
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/xpressive/basic_regex.hpp>
+#include <boost/xpressive/detail/dynamic/parser.hpp>
+#include <boost/xpressive/detail/dynamic/parse_charset.hpp>
+#include <boost/xpressive/detail/dynamic/parser_enum.hpp>
+#include <boost/xpressive/detail/dynamic/parser_traits.hpp>
+#include <boost/xpressive/detail/core/linker.hpp>
+#include <boost/xpressive/detail/core/optimize.hpp>
+
+namespace boost { namespace xpressive
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_compiler
+//
+/// \brief Class template regex_compiler is a factory for building basic_regex objects from a string.
+///
+/// Class template regex_compiler is used to construct a basic_regex object from a string. The string
+/// should contain a valid regular expression. You can imbue a regex_compiler object with a locale,
+/// after which all basic_regex objects created with that regex_compiler object will use that locale.
+/// After creating a regex_compiler object, and optionally imbueing it with a locale, you can call the
+/// compile() method to construct a basic_regex object, passing it the string representing the regular
+/// expression. You can call compile() multiple times on the same regex_compiler object. Two basic_regex
+/// objects compiled from the same string will have different regex_id's.
+template<typename BidiIter, typename RegexTraits, typename CompilerTraits>
+struct regex_compiler
+{
+ typedef BidiIter iterator_type;
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef regex_constants::syntax_option_type flag_type;
+ typedef RegexTraits traits_type;
+ typedef typename traits_type::string_type string_type;
+ typedef typename traits_type::locale_type locale_type;
+ typedef typename traits_type::char_class_type char_class_type;
+
+ explicit regex_compiler(RegexTraits const &traits = RegexTraits())
+ : mark_count_(0)
+ , hidden_mark_count_(0)
+ , traits_(traits)
+ , upper_(0)
+ , self_()
+ , rules_()
+ {
+ this->upper_ = lookup_classname(this->rxtraits(), "upper");
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // imbue
+ /// Specify the locale to be used by a regex_compiler.
+ ///
+ /// \param loc The locale that this regex_compiler should use.
+ /// \return The previous locale.
+ locale_type imbue(locale_type loc)
+ {
+ locale_type oldloc = this->traits_.imbue(loc);
+ this->upper_ = lookup_classname(this->rxtraits(), "upper");
+ return oldloc;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // getloc
+ /// Get the locale used by a regex_compiler.
+ ///
+ /// \return The locale used by this regex_compiler.
+ locale_type getloc() const
+ {
+ return this->traits_.getloc();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // compile
+ /// Builds a basic_regex object from a range of characters.
+ ///
+ /// \param begin The beginning of a range of characters representing the
+ /// regular expression to compile.
+ /// \param end The end of a range of characters representing the
+ /// regular expression to compile.
+ /// \param flags Optional bitmask that determines how the pat string is
+ /// interpreted. (See syntax_option_type.)
+ /// \return A basic_regex object corresponding to the regular expression
+ /// represented by the character range.
+ /// \pre InputIter is a model of the InputIterator concept.
+ /// \pre [begin,end) is a valid range.
+ /// \pre The range of characters specified by [begin,end) contains a
+ /// valid string-based representation of a regular expression.
+ /// \throw regex_error when the range of characters has invalid regular
+ /// expression syntax.
+ template<typename InputIter>
+ basic_regex<BidiIter> compile(InputIter begin, InputIter end, flag_type flags = regex_constants::ECMAScript)
+ {
+ typedef typename iterator_category<InputIter>::type category;
+ return this->compile_(begin, end, flags, category());
+ }
+
+ /// \overload
+ ///
+ template<typename InputRange>
+ basic_regex<BidiIter> compile(InputRange const &pat, flag_type flags = regex_constants::ECMAScript)
+ {
+ return this->compile(boost::begin(pat), boost::end(pat), flags);
+ }
+
+ /// \overload
+ ///
+ basic_regex<BidiIter> compile(char_type const *begin, flag_type flags = regex_constants::ECMAScript)
+ {
+ BOOST_ASSERT(0 != begin);
+ char_type const *end = begin + std::char_traits<char_type>::length(begin);
+ return this->compile(begin, end, flags);
+ }
+
+ /// \overload
+ ///
+ basic_regex<BidiIter> compile(char_type const *begin, std::size_t size, flag_type flags)
+ {
+ BOOST_ASSERT(0 != begin);
+ char_type const *end = begin + size;
+ return this->compile(begin, end, flags);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // operator[]
+ /// Return a reference to the named regular expression. If no such named
+ /// regular expression exists, create a new regular expression and return
+ /// a reference to it.
+ ///
+ /// \param name A std::string containing the name of the regular expression.
+ /// \pre The string is not empty.
+ /// \throw bad_alloc on allocation failure.
+ basic_regex<BidiIter> &operator [](string_type const &name)
+ {
+ BOOST_ASSERT(!name.empty());
+ return this->rules_[name];
+ }
+
+ /// \overload
+ ///
+ basic_regex<BidiIter> const &operator [](string_type const &name) const
+ {
+ BOOST_ASSERT(!name.empty());
+ return this->rules_[name];
+ }
+
+private:
+
+ typedef detail::escape_value<char_type, char_class_type> escape_value;
+ typedef detail::alternate_matcher<detail::alternates_vector<BidiIter>, RegexTraits> alternate_matcher;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // compile_
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ basic_regex<BidiIter> compile_(FwdIter begin, FwdIter end, flag_type flags, std::forward_iterator_tag)
+ {
+ BOOST_MPL_ASSERT((is_same<char_type, typename iterator_value<FwdIter>::type>));
+ using namespace regex_constants;
+ this->reset();
+ this->traits_.flags(flags);
+
+ basic_regex<BidiIter> rextmp, *prex = &rextmp;
+ FwdIter tmp = begin;
+
+ // Check if this regex is a named rule:
+ string_type name;
+ if(token_group_begin == this->traits_.get_token(tmp, end) &&
+ detail::ensure(tmp != end, error_paren, "mismatched parenthesis") &&
+ token_rule_assign == this->traits_.get_group_type(tmp, end, name))
+ {
+ begin = tmp;
+ detail::ensure
+ (
+ begin != end && token_group_end == this->traits_.get_token(begin, end)
+ , error_paren
+ , "mismatched parenthesis"
+ );
+ prex = &this->rules_[name];
+ }
+
+ this->self_ = detail::core_access<BidiIter>::get_regex_impl(*prex);
+
+ // at the top level, a regex is a sequence of alternates
+ detail::sequence<BidiIter> seq = this->parse_alternates(begin, end);
+ detail::ensure(begin == end, error_paren, "mismatched parenthesis");
+
+ // terminate the sequence
+ seq += detail::make_dynamic<BidiIter>(detail::end_matcher());
+
+ // bundle the regex information into a regex_impl object
+ detail::common_compile(seq.xpr().matchable(), *this->self_, this->rxtraits());
+
+ this->self_->traits_ = new detail::traits_holder<RegexTraits>(this->rxtraits());
+ this->self_->mark_count_ = this->mark_count_;
+ this->self_->hidden_mark_count_ = this->hidden_mark_count_;
+
+ // References changed, update dependencies.
+ this->self_->tracking_update();
+ this->self_.reset();
+ return *prex;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // compile_
+ /// INTERNAL ONLY
+ template<typename InputIter>
+ basic_regex<BidiIter> compile_(InputIter begin, InputIter end, flag_type flags, std::input_iterator_tag)
+ {
+ string_type pat(begin, end);
+ return this->compile_(boost::begin(pat), boost::end(pat), flags, std::forward_iterator_tag());
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // reset
+ /// INTERNAL ONLY
+ void reset()
+ {
+ this->mark_count_ = 0;
+ this->hidden_mark_count_ = 0;
+ this->traits_.flags(regex_constants::ECMAScript);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // regex_traits
+ /// INTERNAL ONLY
+ traits_type &rxtraits()
+ {
+ return this->traits_.traits();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // regex_traits
+ /// INTERNAL ONLY
+ traits_type const &rxtraits() const
+ {
+ return this->traits_.traits();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // parse_alternates
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ detail::sequence<BidiIter> parse_alternates(FwdIter &begin, FwdIter end)
+ {
+ using namespace regex_constants;
+ int count = 0;
+ FwdIter tmp = begin;
+ detail::sequence<BidiIter> seq;
+
+ do switch(++count)
+ {
+ case 1:
+ seq = this->parse_sequence(tmp, end);
+ break;
+ case 2:
+ seq = detail::make_dynamic<BidiIter>(alternate_matcher()) | seq;
+ // fall-through
+ default:
+ seq |= this->parse_sequence(tmp, end);
+ }
+ while((begin = tmp) != end && token_alternate == this->traits_.get_token(tmp, end));
+
+ return seq;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // parse_group
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ detail::sequence<BidiIter> parse_group(FwdIter &begin, FwdIter end)
+ {
+ using namespace regex_constants;
+ int mark_nbr = 0;
+ bool keeper = false;
+ bool lookahead = false;
+ bool lookbehind = false;
+ bool negative = false;
+ string_type name;
+
+ detail::sequence<BidiIter> seq, seq_end;
+ FwdIter tmp = FwdIter();
+
+ syntax_option_type old_flags = this->traits_.flags();
+
+ switch(this->traits_.get_group_type(begin, end, name))
+ {
+ case token_no_mark:
+ // Don't process empty groups like (?:) or (?i)
+ // BUGBUG this doesn't handle the degenerate (?:)+ correctly
+ if(token_group_end == this->traits_.get_token(tmp = begin, end))
+ {
+ return this->parse_atom(begin = tmp, end);
+ }
+ break;
+
+ case token_negative_lookahead:
+ negative = true; // fall-through
+ case token_positive_lookahead:
+ lookahead = true;
+ break;
+
+ case token_negative_lookbehind:
+ negative = true; // fall-through
+ case token_positive_lookbehind:
+ lookbehind = true;
+ break;
+
+ case token_independent_sub_expression:
+ keeper = true;
+ break;
+
+ case token_comment:
+ while(detail::ensure(begin != end, error_paren, "mismatched parenthesis"))
+ {
+ switch(this->traits_.get_token(begin, end))
+ {
+ case token_group_end: return this->parse_atom(begin, end);
+ case token_escape: detail::ensure(begin != end, error_escape, "incomplete escape sequence");
+ case token_literal: ++begin;
+ default:;
+ }
+ }
+ break;
+
+ case token_recurse:
+ detail::ensure
+ (
+ begin != end && token_group_end == this->traits_.get_token(begin, end)
+ , error_paren
+ , "mismatched parenthesis"
+ );
+ return detail::make_dynamic<BidiIter>(detail::regex_byref_matcher<BidiIter>(this->self_));
+
+ case token_rule_assign:
+ boost::throw_exception(
+ regex_error(error_badrule, "rule assignments must be at the front of the regex")
+ );
+ break;
+
+ case token_rule_ref:
+ {
+ typedef detail::core_access<BidiIter> access;
+ detail::ensure
+ (
+ begin != end && token_group_end == this->traits_.get_token(begin, end)
+ , error_paren
+ , "mismatched parenthesis"
+ );
+ basic_regex<BidiIter> &rex = this->rules_[name];
+ shared_ptr<detail::regex_impl<BidiIter> > impl = access::get_regex_impl(rex);
+ this->self_->track_reference(*impl);
+ return detail::make_dynamic<BidiIter>(detail::regex_byref_matcher<BidiIter>(impl));
+ }
+
+ case token_named_mark:
+ mark_nbr = static_cast<int>(++this->mark_count_);
+ for(std::size_t i = 0; i < this->self_->named_marks_.size(); ++i)
+ {
+ detail::ensure(this->self_->named_marks_[i].name_ != name, error_badmark, "named mark already exists");
+ }
+ this->self_->named_marks_.push_back(detail::named_mark<char_type>(name, this->mark_count_));
+ seq = detail::make_dynamic<BidiIter>(detail::mark_begin_matcher(mark_nbr));
+ seq_end = detail::make_dynamic<BidiIter>(detail::mark_end_matcher(mark_nbr));
+ break;
+
+ case token_named_mark_ref:
+ detail::ensure
+ (
+ begin != end && token_group_end == this->traits_.get_token(begin, end)
+ , error_paren
+ , "mismatched parenthesis"
+ );
+ for(std::size_t i = 0; i < this->self_->named_marks_.size(); ++i)
+ {
+ if(this->self_->named_marks_[i].name_ == name)
+ {
+ mark_nbr = static_cast<int>(this->self_->named_marks_[i].mark_nbr_);
+ return detail::make_backref_xpression<BidiIter>
+ (
+ mark_nbr, this->traits_.flags(), this->rxtraits()
+ );
+ }
+ }
+ boost::throw_exception(regex_error(error_badmark, "invalid named back-reference"));
+ break;
+
+ default:
+ mark_nbr = static_cast<int>(++this->mark_count_);
+ seq = detail::make_dynamic<BidiIter>(detail::mark_begin_matcher(mark_nbr));
+ seq_end = detail::make_dynamic<BidiIter>(detail::mark_end_matcher(mark_nbr));
+ break;
+ }
+
+ // alternates
+ seq += this->parse_alternates(begin, end);
+ seq += seq_end;
+ detail::ensure
+ (
+ begin != end && token_group_end == this->traits_.get_token(begin, end)
+ , error_paren
+ , "mismatched parenthesis"
+ );
+
+ typedef detail::shared_matchable<BidiIter> xpr_type;
+ if(lookahead)
+ {
+ seq += detail::make_independent_end_xpression<BidiIter>(seq.pure());
+ detail::lookahead_matcher<xpr_type> lookahead(seq.xpr(), negative, seq.pure());
+ seq = detail::make_dynamic<BidiIter>(lookahead);
+ }
+ else if(lookbehind)
+ {
+ seq += detail::make_independent_end_xpression<BidiIter>(seq.pure());
+ detail::lookbehind_matcher<xpr_type> lookbehind(seq.xpr(), seq.width().value(), negative, seq.pure());
+ seq = detail::make_dynamic<BidiIter>(lookbehind);
+ }
+ else if(keeper) // independent sub-expression
+ {
+ seq += detail::make_independent_end_xpression<BidiIter>(seq.pure());
+ detail::keeper_matcher<xpr_type> keeper(seq.xpr(), seq.pure());
+ seq = detail::make_dynamic<BidiIter>(keeper);
+ }
+
+ // restore the modifiers
+ this->traits_.flags(old_flags);
+ return seq;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // parse_charset
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ detail::sequence<BidiIter> parse_charset(FwdIter &begin, FwdIter end)
+ {
+ detail::compound_charset<traits_type> chset;
+
+ // call out to a helper to actually parse the character set
+ detail::parse_charset(begin, end, chset, this->traits_);
+
+ return detail::make_charset_xpression<BidiIter>
+ (
+ chset
+ , this->rxtraits()
+ , this->traits_.flags()
+ );
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // parse_atom
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ detail::sequence<BidiIter> parse_atom(FwdIter &begin, FwdIter end)
+ {
+ using namespace regex_constants;
+ escape_value esc = { 0, 0, 0, detail::escape_char };
+ FwdIter old_begin = begin;
+
+ switch(this->traits_.get_token(begin, end))
+ {
+ case token_literal:
+ return detail::make_literal_xpression<BidiIter>
+ (
+ this->parse_literal(begin, end), this->traits_.flags(), this->rxtraits()
+ );
+
+ case token_any:
+ return detail::make_any_xpression<BidiIter>(this->traits_.flags(), this->rxtraits());
+
+ case token_assert_begin_sequence:
+ return detail::make_dynamic<BidiIter>(detail::assert_bos_matcher());
+
+ case token_assert_end_sequence:
+ return detail::make_dynamic<BidiIter>(detail::assert_eos_matcher());
+
+ case token_assert_begin_line:
+ return detail::make_assert_begin_line<BidiIter>(this->traits_.flags(), this->rxtraits());
+
+ case token_assert_end_line:
+ return detail::make_assert_end_line<BidiIter>(this->traits_.flags(), this->rxtraits());
+
+ case token_assert_word_boundary:
+ return detail::make_assert_word<BidiIter>(detail::word_boundary<mpl::true_>(), this->rxtraits());
+
+ case token_assert_not_word_boundary:
+ return detail::make_assert_word<BidiIter>(detail::word_boundary<mpl::false_>(), this->rxtraits());
+
+ case token_assert_word_begin:
+ return detail::make_assert_word<BidiIter>(detail::word_begin(), this->rxtraits());
+
+ case token_assert_word_end:
+ return detail::make_assert_word<BidiIter>(detail::word_end(), this->rxtraits());
+
+ case token_escape:
+ esc = this->parse_escape(begin, end);
+ switch(esc.type_)
+ {
+ case detail::escape_mark:
+ return detail::make_backref_xpression<BidiIter>
+ (
+ esc.mark_nbr_, this->traits_.flags(), this->rxtraits()
+ );
+ case detail::escape_char:
+ return detail::make_char_xpression<BidiIter>
+ (
+ esc.ch_, this->traits_.flags(), this->rxtraits()
+ );
+ case detail::escape_class:
+ return detail::make_posix_charset_xpression<BidiIter>
+ (
+ esc.class_
+ , this->is_upper_(*begin++)
+ , this->traits_.flags()
+ , this->rxtraits()
+ );
+ }
+
+ case token_group_begin:
+ return this->parse_group(begin, end);
+
+ case token_charset_begin:
+ return this->parse_charset(begin, end);
+
+ case token_invalid_quantifier:
+ boost::throw_exception(regex_error(error_badrepeat, "quantifier not expected"));
+ break;
+
+ case token_quote_meta_begin:
+ return detail::make_literal_xpression<BidiIter>
+ (
+ this->parse_quote_meta(begin, end), this->traits_.flags(), this->rxtraits()
+ );
+
+ case token_quote_meta_end:
+ boost::throw_exception(
+ regex_error(
+ error_escape
+ , "found quote-meta end without corresponding quote-meta begin"
+ )
+ );
+ break;
+
+ case token_end_of_pattern:
+ break;
+
+ default:
+ begin = old_begin;
+ break;
+ }
+
+ return detail::sequence<BidiIter>();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // parse_quant
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ detail::sequence<BidiIter> parse_quant(FwdIter &begin, FwdIter end)
+ {
+ BOOST_ASSERT(begin != end);
+ detail::quant_spec spec = { 0, 0, false, &this->hidden_mark_count_ };
+ detail::sequence<BidiIter> seq = this->parse_atom(begin, end);
+
+ // BUGBUG this doesn't handle the degenerate (?:)+ correctly
+ if(!seq.empty() && begin != end && detail::quant_none != seq.quant())
+ {
+ if(this->traits_.get_quant_spec(begin, end, spec))
+ {
+ BOOST_ASSERT(spec.min_ <= spec.max_);
+
+ if(0 == spec.max_) // quant {0,0} is degenerate -- matches nothing.
+ {
+ seq = this->parse_quant(begin, end);
+ }
+ else
+ {
+ seq.repeat(spec);
+ }
+ }
+ }
+
+ return seq;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // parse_sequence
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ detail::sequence<BidiIter> parse_sequence(FwdIter &begin, FwdIter end)
+ {
+ detail::sequence<BidiIter> seq;
+
+ while(begin != end)
+ {
+ detail::sequence<BidiIter> seq_quant = this->parse_quant(begin, end);
+
+ // did we find a quantified atom?
+ if(seq_quant.empty())
+ break;
+
+ // chain it to the end of the xpression sequence
+ seq += seq_quant;
+ }
+
+ return seq;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // parse_literal
+ // scan ahead looking for char literals to be globbed together into a string literal
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ string_type parse_literal(FwdIter &begin, FwdIter end)
+ {
+ using namespace regex_constants;
+ BOOST_ASSERT(begin != end);
+ BOOST_ASSERT(token_literal == this->traits_.get_token(begin, end));
+ escape_value esc = { 0, 0, 0, detail::escape_char };
+ string_type literal(1, *begin);
+
+ for(FwdIter prev = begin, tmp = ++begin; begin != end; prev = begin, begin = tmp)
+ {
+ detail::quant_spec spec = { 0, 0, false, &this->hidden_mark_count_ };
+ if(this->traits_.get_quant_spec(tmp, end, spec))
+ {
+ if(literal.size() != 1)
+ {
+ begin = prev;
+ literal.erase(boost::prior(literal.end()));
+ }
+ return literal;
+ }
+ else switch(this->traits_.get_token(tmp, end))
+ {
+ case token_escape:
+ esc = this->parse_escape(tmp, end);
+ if(detail::escape_char != esc.type_) return literal;
+ literal.insert(literal.end(), esc.ch_);
+ break;
+ case token_literal:
+ literal.insert(literal.end(), *tmp++);
+ break;
+ default:
+ return literal;
+ }
+ }
+
+ return literal;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // parse_quote_meta
+ // scan ahead looking for char literals to be globbed together into a string literal
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ string_type parse_quote_meta(FwdIter &begin, FwdIter end)
+ {
+ using namespace regex_constants;
+ FwdIter old_begin = begin, old_end;
+ while(end != (old_end = begin))
+ {
+ switch(this->traits_.get_token(begin, end))
+ {
+ case token_quote_meta_end: return string_type(old_begin, old_end);
+ case token_escape: detail::ensure(begin != end, error_escape, "incomplete escape sequence");
+ case token_literal: ++begin;
+ default:;
+ }
+ }
+ return string_type(old_begin, begin);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // parse_escape
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ escape_value parse_escape(FwdIter &begin, FwdIter end)
+ {
+ detail::ensure(begin != end, regex_constants::error_escape, "incomplete escape sequence");
+
+ // first, check to see if this can be a backreference
+ if(0 < this->rxtraits().value(*begin, 10))
+ {
+ // Parse at most 3 decimal digits.
+ FwdIter tmp = begin;
+ int mark_nbr = detail::toi(tmp, end, this->rxtraits(), 10, 999);
+
+ // If the resulting number could conceivably be a backref, then it is.
+ if(10 > mark_nbr || mark_nbr <= static_cast<int>(this->mark_count_))
+ {
+ begin = tmp;
+ escape_value esc = {0, mark_nbr, 0, detail::escape_mark};
+ return esc;
+ }
+ }
+
+ // Not a backreference, defer to the parse_escape helper
+ return detail::parse_escape(begin, end, this->traits_);
+ }
+
+ bool is_upper_(char_type ch) const
+ {
+ return 0 != this->upper_ && this->rxtraits().isctype(ch, this->upper_);
+ }
+
+ std::size_t mark_count_;
+ std::size_t hidden_mark_count_;
+ CompilerTraits traits_;
+ typename RegexTraits::char_class_type upper_;
+ shared_ptr<detail::regex_impl<BidiIter> > self_;
+ std::map<string_type, basic_regex<BidiIter> > rules_;
+};
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_constants.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_constants.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,294 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file regex_constants.hpp
+/// Contains definitions for the syntax_option_type, match_flag_type and
+/// error_type enumerations.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_REGEX_CONSTANTS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_REGEX_CONSTANTS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/mpl/identity.hpp>
+
+#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
+# define icase icase_
+#endif
+
+namespace boost { namespace xpressive { namespace regex_constants
+{
+
+/// Flags used to customize the regex syntax
+///
+enum syntax_option_type
+{
+ // these flags are required:
+
+ ECMAScript = 0, ///< Specifies that the grammar recognized by the regular expression
+ ///< engine uses its normal semantics: that is the same as that given
+ ///< in the ECMA-262, ECMAScript Language Specification, Chapter 15
+ ///< part 10, RegExp (Regular Expression) Objects (FWD.1).
+ ///<
+ icase = 1 << 1, ///< Specifies that matching of regular expressions against a character
+ ///< container sequence shall be performed without regard to case.
+ ///<
+ nosubs = 1 << 2, ///< Specifies that when a regular expression is matched against a
+ ///< character container sequence, then no sub-expression matches are to
+ ///< be stored in the supplied match_results structure.
+ ///<
+ optimize = 1 << 3, ///< Specifies that the regular expression engine should pay more
+ ///< attention to the speed with which regular expressions are matched,
+ ///< and less to the speed with which regular expression objects are
+ ///< constructed. Otherwise it has no detectable effect on the program
+ ///< output.
+ ///<
+ collate = 1 << 4, ///< Specifies that character ranges of the form "[a-b]" should be
+ ///< locale sensitive.
+ ///<
+
+ // These flags are optional. If the functionality is supported
+ // then the flags shall take these names.
+
+ //basic = 1 << 5, ///< Specifies that the grammar recognized by the regular expression
+ // ///< engine is the same as that used by POSIX basic regular expressions
+ // ///< in IEEE Std 1003.1-2001, Portable Operating System Interface
+ // ///< (POSIX), Base Definitions and Headers, Section 9, Regular
+ // ///< Expressions (FWD.1).
+ // ///<
+ //extended = 1 << 6, ///< Specifies that the grammar recognized by the regular expression
+ // ///< engine is the same as that used by POSIX extended regular
+ // ///< expressions in IEEE Std 1003.1-2001, Portable Operating System
+ // ///< Interface (POSIX), Base Definitions and Headers, Section 9,
+ // ///< Regular Expressions (FWD.1).
+ // ///<
+ //awk = 1 << 7, ///< Specifies that the grammar recognized by the regular expression
+ // ///< engine is the same as that used by POSIX utility awk in IEEE Std
+ // ///< 1003.1-2001, Portable Operating System Interface (POSIX), Shells
+ // ///< and Utilities, Section 4, awk (FWD.1).
+ // ///<
+ //grep = 1 << 8, ///< Specifies that the grammar recognized by the regular expression
+ // ///< engine is the same as that used by POSIX utility grep in IEEE Std
+ // ///< 1003.1-2001, Portable Operating System Interface (POSIX),
+ // ///< Shells and Utilities, Section 4, Utilities, grep (FWD.1).
+ // ///<
+ //egrep = 1 << 9, ///< Specifies that the grammar recognized by the regular expression
+ // ///< engine is the same as that used by POSIX utility grep when given
+ // ///< the -E option in IEEE Std 1003.1-2001, Portable Operating System
+ // ///< Interface (POSIX), Shells and Utilities, Section 4, Utilities,
+ // ///< grep (FWD.1).
+ // ///<
+
+ // these flags are specific to xpressive, and they help with perl compliance.
+
+ single_line = 1 << 10, ///< Specifies that the ^ and \$ metacharacters DO NOT match at
+ ///< internal line breaks. Note that this is the opposite of the
+ ///< perl default. It is the inverse of perl's /m (multi-line)
+ ///< modifier.
+ ///<
+ not_dot_null = 1 << 11, ///< Specifies that the . metacharacter does not match the null
+ ///< character \\0.
+ ///<
+ not_dot_newline = 1 << 12, ///< Specifies that the . metacharacter does not match the
+ ///< newline character \\n.
+ ///<
+ ignore_white_space = 1 << 13 ///< Specifies that non-escaped white-space is not significant.
+ ///<
+};
+
+/// Flags used to customize the behavior of the regex algorithms
+///
+enum match_flag_type
+{
+ match_default = 0, ///< Specifies that matching of regular expressions proceeds
+ ///< without any modification of the normal rules used in
+ ///< ECMA-262, ECMAScript Language Specification, Chapter 15
+ ///< part 10, RegExp (Regular Expression) Objects (FWD.1)
+ ///<
+ match_not_bol = 1 << 1, ///< Specifies that the expression "^" should not be matched
+ ///< against the sub-sequence [first,first).
+ ///<
+ match_not_eol = 1 << 2, ///< Specifies that the expression "\$" should not be
+ ///< matched against the sub-sequence [last,last).
+ ///<
+ match_not_bow = 1 << 3, ///< Specifies that the expression "\\b" should not be
+ ///< matched against the sub-sequence [first,first).
+ ///<
+ match_not_eow = 1 << 4, ///< Specifies that the expression "\\b" should not be
+ ///< matched against the sub-sequence [last,last).
+ ///<
+ match_any = 1 << 7, ///< Specifies that if more than one match is possible then
+ ///< any match is an acceptable result.
+ ///<
+ match_not_null = 1 << 8, ///< Specifies that the expression can not be matched
+ ///< against an empty sequence.
+ ///<
+ match_continuous = 1 << 10, ///< Specifies that the expression must match a sub-sequence
+ ///< that begins at first.
+ ///<
+ match_partial = 1 << 11, ///< Specifies that if no match can be found, then it is
+ ///< acceptable to return a match [from, last) where
+ ///< from != last, if there exists some sequence of characters
+ ///< [from,to) of which [from,last) is a prefix, and which
+ ///< would result in a full match.
+ ///<
+ match_prev_avail = 1 << 12, ///< Specifies that --first is a valid iterator position,
+ ///< when this flag is set then the flags match_not_bol
+ ///< and match_not_bow are ignored by the regular expression
+ ///< algorithms (RE.7) and iterators (RE.8).
+ ///<
+ format_default = 0, ///< Specifies that when a regular expression match is to be
+ ///< replaced by a new string, that the new string is
+ ///< constructed using the rules used by the ECMAScript
+ ///< replace function in ECMA-262, ECMAScript Language
+ ///< Specification, Chapter 15 part 5.4.11
+ ///< String.prototype.replace. (FWD.1). In addition during
+ ///< search and replace operations then all non-overlapping
+ ///< occurrences of the regular expression are located and
+ ///< replaced, and sections of the input that did not match
+ ///< the expression, are copied unchanged to the output
+ ///< string.
+ ///<
+ format_sed = 1 << 13, ///< Specifies that when a regular expression match is to be
+ ///< replaced by a new string, that the new string is
+ ///< constructed using the rules used by the Unix sed
+ ///< utility in IEEE Std 1003.1-2001, Portable Operating
+ ///< SystemInterface (POSIX), Shells and Utilities.
+ ///<
+ format_perl = 1 << 14, ///< Specifies that when a regular expression match is to be
+ ///< replaced by a new string, that the new string is
+ ///< constructed using an implementation defined superset
+ ///< of the rules used by the ECMAScript replace function in
+ ///< ECMA-262, ECMAScript Language Specification, Chapter 15
+ ///< part 5.4.11 String.prototype.replace (FWD.1).
+ ///<
+ format_no_copy = 1 << 15, ///< When specified during a search and replace operation,
+ ///< then sections of the character container sequence being
+ ///< searched that do match the regular expression, are not
+ ///< copied to the output string.
+ ///<
+ format_first_only = 1 << 16, ///< When specified during a search and replace operation,
+ ///< then only the first occurrence of the regular
+ ///< expression is replaced.
+ ///<
+ format_literal = 1 << 17, ///< Treat the format string as a literal.
+ ///<
+ format_all = 1 << 18 ///< Specifies that all syntax extensions are enabled,
+ ///< including conditional (?ddexpression1:expression2)
+ ///< replacements.
+ ///<
+};
+
+/// Error codes used by the regex_error type
+///
+enum error_type
+{
+ error_collate, ///< The expression contained an invalid collating element name.
+ ///<
+ error_ctype, ///< The expression contained an invalid character class name.
+ ///<
+ error_escape, ///< The expression contained an invalid escaped character,
+ ///< or a trailing escape.
+ ///<
+ error_subreg, ///< The expression contained an invalid back-reference.
+ ///<
+ error_brack, ///< The expression contained mismatched [ and ].
+ ///<
+ error_paren, ///< The expression contained mismatched ( and ).
+ ///<
+ error_brace, ///< The expression contained mismatched { and }.
+ ///<
+ error_badbrace, ///< The expression contained an invalid range in a {} expression.
+ ///<
+ error_range, ///< The expression contained an invalid character range, for
+ ///< example [b-a].
+ ///<
+ error_space, ///< There was insufficient memory to convert the expression into a
+ ///< finite state machine.
+ ///<
+ error_badrepeat, ///< One of *?+{ was not preceded by a valid regular expression.
+ ///<
+ error_complexity, ///< The complexity of an attempted match against a regular
+ ///< expression exceeded a pre-set level.
+ ///<
+ error_stack, ///< There was insufficient memory to determine whether the regular
+ ///< expression could match the specified character sequence.
+ ///<
+ error_badref, ///< An nested regex is uninitialized.
+ ///<
+ error_badmark, ///< An invalid use of a named capture.
+ ///<
+ error_badlookbehind, ///< An attempt to create a variable-width look-behind assertion
+ ///< was detected.
+ ///<
+ error_badrule, ///< An invalid use of a rule was detected.
+ ///<
+ error_badarg, ///< An argument to an action was unbound.
+ ///<
+ error_badattr, ///< Tried to read from an uninitialized attribute.
+ ///<
+ error_internal ///< An internal error has occured.
+ ///<
+};
+
+/// INTERNAL ONLY
+inline syntax_option_type operator &(syntax_option_type b1, syntax_option_type b2)
+{
+ return static_cast<syntax_option_type>(
+ static_cast<int>(b1) & static_cast<int>(b2));
+}
+
+/// INTERNAL ONLY
+inline syntax_option_type operator |(syntax_option_type b1, syntax_option_type b2)
+{
+ return static_cast<syntax_option_type>(static_cast<int>(b1) | static_cast<int>(b2));
+}
+
+/// INTERNAL ONLY
+inline syntax_option_type operator ^(syntax_option_type b1, syntax_option_type b2)
+{
+ return static_cast<syntax_option_type>(static_cast<int>(b1) ^ static_cast<int>(b2));
+}
+
+/// INTERNAL ONLY
+inline syntax_option_type operator ~(syntax_option_type b)
+{
+ return static_cast<syntax_option_type>(~static_cast<int>(b));
+}
+
+/// INTERNAL ONLY
+inline match_flag_type operator &(match_flag_type b1, match_flag_type b2)
+{
+ return static_cast<match_flag_type>(static_cast<int>(b1) & static_cast<int>(b2));
+}
+
+/// INTERNAL ONLY
+inline match_flag_type operator |(match_flag_type b1, match_flag_type b2)
+{
+ return static_cast<match_flag_type>(static_cast<int>(b1) | static_cast<int>(b2));
+}
+
+/// INTERNAL ONLY
+inline match_flag_type operator ^(match_flag_type b1, match_flag_type b2)
+{
+ return static_cast<match_flag_type>(static_cast<int>(b1) ^ static_cast<int>(b2));
+}
+
+/// INTERNAL ONLY
+inline match_flag_type operator ~(match_flag_type b)
+{
+ return static_cast<match_flag_type>(~static_cast<int>(b));
+}
+
+}}} // namespace boost::xpressive::regex_constants
+
+#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
+# undef icase
+#endif
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_error.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_error.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,87 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file regex_error.hpp
+/// Contains the definition of the regex_error exception class.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_REGEX_ERROR_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_REGEX_ERROR_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <string>
+#include <stdexcept>
+#include <boost/throw_exception.hpp>
+#include <boost/xpressive/regex_constants.hpp>
+
+//{{AFX_DOC_COMMENT
+///////////////////////////////////////////////////////////////////////////////
+// This is a hack to get Doxygen to show the inheritance relation between
+// regex_error and std::runtime_error.
+#ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
+/// INTERNAL ONLY
+namespace std
+{
+ /// INTERNAL ONLY
+ struct runtime_error {};
+}
+#endif
+//}}AFX_DOC_COMMENT
+
+namespace boost { namespace xpressive
+{
+
+////////////////////////////////////////////////////////////////////////////////
+// regex_error
+//
+/// \brief The class regex_error defines the type of objects thrown as
+/// exceptions to report errors during the conversion from a string representing
+/// a regular expression to a finite state machine.
+struct regex_error
+ : std::runtime_error
+{
+ /// Constructs an object of class regex_error.
+ /// \param code The error_type this regex_error represents.
+ /// \post code() == code
+ explicit regex_error(regex_constants::error_type code, char const *str = "")
+ : std::runtime_error(str)
+ , code_(code)
+ {
+ }
+
+ /// Accessor for the error_type value
+ /// \return the error_type code passed to the constructor
+ /// \throw nothrow
+ regex_constants::error_type code() const
+ {
+ return this->code_;
+ }
+
+private:
+
+ regex_constants::error_type code_;
+};
+
+namespace detail
+{
+
+//////////////////////////////////////////////////////////////////////////
+// ensure
+/// INTERNAL ONLY
+inline bool ensure(bool predicate, regex_constants::error_type code, char const *str = "")
+{
+ if(!predicate)
+ {
+ boost::throw_exception(regex_error(code, str));
+ }
+ return predicate;
+}
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_iterator.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_iterator.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,252 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file regex_iterator.hpp
+/// Contains the definition of the regex_iterator type, an STL-compatible iterator
+/// for stepping through all the matches in a sequence.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_REGEX_ITERATOR_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_REGEX_ITERATOR_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/noncopyable.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/access.hpp>
+#include <boost/xpressive/detail/utility/counted_base.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+//////////////////////////////////////////////////////////////////////////
+// regex_iterator_impl
+//
+template<typename BidiIter>
+struct regex_iterator_impl
+ : counted_base<regex_iterator_impl<BidiIter> >
+{
+ typedef detail::core_access<BidiIter> access;
+
+ regex_iterator_impl
+ (
+ BidiIter begin
+ , BidiIter cur
+ , BidiIter end
+ , BidiIter next_search
+ , basic_regex<BidiIter> const &rex
+ , regex_constants::match_flag_type flags
+ , bool not_null = false
+ )
+ : rex_(rex)
+ , what_()
+ , state_(begin, end, what_, *access::get_regex_impl(rex_), flags)
+ , flags_(flags)
+ , not_null_(not_null)
+ {
+ this->state_.cur_ = cur;
+ this->state_.next_search_ = next_search;
+ }
+
+ bool next()
+ {
+ this->state_.reset(this->what_, *access::get_regex_impl(this->rex_));
+ if(!regex_search_impl(this->state_, this->rex_, this->not_null_))
+ {
+ return false;
+ }
+
+ // Report position() correctly by setting the base different from prefix().first
+ access::set_base(this->what_, this->state_.begin_);
+
+ this->state_.cur_ = this->state_.next_search_ = this->what_[0].second;
+ this->not_null_ = (0 == this->what_.length());
+
+ return true;
+ }
+
+ bool equal_to(regex_iterator_impl<BidiIter> const &that) const
+ {
+ return this->rex_.regex_id() == that.rex_.regex_id()
+ && this->state_.begin_ == that.state_.begin_
+ && this->state_.cur_ == that.state_.cur_
+ && this->state_.end_ == that.state_.end_
+ && this->flags_ == that.flags_
+ ;
+ }
+
+ basic_regex<BidiIter> rex_;
+ match_results<BidiIter> what_;
+ match_state<BidiIter> state_;
+ regex_constants::match_flag_type const flags_;
+ bool not_null_;
+};
+
+} // namespace detail
+
+//////////////////////////////////////////////////////////////////////////
+// regex_iterator
+//
+template<typename BidiIter>
+struct regex_iterator
+{
+ typedef basic_regex<BidiIter> regex_type;
+ typedef match_results<BidiIter> value_type;
+ typedef typename iterator_difference<BidiIter>::type difference_type;
+ typedef value_type const *pointer;
+ typedef value_type const &reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ /// INTERNAL ONLY
+ typedef detail::regex_iterator_impl<BidiIter> impl_type_;
+
+ regex_iterator()
+ : impl_()
+ {
+ }
+
+ regex_iterator
+ (
+ BidiIter begin
+ , BidiIter end
+ , basic_regex<BidiIter> const &rex
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ )
+ : impl_(new impl_type_(begin, begin, end, begin, rex, flags))
+ {
+ this->next_();
+ }
+
+ template<typename LetExpr>
+ regex_iterator
+ (
+ BidiIter begin
+ , BidiIter end
+ , basic_regex<BidiIter> const &rex
+ , detail::let_<LetExpr> const &args
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ )
+ : impl_(new impl_type_(begin, begin, end, begin, rex, flags))
+ {
+ detail::bind_args(args, this->impl_->what_);
+ this->next_();
+ }
+
+ regex_iterator(regex_iterator<BidiIter> const &that)
+ : impl_(that.impl_) // COW
+ {
+ }
+
+ regex_iterator<BidiIter> &operator =(regex_iterator<BidiIter> const &that)
+ {
+ this->impl_ = that.impl_; // COW
+ return *this;
+ }
+
+ friend bool operator ==(regex_iterator<BidiIter> const &left, regex_iterator<BidiIter> const &right)
+ {
+ if(!left.impl_ || !right.impl_)
+ {
+ return !left.impl_ && !right.impl_;
+ }
+
+ return left.impl_->equal_to(*right.impl_);
+ }
+
+ friend bool operator !=(regex_iterator<BidiIter> const &left, regex_iterator<BidiIter> const &right)
+ {
+ return !(left == right);
+ }
+
+ value_type const &operator *() const
+ {
+ return this->impl_->what_;
+ }
+
+ value_type const *operator ->() const
+ {
+ return &this->impl_->what_;
+ }
+
+ /// If what.prefix().first != what[0].second and if the element match_prev_avail is not set in
+ /// flags then sets it. Then behaves as if by calling regex_search(what[0].second, end, what, *pre, flags),
+ /// with the following variation: in the event that the previous match found was of zero length
+ /// (what[0].length() == 0) then attempts to find a non-zero length match starting at what[0].second,
+ /// only if that fails and provided what[0].second != suffix().second does it look for a (possibly
+ /// zero length) match starting from what[0].second + 1. If no further match is found then sets
+ /// *this equal to the end of sequence iterator.
+ /// \post (*this)-\>size() == pre-\>mark_count() + 1
+ /// \post (*this)-\>empty() == false
+ /// \post (*this)-\>prefix().first == An iterator denoting the end point of the previous match found
+ /// \post (*this)-\>prefix().last == (**this)[0].first
+ /// \post (*this)-\>prefix().matched == (*this)-\>prefix().first != (*this)-\>prefix().second
+ /// \post (*this)-\>suffix().first == (**this)[0].second
+ /// \post (*this)-\>suffix().last == end
+ /// \post (*this)-\>suffix().matched == (*this)-\>suffix().first != (*this)-\>suffix().second
+ /// \post (**this)[0].first == The starting iterator for this match.
+ /// \post (**this)[0].second == The ending iterator for this match.
+ /// \post (**this)[0].matched == true if a full match was found, and false if it was a partial match (found as a result of the match_partial flag being set).
+ /// \post (**this)[n].first == For all integers n \< (*this)-\>size(), the start of the sequence that matched sub-expression n. Alternatively, if sub-expression n did not participate in the match, then end.
+ /// \post (**this)[n].second == For all integers n \< (*this)-\>size(), the end of the sequence that matched sub-expression n. Alternatively, if sub-expression n did not participate in the match, then end.
+ /// \post (**this)[n].matched == For all integers n \< (*this)-\>size(), true if sub-expression n participated in the match, false otherwise.
+ /// \post (*this)-\>position() == The distance from the start of the original sequence being iterated, to the start of this match.
+ regex_iterator<BidiIter> &operator ++()
+ {
+ this->fork_(); // un-share the implementation
+ this->next_();
+ return *this;
+ }
+
+ regex_iterator<BidiIter> operator ++(int)
+ {
+ regex_iterator<BidiIter> tmp(*this);
+ ++*this;
+ return tmp;
+ }
+
+private:
+
+ /// INTERNAL ONLY
+ void fork_()
+ {
+ if(1 != this->impl_->use_count())
+ {
+ // This is OK, the use_count is > 1
+ impl_type_ *that = this->impl_.get();
+ this->impl_ = new impl_type_
+ (
+ that->state_.begin_
+ , that->state_.cur_
+ , that->state_.end_
+ , that->state_.next_search_
+ , that->rex_
+ , that->flags_
+ , that->not_null_
+ );
+ detail::core_access<BidiIter>::get_action_args(this->impl_->what_)
+ = detail::core_access<BidiIter>::get_action_args(that->what_);
+ }
+ }
+
+ /// INTERNAL ONLY
+ void next_()
+ {
+ BOOST_ASSERT(this->impl_ && 1 == this->impl_->use_count());
+ if(!this->impl_->next())
+ {
+ this->impl_ = 0;
+ }
+ }
+
+ intrusive_ptr<impl_type_> impl_;
+};
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_primitives.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_primitives.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,869 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file regex_primitives.hpp
+/// Contains the syntax elements for writing static regular expressions.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_REGEX_PRIMITIVES_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_REGEX_PRIMITIVES_HPP_EAN_10_04_2005
+
+#include <vector>
+#include <climits>
+#include <boost/config.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/core/matchers.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+
+// Doxygen can't handle proto :-(
+#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
+# include <boost/xpressive/proto/proto.hpp>
+# include <boost/xpressive/proto/transform.hpp>
+# include <boost/xpressive/detail/core/icase.hpp>
+# include <boost/xpressive/detail/static/compile.hpp>
+# include <boost/xpressive/detail/static/modifier.hpp>
+#endif
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+ typedef assert_word_placeholder<word_boundary<mpl::true_> > assert_word_boundary;
+ typedef assert_word_placeholder<word_begin> assert_word_begin;
+ typedef assert_word_placeholder<word_end> assert_word_end;
+
+ struct mark_tag
+ : proto::extends<basic_mark_tag, mark_tag>
+ {
+ mark_tag(int mark_nbr)
+ {
+ mark_placeholder mark = {mark_nbr};
+ proto::arg(*this) = mark;
+ }
+
+ operator basic_mark_tag const &() const
+ {
+ return this->proto_base();
+ }
+
+ using proto::extends<basic_mark_tag, mark_tag>::operator =;
+ };
+
+ // workaround msvc-7.1 bug with function pointer types
+ // within function types:
+ #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+ #define mark_number(x) proto::call<mark_number(x)>
+ #define minus_one() proto::make<minus_one()>
+ #endif
+
+ struct push_back : proto::callable
+ {
+ typedef int result_type;
+
+ template<typename Subs>
+ int operator ()(Subs &subs, int i) const
+ {
+ subs.push_back(i);
+ return i;
+ }
+ };
+
+ struct mark_number : proto::callable
+ {
+ typedef int result_type;
+
+ template<typename Expr>
+ int operator ()(Expr const &expr) const
+ {
+ return expr.mark_number_;
+ }
+ };
+
+ typedef mpl::int_<-1> minus_one;
+
+ // s1 or -s1
+ struct SubMatch
+ : proto::or_<
+ proto::when<basic_mark_tag, push_back(proto::_visitor, mark_number(proto::_arg)) >
+ , proto::when<proto::negate<basic_mark_tag>, push_back(proto::_visitor, minus_one()) >
+ >
+ {};
+
+ struct SubMatchList
+ : proto::or_<SubMatch, proto::comma<SubMatchList, SubMatch> >
+ {};
+
+ template<typename Subs>
+ typename enable_if<
+ mpl::and_<proto::is_expr<Subs>, proto::matches<Subs, SubMatchList> >
+ , std::vector<int>
+ >::type
+ to_vector(Subs const &subs)
+ {
+ std::vector<int> subs_;
+ SubMatchList()(subs, 0, subs_);
+ return subs_;
+ }
+
+ #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+ #undef mark_number
+ #undef minus_one
+ #endif
+
+ // replace "Expr" with "keep(*State) >> Expr"
+ struct skip_primitives : proto::callable
+ {
+ template<typename Sig> struct result {};
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ {
+ typedef
+ typename proto::shift_right<
+ typename proto::unary_expr<
+ keeper_tag
+ , typename proto::dereference<State>::type
+ >::type
+ , Expr
+ >::type
+ type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ typename result<void(Expr, State, Visitor)>::type
+ operator ()(Expr const &expr, State const &state, Visitor &) const
+ {
+ typedef typename result<void(Expr, State, Visitor)>::type type;
+ type that = {{{state}}, expr};
+ return that;
+ }
+ };
+
+ struct Primitives
+ : proto::or_<
+ proto::terminal<proto::_>
+ , proto::comma<proto::_, proto::_>
+ , proto::subscript<proto::terminal<set_initializer>, proto::_>
+ , proto::assign<proto::terminal<set_initializer>, proto::_>
+ , proto::assign<proto::terminal<attribute_placeholder<proto::_> >, proto::_>
+ , proto::complement<Primitives>
+ >
+ {};
+
+ struct SkipGrammar
+ : proto::or_<
+ proto::when<Primitives, skip_primitives>
+ , proto::assign<proto::terminal<mark_placeholder>, SkipGrammar> // don't "skip" mark tags
+ , proto::subscript<SkipGrammar, proto::_> // don't put skips in actions
+ , proto::binary_expr<modifier_tag, proto::_, SkipGrammar> // don't skip modifiers
+ , proto::unary_expr<lookbehind_tag, proto::_> // don't skip lookbehinds
+ , proto::nary_expr<proto::_, proto::vararg<SkipGrammar> > // everything else is fair game!
+ >
+ {};
+
+ template<typename Skip>
+ struct skip_directive
+ {
+ typedef typename proto::result_of::as_expr<Skip>::type skip_type;
+
+ skip_directive(Skip const &skip)
+ : skip_(proto::as_expr(skip))
+ {}
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ {
+ typedef
+ typename proto::shift_right<
+ typename SkipGrammar::result<void(
+ typename proto::result_of::as_expr<Expr>::type
+ , skip_type
+ , mpl::void_
+ )>::type
+ , typename proto::dereference<skip_type>::type
+ >::type
+ type;
+ };
+
+ template<typename Expr>
+ typename result<skip_directive(Expr)>::type
+ operator ()(Expr const &expr) const
+ {
+ mpl::void_ ignore;
+ typedef typename result<skip_directive(Expr)>::type result_type;
+ result_type result = {SkipGrammar()(proto::as_expr(expr), this->skip_, ignore), {skip_}};
+ return result;
+ }
+
+ private:
+ skip_type skip_;
+ };
+
+/*
+///////////////////////////////////////////////////////////////////////////////
+/// INTERNAL ONLY
+// BOOST_XPRESSIVE_GLOBAL
+// for defining globals that neither violate the One Definition Rule nor
+// lead to undefined behavior due to global object initialization order.
+//#define BOOST_XPRESSIVE_GLOBAL(type, name, init) \
+// namespace detail \
+// { \
+// template<int Dummy> \
+// struct BOOST_PP_CAT(global_pod_, name) \
+// { \
+// static type const value; \
+// private: \
+// union type_must_be_pod \
+// { \
+// type t; \
+// char ch; \
+// } u; \
+// }; \
+// template<int Dummy> \
+// type const BOOST_PP_CAT(global_pod_, name)<Dummy>::value = init; \
+// } \
+// type const &name = detail::BOOST_PP_CAT(global_pod_, name)<0>::value
+*/
+
+
+} // namespace detail
+
+/// INTERNAL ONLY (for backwards compatibility)
+unsigned int const repeat_max = UINT_MAX-1;
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief For infinite repetition of a sub-expression.
+///
+/// Magic value used with the repeat\<\>() function template
+/// to specify an unbounded repeat. Use as: repeat<17, inf>('a').
+/// The equivalent in perl is /a{17,}/.
+unsigned int const inf = UINT_MAX-1;
+
+/// INTERNAL ONLY (for backwards compatibility)
+proto::terminal<detail::epsilon_matcher>::type const epsilon = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Successfully matches nothing.
+///
+/// Successfully matches a zero-width sequence. nil always succeeds and
+/// never consumes any characters.
+proto::terminal<detail::epsilon_matcher>::type const nil = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches an alpha-numeric character.
+///
+/// The regex traits are used to determine which characters are alpha-numeric.
+/// To match any character that is not alpha-numeric, use ~alnum.
+///
+/// \attention alnum is equivalent to /[[:alnum:]]/ in perl. ~alnum is equivalent
+/// to /[[:^alnum:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const alnum = {{"alnum", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches an alphabetic character.
+///
+/// The regex traits are used to determine which characters are alphabetic.
+/// To match any character that is not alphabetic, use ~alpha.
+///
+/// \attention alpha is equivalent to /[[:alpha:]]/ in perl. ~alpha is equivalent
+/// to /[[:^alpha:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const alpha = {{"alpha", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a blank (horizonal white-space) character.
+///
+/// The regex traits are used to determine which characters are blank characters.
+/// To match any character that is not blank, use ~blank.
+///
+/// \attention blank is equivalent to /[[:blank:]]/ in perl. ~blank is equivalent
+/// to /[[:^blank:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const blank = {{"blank", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a control character.
+///
+/// The regex traits are used to determine which characters are control characters.
+/// To match any character that is not a control character, use ~cntrl.
+///
+/// \attention cntrl is equivalent to /[[:cntrl:]]/ in perl. ~cntrl is equivalent
+/// to /[[:^cntrl:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const cntrl = {{"cntrl", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a digit character.
+///
+/// The regex traits are used to determine which characters are digits.
+/// To match any character that is not a digit, use ~digit.
+///
+/// \attention digit is equivalent to /[[:digit:]]/ in perl. ~digit is equivalent
+/// to /[[:^digit:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const digit = {{"digit", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a graph character.
+///
+/// The regex traits are used to determine which characters are graphable.
+/// To match any character that is not graphable, use ~graph.
+///
+/// \attention graph is equivalent to /[[:graph:]]/ in perl. ~graph is equivalent
+/// to /[[:^graph:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const graph = {{"graph", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a lower-case character.
+///
+/// The regex traits are used to determine which characters are lower-case.
+/// To match any character that is not a lower-case character, use ~lower.
+///
+/// \attention lower is equivalent to /[[:lower:]]/ in perl. ~lower is equivalent
+/// to /[[:^lower:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const lower = {{"lower", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a printable character.
+///
+/// The regex traits are used to determine which characters are printable.
+/// To match any character that is not printable, use ~print.
+///
+/// \attention print is equivalent to /[[:print:]]/ in perl. ~print is equivalent
+/// to /[[:^print:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const print = {{"print", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a punctuation character.
+///
+/// The regex traits are used to determine which characters are punctuation.
+/// To match any character that is not punctuation, use ~punct.
+///
+/// \attention punct is equivalent to /[[:punct:]]/ in perl. ~punct is equivalent
+/// to /[[:^punct:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const punct = {{"punct", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a space character.
+///
+/// The regex traits are used to determine which characters are space characters.
+/// To match any character that is not white-space, use ~space.
+///
+/// \attention space is equivalent to /[[:space:]]/ in perl. ~space is equivalent
+/// to /[[:^space:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const space = {{"space", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches an upper-case character.
+///
+/// The regex traits are used to determine which characters are upper-case.
+/// To match any character that is not upper-case, use ~upper.
+///
+/// \attention upper is equivalent to /[[:upper:]]/ in perl. ~upper is equivalent
+/// to /[[:^upper:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const upper = {{"upper", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a hexadecimal digit character.
+///
+/// The regex traits are used to determine which characters are hex digits.
+/// To match any character that is not a hex digit, use ~xdigit.
+///
+/// \attention xdigit is equivalent to /[[:xdigit:]]/ in perl. ~xdigit is equivalent
+/// to /[[:^xdigit:]]/ in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const xdigit = {{"xdigit", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Beginning of sequence assertion.
+///
+/// For the character sequence [begin, end), 'bos' matches the
+/// zero-width sub-sequence [begin, begin).
+proto::terminal<detail::assert_bos_matcher>::type const bos = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief End of sequence assertion.
+///
+/// For the character sequence [begin, end),
+/// 'eos' matches the zero-width sub-sequence [end, end).
+///
+/// \attention Unlike the perl end of sequence assertion \$, 'eos' will
+/// not match at the position [end-1, end-1) if *(end-1) is '\\n'. To
+/// get that behavior, use (!_n >> eos).
+proto::terminal<detail::assert_eos_matcher>::type const eos = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Beginning of line assertion.
+///
+/// 'bol' matches the zero-width sub-sequence
+/// immediately following a logical newline sequence. The regex traits
+/// is used to determine what constitutes a logical newline sequence.
+proto::terminal<detail::assert_bol_placeholder>::type const bol = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief End of line assertion.
+///
+/// 'eol' matches the zero-width sub-sequence
+/// immediately preceeding a logical newline sequence. The regex traits
+/// is used to determine what constitutes a logical newline sequence.
+proto::terminal<detail::assert_eol_placeholder>::type const eol = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Beginning of word assertion.
+///
+/// 'bow' matches the zero-width sub-sequence
+/// immediately following a non-word character and preceeding a word character.
+/// The regex traits are used to determine what constitutes a word character.
+proto::terminal<detail::assert_word_begin>::type const bow = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief End of word assertion.
+///
+/// 'eow' matches the zero-width sub-sequence
+/// immediately following a word character and preceeding a non-word character.
+/// The regex traits are used to determine what constitutes a word character.
+proto::terminal<detail::assert_word_end>::type const eow = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Word boundary assertion.
+///
+/// '_b' matches the zero-width sub-sequence at the beginning or the end of a word.
+/// It is equivalent to (bow | eow). The regex traits are used to determine what
+/// constitutes a word character. To match a non-word boundary, use ~_b.
+///
+/// \attention _b is like \\b in perl. ~_b is like \\B in perl.
+proto::terminal<detail::assert_word_boundary>::type const _b = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a word character.
+///
+/// '_w' matches a single word character. The regex traits are used to determine which
+/// characters are word characters. Use ~_w to match a character that is not a word
+/// character.
+///
+/// \attention _w is like \\w in perl. ~_w is like \\W in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const _w = {{"w", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a digit character.
+///
+/// '_d' matches a single digit character. The regex traits are used to determine which
+/// characters are digits. Use ~_d to match a character that is not a digit
+/// character.
+///
+/// \attention _d is like \\d in perl. ~_d is like \\D in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const _d = {{"d", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a space character.
+///
+/// '_s' matches a single space character. The regex traits are used to determine which
+/// characters are space characters. Use ~_s to match a character that is not a space
+/// character.
+///
+/// \attention _s is like \\s in perl. ~_s is like \\S in perl.
+proto::terminal<detail::posix_charset_placeholder>::type const _s = {{"s", false}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a literal newline character, '\\n'.
+///
+/// '_n' matches a single newline character, '\\n'. Use ~_n to match a character
+/// that is not a newline.
+///
+/// \attention ~_n is like '.' in perl without the /s modifier.
+proto::terminal<char>::type const _n = {'\n'};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches a logical newline sequence.
+///
+/// '_ln' matches a logical newline sequence. This can be any character in the
+/// line separator class, as determined by the regex traits, or the '\\r\\n' sequence.
+/// For the purpose of back-tracking, '\\r\\n' is treated as a unit.
+/// To match any one character that is not a logical newline, use ~_ln.
+detail::logical_newline_xpression const _ln = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Matches any one character.
+///
+/// Match any character, similar to '.' in perl syntax with the /s modifier.
+/// '_' matches any one character, including the newline.
+///
+/// \attention To match any character except the newline, use ~_n
+proto::terminal<detail::any_matcher>::type const _ = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Reference to the current regex object
+///
+/// Useful when constructing recursive regular expression objects. The 'self'
+/// identifier is a short-hand for the current regex object. For instance,
+/// sregex rx = '(' >> (self | nil) >> ')'; will create a regex object that
+/// matches balanced parens such as "((()))".
+proto::terminal<detail::self_placeholder>::type const self = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Used to create character sets.
+///
+/// There are two ways to create character sets with the 'set' identifier. The
+/// easiest is to create a comma-separated list of the characters in the set,
+/// as in (set= 'a','b','c'). This set will match 'a', 'b', or 'c'. The other
+/// way is to define the set as an argument to the set subscript operator.
+/// For instance, set[ 'a' | range('b','c') | digit ] will match an 'a', 'b',
+/// 'c' or a digit character.
+///
+/// To complement a set, apply the '~' operator. For instance, ~(set= 'a','b','c')
+/// will match any character that is not an 'a', 'b', or 'c'.
+///
+/// Sets can be composed of other, possibly complemented, sets. For instance,
+/// set[ ~digit | ~(set= 'a','b','c') ].
+detail::set_initializer_type const set = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Sub-match placeholder, like $& in Perl
+mark_tag::proto_base_expr const s0 = {{0}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Sub-match placeholder, like $1 in perl.
+///
+/// To create a sub-match, assign a sub-expression to the sub-match placeholder.
+/// For instance, (s1= _) will match any one character and remember which
+/// character was matched in the 1st sub-match. Later in the pattern, you can
+/// refer back to the sub-match. For instance, (s1= _) >> s1 will match any
+/// character, and then match the same character again.
+///
+/// After a successful regex_match() or regex_search(), the sub-match placeholders
+/// can be used to index into the match_results\<\> object to retrieve the Nth
+/// sub-match.
+mark_tag::proto_base_expr const s1 = {{1}};
+mark_tag::proto_base_expr const s2 = {{2}};
+mark_tag::proto_base_expr const s3 = {{3}};
+mark_tag::proto_base_expr const s4 = {{4}};
+mark_tag::proto_base_expr const s5 = {{5}};
+mark_tag::proto_base_expr const s6 = {{6}};
+mark_tag::proto_base_expr const s7 = {{7}};
+mark_tag::proto_base_expr const s8 = {{8}};
+mark_tag::proto_base_expr const s9 = {{9}};
+
+// NOTE: For the purpose of xpressive's documentation, make icase() look like an
+// ordinary function. In reality, it is a function object defined in detail/icase.hpp
+// so that it can serve double-duty as regex_constants::icase, the syntax_option_type.
+#ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Makes a sub-expression case-insensitive.
+///
+/// Use icase() to make a sub-expression case-insensitive. For instance,
+/// "foo" >> icase(set['b'] >> "ar") will match "foo" exactly followed by
+/// "bar" irrespective of case.
+template<typename Expr> detail::unspecified icase(Expr const &expr) { return 0; }
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Makes a literal into a regular expression.
+///
+/// Use as_xpr() to turn a literal into a regular expression. For instance,
+/// "foo" >> "bar" will not compile because both operands to the right-shift
+/// operator are const char*, and no such operator exists. Use as_xpr("foo") >> "bar"
+/// instead.
+///
+/// You can use as_xpr() with character literals in addition to string literals.
+/// For instance, as_xpr('a') will match an 'a'. You can also complement a
+/// character literal, as with ~as_xpr('a'). This will match any one character
+/// that is not an 'a'.
+#ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
+template<typename Literal> detail::unspecified as_xpr(Literal const &literal) { return 0; }
+#else
+proto::functional::as_expr<> const as_xpr = {};
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Embed a regex object by reference.
+///
+/// \param rex The basic_regex object to embed by reference.
+template<typename BidiIter>
+inline typename proto::terminal<reference_wrapper<basic_regex<BidiIter> const> >::type const
+by_ref(basic_regex<BidiIter> const &rex)
+{
+ reference_wrapper<basic_regex<BidiIter> const> ref(rex);
+ return proto::terminal<reference_wrapper<basic_regex<BidiIter> const> >::type::make(ref);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Match a range of characters.
+///
+/// Match any character in the range [ch_min, ch_max].
+///
+/// \param ch_min The lower end of the range to match.
+/// \param ch_max The upper end of the range to match.
+template<typename Char>
+inline typename proto::terminal<detail::range_placeholder<Char> >::type const
+range(Char ch_min, Char ch_max)
+{
+ detail::range_placeholder<Char> that = {ch_min, ch_max, false};
+ return proto::terminal<detail::range_placeholder<Char> >::type::make(that);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Make a sub-expression optional. Equivalent to !as_xpr(expr).
+///
+/// \param expr The sub-expression to make optional.
+template<typename Expr>
+typename proto::result_of::make_expr<
+ proto::tag::logical_not
+ , proto::default_domain
+ , Expr const &
+>::type const
+optional(Expr const &expr)
+{
+ return proto::make_expr<
+ proto::tag::logical_not
+ , proto::default_domain
+ >(boost::ref(expr));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Repeat a sub-expression multiple times.
+///
+/// There are two forms of the repeat\<\>() function template. To match a
+/// sub-expression N times, use repeat\<N\>(expr). To match a sub-expression
+/// from M to N times, use repeat\<M,N\>(expr).
+///
+/// The repeat\<\>() function creates a greedy quantifier. To make the quantifier
+/// non-greedy, apply the unary minus operator, as in -repeat\<M,N\>(expr).
+///
+/// \param expr The sub-expression to repeat.
+template<unsigned int Min, unsigned int Max, typename Expr>
+typename proto::result_of::make_expr<
+ detail::generic_quant_tag<Min, Max>
+ , proto::default_domain
+ , Expr const &
+>::type const
+repeat(Expr const &expr)
+{
+ return proto::make_expr<
+ detail::generic_quant_tag<Min, Max>
+ , proto::default_domain
+ >(boost::ref(expr));
+}
+
+/// \overload
+///
+template<unsigned int Count, typename Expr2>
+typename proto::result_of::make_expr<
+ detail::generic_quant_tag<Count, Count>
+ , proto::default_domain
+ , Expr2 const &
+>::type const
+repeat(Expr2 const &expr2)
+{
+ return proto::make_expr<
+ detail::generic_quant_tag<Count, Count>
+ , proto::default_domain
+ >(boost::ref(expr2));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Create an independent sub-expression.
+///
+/// Turn off back-tracking for a sub-expression. Any branches or repeats within
+/// the sub-expression will match only one way, and no other alternatives are
+/// tried.
+///
+/// \attention keep(expr) is equivalent to the perl (?>...) extension.
+///
+/// \param expr The sub-expression to modify.
+template<typename Expr>
+typename proto::result_of::make_expr<
+ detail::keeper_tag
+ , proto::default_domain
+ , Expr const &
+>::type const
+keep(Expr const &expr)
+{
+ return proto::make_expr<
+ detail::keeper_tag
+ , proto::default_domain
+ >(boost::ref(expr));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Look-ahead assertion.
+///
+/// before(expr) succeeds if the expr sub-expression would match at the current
+/// position in the sequence, but expr is not included in the match. For instance,
+/// before("foo") succeeds if we are before a "foo". Look-ahead assertions can be
+/// negated with the bit-compliment operator.
+///
+/// \attention before(expr) is equivalent to the perl (?=...) extension.
+/// ~before(expr) is a negative look-ahead assertion, equivalent to the
+/// perl (?!...) extension.
+///
+/// \param expr The sub-expression to put in the look-ahead assertion.
+template<typename Expr>
+typename proto::result_of::make_expr<
+ detail::lookahead_tag
+ , proto::default_domain
+ , Expr const &
+>::type const
+before(Expr const &expr)
+{
+ return proto::make_expr<
+ detail::lookahead_tag
+ , proto::default_domain
+ >(boost::ref(expr));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Look-behind assertion.
+///
+/// after(expr) succeeds if the expr sub-expression would match at the current
+/// position minus N in the sequence, where N is the width of expr. expr is not included in
+/// the match. For instance, after("foo") succeeds if we are after a "foo". Look-behind
+/// assertions can be negated with the bit-complement operator.
+///
+/// \attention after(expr) is equivalent to the perl (?<=...) extension.
+/// ~after(expr) is a negative look-behind assertion, equivalent to the
+/// perl (?<!...) extension.
+///
+/// \param expr The sub-expression to put in the look-ahead assertion.
+///
+/// \pre expr cannot match a variable number of characters.
+template<typename Expr>
+typename proto::result_of::make_expr<
+ detail::lookbehind_tag
+ , proto::default_domain
+ , Expr const &
+>::type const
+after(Expr const &expr)
+{
+ return proto::make_expr<
+ detail::lookbehind_tag
+ , proto::default_domain
+ >(boost::ref(expr));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Specify a regex traits or a std::locale.
+///
+/// imbue() instructs the regex engine to use the specified traits or locale
+/// when matching the regex. The entire expression must use the same traits/locale.
+/// For instance, the following specifies a locale for use with a regex:
+/// std::locale loc;
+/// sregex rx = imbue(loc)(+digit);
+///
+/// \param loc The std::locale or regex traits object.
+template<typename Locale>
+inline detail::modifier_op<detail::locale_modifier<Locale> > const
+imbue(Locale const &loc)
+{
+ detail::modifier_op<detail::locale_modifier<Locale> > mod =
+ {
+ detail::locale_modifier<Locale>(loc)
+ , regex_constants::ECMAScript
+ };
+ return mod;
+}
+
+proto::terminal<detail::attribute_placeholder<mpl::int_<1> > >::type const a1 = {{}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<2> > >::type const a2 = {{}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<3> > >::type const a3 = {{}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<4> > >::type const a4 = {{}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<5> > >::type const a5 = {{}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<6> > >::type const a6 = {{}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<7> > >::type const a7 = {{}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<8> > >::type const a8 = {{}};
+proto::terminal<detail::attribute_placeholder<mpl::int_<9> > >::type const a9 = {{}};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief Specify which characters to skip when matching a regex.
+///
+/// <tt>skip()</tt> instructs the regex engine to skip certain characters when matching
+/// a regex. It is most useful for writing regexes that ignore whitespace.
+/// For instance, the following specifies a regex that skips whitespace and
+/// punctuation:
+///
+/// \code
+/// // A sentence is one or more words separated by whitespace
+/// // and punctuation.
+/// sregex word = +alpha;
+/// sregex sentence = skip(set[_s | punct])( +word );
+/// \endcode
+///
+/// The way it works in the above example is to insert
+/// <tt>keep(*set[_s | punct])</tt> before each primitive within the regex.
+/// A "primitive" includes terminals like strings, character sets and nested
+/// regexes. A final <tt>*set[_s | punct]</tt> is added to the end of the
+/// regex. The regex <tt>sentence</tt> specified above is equivalent to
+/// the following:
+///
+/// \code
+/// sregex sentence = +( keep(*set[_s | punct]) >> word )
+/// >> *set[_s | punct];
+/// \endcode
+///
+/// \attention Skipping does not affect how nested regexes are handled because
+/// they are treated atomically. String literals are also treated
+/// atomically; that is, no skipping is done within a string literal. So
+/// <tt>skip(_s)("this that")</tt> is not the same as
+/// <tt>skip(_s)("this" >> as_xpr("that"))</tt>. The first will only match
+/// when there is only one space between "this" and "that". The second will
+/// skip any and all whitespace between "this" and "that".
+///
+/// \param skip A regex that specifies which characters to skip.
+template<typename Skip>
+detail::skip_directive<Skip> skip(Skip const &skip)
+{
+ return detail::skip_directive<Skip>(skip);
+}
+
+namespace detail
+{
+ inline void ignore_unused_regex_primitives()
+ {
+ ignore_unused(repeat_max);
+ ignore_unused(inf);
+ ignore_unused(epsilon);
+ ignore_unused(nil);
+ ignore_unused(alnum);
+ ignore_unused(bos);
+ ignore_unused(eos);
+ ignore_unused(bol);
+ ignore_unused(eol);
+ ignore_unused(bow);
+ ignore_unused(eow);
+ ignore_unused(_b);
+ ignore_unused(_w);
+ ignore_unused(_d);
+ ignore_unused(_s);
+ ignore_unused(_n);
+ ignore_unused(_ln);
+ ignore_unused(_);
+ ignore_unused(self);
+ ignore_unused(set);
+ ignore_unused(s0);
+ ignore_unused(s1);
+ ignore_unused(s2);
+ ignore_unused(s3);
+ ignore_unused(s4);
+ ignore_unused(s5);
+ ignore_unused(s6);
+ ignore_unused(s7);
+ ignore_unused(s8);
+ ignore_unused(s9);
+ ignore_unused(a1);
+ ignore_unused(a2);
+ ignore_unused(a3);
+ ignore_unused(a4);
+ ignore_unused(a5);
+ ignore_unused(a6);
+ ignore_unused(a7);
+ ignore_unused(a8);
+ ignore_unused(a9);
+ ignore_unused(as_xpr);
+ }
+}
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_token_iterator.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_token_iterator.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,354 @@
+ ///////////////////////////////////////////////////////////////////////////////
+/// \file regex_token_iterator.hpp
+/// Contains the definition of regex_token_iterator, and STL-compatible iterator
+/// for tokenizing a string using a regular expression.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_REGEX_TOKEN_ITERATOR_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_REGEX_TOKEN_ITERATOR_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <vector>
+#include <boost/assert.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/xpressive/regex_iterator.hpp>
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+//////////////////////////////////////////////////////////////////////////
+// regex_token_iterator_impl
+//
+template<typename BidiIter>
+struct regex_token_iterator_impl
+ : counted_base<regex_token_iterator_impl<BidiIter> >
+{
+ typedef sub_match<BidiIter> value_type;
+
+ regex_token_iterator_impl
+ (
+ BidiIter begin
+ , BidiIter cur
+ , BidiIter end
+ , BidiIter next_search
+ , basic_regex<BidiIter> const &rex
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ , std::vector<int> subs = std::vector<int>(1, 0)
+ , int n = -2
+ , bool not_null = false
+ )
+ : iter_(begin, cur, end, next_search, rex, flags, not_null)
+ , result_()
+ , n_((-2 == n) ? (int)subs.size() - 1 : n)
+ , subs_()
+ {
+ BOOST_ASSERT(0 != subs.size());
+ this->subs_.swap(subs);
+ }
+
+ bool next()
+ {
+ if(-1 != this->n_)
+ {
+ BidiIter cur = this->iter_.state_.cur_;
+ if(0 != (++this->n_ %= (int)this->subs_.size()) || this->iter_.next())
+ {
+ this->result_ = (-1 == this->subs_[ this->n_ ])
+ ? this->iter_.what_.prefix()
+ : this->iter_.what_[ this->subs_[ this->n_ ] ];
+ return true;
+ }
+ else if(-1 == this->subs_[ this->n_-- ] && cur != this->iter_.state_.end_)
+ {
+ this->result_ = value_type(cur, this->iter_.state_.end_, true);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool equal_to(regex_token_iterator_impl<BidiIter> const &that) const
+ {
+ return this->iter_.equal_to(that.iter_) && this->n_ == that.n_;
+ }
+
+ regex_iterator_impl<BidiIter> iter_;
+ value_type result_;
+ int n_;
+ std::vector<int> subs_;
+};
+
+inline int get_mark_number(int i)
+{
+ return i;
+}
+
+inline std::vector<int> to_vector(int sub_match)
+{
+ return std::vector<int>(1, sub_match);
+}
+
+inline std::vector<int> const &to_vector(std::vector<int> const &sub_matches)
+{
+ return sub_matches;
+}
+
+template<typename Int, std::size_t Size>
+inline std::vector<int> to_vector(Int const (&sub_matches)[ Size ])
+{
+ // so that people can specify sub-match indices inline with
+ // string literals, like "\1\2\3", leave off the trailing '\0'
+ std::size_t const size = Size - is_same<Int, char>::value;
+ std::vector<int> vect(size);
+ for(std::size_t i = 0; i < size; ++i)
+ {
+ vect[i] = get_mark_number(sub_matches[i]);
+ }
+ return vect;
+}
+
+template<typename Int>
+inline std::vector<int> to_vector(std::vector<Int> const &sub_matches)
+{
+ BOOST_MPL_ASSERT((is_convertible<Int, int>));
+ return std::vector<int>(sub_matches.begin(), sub_matches.end());
+}
+
+} // namespace detail
+
+//////////////////////////////////////////////////////////////////////////
+// regex_token_iterator
+//
+template<typename BidiIter>
+struct regex_token_iterator
+{
+ typedef basic_regex<BidiIter> regex_type;
+ typedef typename iterator_value<BidiIter>::type char_type;
+ typedef sub_match<BidiIter> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef value_type const *pointer;
+ typedef value_type const &reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ /// INTERNAL ONLY
+ typedef detail::regex_token_iterator_impl<BidiIter> impl_type_;
+
+ /// \post \c *this is the end of sequence iterator.
+ regex_token_iterator()
+ : impl_()
+ {
+ }
+
+ /// \param begin The beginning of the character range to search.
+ /// \param end The end of the character range to search.
+ /// \param rex The regex pattern to search for.
+ /// \pre \c [begin,end) is a valid range.
+ regex_token_iterator
+ (
+ BidiIter begin
+ , BidiIter end
+ , basic_regex<BidiIter> const &rex
+ )
+ : impl_(new impl_type_(begin, begin, end, begin, rex))
+ {
+ this->next_();
+ }
+
+ /// \param begin The beginning of the character range to search.
+ /// \param end The end of the character range to search.
+ /// \param rex The regex pattern to search for.
+ /// \param args A let() expression with argument bindings for semantic actions.
+ /// \pre \c [begin,end) is a valid range.
+ template<typename LetExpr>
+ regex_token_iterator
+ (
+ BidiIter begin
+ , BidiIter end
+ , basic_regex<BidiIter> const &rex
+ , detail::let_<LetExpr> const &args
+ )
+ : impl_(new impl_type_(begin, begin, end, begin, rex))
+ {
+ detail::bind_args(args, this->impl_->iter_.what_);
+ this->next_();
+ }
+
+ /// \param begin The beginning of the character range to search.
+ /// \param end The end of the character range to search.
+ /// \param rex The regex pattern to search for.
+ /// \param flags Optional match flags, used to control how the expression is matched against the sequence. (See match_flag_type.)
+ /// \pre \c [begin,end) is a valid range.
+ /// \pre \c subs is either an integer greater or equal to -1,
+ /// or else an array or non-empty \c std::vector\<\> of such integers.
+ template<typename Subs>
+ regex_token_iterator
+ (
+ BidiIter begin
+ , BidiIter end
+ , basic_regex<BidiIter> const &rex
+ , Subs const &subs
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ )
+ : impl_(new impl_type_(begin, begin, end, begin, rex, flags, detail::to_vector(subs)))
+ {
+ this->next_();
+ }
+
+ /// \param begin The beginning of the character range to search.
+ /// \param end The end of the character range to search.
+ /// \param rex The regex pattern to search for.
+ /// \param args A let() expression with argument bindings for semantic actions.
+ /// \param flags Optional match flags, used to control how the expression is matched against the sequence. (See match_flag_type.)
+ /// \pre \c [begin,end) is a valid range.
+ /// \pre \c subs is either an integer greater or equal to -1,
+ /// or else an array or non-empty \c std::vector\<\> of such integers.
+ template<typename Subs, typename LetExpr>
+ regex_token_iterator
+ (
+ BidiIter begin
+ , BidiIter end
+ , basic_regex<BidiIter> const &rex
+ , Subs const &subs
+ , detail::let_<LetExpr> const &args
+ , regex_constants::match_flag_type flags = regex_constants::match_default
+ )
+ : impl_(new impl_type_(begin, begin, end, begin, rex, flags, detail::to_vector(subs)))
+ {
+ detail::bind_args(args, this->impl_->iter_.what_);
+ this->next_();
+ }
+
+ /// \post <tt>*this == that</tt>
+ regex_token_iterator(regex_token_iterator<BidiIter> const &that)
+ : impl_(that.impl_) // COW
+ {
+ }
+
+ /// \post <tt>*this == that</tt>
+ regex_token_iterator<BidiIter> &operator =(regex_token_iterator<BidiIter> const &that)
+ {
+ this->impl_ = that.impl_; // COW
+ return *this;
+ }
+
+ friend bool operator ==(regex_token_iterator<BidiIter> const &left, regex_token_iterator<BidiIter> const &right)
+ {
+ if(!left.impl_ || !right.impl_)
+ {
+ return !left.impl_ && !right.impl_;
+ }
+
+ return left.impl_->equal_to(*right.impl_);
+ }
+
+ friend bool operator !=(regex_token_iterator<BidiIter> const &left, regex_token_iterator<BidiIter> const &right)
+ {
+ return !(left == right);
+ }
+
+ value_type const &operator *() const
+ {
+ return this->impl_->result_;
+ }
+
+ value_type const *operator ->() const
+ {
+ return &this->impl_->result_;
+ }
+
+ /// If N == -1 then sets *this equal to the end of sequence iterator.
+ /// Otherwise if N+1 \< subs.size(), then increments N and sets result equal to
+ /// ((subs[N] == -1) ? value_type(what.prefix().str()) : value_type(what[subs[N]].str())).
+ /// Otherwise if what.prefix().first != what[0].second and if the element match_prev_avail is
+ /// not set in flags then sets it. Then locates the next match as if by calling
+ /// regex_search(what[0].second, end, what, *pre, flags), with the following variation:
+ /// in the event that the previous match found was of zero length (what[0].length() == 0)
+ /// then attempts to find a non-zero length match starting at what[0].second, only if that
+ /// fails and provided what[0].second != suffix().second does it look for a (possibly zero
+ /// length) match starting from what[0].second + 1. If such a match is found then sets N
+ /// equal to zero, and sets result equal to
+ /// ((subs[N] == -1) ? value_type(what.prefix().str()) : value_type(what[subs[N]].str())).
+ /// Otherwise if no further matches were found, then let last_end be the endpoint of the last
+ /// match that was found. Then if last_end != end and subs[0] == -1 sets N equal to -1 and
+ /// sets result equal to value_type(last_end, end). Otherwise sets *this equal to the end
+ /// of sequence iterator.
+ regex_token_iterator<BidiIter> &operator ++()
+ {
+ this->fork_(); // un-share the implementation
+ this->next_();
+ return *this;
+ }
+
+ regex_token_iterator<BidiIter> operator ++(int)
+ {
+ regex_token_iterator<BidiIter> tmp(*this);
+ ++*this;
+ return tmp;
+ }
+
+private:
+
+ /// INTERNAL ONLY
+ void fork_()
+ {
+ if(1 != this->impl_->use_count())
+ {
+ intrusive_ptr<impl_type_> clone = new impl_type_
+ (
+ this->impl_->iter_.state_.begin_
+ , this->impl_->iter_.state_.cur_
+ , this->impl_->iter_.state_.end_
+ , this->impl_->iter_.state_.next_search_
+ , this->impl_->iter_.rex_
+ , this->impl_->iter_.flags_
+ , this->impl_->subs_
+ , this->impl_->n_
+ , this->impl_->iter_.not_null_
+ );
+
+ // only copy the match_results struct if we have to. Note: if the next call
+ // to impl_->next() will return false or call regex_search, we don't need to
+ // copy the match_results struct.
+ if(-1 != this->impl_->n_ && this->impl_->n_ + 1 != static_cast<int>(this->impl_->subs_.size()))
+ {
+ // BUGBUG This is expensive -- it causes the sequence_stack to be cleared.
+ // Find a better way
+ clone->iter_.what_ = this->impl_->iter_.what_;
+ }
+ else
+ {
+ // At the very least, copy the action args
+ detail::core_access<BidiIter>::get_action_args(clone->iter_.what_)
+ = detail::core_access<BidiIter>::get_action_args(this->impl_->iter_.what_);
+ }
+
+ this->impl_.swap(clone);
+ }
+ }
+
+ /// INTERNAL ONLY
+ void next_()
+ {
+ BOOST_ASSERT(this->impl_ && 1 == this->impl_->use_count());
+ if(!this->impl_->next())
+ {
+ this->impl_ = 0;
+ }
+ }
+
+ intrusive_ptr<impl_type_> impl_;
+};
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_traits.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/regex_traits.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,107 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file regex_traits.hpp
+/// Includes the C regex traits or the CPP regex traits header file depending on the
+/// BOOST_XPRESSIVE_USE_C_TRAITS macro.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_REGEX_TRAITS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_REGEX_TRAITS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+
+#ifdef BOOST_XPRESSIVE_USE_C_TRAITS
+# include <boost/xpressive/traits/c_regex_traits.hpp>
+#else
+# include <boost/xpressive/traits/cpp_regex_traits.hpp>
+#endif
+
+namespace boost { namespace xpressive
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_traits_version_1_tag
+/// Tag used to denote that a traits class conforms to the version 1 traits
+/// interface.
+struct regex_traits_version_1_tag
+{
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_traits_version_2_tag
+/// Tag used to denote that a traits class conforms to the version 2 traits
+/// interface.
+struct regex_traits_version_2_tag
+ : regex_traits_version_1_tag
+{
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_traits_version_1_case_fold_tag DEPRECATED use has_fold_case trait
+/// INTERNAL ONLY
+///
+struct regex_traits_version_1_case_fold_tag
+ : regex_traits_version_1_tag
+{
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// has_fold_case
+/// Trait used to denote that a traits class has the fold_case member function.
+template<typename Traits>
+struct has_fold_case
+ : is_convertible<
+ typename Traits::version_tag *
+ , regex_traits_version_1_case_fold_tag *
+ >
+{
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_traits
+/// Thin wrapper around the default regex_traits implementation, either
+/// cpp_regex_traits or c_regex_traits
+///
+template<typename Char, typename Impl>
+struct regex_traits
+ : Impl
+{
+ typedef typename Impl::locale_type locale_type;
+
+ regex_traits()
+ : Impl()
+ {
+ }
+
+ explicit regex_traits(locale_type const &loc)
+ : Impl(loc)
+ {
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// lookup_classname
+/// INTERNAL ONLY
+template<typename Traits, std::size_t N>
+inline typename Traits::char_class_type
+lookup_classname(Traits const &traits, char const (&cname)[N], bool icase)
+{
+ typename Traits::char_type name[N] = {0};
+ for(std::size_t j = 0; j < N-1; ++j)
+ {
+ name[j] = traits.widen(cname[j]);
+ }
+ return traits.lookup_classname(name, name + N - 1, icase);
+}
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/sub_match.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/sub_match.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,392 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file sub_match.hpp
+/// Contains the definition of the class template sub_match\<\>
+/// and associated helper functions
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_SUB_MATCH_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_SUB_MATCH_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <iosfwd>
+#include <string>
+#include <utility>
+#include <iterator>
+#include <algorithm>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+
+//{{AFX_DOC_COMMENT
+///////////////////////////////////////////////////////////////////////////////
+// This is a hack to get Doxygen to show the inheritance relation between
+// sub_match<T> and std::pair<T,T>.
+#ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
+/// INTERNAL ONLY
+namespace std
+{
+ /// INTERNAL ONLY
+ template<typename, typename> struct pair {};
+}
+#endif
+//}}AFX_DOC_COMMENT
+
+namespace boost { namespace xpressive
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// sub_match
+//
+/// \brief Class template sub_match denotes the sequence of characters matched by a particular marked sub-expression.
+///
+/// When the marked sub-expression denoted by an object of type sub_match\<\> participated in a
+/// regular expression match then member matched evaluates to true, and members first and second
+/// denote the range of characters [first,second) which formed that match. Otherwise matched is false,
+/// and members first and second contained undefined values.
+///
+/// If an object of type sub_match\<\> represents sub-expression 0 - that is to say the whole match -
+/// then member matched is always true, unless a partial match was obtained as a result of the flag
+/// match_partial being passed to a regular expression algorithm, in which case member matched is
+/// false, and members first and second represent the character range that formed the partial match.
+template<typename BidiIter>
+struct sub_match
+ : std::pair<BidiIter, BidiIter>
+{
+private:
+ /// INTERNAL ONLY
+ ///
+ struct dummy { int i_; };
+ typedef int dummy::*bool_type;
+
+public:
+ typedef typename iterator_value<BidiIter>::type value_type;
+ typedef typename iterator_difference<BidiIter>::type difference_type;
+ typedef typename detail::string_type<value_type>::type string_type;
+ typedef BidiIter iterator;
+
+ sub_match()
+ : std::pair<BidiIter, BidiIter>()
+ , matched(false)
+ {
+ }
+
+ sub_match(BidiIter first, BidiIter second, bool matched_ = false)
+ : std::pair<BidiIter, BidiIter>(first, second)
+ , matched(matched_)
+ {
+ }
+
+ string_type str() const
+ {
+ return this->matched ? string_type(this->first, this->second) : string_type();
+ }
+
+ operator string_type() const
+ {
+ return this->matched ? string_type(this->first, this->second) : string_type();
+ }
+
+ difference_type length() const
+ {
+ return this->matched ? std::distance(this->first, this->second) : 0;
+ }
+
+ operator bool_type() const
+ {
+ return this->matched ? &dummy::i_ : 0;
+ }
+
+ bool operator !() const
+ {
+ return !this->matched;
+ }
+
+ /// \brief Performs a lexicographic string comparison
+ /// \param str the string against which to compare
+ /// \return the results of (*this).str().compare(str)
+ int compare(string_type const &str) const
+ {
+ return this->str().compare(str);
+ }
+
+ /// \overload
+ ///
+ int compare(sub_match const &sub) const
+ {
+ return this->str().compare(sub.str());
+ }
+
+ /// \overload
+ ///
+ int compare(value_type const *ptr) const
+ {
+ return this->str().compare(ptr);
+ }
+
+ /// \brief true if this sub-match participated in the full match.
+ bool matched;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief insertion operator for sending sub-matches to ostreams
+/// \param sout output stream.
+/// \param sub sub_match object to be written to the stream.
+/// \return sout \<\< sub.str()
+template<typename BidiIter, typename Char, typename Traits>
+inline std::basic_ostream<Char, Traits> &operator <<
+(
+ std::basic_ostream<Char, Traits> &sout
+ , sub_match<BidiIter> const &sub
+)
+{
+ typedef typename iterator_value<BidiIter>::type char_type;
+ if(sub.matched)
+ {
+ std::ostream_iterator<char_type, Char, Traits> iout(sout);
+ std::copy(sub.first, sub.second, iout);
+ }
+ return sout;
+}
+
+
+// BUGBUG make these more efficient
+
+template<typename BidiIter>
+bool operator == (sub_match<BidiIter> const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs.compare(rhs) == 0;
+}
+
+template<typename BidiIter>
+bool operator != (sub_match<BidiIter> const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs.compare(rhs) != 0;
+}
+
+template<typename BidiIter>
+bool operator < (sub_match<BidiIter> const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs.compare(rhs) < 0;
+}
+
+template<typename BidiIter>
+bool operator <= (sub_match<BidiIter> const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs.compare(rhs) <= 0;
+}
+
+template<typename BidiIter>
+bool operator >= (sub_match<BidiIter> const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs.compare(rhs) >= 0;
+}
+
+template<typename BidiIter>
+bool operator > (sub_match<BidiIter> const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs.compare(rhs) > 0;
+}
+
+template<typename BidiIter>
+bool operator == (typename iterator_value<BidiIter>::type const *lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs == rhs.str();
+}
+
+template<typename BidiIter>
+bool operator != (typename iterator_value<BidiIter>::type const *lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs != rhs.str();
+}
+
+template<typename BidiIter>
+bool operator < (typename iterator_value<BidiIter>::type const *lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs < rhs.str();
+}
+
+template<typename BidiIter>
+bool operator > (typename iterator_value<BidiIter>::type const *lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs> rhs.str();
+}
+
+template<typename BidiIter>
+bool operator >= (typename iterator_value<BidiIter>::type const *lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs >= rhs.str();
+}
+
+template<typename BidiIter>
+bool operator <= (typename iterator_value<BidiIter>::type const *lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs <= rhs.str();
+}
+
+template<typename BidiIter>
+bool operator == (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const *rhs)
+{
+ return lhs.str() == rhs;
+}
+
+template<typename BidiIter>
+bool operator != (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const *rhs)
+{
+ return lhs.str() != rhs;
+}
+
+template<typename BidiIter>
+bool operator < (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const *rhs)
+{
+ return lhs.str() < rhs;
+}
+
+template<typename BidiIter>
+bool operator > (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const *rhs)
+{
+ return lhs.str() > rhs;
+}
+
+template<typename BidiIter>
+bool operator >= (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const *rhs)
+{
+ return lhs.str() >= rhs;
+}
+
+template<typename BidiIter>
+bool operator <= (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const *rhs)
+{
+ return lhs.str() <= rhs;
+}
+
+template<typename BidiIter>
+bool operator == (typename iterator_value<BidiIter>::type const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs == rhs.str();
+}
+
+template<typename BidiIter>
+bool operator != (typename iterator_value<BidiIter>::type const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs != rhs.str();
+}
+
+template<typename BidiIter>
+bool operator < (typename iterator_value<BidiIter>::type const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs < rhs.str();
+}
+
+template<typename BidiIter>
+bool operator > (typename iterator_value<BidiIter>::type const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs> rhs.str();
+}
+
+template<typename BidiIter>
+bool operator >= (typename iterator_value<BidiIter>::type const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs >= rhs.str();
+}
+
+template<typename BidiIter>
+bool operator <= (typename iterator_value<BidiIter>::type const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs <= rhs.str();
+}
+
+template<typename BidiIter>
+bool operator == (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const &rhs)
+{
+ return lhs.str() == rhs;
+}
+
+template<typename BidiIter>
+bool operator != (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const &rhs)
+{
+ return lhs.str() != rhs;
+}
+
+template<typename BidiIter>
+bool operator < (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const &rhs)
+{
+ return lhs.str() < rhs;
+}
+
+template<typename BidiIter>
+bool operator > (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const &rhs)
+{
+ return lhs.str() > rhs;
+}
+
+template<typename BidiIter>
+bool operator >= (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const &rhs)
+{
+ return lhs.str() >= rhs;
+}
+
+template<typename BidiIter>
+bool operator <= (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const &rhs)
+{
+ return lhs.str() <= rhs;
+}
+
+// Operator+ convenience function
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (sub_match<BidiIter> const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs.str() + rhs.str();
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const &rhs)
+{
+ return lhs.str() + rhs;
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (typename iterator_value<BidiIter>::type const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs + rhs.str();
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (sub_match<BidiIter> const &lhs, typename iterator_value<BidiIter>::type const *rhs)
+{
+ return lhs.str() + rhs;
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (typename iterator_value<BidiIter>::type const *lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs + rhs.str();
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (sub_match<BidiIter> const &lhs, typename sub_match<BidiIter>::string_type const &rhs)
+{
+ return lhs.str() + rhs;
+}
+
+template<typename BidiIter>
+typename sub_match<BidiIter>::string_type
+operator + (typename sub_match<BidiIter>::string_type const &lhs, sub_match<BidiIter> const &rhs)
+{
+ return lhs + rhs.str();
+}
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/c_regex_traits.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/c_regex_traits.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,413 @@
+//////////////////////////////////////////////////////////////////////////////
+/// \file c_regex_traits.hpp
+/// Contains the definition of the c_regex_traits\<\> template, which is a
+/// wrapper for the C locale functions that can be used to customize the
+/// behavior of static and dynamic regexes.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_TRAITS_C_REGEX_TRAITS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_TRAITS_C_REGEX_TRAITS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <cstdlib>
+#include <boost/config.hpp>
+#include <boost/assert.hpp>
+#include <boost/xpressive/traits/detail/c_ctype.hpp>
+
+namespace boost { namespace xpressive
+{
+
+namespace detail
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // empty_locale
+ struct empty_locale
+ {
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // c_regex_traits_base
+ template<typename Char, std::size_t SizeOfChar = sizeof(Char)>
+ struct c_regex_traits_base
+ {
+ protected:
+ template<typename Traits>
+ void imbue(Traits const &tr)
+ {
+ }
+ };
+
+ template<typename Char>
+ struct c_regex_traits_base<Char, 1>
+ {
+ protected:
+ template<typename Traits>
+ static void imbue(Traits const &)
+ {
+ }
+ };
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ template<std::size_t SizeOfChar>
+ struct c_regex_traits_base<wchar_t, SizeOfChar>
+ {
+ protected:
+ template<typename Traits>
+ static void imbue(Traits const &)
+ {
+ }
+ };
+ #endif
+
+ template<typename Char>
+ Char c_tolower(Char);
+
+ template<typename Char>
+ Char c_toupper(Char);
+
+ template<>
+ inline char c_tolower(char ch)
+ {
+ using namespace std;
+ return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
+ }
+
+ template<>
+ inline char c_toupper(char ch)
+ {
+ using namespace std;
+ return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
+ }
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ template<>
+ inline wchar_t c_tolower(wchar_t ch)
+ {
+ using namespace std;
+ return towlower(ch);
+ }
+
+ template<>
+ inline wchar_t c_toupper(wchar_t ch)
+ {
+ using namespace std;
+ return towupper(ch);
+ }
+ #endif
+
+} // namespace detail
+
+///////////////////////////////////////////////////////////////////////////////
+// regex_traits_version_1_tag
+//
+struct regex_traits_version_1_tag;
+
+///////////////////////////////////////////////////////////////////////////////
+// c_regex_traits
+//
+/// \brief Encapsaulates the standard C locale functions for use by the
+/// basic_regex\<\> class template.
+template<typename Char>
+struct c_regex_traits
+ : detail::c_regex_traits_base<Char>
+{
+ typedef Char char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef detail::empty_locale locale_type;
+ typedef typename detail::char_class_impl<Char>::char_class_type char_class_type;
+ typedef regex_traits_version_2_tag version_tag;
+ typedef detail::c_regex_traits_base<Char> base_type;
+
+ /// Initialize a c_regex_traits object to use the global C locale.
+ ///
+ c_regex_traits(locale_type const &loc = locale_type())
+ : base_type()
+ {
+ this->imbue(loc);
+ }
+
+ /// Checks two c_regex_traits objects for equality
+ ///
+ /// \return true.
+ bool operator ==(c_regex_traits<char_type> const &) const
+ {
+ return true;
+ }
+
+ /// Checks two c_regex_traits objects for inequality
+ ///
+ /// \return false.
+ bool operator !=(c_regex_traits<char_type> const &) const
+ {
+ return false;
+ }
+
+ /// Convert a char to a Char
+ ///
+ /// \param ch The source character.
+ /// \return ch if Char is char, std::btowc(ch) if Char is wchar_t.
+ static char_type widen(char ch);
+
+ /// Returns a hash value for a Char in the range [0, UCHAR_MAX]
+ ///
+ /// \param ch The source character.
+ /// \return a value between 0 and UCHAR_MAX, inclusive.
+ static unsigned char hash(char_type ch)
+ {
+ return static_cast<unsigned char>(std::char_traits<Char>::to_int_type(ch));
+ }
+
+ /// No-op
+ ///
+ /// \param ch The source character.
+ /// \return ch
+ static char_type translate(char_type ch)
+ {
+ return ch;
+ }
+
+ /// Converts a character to lower-case using the current global C locale.
+ ///
+ /// \param ch The source character.
+ /// \return std::tolower(ch) if Char is char, std::towlower(ch) if Char is wchar_t.
+ static char_type translate_nocase(char_type ch)
+ {
+ return detail::c_tolower(ch);
+ }
+
+ /// Converts a character to lower-case using the current global C locale.
+ ///
+ /// \param ch The source character.
+ /// \return std::tolower(ch) if Char is char, std::towlower(ch) if Char is wchar_t.
+ static char_type tolower(char_type ch)
+ {
+ return detail::c_tolower(ch);
+ }
+
+ /// Converts a character to upper-case using the current global C locale.
+ ///
+ /// \param ch The source character.
+ /// \return std::toupper(ch) if Char is char, std::towupper(ch) if Char is wchar_t.
+ static char_type toupper(char_type ch)
+ {
+ return detail::c_toupper(ch);
+ }
+
+ /// Returns a string_type containing all the characters that compare equal
+ /// disregrarding case to the one passed in. This function can only be called
+ /// if has_fold_case<c_regex_traits<Char> >::value is true.
+ ///
+ /// \param ch The source character.
+ /// \return string_type containing all chars which are equal to ch when disregarding
+ /// case
+ //typedef array<char_type, 2> fold_case_type;
+ string_type fold_case(char_type ch) const
+ {
+ BOOST_MPL_ASSERT((is_same<char_type, char>));
+ char_type ntcs[] = {
+ detail::c_tolower(ch)
+ , detail::c_toupper(ch)
+ , 0
+ };
+ if(ntcs[1] == ntcs[0])
+ ntcs[1] = 0;
+ return string_type(ntcs);
+ }
+
+ /// Checks to see if a character is within a character range.
+ ///
+ /// \param first The bottom of the range, inclusive.
+ /// \param last The top of the range, inclusive.
+ /// \param ch The source character.
+ /// \return first <= ch && ch <= last.
+ static bool in_range(char_type first, char_type last, char_type ch)
+ {
+ return first <= ch && ch <= last;
+ }
+
+ /// Checks to see if a character is within a character range, irregardless of case.
+ ///
+ /// \param first The bottom of the range, inclusive.
+ /// \param last The top of the range, inclusive.
+ /// \param ch The source character.
+ /// \return in_range(first, last, ch) || in_range(first, last, tolower(ch)) || in_range(first,
+ /// last, toupper(ch))
+ /// \attention The default implementation doesn't do proper Unicode
+ /// case folding, but this is the best we can do with the standard
+ /// C locale functions.
+ static bool in_range_nocase(char_type first, char_type last, char_type ch)
+ {
+ return c_regex_traits::in_range(first, last, ch)
+ || c_regex_traits::in_range(first, last, detail::c_tolower(ch))
+ || c_regex_traits::in_range(first, last, detail::c_toupper(ch));
+ }
+
+ /// Returns a sort key for the character sequence designated by the iterator range [F1, F2)
+ /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2)
+ /// then v.transform(G1, G2) < v.transform(H1, H2).
+ ///
+ /// \attention Not used in xpressive 1.0
+ template<typename FwdIter>
+ static string_type transform(FwdIter begin, FwdIter end)
+ {
+ BOOST_ASSERT(false); // BUGBUG implement me
+ }
+
+ /// Returns a sort key for the character sequence designated by the iterator range [F1, F2)
+ /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2)
+ /// when character case is not considered then
+ /// v.transform_primary(G1, G2) < v.transform_primary(H1, H2).
+ ///
+ /// \attention Not used in xpressive 1.0
+ template<typename FwdIter>
+ static string_type transform_primary(FwdIter begin, FwdIter end)
+ {
+ BOOST_ASSERT(false); // BUGBUG implement me
+ }
+
+ /// Returns a sequence of characters that represents the collating element
+ /// consisting of the character sequence designated by the iterator range [F1, F2).
+ /// Returns an empty string if the character sequence is not a valid collating element.
+ ///
+ /// \attention Not used in xpressive 1.0
+ template<typename FwdIter>
+ static string_type lookup_collatename(FwdIter begin, FwdIter end)
+ {
+ BOOST_ASSERT(false); // BUGBUG implement me
+ }
+
+ /// For the character class name represented by the specified character sequence,
+ /// return the corresponding bitmask representation.
+ ///
+ /// \param begin A forward iterator to the start of the character sequence representing
+ /// the name of the character class.
+ /// \param end The end of the character sequence.
+ /// \param icase Specifies whether the returned bitmask should represent the case-insensitive
+ /// version of the character class.
+ /// \return A bitmask representing the character class.
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ return detail::char_class_impl<char_type>::lookup_classname(begin, end, icase);
+ }
+
+ /// Tests a character against a character class bitmask.
+ ///
+ /// \param ch The character to test.
+ /// \param mask The character class bitmask against which to test.
+ /// \pre mask is a bitmask returned by lookup_classname, or is several such masks bit-or'ed
+ /// together.
+ /// \return true if the character is a member of any of the specified character classes, false
+ /// otherwise.
+ static bool isctype(char_type ch, char_class_type mask)
+ {
+ return detail::char_class_impl<char_type>::isctype(ch, mask);
+ }
+
+ /// Convert a digit character into the integer it represents.
+ ///
+ /// \param ch The digit character.
+ /// \param radix The radix to use for the conversion.
+ /// \pre radix is one of 8, 10, or 16.
+ /// \return -1 if ch is not a digit character, the integer value of the character otherwise. If
+ /// char_type is char, std::strtol is used for the conversion. If char_type is wchar_t,
+ /// std::wcstol is used.
+ static int value(char_type ch, int radix);
+
+ /// No-op
+ ///
+ locale_type imbue(locale_type loc)
+ {
+ this->base_type::imbue(*this);
+ return loc;
+ }
+
+ /// No-op
+ ///
+ static locale_type getloc()
+ {
+ locale_type loc;
+ return loc;
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// c_regex_traits<>::widen specializations
+/// INTERNAL ONLY
+template<>
+inline char c_regex_traits<char>::widen(char ch)
+{
+ return ch;
+}
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+/// INTERNAL ONLY
+template<>
+inline wchar_t c_regex_traits<wchar_t>::widen(char ch)
+{
+ using namespace std;
+ return btowc(ch);
+}
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// c_regex_traits<>::hash specializations
+/// INTERNAL ONLY
+template<>
+inline unsigned char c_regex_traits<char>::hash(char ch)
+{
+ return static_cast<unsigned char>(ch);
+}
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+/// INTERNAL ONLY
+template<>
+inline unsigned char c_regex_traits<wchar_t>::hash(wchar_t ch)
+{
+ return static_cast<unsigned char>(ch);
+}
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// c_regex_traits<>::value specializations
+/// INTERNAL ONLY
+template<>
+inline int c_regex_traits<char>::value(char ch, int radix)
+{
+ using namespace std;
+ BOOST_ASSERT(8 == radix || 10 == radix || 16 == radix);
+ char begin[2] = { ch, '\0' }, *end = 0;
+ int val = strtol(begin, &end, radix);
+ return begin == end ? -1 : val;
+}
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+/// INTERNAL ONLY
+template<>
+inline int c_regex_traits<wchar_t>::value(wchar_t ch, int radix)
+{
+ using namespace std;
+ BOOST_ASSERT(8 == radix || 10 == radix || 16 == radix);
+ wchar_t begin[2] = { ch, L'\0' }, *end = 0;
+ int val = wcstol(begin, &end, radix);
+ return begin == end ? -1 : val;
+}
+#endif
+
+// Narrow C traits has fold_case() member function.
+template<>
+struct has_fold_case<c_regex_traits<char> >
+ : mpl::true_
+{
+};
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/cpp_regex_traits.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/cpp_regex_traits.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,694 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file cpp_regex_traits.hpp
+/// Contains the definition of the cpp_regex_traits\<\> template, which is a
+/// wrapper for std::locale that can be used to customize the behavior of
+/// static and dynamic regexes.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_TRAITS_CPP_REGEX_TRAITS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_TRAITS_CPP_REGEX_TRAITS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <ios>
+#include <string>
+#include <locale>
+#include <sstream>
+#include <boost/config.hpp>
+#include <boost/assert.hpp>
+#include <boost/integer.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/utility/literals.hpp>
+
+// From John Maddock:
+// Fix for gcc prior to 3.4: std::ctype<wchar_t> doesn't allow masks to be combined, for example:
+// std::use_facet<std::ctype<wchar_t> >(locale()).is(std::ctype_base::lower|std::ctype_base::upper, L'a');
+// incorrectly returns false.
+// NOTE: later version of the gcc define __GLIBCXX__, not __GLIBCPP__
+#if BOOST_WORKAROUND(__GLIBCPP__, != 0)
+# define BOOST_XPRESSIVE_BUGGY_CTYPE_FACET
+#endif
+
+namespace boost { namespace xpressive
+{
+
+namespace detail
+{
+ // define an unsigned integral typedef of the same size as std::ctype_base::mask
+ typedef boost::uint_t<sizeof(std::ctype_base::mask) * CHAR_BIT>::least umask_t;
+ BOOST_MPL_ASSERT_RELATION(sizeof(std::ctype_base::mask), ==, sizeof(umask_t));
+
+ // Calculate what the size of the umaskex_t type should be to fix the 3 extra bitmasks
+ // 11 char categories in ctype_base
+ // + 3 extra categories for xpressive
+ // = 14 total bits needed
+ int const umaskex_bits = (14 > (sizeof(umask_t) * CHAR_BIT)) ? 14 : sizeof(umask_t) * CHAR_BIT;
+
+ // define an unsigned integral type with at least umaskex_bits
+ typedef boost::uint_t<umaskex_bits>::fast umaskex_t;
+ BOOST_MPL_ASSERT_RELATION(sizeof(umask_t), <=, sizeof(umaskex_t));
+
+ // cast a ctype mask to a umaskex_t
+ template<std::ctype_base::mask Mask>
+ struct mask_cast
+ {
+ BOOST_STATIC_CONSTANT(umaskex_t, value = static_cast<umask_t>(Mask));
+ };
+
+ #ifdef __CYGWIN__
+ // Work around a gcc warning on cygwin
+ template<>
+ struct mask_cast<std::ctype_base::print>
+ {
+ BOOST_MPL_ASSERT_RELATION('\227', ==, std::ctype_base::print);
+ BOOST_STATIC_CONSTANT(umaskex_t, value = 0227);
+ };
+ #endif
+
+ #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+ template<std::ctype_base::mask Mask>
+ umaskex_t const mask_cast<Mask>::value;
+ #endif
+
+ #ifndef BOOST_XPRESSIVE_BUGGY_CTYPE_FACET
+ // an unsigned integer with the highest bit set
+ umaskex_t const highest_bit = 1 << (sizeof(umaskex_t) * CHAR_BIT - 1);
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // unused_mask
+ // find a bit in an int that isn't set
+ template<umaskex_t In, umaskex_t Out = highest_bit, bool Done = (0 == (Out & In))>
+ struct unused_mask
+ {
+ BOOST_MPL_ASSERT_RELATION(1, !=, Out);
+ BOOST_STATIC_CONSTANT(umaskex_t, value = (unused_mask<In, (Out >> 1)>::value));
+ };
+
+ template<umaskex_t In, umaskex_t Out>
+ struct unused_mask<In, Out, true>
+ {
+ BOOST_STATIC_CONSTANT(umaskex_t, value = Out);
+ };
+
+ #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+ template<umaskex_t In, umaskex_t Out, bool Done>
+ umaskex_t const unused_mask<In, Out, Done>::value;
+ #endif
+
+ umaskex_t const std_ctype_alnum = mask_cast<std::ctype_base::alnum>::value;
+ umaskex_t const std_ctype_alpha = mask_cast<std::ctype_base::alpha>::value;
+ umaskex_t const std_ctype_cntrl = mask_cast<std::ctype_base::cntrl>::value;
+ umaskex_t const std_ctype_digit = mask_cast<std::ctype_base::digit>::value;
+ umaskex_t const std_ctype_graph = mask_cast<std::ctype_base::graph>::value;
+ umaskex_t const std_ctype_lower = mask_cast<std::ctype_base::lower>::value;
+ umaskex_t const std_ctype_print = mask_cast<std::ctype_base::print>::value;
+ umaskex_t const std_ctype_punct = mask_cast<std::ctype_base::punct>::value;
+ umaskex_t const std_ctype_space = mask_cast<std::ctype_base::space>::value;
+ umaskex_t const std_ctype_upper = mask_cast<std::ctype_base::upper>::value;
+ umaskex_t const std_ctype_xdigit = mask_cast<std::ctype_base::xdigit>::value;
+
+ // Reserve some bits for the implementation
+ #if defined(__GLIBCXX__)
+ umaskex_t const std_ctype_reserved = 0x8000;
+ #elif defined(_CPPLIB_VER) && defined(BOOST_WINDOWS)
+ umaskex_t const std_ctype_reserved = 0x8200;
+ #else
+ umaskex_t const std_ctype_reserved = 0;
+ #endif
+
+ // Bitwise-or all the ctype masks together
+ umaskex_t const all_ctype_masks = std_ctype_reserved
+ | std_ctype_alnum | std_ctype_alpha | std_ctype_cntrl | std_ctype_digit
+ | std_ctype_graph | std_ctype_lower | std_ctype_print | std_ctype_punct
+ | std_ctype_space | std_ctype_upper | std_ctype_xdigit;
+
+ // define a new mask for "underscore" ("word" == alnum | underscore)
+ umaskex_t const non_std_ctype_underscore = unused_mask<all_ctype_masks>::value;
+
+ // define a new mask for "blank"
+ umaskex_t const non_std_ctype_blank = unused_mask<all_ctype_masks | non_std_ctype_underscore>::value;
+
+ // define a new mask for "newline"
+ umaskex_t const non_std_ctype_newline = unused_mask<all_ctype_masks | non_std_ctype_underscore | non_std_ctype_blank>::value;
+
+ #else
+ ///////////////////////////////////////////////////////////////////////////////
+ // Ugly work-around for buggy ctype facets.
+ umaskex_t const std_ctype_alnum = 1 << 0;
+ umaskex_t const std_ctype_alpha = 1 << 1;
+ umaskex_t const std_ctype_cntrl = 1 << 2;
+ umaskex_t const std_ctype_digit = 1 << 3;
+ umaskex_t const std_ctype_graph = 1 << 4;
+ umaskex_t const std_ctype_lower = 1 << 5;
+ umaskex_t const std_ctype_print = 1 << 6;
+ umaskex_t const std_ctype_punct = 1 << 7;
+ umaskex_t const std_ctype_space = 1 << 8;
+ umaskex_t const std_ctype_upper = 1 << 9;
+ umaskex_t const std_ctype_xdigit = 1 << 10;
+ umaskex_t const non_std_ctype_underscore = 1 << 11;
+ umaskex_t const non_std_ctype_blank = 1 << 12;
+ umaskex_t const non_std_ctype_newline = 1 << 13;
+
+ static umaskex_t const std_masks[] =
+ {
+ mask_cast<std::ctype_base::alnum>::value
+ , mask_cast<std::ctype_base::alpha>::value
+ , mask_cast<std::ctype_base::cntrl>::value
+ , mask_cast<std::ctype_base::digit>::value
+ , mask_cast<std::ctype_base::graph>::value
+ , mask_cast<std::ctype_base::lower>::value
+ , mask_cast<std::ctype_base::print>::value
+ , mask_cast<std::ctype_base::punct>::value
+ , mask_cast<std::ctype_base::space>::value
+ , mask_cast<std::ctype_base::upper>::value
+ , mask_cast<std::ctype_base::xdigit>::value
+ };
+
+ inline int mylog2(umaskex_t i)
+ {
+ return "\0\0\1\0\2\0\0\0\3"[i & 0xf]
+ + "\0\4\5\0\6\0\0\0\7"[(i & 0xf0) >> 04]
+ + "\0\10\11\0\12\0\0\0\13"[(i & 0xf00) >> 010];
+ }
+ #endif
+
+ // convenient constant for the extra masks
+ umaskex_t const non_std_ctype_masks = non_std_ctype_underscore | non_std_ctype_blank | non_std_ctype_newline;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // cpp_regex_traits_base
+ // BUGBUG this should be replaced with a regex facet that lets you query for
+ // an array of underscore characters and an array of line separator characters.
+ template<typename Char, std::size_t SizeOfChar = sizeof(Char)>
+ struct cpp_regex_traits_base
+ {
+ protected:
+ void imbue(std::locale const &)
+ {
+ }
+
+ static bool is(std::ctype<Char> const &ct, Char ch, umaskex_t mask)
+ {
+ #ifndef BOOST_XPRESSIVE_BUGGY_CTYPE_FACET
+
+ if(ct.is((std::ctype_base::mask)(umask_t)mask, ch))
+ {
+ return true;
+ }
+
+ #else
+
+ umaskex_t tmp = mask & ~non_std_ctype_masks;
+ for(umaskex_t i; 0 != (i = (tmp & (~tmp+1))); tmp &= ~i)
+ {
+ std::ctype_base::mask m = (std::ctype_base::mask)(umask_t)std_masks[mylog2(i)];
+ if(ct.is(m, ch))
+ {
+ return true;
+ }
+ }
+
+ #endif
+
+ return ((mask & non_std_ctype_blank) && cpp_regex_traits_base::is_blank(ch))
+ || ((mask & non_std_ctype_underscore) && cpp_regex_traits_base::is_underscore(ch))
+ || ((mask & non_std_ctype_newline) && cpp_regex_traits_base::is_newline(ch));
+ }
+
+ private:
+ static bool is_blank(Char ch)
+ {
+ BOOST_MPL_ASSERT_RELATION('\t', ==, L'\t');
+ BOOST_MPL_ASSERT_RELATION(' ', ==, L' ');
+ return L' ' == ch || L'\t' == ch;
+ }
+
+ static bool is_underscore(Char ch)
+ {
+ BOOST_MPL_ASSERT_RELATION('_', ==, L'_');
+ return L'_' == ch;
+ }
+
+ static bool is_newline(Char ch)
+ {
+ BOOST_MPL_ASSERT_RELATION('\r', ==, L'\r');
+ BOOST_MPL_ASSERT_RELATION('\n', ==, L'\n');
+ BOOST_MPL_ASSERT_RELATION('\f', ==, L'\f');
+ return L'\r' == ch || L'\n' == ch || L'\f' == ch
+ || (1 < SizeOfChar && (0x2028u == ch || 0x2029u == ch || 0x85u == ch));
+ }
+ };
+
+ #ifndef BOOST_XPRESSIVE_BUGGY_CTYPE_FACET
+
+ template<typename Char>
+ struct cpp_regex_traits_base<Char, 1>
+ {
+ protected:
+ void imbue(std::locale const &loc)
+ {
+ int i = 0;
+ Char allchars[UCHAR_MAX + 1];
+ for(i = 0; i <= UCHAR_MAX; ++i)
+ {
+ allchars[i] = static_cast<Char>(i);
+ }
+
+ std::ctype<Char> const &ct = BOOST_USE_FACET(std::ctype<Char>, loc);
+ std::ctype_base::mask tmp[UCHAR_MAX + 1];
+ ct.is(allchars, allchars + UCHAR_MAX + 1, tmp);
+ for(i = 0; i <= UCHAR_MAX; ++i)
+ {
+ this->masks_[i] = static_cast<umask_t>(tmp[i]);
+ BOOST_ASSERT(0 == (this->masks_[i] & non_std_ctype_masks));
+ }
+
+ this->masks_[static_cast<unsigned char>('_')] |= non_std_ctype_underscore;
+ this->masks_[static_cast<unsigned char>(' ')] |= non_std_ctype_blank;
+ this->masks_[static_cast<unsigned char>('\t')] |= non_std_ctype_blank;
+ this->masks_[static_cast<unsigned char>('\n')] |= non_std_ctype_newline;
+ this->masks_[static_cast<unsigned char>('\r')] |= non_std_ctype_newline;
+ this->masks_[static_cast<unsigned char>('\f')] |= non_std_ctype_newline;
+ }
+
+ bool is(std::ctype<Char> const &, Char ch, umaskex_t mask) const
+ {
+ return 0 != (this->masks_[static_cast<unsigned char>(ch)] & mask);
+ }
+
+ private:
+ umaskex_t masks_[UCHAR_MAX + 1];
+ };
+
+ #endif
+
+} // namespace detail
+
+
+///////////////////////////////////////////////////////////////////////////////
+// cpp_regex_traits
+//
+/// \brief Encapsaulates a std::locale for use by the
+/// basic_regex\<\> class template.
+template<typename Char>
+struct cpp_regex_traits
+ : detail::cpp_regex_traits_base<Char>
+{
+ typedef Char char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef std::locale locale_type;
+ typedef detail::umaskex_t char_class_type;
+ typedef regex_traits_version_2_tag version_tag;
+ typedef detail::cpp_regex_traits_base<Char> base_type;
+
+ /// Initialize a cpp_regex_traits object to use the specified std::locale,
+ /// or the global std::locale if none is specified.
+ ///
+ cpp_regex_traits(locale_type const &loc = locale_type())
+ : base_type()
+ , loc_()
+ {
+ this->imbue(loc);
+ }
+
+ /// Checks two cpp_regex_traits objects for equality
+ ///
+ /// \return this->getloc() == that.getloc().
+ bool operator ==(cpp_regex_traits<char_type> const &that) const
+ {
+ return this->loc_ == that.loc_;
+ }
+
+ /// Checks two cpp_regex_traits objects for inequality
+ ///
+ /// \return this->getloc() != that.getloc().
+ bool operator !=(cpp_regex_traits<char_type> const &that) const
+ {
+ return this->loc_ != that.loc_;
+ }
+
+ /// Convert a char to a Char
+ ///
+ /// \param ch The source character.
+ /// \return std::use_facet\<std::ctype\<char_type\> \>(this->getloc()).widen(ch).
+ char_type widen(char ch) const
+ {
+ return this->ctype_->widen(ch);
+ }
+
+ /// Returns a hash value for a Char in the range [0, UCHAR_MAX]
+ ///
+ /// \param ch The source character.
+ /// \return a value between 0 and UCHAR_MAX, inclusive.
+ static unsigned char hash(char_type ch)
+ {
+ return static_cast<unsigned char>(std::char_traits<Char>::to_int_type(ch));
+ }
+
+ /// No-op
+ ///
+ /// \param ch The source character.
+ /// \return ch
+ static char_type translate(char_type ch)
+ {
+ return ch;
+ }
+
+ /// Converts a character to lower-case using the internally-stored std::locale.
+ ///
+ /// \param ch The source character.
+ /// \return std::tolower(ch, this->getloc()).
+ char_type translate_nocase(char_type ch) const
+ {
+ return this->ctype_->tolower(ch);
+ }
+
+ /// Converts a character to lower-case using the internally-stored std::locale.
+ ///
+ /// \param ch The source character.
+ /// \return std::tolower(ch, this->getloc()).
+ char_type tolower(char_type ch) const
+ {
+ return this->ctype_->tolower(ch);
+ }
+
+ /// Converts a character to upper-case using the internally-stored std::locale.
+ ///
+ /// \param ch The source character.
+ /// \return std::toupper(ch, this->getloc()).
+ char_type toupper(char_type ch) const
+ {
+ return this->ctype_->toupper(ch);
+ }
+
+ /// Returns a string_type containing all the characters that compare equal
+ /// disregrarding case to the one passed in. This function can only be called
+ /// if has_fold_case\<cpp_regex_traits\<Char\> \>::value is true.
+ ///
+ /// \param ch The source character.
+ /// \return string_type containing all chars which are equal to ch when disregarding
+ /// case
+ string_type fold_case(char_type ch) const
+ {
+ BOOST_MPL_ASSERT((is_same<char_type, char>));
+ char_type ntcs[] = {
+ this->ctype_->tolower(ch)
+ , this->ctype_->toupper(ch)
+ , 0
+ };
+ if(ntcs[1] == ntcs[0])
+ ntcs[1] = 0;
+ return string_type(ntcs);
+ }
+
+ /// Checks to see if a character is within a character range.
+ ///
+ /// \param first The bottom of the range, inclusive.
+ /// \param last The top of the range, inclusive.
+ /// \param ch The source character.
+ /// \return first <= ch && ch <= last.
+ static bool in_range(char_type first, char_type last, char_type ch)
+ {
+ return first <= ch && ch <= last;
+ }
+
+ /// Checks to see if a character is within a character range, irregardless of case.
+ ///
+ /// \param first The bottom of the range, inclusive.
+ /// \param last The top of the range, inclusive.
+ /// \param ch The source character.
+ /// \return in_range(first, last, ch) || in_range(first, last, tolower(ch, this->getloc())) ||
+ /// in_range(first, last, toupper(ch, this->getloc()))
+ /// \attention The default implementation doesn't do proper Unicode
+ /// case folding, but this is the best we can do with the standard
+ /// ctype facet.
+ bool in_range_nocase(char_type first, char_type last, char_type ch) const
+ {
+ // NOTE: this default implementation doesn't do proper Unicode
+ // case folding, but this is the best we can do with the standard
+ // std::ctype facet.
+ return this->in_range(first, last, ch)
+ || this->in_range(first, last, this->ctype_->toupper(ch))
+ || this->in_range(first, last, this->ctype_->tolower(ch));
+ }
+
+ /// INTERNAL ONLY
+ //string_type transform(char_type const *begin, char_type const *end) const
+ //{
+ // return this->collate_->transform(begin, end);
+ //}
+
+ /// Returns a sort key for the character sequence designated by the iterator range [F1, F2)
+ /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2)
+ /// then v.transform(G1, G2) \< v.transform(H1, H2).
+ ///
+ /// \attention Not used in xpressive 1.0
+ template<typename FwdIter>
+ string_type transform(FwdIter begin, FwdIter end) const
+ {
+ //string_type str(begin, end);
+ //return this->transform(str.data(), str.data() + str.size());
+
+ BOOST_ASSERT(false);
+ return string_type();
+ }
+
+ /// Returns a sort key for the character sequence designated by the iterator range [F1, F2)
+ /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2)
+ /// when character case is not considered then
+ /// v.transform_primary(G1, G2) \< v.transform_primary(H1, H2).
+ ///
+ /// \attention Not used in xpressive 1.0
+ template<typename FwdIter>
+ string_type transform_primary(FwdIter begin, FwdIter end) const
+ {
+ BOOST_ASSERT(false); // TODO implement me
+ return string_type();
+ }
+
+ /// Returns a sequence of characters that represents the collating element
+ /// consisting of the character sequence designated by the iterator range [F1, F2).
+ /// Returns an empty string if the character sequence is not a valid collating element.
+ ///
+ /// \attention Not used in xpressive 1.0
+ template<typename FwdIter>
+ string_type lookup_collatename(FwdIter begin, FwdIter end) const
+ {
+ BOOST_ASSERT(false); // TODO implement me
+ return string_type();
+ }
+
+ /// For the character class name represented by the specified character sequence,
+ /// return the corresponding bitmask representation.
+ ///
+ /// \param begin A forward iterator to the start of the character sequence representing
+ /// the name of the character class.
+ /// \param end The end of the character sequence.
+ /// \param icase Specifies whether the returned bitmask should represent the case-insensitive
+ /// version of the character class.
+ /// \return A bitmask representing the character class.
+ template<typename FwdIter>
+ char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase) const
+ {
+ static detail::umaskex_t const icase_masks =
+ detail::std_ctype_lower | detail::std_ctype_upper;
+
+ BOOST_ASSERT(begin != end);
+ char_class_type char_class = this->lookup_classname_impl_(begin, end);
+ if(0 == char_class)
+ {
+ // convert the string to lowercase
+ string_type classname(begin, end);
+ for(typename string_type::size_type i = 0, len = classname.size(); i < len; ++i)
+ {
+ classname[i] = this->translate_nocase(classname[i]);
+ }
+ char_class = this->lookup_classname_impl_(classname.begin(), classname.end());
+ }
+ // erase case-sensitivity if icase==true
+ if(icase && 0 != (char_class & icase_masks))
+ {
+ char_class |= icase_masks;
+ }
+ return char_class;
+ }
+
+ /// Tests a character against a character class bitmask.
+ ///
+ /// \param ch The character to test.
+ /// \param mask The character class bitmask against which to test.
+ /// \pre mask is a bitmask returned by lookup_classname, or is several such masks bit-or'ed
+ /// together.
+ /// \return true if the character is a member of any of the specified character classes, false
+ /// otherwise.
+ bool isctype(char_type ch, char_class_type mask) const
+ {
+ return this->base_type::is(*this->ctype_, ch, mask);
+ }
+
+ /// Convert a digit character into the integer it represents.
+ ///
+ /// \param ch The digit character.
+ /// \param radix The radix to use for the conversion.
+ /// \pre radix is one of 8, 10, or 16.
+ /// \return -1 if ch is not a digit character, the integer value of the character otherwise.
+ /// The conversion is performed by imbueing a std::stringstream with this-\>getloc();
+ /// setting the radix to one of oct, hex or dec; inserting ch into the stream; and
+ /// extracting an int.
+ int value(char_type ch, int radix) const
+ {
+ BOOST_ASSERT(8 == radix || 10 == radix || 16 == radix);
+ int val = -1;
+ std::basic_stringstream<char_type> str;
+ str.imbue(this->getloc());
+ str << (8 == radix ? std::oct : (16 == radix ? std::hex : std::dec));
+ str.put(ch);
+ str >> val;
+ return str.fail() ? -1 : val;
+ }
+
+ /// Imbues *this with loc
+ ///
+ /// \param loc A std::locale.
+ /// \return the previous std::locale used by *this.
+ locale_type imbue(locale_type loc)
+ {
+ locale_type old_loc = this->loc_;
+ this->loc_ = loc;
+ this->ctype_ = &BOOST_USE_FACET(std::ctype<char_type>, this->loc_);
+ //this->collate_ = &BOOST_USE_FACET(std::collate<char_type>, this->loc_);
+ this->base_type::imbue(this->loc_);
+ return old_loc;
+ }
+
+ /// Returns the current std::locale used by *this.
+ ///
+ locale_type getloc() const
+ {
+ return this->loc_;
+ }
+
+private:
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // char_class_pair
+ /// INTERNAL ONLY
+ struct char_class_pair
+ {
+ char_type const *class_name_;
+ char_class_type class_type_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // char_class
+ /// INTERNAL ONLY
+ static char_class_pair const &char_class(std::size_t j)
+ {
+ static char_class_pair const s_char_class_map[] =
+ {
+ { BOOST_XPR_CSTR_(char_type, "alnum"), detail::std_ctype_alnum }
+ , { BOOST_XPR_CSTR_(char_type, "alpha"), detail::std_ctype_alpha }
+ , { BOOST_XPR_CSTR_(char_type, "blank"), detail::non_std_ctype_blank }
+ , { BOOST_XPR_CSTR_(char_type, "cntrl"), detail::std_ctype_cntrl }
+ , { BOOST_XPR_CSTR_(char_type, "d"), detail::std_ctype_digit }
+ , { BOOST_XPR_CSTR_(char_type, "digit"), detail::std_ctype_digit }
+ , { BOOST_XPR_CSTR_(char_type, "graph"), detail::std_ctype_graph }
+ , { BOOST_XPR_CSTR_(char_type, "lower"), detail::std_ctype_lower }
+ , { BOOST_XPR_CSTR_(char_type, "newline"),detail::non_std_ctype_newline }
+ , { BOOST_XPR_CSTR_(char_type, "print"), detail::std_ctype_print }
+ , { BOOST_XPR_CSTR_(char_type, "punct"), detail::std_ctype_punct }
+ , { BOOST_XPR_CSTR_(char_type, "s"), detail::std_ctype_space }
+ , { BOOST_XPR_CSTR_(char_type, "space"), detail::std_ctype_space }
+ , { BOOST_XPR_CSTR_(char_type, "upper"), detail::std_ctype_upper }
+ , { BOOST_XPR_CSTR_(char_type, "w"), detail::std_ctype_alnum | detail::non_std_ctype_underscore }
+ , { BOOST_XPR_CSTR_(char_type, "xdigit"), detail::std_ctype_xdigit }
+ , { 0, 0 }
+ };
+ return s_char_class_map[j];
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // lookup_classname_impl
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ static char_class_type lookup_classname_impl_(FwdIter begin, FwdIter end)
+ {
+ // find the classname
+ typedef cpp_regex_traits<Char> this_t;
+ for(std::size_t j = 0; 0 != this_t::char_class(j).class_name_; ++j)
+ {
+ if(this_t::compare_(this_t::char_class(j).class_name_, begin, end))
+ {
+ return this_t::char_class(j).class_type_;
+ }
+ }
+ return 0;
+ }
+
+ /// INTERNAL ONLY
+ template<typename FwdIter>
+ static bool compare_(char_type const *name, FwdIter begin, FwdIter end)
+ {
+ for(; *name && begin != end; ++name, ++begin)
+ {
+ if(*name != *begin)
+ {
+ return false;
+ }
+ }
+ return !*name && begin == end;
+ }
+
+ locale_type loc_;
+ std::ctype<char_type> const *ctype_;
+ //std::collate<char_type> const *collate_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// cpp_regex_traits<>::hash specializations
+template<>
+inline unsigned char cpp_regex_traits<unsigned char>::hash(unsigned char ch)
+{
+ return ch;
+}
+
+template<>
+inline unsigned char cpp_regex_traits<char>::hash(char ch)
+{
+ return static_cast<unsigned char>(ch);
+}
+
+template<>
+inline unsigned char cpp_regex_traits<signed char>::hash(signed char ch)
+{
+ return static_cast<unsigned char>(ch);
+}
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+template<>
+inline unsigned char cpp_regex_traits<wchar_t>::hash(wchar_t ch)
+{
+ return static_cast<unsigned char>(ch);
+}
+#endif
+
+// Narrow C++ traits has fold_case() member function.
+template<>
+struct has_fold_case<cpp_regex_traits<char> >
+ : mpl::true_
+{
+};
+
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/detail/c_ctype.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/detail/c_ctype.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,841 @@
+///////////////////////////////////////////////////////////////////////////////
+// c_ctype.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_TRAITS_DETAIL_C_CTYPE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_TRAITS_DETAIL_C_CTYPE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <cctype>
+#include <cstring>
+#include <boost/mpl/assert.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+# include <cwchar>
+# include <cwctype>
+#endif
+
+namespace boost { namespace xpressive { namespace detail
+{
+
+///////////////////////////////////////////////////////////////////////////////
+// isnewline
+//
+inline bool isnewline(char ch)
+{
+ switch(ch)
+ {
+ case L'\n': case L'\r': case L'\f':
+ return true;
+ default:
+ return false;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// iswnewline
+//
+inline bool iswnewline(wchar_t ch)
+{
+ switch(ch)
+ {
+ case L'\n': case L'\r': case L'\f': case 0x2028u: case 0x2029u: case 0x85u:
+ return true;
+ default:
+ return false;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// classname_a
+//
+template<typename FwdIter>
+inline std::string classname_a(FwdIter begin, FwdIter end)
+{
+ std::string name(begin, end);
+ for(std::size_t i = 0; i < name.size(); ++i)
+ {
+ using namespace std;
+ name[i] = static_cast<char>(tolower(static_cast<unsigned char>(name[i])));
+ }
+ return name;
+}
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+///////////////////////////////////////////////////////////////////////////////
+// classname_w
+//
+template<typename FwdIter>
+inline std::wstring classname_w(FwdIter begin, FwdIter end)
+{
+ std::wstring name(begin, end);
+ for(std::size_t i = 0; i < name.size(); ++i)
+ {
+ using namespace std;
+ name[i] = towlower(name[i]);
+ }
+ return name;
+}
+#endif
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// char_class_impl
+//
+template<typename Char>
+struct char_class_impl;
+
+
+#if defined(__QNXNTO__)
+
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<char>
+{
+ typedef short char_class_type;
+ BOOST_MPL_ASSERT_RELATION(0x07FF, ==, (_XB|_XA|_XS|_BB|_CN|_DI|_LO|_PU|_SP|_UP|_XD));
+ BOOST_STATIC_CONSTANT(short, char_class_underscore = 0x1000);
+ BOOST_STATIC_CONSTANT(short, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ string const name = classname_a(begin, end);
+ if(name == "alnum") return _DI|_LO|_UP|_XA;
+ if(name == "alpha") return _LO|_UP|_XA;
+ if(name == "blank") return _SP|_XB;
+ if(name == "cntrl") return _BB;
+ if(name == "d") return _DI;
+ if(name == "digit") return _DI;
+ if(name == "graph") return _DI|_LO|_PU|_UP|_XA;
+ if(name == "lower") return icase ? (_LO|_UP) : _LO;
+ if(name == "newline") return char_class_newline;
+ if(name == "print") return _DI|_LO|_PU|_SP|_UP|_XA;
+ if(name == "punct") return _PU;
+ if(name == "s") return _CN|_SP|_XS;
+ if(name == "space") return _CN|_SP|_XS;
+ if(name == "upper") return icase ? (_UP|_LO) : _UP;
+ if(name == "w") return _DI|_LO|_UP|_XA|char_class_underscore;
+ if(name == "xdigit") return _XD;
+ return 0;
+ }
+
+ static bool isctype(char ch, char_class_type mask)
+ {
+ using namespace std;
+ if(0 != (_Getchrtype((unsigned char)ch) & mask))
+ {
+ return true;
+ }
+
+ switch(ch)
+ {
+ case '_': return 0 != (mask & char_class_underscore);
+ case '\n': case '\r': case '\f': return 0 != (mask & char_class_newline);
+ default:;
+ }
+
+ return false;
+ }
+};
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<wchar_t>
+{
+ typedef int char_class_type;
+ //BOOST_STATIC_CONSTANT(int, char_class_alnum = 0x0001);
+ BOOST_STATIC_CONSTANT(int, char_class_alpha = 0x0002);
+ BOOST_STATIC_CONSTANT(int, char_class_blank = 0x0004);
+ BOOST_STATIC_CONSTANT(int, char_class_cntrl = 0x0008);
+ BOOST_STATIC_CONSTANT(int, char_class_digit = 0x0010);
+ //BOOST_STATIC_CONSTANT(int, char_class_graph = 0x0020);
+ BOOST_STATIC_CONSTANT(int, char_class_lower = 0x0040);
+ //BOOST_STATIC_CONSTANT(int, char_class_print = 0x0080);
+ BOOST_STATIC_CONSTANT(int, char_class_punct = 0x0100);
+ BOOST_STATIC_CONSTANT(int, char_class_space = 0x0200);
+ BOOST_STATIC_CONSTANT(int, char_class_upper = 0x0400);
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x0800);
+ BOOST_STATIC_CONSTANT(int, char_class_xdigit = 0x1000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ wstring const name = classname_w(begin, end);
+ if(name == L"alnum") return char_class_alpha|char_class_digit;
+ if(name == L"alpha") return char_class_alpha;
+ if(name == L"blank") return char_class_blank;
+ if(name == L"cntrl") return char_class_cntrl;
+ if(name == L"d") return char_class_digit;
+ if(name == L"digit") return char_class_digit;
+ if(name == L"graph") return char_class_punct|char_class_alpha|char_class_digit;
+ if(name == L"lower") return icase ? (char_class_lower|char_class_upper) : char_class_lower;
+ if(name == L"newline") return char_class_newline;
+ if(name == L"print") return char_class_blank|char_class_punct|char_class_alpha|char_class_digit;
+ if(name == L"punct") return char_class_punct;
+ if(name == L"s") return char_class_space;
+ if(name == L"space") return char_class_space;
+ if(name == L"upper") return icase ? (char_class_upper|char_class_lower) : char_class_upper;
+ if(name == L"w") return char_class_alpha|char_class_digit|char_class_underscore;
+ if(name == L"xdigit") return char_class_xdigit;
+ return 0;
+ }
+
+ static bool isctype(wchar_t ch, char_class_type mask)
+ {
+ using namespace std;
+ return ((char_class_alpha & mask) && iswalpha(ch))
+ || ((char_class_blank & mask) && (L' ' == ch || L'\t' == ch)) // BUGBUG
+ || ((char_class_cntrl & mask) && iswcntrl(ch))
+ || ((char_class_digit & mask) && iswdigit(ch))
+ || ((char_class_lower & mask) && iswlower(ch))
+ || ((char_class_newline & mask) && detail::iswnewline(ch))
+ || ((char_class_punct & mask) && iswpunct(ch))
+ || ((char_class_space & mask) && iswspace(ch))
+ || ((char_class_upper & mask) && iswupper(ch))
+ || ((char_class_underscore & mask) && L'_' == ch)
+ || ((char_class_xdigit & mask) && iswxdigit(ch))
+ ;
+ }
+};
+#endif
+
+
+#elif defined(__MINGW32_VERSION)
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<char>
+{
+ typedef int char_class_type;
+ BOOST_MPL_ASSERT_RELATION(0x81FF, ==, (_ALPHA|_UPPER|_LOWER|_DIGIT|_SPACE|_PUNCT|_CONTROL|_BLANK|_HEX|_LEADBYTE));
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x1000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ string const name = classname_a(begin, end);
+ if(name == "alnum") return _ALPHA|_DIGIT;
+ if(name == "alpha") return _ALPHA;
+ if(name == "blank") return _BLANK; // this is ONLY space!!!
+ if(name == "cntrl") return _CONTROL;
+ if(name == "d") return _DIGIT;
+ if(name == "digit") return _DIGIT;
+ if(name == "graph") return _PUNCT|_ALPHA|_DIGIT;
+ if(name == "lower") return icase ? (_LOWER|_UPPER) : _LOWER;
+ if(name == "newline") return char_class_newline;
+ if(name == "print") return _BLANK|_PUNCT|_ALPHA|_DIGIT;
+ if(name == "punct") return _PUNCT;
+ if(name == "s") return _SPACE;
+ if(name == "space") return _SPACE;
+ if(name == "upper") return icase ? (_UPPER|_LOWER) : _UPPER;
+ if(name == "w") return _ALPHA|_DIGIT|char_class_underscore;
+ if(name == "xdigit") return _HEX;
+ return 0;
+ }
+
+ static bool isctype(char ch, char_class_type mask)
+ {
+ using namespace std;
+ if(0 != _isctype(static_cast<unsigned char>(ch), mask))
+ {
+ return true;
+ }
+
+ switch(ch)
+ {
+ case '\t': return 0 != (mask & _BLANK);
+ case '_': return 0 != (mask & char_class_underscore);
+ case '\n': case '\r': case '\f': return 0 != (mask & char_class_newline);
+ default:;
+ }
+
+ return false;
+ }
+};
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<wchar_t>
+{
+ typedef wctype_t char_class_type;
+ BOOST_MPL_ASSERT_RELATION(0x81FF, ==, (_ALPHA|_UPPER|_LOWER|_DIGIT|_SPACE|_PUNCT|_CONTROL|_BLANK|_HEX|_LEADBYTE));
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x1000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ wstring const name = classname_w(begin, end);
+ if(name == L"alnum") return _ALPHA|_DIGIT;
+ if(name == L"alpha") return _ALPHA;
+ if(name == L"blank") return _BLANK; // this is ONLY space!!!
+ if(name == L"cntrl") return _CONTROL;
+ if(name == L"d") return _DIGIT;
+ if(name == L"digit") return _DIGIT;
+ if(name == L"graph") return _PUNCT|_ALPHA|_DIGIT;
+ if(name == L"lower") return icase ? (_LOWER|_UPPER) : _LOWER;
+ if(name == L"newline") return char_class_newline;
+ if(name == L"print") return _BLANK|_PUNCT|_ALPHA|_DIGIT;
+ if(name == L"punct") return _PUNCT;
+ if(name == L"s") return _SPACE;
+ if(name == L"space") return _SPACE;
+ if(name == L"upper") return icase ? (_UPPER|_LOWER) : _UPPER;
+ if(name == L"w") return _ALPHA|_DIGIT|char_class_underscore;
+ if(name == L"xdigit") return _HEX;
+ return 0;
+ }
+
+ static bool isctype(wchar_t ch, char_class_type mask)
+ {
+ using namespace std;
+ if(0 != iswctype(ch, mask))
+ {
+ return true;
+ }
+
+ switch(ch)
+ {
+ case L'\t': return 0 != (mask & _BLANK);
+ case L'_': return 0 != (mask & char_class_underscore);
+ case L'\n': case L'\r': case L'\f': case 0x2028u: case 0x2029u: case 0x85u:
+ return 0 != (mask & char_class_newline);
+ default:;
+ }
+
+ return false;
+ }
+};
+#endif
+
+
+#elif defined(__CYGWIN__)
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<char>
+{
+ typedef int char_class_type;
+ BOOST_MPL_ASSERT_RELATION(0377, ==, (_U|_L|_N|_S|_P|_C|_B|_X));
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0400);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 01000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ string const name = classname_a(begin, end);
+ if(name == "alnum") return _U|_L|_N;
+ if(name == "alpha") return _U|_L;
+ if(name == "blank") return _B; // BUGBUG what is this?
+ if(name == "cntrl") return _C;
+ if(name == "d") return _N;
+ if(name == "digit") return _N;
+ if(name == "graph") return _P|_U|_L|_N;
+ if(name == "lower") return icase ? (_L|_U) : _L;
+ if(name == "newline") return char_class_newline;
+ if(name == "print") return _B|_P|_U|_L|_N;
+ if(name == "punct") return _P;
+ if(name == "s") return _S;
+ if(name == "space") return _S;
+ if(name == "upper") return icase ? (_U|_L) : _U;
+ if(name == "w") return _U|_L|_N|char_class_underscore;
+ if(name == "xdigit") return _X;
+ return 0;
+ }
+
+ static bool isctype(char ch, char_class_type mask)
+ {
+ if(0 != static_cast<unsigned char>(((_ctype_+1)[(unsigned)(ch)]) & mask))
+ {
+ return true;
+ }
+
+ switch(ch)
+ {
+ case '_': return 0 != (mask & char_class_underscore);
+ case '\n': case '\r': case '\f': return 0 != (mask & char_class_newline);
+ default:;
+ }
+
+ return false;
+ }
+};
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<wchar_t>
+{
+ typedef int char_class_type;
+ //BOOST_STATIC_CONSTANT(int, char_class_alnum = 0x0001);
+ BOOST_STATIC_CONSTANT(int, char_class_alpha = 0x0002);
+ BOOST_STATIC_CONSTANT(int, char_class_blank = 0x0004);
+ BOOST_STATIC_CONSTANT(int, char_class_cntrl = 0x0008);
+ BOOST_STATIC_CONSTANT(int, char_class_digit = 0x0010);
+ //BOOST_STATIC_CONSTANT(int, char_class_graph = 0x0020);
+ BOOST_STATIC_CONSTANT(int, char_class_lower = 0x0040);
+ //BOOST_STATIC_CONSTANT(int, char_class_print = 0x0080);
+ BOOST_STATIC_CONSTANT(int, char_class_punct = 0x0100);
+ BOOST_STATIC_CONSTANT(int, char_class_space = 0x0200);
+ BOOST_STATIC_CONSTANT(int, char_class_upper = 0x0400);
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x0800);
+ BOOST_STATIC_CONSTANT(int, char_class_xdigit = 0x1000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ wstring const name = classname_w(begin, end);
+ if(name == L"alnum") return char_class_alpha|char_class_digit;
+ if(name == L"alpha") return char_class_alpha;
+ if(name == L"blank") return char_class_blank;
+ if(name == L"cntrl") return char_class_cntrl;
+ if(name == L"d") return char_class_digit;
+ if(name == L"digit") return char_class_digit;
+ if(name == L"graph") return char_class_punct|char_class_alpha|char_class_digit;
+ if(name == L"lower") return icase ? (char_class_lower|char_class_upper) : char_class_lower;
+ if(name == L"newline") return char_class_newline;
+ if(name == L"print") return char_class_blank|char_class_punct|char_class_alpha|char_class_digit;
+ if(name == L"punct") return char_class_punct;
+ if(name == L"s") return char_class_space;
+ if(name == L"space") return char_class_space;
+ if(name == L"upper") return icase ? (char_class_upper|char_class_lower) : char_class_upper;
+ if(name == L"w") return char_class_alpha|char_class_digit|char_class_underscore;
+ if(name == L"xdigit") return char_class_xdigit;
+ return 0;
+ }
+
+ static bool isctype(wchar_t ch, char_class_type mask)
+ {
+ using namespace std;
+ return ((char_class_alpha & mask) && iswalpha(ch))
+ || ((char_class_blank & mask) && (L' ' == ch || L'\t' == ch)) // BUGBUG
+ || ((char_class_cntrl & mask) && iswcntrl(ch))
+ || ((char_class_digit & mask) && iswdigit(ch))
+ || ((char_class_lower & mask) && iswlower(ch))
+ || ((char_class_newline & mask) && detail::iswnewline(ch))
+ || ((char_class_punct & mask) && iswpunct(ch))
+ || ((char_class_space & mask) && iswspace(ch))
+ || ((char_class_upper & mask) && iswupper(ch))
+ || ((char_class_underscore & mask) && L'_' == ch)
+ || ((char_class_xdigit & mask) && iswxdigit(ch))
+ ;
+ }
+};
+#endif
+
+
+
+#elif defined(__GLIBC__)
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<char>
+{
+ typedef int char_class_type;
+ BOOST_MPL_ASSERT_RELATION(0xffff, ==, (_ISalnum|_ISalpha|_ISblank|_IScntrl|_ISdigit|_ISgraph|
+ _ISlower|_ISprint|_ISpunct|_ISspace|_ISupper|_ISxdigit|0xffff));
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x00010000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x00020000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ string const name = classname_a(begin, end);
+ if(name == "alnum") return _ISalnum;
+ if(name == "alpha") return _ISalpha;
+ if(name == "blank") return _ISblank;
+ if(name == "cntrl") return _IScntrl;
+ if(name == "d") return _ISdigit;
+ if(name == "digit") return _ISdigit;
+ if(name == "graph") return _ISgraph;
+ if(name == "lower") return icase ? (_ISlower|_ISupper) : _ISlower;
+ if(name == "print") return _ISprint;
+ if(name == "newline") return char_class_newline;
+ if(name == "punct") return _ISpunct;
+ if(name == "s") return _ISspace;
+ if(name == "space") return _ISspace;
+ if(name == "upper") return icase ? (_ISupper|_ISlower) : _ISupper;
+ if(name == "w") return _ISalnum|char_class_underscore;
+ if(name == "xdigit") return _ISxdigit;
+ return 0;
+ }
+
+ static bool isctype(char ch, char_class_type mask)
+ {
+ using namespace std;
+ if(0 != __isctype(static_cast<unsigned char>(ch), mask))
+ {
+ return true;
+ }
+
+ switch(ch)
+ {
+ case '_': return 0 != (mask & char_class_underscore);
+ case '\n': case '\r': case '\f': return 0 != (mask & char_class_newline);
+ default:;
+ }
+
+ return false;
+ }
+};
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<wchar_t>
+{
+ typedef int char_class_type;
+ //BOOST_STATIC_CONSTANT(int, char_class_alnum = 0x0001);
+ BOOST_STATIC_CONSTANT(int, char_class_alpha = 0x0002);
+ BOOST_STATIC_CONSTANT(int, char_class_blank = 0x0004);
+ BOOST_STATIC_CONSTANT(int, char_class_cntrl = 0x0008);
+ BOOST_STATIC_CONSTANT(int, char_class_digit = 0x0010);
+ //BOOST_STATIC_CONSTANT(int, char_class_graph = 0x0020);
+ BOOST_STATIC_CONSTANT(int, char_class_lower = 0x0040);
+ //BOOST_STATIC_CONSTANT(int, char_class_print = 0x0080);
+ BOOST_STATIC_CONSTANT(int, char_class_punct = 0x0100);
+ BOOST_STATIC_CONSTANT(int, char_class_space = 0x0200);
+ BOOST_STATIC_CONSTANT(int, char_class_upper = 0x0400);
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x0800);
+ BOOST_STATIC_CONSTANT(int, char_class_xdigit = 0x1000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ wstring const name = classname_w(begin, end);
+ if(name == L"alnum") return char_class_alpha|char_class_digit;
+ if(name == L"alpha") return char_class_alpha;
+ if(name == L"blank") return char_class_blank;
+ if(name == L"cntrl") return char_class_cntrl;
+ if(name == L"d") return char_class_digit;
+ if(name == L"digit") return char_class_digit;
+ if(name == L"graph") return char_class_punct|char_class_alpha|char_class_digit;
+ if(name == L"lower") return icase ? (char_class_lower|char_class_upper) : char_class_lower;
+ if(name == L"newline") return char_class_newline;
+ if(name == L"print") return char_class_blank|char_class_punct|char_class_alpha|char_class_digit;
+ if(name == L"punct") return char_class_punct;
+ if(name == L"s") return char_class_space;
+ if(name == L"space") return char_class_space;
+ if(name == L"upper") return icase ? (char_class_upper|char_class_lower) : char_class_upper;
+ if(name == L"w") return char_class_alpha|char_class_digit|char_class_underscore;
+ if(name == L"xdigit") return char_class_xdigit;
+ return 0;
+ }
+
+ static bool isctype(wchar_t ch, char_class_type mask)
+ {
+ using namespace std;
+ return ((char_class_alpha & mask) && iswalpha(ch))
+ || ((char_class_blank & mask) && (L' ' == ch || L'\t' == ch)) // BUGBUG
+ || ((char_class_cntrl & mask) && iswcntrl(ch))
+ || ((char_class_digit & mask) && iswdigit(ch))
+ || ((char_class_lower & mask) && iswlower(ch))
+ || ((char_class_newline & mask) && detail::iswnewline(ch))
+ || ((char_class_punct & mask) && iswpunct(ch))
+ || ((char_class_space & mask) && iswspace(ch))
+ || ((char_class_upper & mask) && iswupper(ch))
+ || ((char_class_underscore & mask) && L'_' == ch)
+ || ((char_class_xdigit & mask) && iswxdigit(ch))
+ ;
+ }
+};
+#endif
+
+
+
+#elif defined(_CPPLIB_VER) // Dinkumware STL
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<char>
+{
+ typedef int char_class_type;
+ BOOST_MPL_ASSERT_RELATION(0x81FF, ==, (_ALPHA|_UPPER|_LOWER|_DIGIT|_SPACE|_PUNCT|_CONTROL|_BLANK|_HEX|_LEADBYTE));
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x1000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ string const name = classname_a(begin, end);
+ if(name == "alnum") return _ALPHA|_DIGIT;
+ if(name == "alpha") return _ALPHA;
+ if(name == "blank") return _BLANK; // this is ONLY space!!!
+ if(name == "cntrl") return _CONTROL;
+ if(name == "d") return _DIGIT;
+ if(name == "digit") return _DIGIT;
+ if(name == "graph") return _PUNCT|_ALPHA|_DIGIT;
+ if(name == "lower") return icase ? (_LOWER|_UPPER) : _LOWER;
+ if(name == "newline") return char_class_newline;
+ if(name == "print") return _BLANK|_PUNCT|_ALPHA|_DIGIT;
+ if(name == "punct") return _PUNCT;
+ if(name == "s") return _SPACE;
+ if(name == "space") return _SPACE;
+ if(name == "upper") return icase ? (_UPPER|_LOWER) : _UPPER;
+ if(name == "w") return _ALPHA|_DIGIT|char_class_underscore;
+ if(name == "xdigit") return _HEX;
+ return 0;
+ }
+
+ static bool isctype(char ch, char_class_type mask)
+ {
+ using namespace std;
+ if(0 != _isctype(static_cast<unsigned char>(ch), mask))
+ {
+ return true;
+ }
+
+ switch(ch)
+ {
+ case '\t': return 0 != (mask & _BLANK);
+ case '_': return 0 != (mask & char_class_underscore);
+ case '\n': case '\r': case '\f': return 0 != (mask & char_class_newline);
+ default:;
+ }
+
+ return false;
+ }
+};
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<wchar_t>
+{
+ typedef wctype_t char_class_type;
+ BOOST_MPL_ASSERT_RELATION(0x81FF, ==, (_ALPHA|_UPPER|_LOWER|_DIGIT|_SPACE|_PUNCT|_CONTROL|_BLANK|_HEX|_LEADBYTE));
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x1000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ wstring const name = classname_w(begin, end);
+ if(name == L"alnum") return _ALPHA|_DIGIT;
+ if(name == L"alpha") return _ALPHA;
+ if(name == L"blank") return _BLANK; // this is ONLY space!!!
+ if(name == L"cntrl") return _CONTROL;
+ if(name == L"d") return _DIGIT;
+ if(name == L"digit") return _DIGIT;
+ if(name == L"graph") return _PUNCT|_ALPHA|_DIGIT;
+ if(name == L"lower") return icase ? _LOWER|_UPPER : _LOWER;
+ if(name == L"newline") return char_class_newline;
+ if(name == L"print") return _BLANK|_PUNCT|_ALPHA|_DIGIT;
+ if(name == L"punct") return _PUNCT;
+ if(name == L"s") return _SPACE;
+ if(name == L"space") return _SPACE;
+ if(name == L"upper") return icase ? _UPPER|_LOWER : _UPPER;
+ if(name == L"w") return _ALPHA|_DIGIT|char_class_underscore;
+ if(name == L"xdigit") return _HEX;
+ return 0;
+ }
+
+ static bool isctype(wchar_t ch, char_class_type mask)
+ {
+ using namespace std;
+ if(0 != iswctype(ch, mask))
+ {
+ return true;
+ }
+
+ switch(ch)
+ {
+ case L'\t': return 0 != (mask & _BLANK);
+ case L'_': return 0 != (mask & char_class_underscore);
+ case L'\n': case L'\r': case L'\f': case 0x2028u: case 0x2029u: case 0x85u:
+ return 0 != (mask & char_class_newline);
+ default:;
+ }
+
+ return false;
+ }
+};
+#endif
+
+
+
+#else // unknown, use portable implementation
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<char>
+{
+ typedef int char_class_type;
+ //BOOST_STATIC_CONSTANT(int, char_class_alnum = 0x0001);
+ BOOST_STATIC_CONSTANT(int, char_class_alpha = 0x0002);
+ BOOST_STATIC_CONSTANT(int, char_class_blank = 0x0004);
+ BOOST_STATIC_CONSTANT(int, char_class_cntrl = 0x0008);
+ BOOST_STATIC_CONSTANT(int, char_class_digit = 0x0010);
+ //BOOST_STATIC_CONSTANT(int, char_class_graph = 0x0020);
+ BOOST_STATIC_CONSTANT(int, char_class_lower = 0x0040);
+ //BOOST_STATIC_CONSTANT(int, char_class_print = 0x0080);
+ BOOST_STATIC_CONSTANT(int, char_class_punct = 0x0100);
+ BOOST_STATIC_CONSTANT(int, char_class_space = 0x0200);
+ BOOST_STATIC_CONSTANT(int, char_class_upper = 0x0400);
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x0800);
+ BOOST_STATIC_CONSTANT(int, char_class_xdigit = 0x1000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ string const name = classname_a(begin, end);
+ if(name == "alnum") return char_class_alpha|char_class_digit;
+ if(name == "alpha") return char_class_alpha;
+ if(name == "blank") return char_class_blank;
+ if(name == "cntrl") return char_class_cntrl;
+ if(name == "d") return char_class_digit;
+ if(name == "digit") return char_class_digit;
+ if(name == "graph") return char_class_punct|char_class_alpha|char_class_digit;
+ if(name == "lower") return icase ? (char_class_lower|char_class_upper) : char_class_lower;
+ if(name == "newline") return char_class_newline;
+ if(name == "print") return char_class_blank|char_class_punct|char_class_alpha|char_class_digit;
+ if(name == "punct") return char_class_punct;
+ if(name == "s") return char_class_space;
+ if(name == "space") return char_class_space;
+ if(name == "upper") return icase ? (char_class_upper|char_class_lower) : char_class_upper;
+ if(name == "w") return char_class_alpha|char_class_digit|char_class_underscore;
+ if(name == "xdigit") return char_class_xdigit;
+ return 0;
+ }
+
+ static bool isctype(char ch, char_class_type mask)
+ {
+ using namespace std;
+ unsigned char uch = static_cast<unsigned char>(ch);
+ return ((char_class_alpha & mask) && isalpha(uch))
+ || ((char_class_blank & mask) && (' ' == ch || '\t' == ch)) // BUGBUG
+ || ((char_class_cntrl & mask) && iscntrl(uch))
+ || ((char_class_digit & mask) && isdigit(uch))
+ || ((char_class_lower & mask) && islower(uch))
+ || ((char_class_newline & mask) && detail::isnewline(ch))
+ || ((char_class_punct & mask) && ispunct(uch))
+ || ((char_class_space & mask) && isspace(uch))
+ || ((char_class_upper & mask) && isupper(uch))
+ || ((char_class_underscore & mask) && '_' == ch)
+ || ((char_class_xdigit & mask) && isxdigit(uch))
+ ;
+ }
+};
+
+#ifndef BOOST_XPRESSIVE_NO_WREGEX
+///////////////////////////////////////////////////////////////////////////////
+//
+template<>
+struct char_class_impl<wchar_t>
+{
+ typedef int char_class_type;
+ //BOOST_STATIC_CONSTANT(int, char_class_alnum = 0x0001);
+ BOOST_STATIC_CONSTANT(int, char_class_alpha = 0x0002);
+ BOOST_STATIC_CONSTANT(int, char_class_blank = 0x0004);
+ BOOST_STATIC_CONSTANT(int, char_class_cntrl = 0x0008);
+ BOOST_STATIC_CONSTANT(int, char_class_digit = 0x0010);
+ //BOOST_STATIC_CONSTANT(int, char_class_graph = 0x0020);
+ BOOST_STATIC_CONSTANT(int, char_class_lower = 0x0040);
+ //BOOST_STATIC_CONSTANT(int, char_class_print = 0x0080);
+ BOOST_STATIC_CONSTANT(int, char_class_punct = 0x0100);
+ BOOST_STATIC_CONSTANT(int, char_class_space = 0x0200);
+ BOOST_STATIC_CONSTANT(int, char_class_upper = 0x0400);
+ BOOST_STATIC_CONSTANT(int, char_class_underscore = 0x0800);
+ BOOST_STATIC_CONSTANT(int, char_class_xdigit = 0x1000);
+ BOOST_STATIC_CONSTANT(int, char_class_newline = 0x2000);
+
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ using namespace std;
+ wstring const name = classname_w(begin, end);
+ if(name == L"alnum") return char_class_alpha|char_class_digit;
+ if(name == L"alpha") return char_class_alpha;
+ if(name == L"blank") return char_class_blank;
+ if(name == L"cntrl") return char_class_cntrl;
+ if(name == L"d") return char_class_digit;
+ if(name == L"digit") return char_class_digit;
+ if(name == L"graph") return char_class_punct|char_class_alpha|char_class_digit;
+ if(name == L"newline") return char_class_newline;
+ if(name == L"lower") return icase ? (char_class_lower|char_class_upper) : char_class_lower;
+ if(name == L"print") return char_class_blank|char_class_punct|char_class_alpha|char_class_digit;
+ if(name == L"punct") return char_class_punct;
+ if(name == L"s") return char_class_space;
+ if(name == L"space") return char_class_space;
+ if(name == L"upper") return icase ? (char_class_upper|char_class_lower) : char_class_upper;
+ if(name == L"w") return char_class_alpha|char_class_digit|char_class_underscore;
+ if(name == L"xdigit") return char_class_xdigit;
+ return 0;
+ }
+
+ static bool isctype(wchar_t ch, char_class_type mask)
+ {
+ using namespace std;
+ return ((char_class_alpha & mask) && iswalpha(ch))
+ || ((char_class_blank & mask) && (L' ' == ch || L'\t' == ch)) // BUGBUG
+ || ((char_class_cntrl & mask) && iswcntrl(ch))
+ || ((char_class_digit & mask) && iswdigit(ch))
+ || ((char_class_lower & mask) && iswlower(ch))
+ || ((char_class_newline & mask) && detail::iswnewline(ch))
+ || ((char_class_punct & mask) && iswpunct(ch))
+ || ((char_class_space & mask) && iswspace(ch))
+ || ((char_class_upper & mask) && iswupper(ch))
+ || ((char_class_underscore & mask) && L'_' == ch)
+ || ((char_class_xdigit & mask) && iswxdigit(ch))
+ ;
+ }
+};
+#endif
+
+
+#endif
+
+
+}}} // namespace boost::xpressive::detail
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/null_regex_traits.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/traits/null_regex_traits.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,231 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file null_regex_traits.hpp
+/// Contains the definition of the null_regex_traits\<\> template, which is a
+/// stub regex traits implementation that can be used by static and dynamic
+/// regexes for searching non-character data.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_TRAITS_NULL_REGEX_TRAITS_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_TRAITS_NULL_REGEX_TRAITS_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <vector>
+#include <boost/assert.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+#include <boost/xpressive/detail/utility/never_true.hpp>
+#include <boost/xpressive/detail/utility/ignore_unused.hpp>
+
+namespace boost { namespace xpressive
+{
+
+namespace detail
+{
+ struct not_a_locale {};
+}
+
+struct regex_traits_version_1_tag;
+
+///////////////////////////////////////////////////////////////////////////////
+// null_regex_traits
+//
+/// \brief stub regex_traits for non-char data
+///
+template<typename Elem>
+struct null_regex_traits
+{
+ typedef Elem char_type;
+ typedef std::vector<char_type> string_type;
+ typedef detail::not_a_locale locale_type;
+ typedef int char_class_type;
+ typedef regex_traits_version_1_tag version_tag;
+
+ /// Initialize a null_regex_traits object.
+ ///
+ null_regex_traits(locale_type = locale_type())
+ {
+ }
+
+ /// Checks two null_regex_traits objects for equality
+ ///
+ /// \return true.
+ bool operator ==(null_regex_traits<char_type> const &that) const
+ {
+ detail::ignore_unused(that);
+ return true;
+ }
+
+ /// Checks two null_regex_traits objects for inequality
+ ///
+ /// \return false.
+ bool operator !=(null_regex_traits<char_type> const &that) const
+ {
+ detail::ignore_unused(that);
+ return false;
+ }
+
+ /// Convert a char to a Elem
+ ///
+ /// \param ch The source character.
+ /// \return Elem(ch).
+ char_type widen(char ch) const
+ {
+ return char_type(ch);
+ }
+
+ /// Returns a hash value for a Elem in the range [0, UCHAR_MAX]
+ ///
+ /// \param ch The source character.
+ /// \return a value between 0 and UCHAR_MAX, inclusive.
+ static unsigned char hash(char_type ch)
+ {
+ return static_cast<unsigned char>(ch);
+ }
+
+ /// No-op
+ ///
+ /// \param ch The source character.
+ /// \return ch
+ static char_type translate(char_type ch)
+ {
+ return ch;
+ }
+
+ /// No-op
+ ///
+ /// \param ch The source character.
+ /// \return ch
+ static char_type translate_nocase(char_type ch)
+ {
+ return ch;
+ }
+
+ /// Checks to see if a character is within a character range.
+ ///
+ /// \param first The bottom of the range, inclusive.
+ /// \param last The top of the range, inclusive.
+ /// \param ch The source character.
+ /// \return first <= ch && ch <= last.
+ static bool in_range(char_type first, char_type last, char_type ch)
+ {
+ return first <= ch && ch <= last;
+ }
+
+ /// Checks to see if a character is within a character range.
+ ///
+ /// \param first The bottom of the range, inclusive.
+ /// \param last The top of the range, inclusive.
+ /// \param ch The source character.
+ /// \return first <= ch && ch <= last.
+ /// \attention Since the null_regex_traits does not do case-folding,
+ /// this function is equivalent to in_range().
+ static bool in_range_nocase(char_type first, char_type last, char_type ch)
+ {
+ return first <= ch && ch <= last;
+ }
+
+ /// Returns a sort key for the character sequence designated by the iterator range [F1, F2)
+ /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2)
+ /// then v.transform(G1, G2) < v.transform(H1, H2).
+ ///
+ /// \attention Not used in xpressive 1.0
+ template<typename FwdIter>
+ static string_type transform(FwdIter begin, FwdIter end)
+ {
+ return string_type(begin, end);
+ }
+
+ /// Returns a sort key for the character sequence designated by the iterator range [F1, F2)
+ /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2)
+ /// when character case is not considered then
+ /// v.transform_primary(G1, G2) < v.transform_primary(H1, H2).
+ ///
+ /// \attention Not used in xpressive 1.0
+ template<typename FwdIter>
+ static string_type transform_primary(FwdIter begin, FwdIter end)
+ {
+ return string_type(begin, end);
+ }
+
+ /// Returns a sequence of characters that represents the collating element
+ /// consisting of the character sequence designated by the iterator range [F1, F2).
+ /// Returns an empty string if the character sequence is not a valid collating element.
+ ///
+ /// \attention Not used in xpressive 1.0
+ template<typename FwdIter>
+ static string_type lookup_collatename(FwdIter begin, FwdIter end)
+ {
+ detail::ignore_unused(begin);
+ detail::ignore_unused(end);
+ return string_type();
+ }
+
+ /// The null_regex_traits does not have character classifications, so lookup_classname()
+ /// is unused.
+ ///
+ /// \param begin not used
+ /// \param end not used
+ /// \param icase not used
+ /// \return static_cast\<char_class_type\>(0)
+ template<typename FwdIter>
+ static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
+ {
+ detail::ignore_unused(begin);
+ detail::ignore_unused(end);
+ detail::ignore_unused(icase);
+ return 0;
+ }
+
+ /// The null_regex_traits does not have character classifications, so isctype()
+ /// is unused.
+ ///
+ /// \param ch not used
+ /// \param mask not used
+ /// \return false
+ static bool isctype(char_type ch, char_class_type mask)
+ {
+ detail::ignore_unused(ch);
+ detail::ignore_unused(mask);
+ return false;
+ }
+
+ /// The null_regex_traits recognizes no elements as digits, so value() is unused.
+ ///
+ /// \param ch not used
+ /// \param radix not used
+ /// \return -1
+ static int value(char_type ch, int radix)
+ {
+ detail::ignore_unused(ch);
+ detail::ignore_unused(radix);
+ return -1;
+ }
+
+ /// Not used
+ ///
+ /// \param loc not used
+ /// \return loc
+ static locale_type imbue(locale_type loc)
+ {
+ return loc;
+ }
+
+ /// Returns locale_type().
+ ///
+ /// \return locale_type()
+ static locale_type getloc()
+ {
+ return locale_type();
+ }
+};
+
+}}
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file xpressive.hpp
+/// Includes all of xpressive including support for both static and
+/// dynamic regular expressions.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/xpressive_static.hpp>
+#include <boost/xpressive/xpressive_dynamic.hpp>
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_dynamic.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_dynamic.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file xpressive_dynamic.hpp
+/// Includes everything you need to write and use dynamic regular expressions.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_DYNAMIC_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_DYNAMIC_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/xpressive/regex_compiler.hpp>
+#include <boost/xpressive/basic_regex.hpp>
+#include <boost/xpressive/sub_match.hpp>
+#include <boost/xpressive/match_results.hpp>
+#include <boost/xpressive/regex_algorithms.hpp>
+#include <boost/xpressive/regex_iterator.hpp>
+#include <boost/xpressive/regex_token_iterator.hpp>
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_fwd.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_fwd.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,209 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file xpressive_fwd.hpp
+/// Forward declarations for all of xpressive's public data types.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_XPRESSIVE_FWD_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_XPRESSIVE_FWD_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <string>
+#include <boost/config.hpp>
+#include <boost/version.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+
+#if BOOST_VERSION >= 103500
+# define BOOST_PROTO_FUSION_V2
+#endif
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+# error Sorry, xpressive requires a compiler that supports partial template specialization.
+#endif
+
+#if defined(BOOST_NO_STD_LOCALE) & !defined(BOOST_XPRESSIVE_USE_C_TRAITS)
+# define BOOST_XPRESSIVE_USE_C_TRAITS
+#endif
+
+#if defined(BOOST_NO_CWCHAR) | defined(BOOST_NO_CWCTYPE) | defined(BOOST_NO_STD_WSTRING)
+# ifndef BOOST_XPRESSIVE_NO_WREGEX
+# define BOOST_XPRESSIVE_NO_WREGEX
+# endif
+#endif
+
+// Stack protection under MS Windows
+// Config logic taken from boost/regex/config.hpp
+#ifndef BOOST_XPRESSIVE_HAS_MS_STACK_GUARD
+# if (defined(_WIN32) || defined(_WIN64) || defined(_WINCE)) \
+ && !defined(__GNUC__) \
+ && !(defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)) \
+ && !(defined(__MWERKS__) && (__MWERKS__ <= 0x3003))
+# define BOOST_XPRESSIVE_HAS_MS_STACK_GUARD 1
+# else
+# define BOOST_XPRESSIVE_HAS_MS_STACK_GUARD 0
+# endif
+#endif
+
+#include <boost/xpressive/proto/proto_fwd.hpp>
+#include <boost/xpressive/proto/traits.hpp>
+
+namespace boost { namespace xpressive
+{
+
+ template<typename Char>
+ struct cpp_regex_traits;
+
+ template<typename Char>
+ struct c_regex_traits;
+
+ template<typename Elem>
+ struct null_regex_traits;
+
+ namespace detail
+ {
+ template<typename Char>
+ struct default_regex_traits
+ {
+ #ifdef BOOST_XPRESSIVE_USE_C_TRAITS
+ typedef c_regex_traits<Char> type;
+ #else
+ typedef cpp_regex_traits<Char> type;
+ #endif
+ };
+
+ struct mark_placeholder;
+ typedef proto::terminal<mark_placeholder>::type basic_mark_tag;
+ struct mark_tag;
+
+ } // namespace detail
+
+ using detail::mark_tag;
+
+ typedef void const *regex_id_type;
+
+ struct regex_error;
+
+ struct regex_traits_version_1_tag;
+
+ struct regex_traits_version_2_tag;
+
+ // DEPRECATED
+ /// INTERNAL ONLY
+ ///
+ struct regex_traits_version_1_case_fold_tag;
+
+ template<typename Trait>
+ struct has_fold_case;
+
+ template<typename BidiIter>
+ struct basic_regex;
+
+ template<typename BidiIter>
+ struct match_results;
+
+ template<typename BidiIter>
+ struct regex_iterator;
+
+ template<typename BidiIter>
+ struct regex_token_iterator;
+
+ template<typename BidiIter>
+ struct regex_id_filter_predicate;
+
+ template<typename BidiIter>
+ struct sub_match;
+
+ template<typename RegexTraits>
+ struct compiler_traits;
+
+ template<typename Char, typename Impl = typename detail::default_regex_traits<Char>::type>
+ struct regex_traits;
+
+ template
+ <
+ typename BidiIter
+ , typename RegexTraits = regex_traits<typename iterator_value<BidiIter>::type>
+ , typename CompilerTraits = compiler_traits<RegexTraits>
+ >
+ struct regex_compiler;
+
+ template<typename T>
+ struct value;
+
+ template<typename T>
+ struct reference;
+
+ template<typename T>
+ struct local;
+
+ template<typename T, int I = 0, typename Dummy = proto::is_proto_expr>
+ struct placeholder;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Common typedefs
+ //
+ typedef basic_regex<std::string::const_iterator> sregex;
+ typedef basic_regex<char const *> cregex;
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef basic_regex<std::wstring::const_iterator> wsregex;
+ typedef basic_regex<wchar_t const *> wcregex;
+ #endif
+
+ typedef sub_match<std::string::const_iterator> ssub_match;
+ typedef sub_match<char const *> csub_match;
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef sub_match<std::wstring::const_iterator> wssub_match;
+ typedef sub_match<wchar_t const *> wcsub_match;
+ #endif
+
+ typedef regex_compiler<std::string::const_iterator> sregex_compiler;
+ typedef regex_compiler<char const *> cregex_compiler;
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef regex_compiler<std::wstring::const_iterator> wsregex_compiler;
+ typedef regex_compiler<wchar_t const *> wcregex_compiler;
+ #endif
+
+ typedef regex_iterator<std::string::const_iterator> sregex_iterator;
+ typedef regex_iterator<char const *> cregex_iterator;
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef regex_iterator<std::wstring::const_iterator> wsregex_iterator;
+ typedef regex_iterator<wchar_t const *> wcregex_iterator;
+ #endif
+
+ typedef regex_token_iterator<std::string::const_iterator> sregex_token_iterator;
+ typedef regex_token_iterator<char const *> cregex_token_iterator;
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef regex_token_iterator<std::wstring::const_iterator> wsregex_token_iterator;
+ typedef regex_token_iterator<wchar_t const *> wcregex_token_iterator;
+ #endif
+
+ typedef match_results<std::string::const_iterator> smatch;
+ typedef match_results<char const *> cmatch;
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef match_results<std::wstring::const_iterator> wsmatch;
+ typedef match_results<wchar_t const *> wcmatch;
+ #endif
+
+ typedef regex_id_filter_predicate<std::string::const_iterator> sregex_id_filter_predicate;
+ typedef regex_id_filter_predicate<char const *> cregex_id_filter_predicate;
+
+ #ifndef BOOST_XPRESSIVE_NO_WREGEX
+ typedef regex_id_filter_predicate<std::wstring::const_iterator> wsregex_id_filter_predicate;
+ typedef regex_id_filter_predicate<wchar_t const *> wcregex_id_filter_predicate;
+ #endif
+
+}} // namespace boost::xpressive
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_static.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_static.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,32 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file xpressive_static.hpp
+/// Includes everything you need to write static regular expressions and use
+/// them.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_STATIC_HPP_EAN_10_04_2005
+#define BOOST_XPRESSIVE_STATIC_HPP_EAN_10_04_2005
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+// inline aggressively
+# pragma inline_recursion(on) // turn on inline recursion
+# pragma inline_depth(255) // max inline depth
+#endif
+
+#include <boost/xpressive/regex_primitives.hpp>
+#include <boost/xpressive/basic_regex.hpp>
+#include <boost/xpressive/sub_match.hpp>
+#include <boost/xpressive/match_results.hpp>
+#include <boost/xpressive/regex_algorithms.hpp>
+#include <boost/xpressive/regex_iterator.hpp>
+#include <boost/xpressive/regex_token_iterator.hpp>
+
+#endif

Added: branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_typeof.hpp
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/xpressive/include/boost/xpressive/xpressive_typeof.hpp 2008-07-01 12:46:45 EDT (Tue, 01 Jul 2008)
@@ -0,0 +1,150 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file xpressive_typeof.hpp
+/// Type registrations so that xpressive can be used with the Boost.Typeof library.
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_XPRESSIVE_XPRESSIVE_TYPEOF_H
+#define BOOST_XPRESSIVE_XPRESSIVE_TYPEOF_H
+
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/config.hpp>
+#include <boost/typeof/typeof.hpp>
+#ifndef BOOST_NO_STL_LOCALE
+# include <boost/typeof/std/locale.hpp>
+#endif
+#include <boost/xpressive/proto/proto_typeof.hpp>
+#include <boost/xpressive/detail/detail_fwd.hpp>
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::mpl::bool_, (bool))
+
+///////////////////////////////////////////////////////////////////////////////
+// Misc.
+//
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::set_initializer)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::keeper_tag)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::modifier_tag)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::lookahead_tag)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::lookbehind_tag)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::check_tag)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::mark_tag)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::word_begin)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::word_end)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::generic_quant_tag, (unsigned int)(unsigned int))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::basic_regex, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::word_boundary, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::value, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::reference, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::local, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::placeholder, (typename)(int)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::tracking_ptr, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::regex_impl, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::let_, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::action_arg, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::named_mark, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::sub_match, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::nested_results, (typename))
+
+///////////////////////////////////////////////////////////////////////////////
+// Placeholders
+//
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::mark_placeholder)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::posix_charset_placeholder)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::assert_bol_placeholder)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::assert_eol_placeholder)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::logical_newline_placeholder)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::self_placeholder)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::assert_word_placeholder, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::range_placeholder, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::attribute_placeholder, (typename))
+
+///////////////////////////////////////////////////////////////////////////////
+// Matchers
+//
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::epsilon_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::true_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::end_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::independent_end_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::any_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::assert_bos_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::assert_eos_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::mark_begin_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::mark_end_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::repeat_begin_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::alternate_end_matcher)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::attr_end_matcher)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::assert_bol_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::assert_eol_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::literal_matcher, (typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::string_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::charset_matcher, (typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::logical_newline_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::mark_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::repeat_end_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::alternate_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::optional_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::optional_mark_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::simple_repeat_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::regex_byref_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::regex_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::posix_charset_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::assert_word_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::range_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::keeper_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::lookahead_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::lookbehind_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::set_matcher, (typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::predicate_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::action_matcher, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::attr_matcher, (typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::attr_begin_matcher, (typename))
+
+///////////////////////////////////////////////////////////////////////////////
+// Ops
+//
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::push)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::push_back)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::pop)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::push_front)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::pop_back)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::pop_front)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::back)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::front)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::top)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::first)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::second)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::matched)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::length)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::str)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::insert)
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::op::make_pair)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::op::as, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::op::static_cast_, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::op::dynamic_cast_, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::op::const_cast_, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::op::construct, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::op::throw_, (typename))
+
+///////////////////////////////////////////////////////////////////////////////
+// Modifiers
+//
+BOOST_TYPEOF_REGISTER_TYPE(boost::xpressive::detail::icase_modifier)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::detail::locale_modifier, (typename))
+
+///////////////////////////////////////////////////////////////////////////////
+// Traits
+//
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::null_regex_traits, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::cpp_regex_traits, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::c_regex_traits, (typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::xpressive::regex_traits, (typename)(typename))
+
+#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk