Update of /cvsroot/boost/boost/boost/xpressive/detail/static
In directory
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19963/boost/xpressive/detail/static
Modified Files:
compile.hpp grammar.hpp
Added Files:
transmogrify.hpp visitor.hpp
Log Message:
switch xpressive from proto compilers to proto transforms
--- NEW FILE: transmogrify.hpp ---
///////////////////////////////////////////////////////////////////////////////
// transmogrify.hpp
//
// Copyright 2004 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/bool.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/remove_reference.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>
struct is_string_literal
: is_array<typename remove_reference<T>::type>
{};
template<typename T>
struct is_string_literal<T *>
: mpl::true_
{};
///////////////////////////////////////////////////////////////////////////////
// transmogrify
//
template<typename BidiIter, typename ICase, typename Traits, typename
Matcher, typename EnableIf = void>
struct default_transmogrify
{
typedef typename iterator_value<BidiIter>::type char_type;
typedef std::basic_string<char_type> string_type;
typedef typename mpl::if_
<
is_string_literal<Matcher>
, string_matcher<Traits, ICase::value>
, literal_matcher<Traits, ICase::value, false>
>::type type;
template<typename Matcher2, typename Visitor>
static type call(Matcher2 const &m, Visitor &visitor)
{
return default_transmogrify::call_(m, visitor,
is_string_literal<Matcher2>());
}
template<typename Matcher2, typename Visitor>
static type call_(Matcher2 const &m, Visitor &visitor, mpl::false_)
{
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::true_)
{
return type(string_cast<char_type>(string_type(m),
visitor.traits()), 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, not_literal_placeholder<Char> >
{
typedef typename iterator_value<BidiIter>::type char_type;
typedef literal_matcher<Traits, ICase::value, true> type;
template<typename Matcher2, typename Visitor>
static type call(Matcher2 const &m, Visitor &visitor)
{
char_type ch = char_cast<char_type>(m.ch_, visitor.traits());
return type(ch, 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::value> 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::value> 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, int 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,
regex_byref_placeholder<BidiIter> >
{
typedef regex_byref_matcher<BidiIter> type;
template<typename Matcher2>
static type call(Matcher2 const &m, dont_care)
{
return type(m.impl_);
}
};
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
--- NEW FILE: visitor.hpp ---
///////////////////////////////////////////////////////////////////////////////
// visitor.hpp
//
// Copyright 2004 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/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_(regex_byref_placeholder<BidiIter> const &rex)
{
// when visiting an embedded regex, track the references
this->self_->track_reference(*rex.impl_);
}
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
Index: compile.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/compile.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- compile.hpp 6 Apr 2007 02:07:10 -0000 1.11
+++ compile.hpp 15 Apr 2007 06:40:25 -0000 1.12
@@ -23,10 +23,8 @@
#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/productions/visitor.hpp>
-#include <boost/xpressive/detail/static/productions/domain_tags.hpp>
-
-//#include <boost/xpressive/detail/static/transforms/transform.hpp>
+#include <boost/xpressive/detail/static/visitor.hpp>
+#include <boost/xpressive/detail/static/grammar.hpp>
namespace boost { namespace xpressive { namespace detail
{
@@ -36,14 +34,14 @@
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> >(
- //detail::transform(xpr, visitor)
- proto::compile(xpr, end_xpression(), visitor, seq_tag())
+ Grammar<char_type>::call(xpr, end_xpression(), visitor)
);
// Link and optimize the regex
Index: grammar.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/grammar.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- grammar.hpp 22 Mar 2007 19:54:45 -0000 1.15
+++ grammar.hpp 15 Apr 2007 06:40:25 -0000 1.16
@@ -13,288 +13,275 @@
# pragma once
#endif
-#include <boost/mpl/or.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/bool.hpp>
#include <boost/mpl/assert.hpp>
-#include <boost/xpressive/proto/proto_fwd.hpp>
-#include <boost/xpressive/proto/matches.hpp>
-#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto/proto.hpp>
+#include <boost/xpressive/proto/transform/arg.hpp>
+#include <boost/xpressive/proto/transform/fold.hpp>
+#include <boost/xpressive/proto/transform/compose.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>
-#ifdef BOOST_XPRESSIVE_BETTER_ERRORS
-# define BOOST_XPRESSIVE_CHECK_GRAMMAR(Expr, Char)\
- BOOST_MPL_ASSERT((boost::proto::matches<Expr,
boost::xpressive::XpressiveGrammar<Char> >))
-#else
-# define BOOST_XPRESSIVE_CHECK_GRAMMAR(Expr, Char)\
- BOOST_MPL_ASSERT((mpl::true_))
-#endif
+#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\
+ ));
namespace boost { namespace xpressive
-{
+{
+ template<typename Char>
+ struct Grammar;
+
namespace detail
{
- // is_generic_repeat
- template<typename T>
- struct is_generic_repeat
- : mpl::false_
- {};
-
- template<uint_t Min, uint_t Max>
- struct is_generic_repeat<generic_quant_tag<Min, Max> >
- : mpl::true_
- {};
-
- // is_xpressive_literal_impl
- template<typename Char, typename T>
- struct is_xpressive_literal_impl
- : mpl::false_
- {};
-
+
///////////////////////////////////////////////////////////////////////////
+ // CharLiteral
template<typename Char>
- struct is_xpressive_literal_impl<Char, Char>
- : mpl::true_
- {};
+ struct CharLiteral;
+
///////////////////////////////////////////////////////////////////////////
+ // ListSet
template<typename Char>
- struct is_xpressive_literal_impl<Char, Char const *>
- : mpl::true_
- {};
-
- template<typename Char, std::size_t N>
- struct is_xpressive_literal_impl<Char, Char (&)[N]>
- : mpl::true_
+ struct ListSet
+ : proto::or_<
+ proto::comma<ListSet<Char>, CharLiteral<Char> >
+ , proto::assign<set_initializer_type, CharLiteral<Char> >
+ >
{};
- template<typename Char, std::size_t N>
- struct is_xpressive_literal_impl<Char, Char const (&)[N]>
- : mpl::true_
+
///////////////////////////////////////////////////////////////////////////
+ // as_repeat
+ template<typename Char, typename Tag, bool Greedy>
+ struct as_repeat
+ : proto::trans::conditional<
+ use_simple_repeat<proto::result_of::arg<mpl::_> >
+ , as_simple_quantifier<proto::unary_expr<Tag, Grammar<Char> >,
Greedy>
+ , as_default_quantifier<proto::unary_expr<Tag, Grammar<Char> >,
Greedy>
+ >
{};
+
///////////////////////////////////////////////////////////////////////////
+ // NonGreedyRepeatCases
template<typename Char>
- struct is_xpressive_literal_impl<Char, not_literal_placeholder<Char> >
- : mpl::true_
- {};
+ struct NonGreedyRepeatCases
+ {
+ template<typename Tag, typename Dummy = void>
+ struct case_
+ : proto::not_<proto::_>
+ {};
- template<typename Char, typename Traits, typename Alloc>
- struct is_xpressive_literal_impl<Char, std::basic_string<Char, Traits,
Alloc> >
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::unary_star, Dummy>
+ : as_repeat<Char, proto::tag::unary_star, false>
+ {};
- // is_xpressive_literal
- template<typename Char, typename T>
- struct is_xpressive_literal
- : mpl::or_<
- is_xpressive_literal_impl<Char, T>
- , is_xpressive_literal_impl<char, T>
- >
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::unary_plus, Dummy>
+ : as_repeat<Char, proto::tag::unary_plus, false>
+ {};
- template<typename T>
- struct is_xpressive_literal<char, T>
- : is_xpressive_literal_impl<char, T>
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::logical_not, Dummy>
+ : as_repeat<Char, proto::tag::logical_not, false>
+ {};
- // is_xpressive_terminal
- template<typename Char, typename T>
- struct is_xpressive_terminal
- : is_xpressive_literal<Char, T>
- {};
+ template<uint_t Min, uint_t Max, typename Dummy>
+ struct case_<generic_quant_tag<Min, Max>, Dummy>
+ : as_repeat<Char, generic_quant_tag<Min, Max>, false>
+ {};
+ };
+
///////////////////////////////////////////////////////////////////////////
+ // InvertibleCases
template<typename Char>
- struct is_xpressive_terminal<Char, posix_charset_placeholder>
- : mpl::true_
- {};
+ struct InvertibleCases
+ {
+ template<typename Tag, typename Dummy = void>
+ struct case_
+ : proto::not_<proto::_>
+ {};
- template<typename Char>
- struct is_xpressive_terminal<Char, assert_bos_matcher>
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::comma, Dummy>
+ : as_list_set<ListSet<Char> >
+ {};
- template<typename Char>
- struct is_xpressive_terminal<Char, assert_eos_matcher>
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::assign, Dummy>
+ : as_list_set<ListSet<Char> >
+ {};
- template<typename Char>
- struct is_xpressive_terminal<Char, epsilon_matcher>
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::subscript, Dummy>
+ : proto::trans::right<proto::subscript<set_initializer_type,
as_set<Grammar<Char> > > >
+ {};
- template<typename Char>
- struct is_xpressive_terminal<Char, assert_bol_placeholder>
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<lookahead_tag<true>, Dummy>
+ : proto::trans::arg<proto::unary_expr<lookahead_tag<true>,
as_lookahead<Grammar<Char> > > >
+ {};
- template<typename Char>
- struct is_xpressive_terminal<Char, assert_eol_placeholder>
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<lookbehind_tag<true>, Dummy>
+ : proto::trans::arg<proto::unary_expr<lookbehind_tag<true>,
as_lookbehind<Grammar<Char> > > >
+ {};
- template<typename Char, typename Cond>
- struct is_xpressive_terminal<Char, assert_word_placeholder<Cond> >
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::terminal, Dummy>
+ : proto::or_<
+ as_matcher<CharLiteral<Char> >
+ , as_matcher<proto::terminal<posix_charset_placeholder> >
+ , as_matcher<proto::terminal<range_placeholder<proto::_> > >
+ , as_matcher<proto::terminal<logical_newline_placeholder> >
+ ,
as_matcher<proto::terminal<assert_word_placeholder<word_boundary<true> > > >
+ >
+ {};
+ };
+
///////////////////////////////////////////////////////////////////////////
+ // Cases
template<typename Char>
- struct is_xpressive_terminal<Char, logical_newline_placeholder>
- : mpl::true_
- {};
+ struct Cases
+ {
+ template<typename Tag, typename Dummy = void>
+ struct case_
+ : proto::not_<proto::_>
+ {};
- template<typename Char>
- struct is_xpressive_terminal<Char, any_matcher>
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::right_shift, Dummy>
+ : proto::trans::reverse_fold<proto::right_shift<Grammar<Char>,
Grammar<Char> > >
+ {};
- template<typename Char>
- struct is_xpressive_terminal<Char, self_placeholder>
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::terminal, Dummy>
+ : in_sequence<as_matcher<proto::terminal<proto::_> > >
+ {};
- template<typename Char>
- struct is_xpressive_terminal<Char, mark_placeholder>
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::bitwise_or, Dummy>
+ : in_sequence<as_alternate<proto::bitwise_or<Grammar<Char>,
Grammar<Char> > > >
+ {};
- template<typename Char>
- struct is_xpressive_terminal<Char, range_placeholder<Char> >
- : mpl::true_
- {};
+ template<typename Dummy, bool Greedy>
+ struct case_<optional_tag<Greedy> , Dummy>
+ :
in_sequence<proto::trans::arg<proto::unary_expr<optional_tag<Greedy>,
as_optional<Grammar<Char>, Greedy> > > >
+ {};
- template<typename Char, typename BidiIter>
- struct is_xpressive_terminal<Char, regex_byref_placeholder<BidiIter> >
- : mpl::true_
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::unary_star, Dummy>
+ : proto::trans::compose<as_repeat<Char, proto::tag::unary_star,
true>, Grammar<Char> >
+ {};
- template<typename Char, typename BidiIter>
- struct is_xpressive_terminal<Char, tracking_ptr<regex_impl<BidiIter> >
>
- : mpl::true_
- {};
- }
+ template<typename Dummy>
+ struct case_<proto::tag::unary_plus, Dummy>
+ : proto::trans::compose<as_repeat<Char, proto::tag::unary_plus,
true>, Grammar<Char> >
+ {};
- template<typename Char>
- struct XpressiveGrammar;
+ template<typename Dummy>
+ struct case_<proto::tag::logical_not, Dummy>
+ : proto::trans::compose<as_repeat<Char, proto::tag::logical_not,
true>, Grammar<Char> >
+ {};
- template<typename Char>
- struct XpressiveListSet
- : proto::or_<
- proto::comma< XpressiveListSet<Char>, proto::terminal<Char> >
- , proto::comma< XpressiveListSet<Char>, proto::terminal<char> >
- , proto::assign<detail::set_initializer_type, proto::terminal<Char> >
- , proto::assign<detail::set_initializer_type, proto::terminal<char> >
- >
- {};
+ template<uint_t Min, uint_t Max, typename Dummy>
+ struct case_<generic_quant_tag<Min, Max> , Dummy>
+ : proto::trans::compose<as_repeat<Char, generic_quant_tag<Min,
Max>, true>, Grammar<Char> >
+ {};
- template<>
- struct XpressiveListSet<char>
- : proto::or_<
- proto::comma< XpressiveListSet<char>, proto::terminal<char> >
- , proto::assign<detail::set_initializer_type, proto::terminal<char> >
- >
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::unary_minus, Dummy>
+ : proto::trans::compose<
+
proto::trans::arg<proto::unary_minus<proto::switch_<NonGreedyRepeatCases<Char>
> > >
+ , Grammar<Char>
+ >
+ {};
- template<typename Char>
- struct XpressiveSet
- : proto::or_<
- proto::subscript<detail::set_initializer_type,
XpressiveGrammar<Char> >
- , XpressiveListSet<Char>
- >
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::complement, Dummy>
+ : in_sequence<as_inverse<
+
proto::trans::arg<proto::complement<proto::switch_<InvertibleCases<Char> > > >
+ > >
+ {};
- template<typename Char>
- struct XpressiveTaggedSubExpression
- : proto::assign< detail::basic_mark_tag, XpressiveGrammar<Char> >
- {};
+ template<typename Dummy>
+ struct case_<modifier_tag, Dummy>
+ : as_modifier<proto::binary_expr<modifier_tag, proto::_,
Grammar<Char> > >
+ {};
- template<typename Char>
- struct XpressiveLookAroundAssertion
- : proto::or_<
- proto::unary_expr<detail::lookahead_tag<true>,
XpressiveGrammar<Char> >
- , proto::unary_expr<detail::lookbehind_tag<true>,
XpressiveGrammar<Char> >
- >
- {};
+ template<typename Dummy>
+ struct case_<lookahead_tag<true> , Dummy>
+ :
in_sequence<proto::trans::arg<proto::unary_expr<lookahead_tag<true>,
as_lookahead<Grammar<Char> > > > >
+ {};
- template<typename Char>
- struct XpressiveIndependentSubExpression
- : proto::unary_expr<detail::keeper_tag, XpressiveGrammar<Char> >
- {};
+ template<typename Dummy>
+ struct case_<lookbehind_tag<true> , Dummy>
+ :
in_sequence<proto::trans::arg<proto::unary_expr<lookbehind_tag<true>,
as_lookbehind<Grammar<Char> > > > >
+ {};
- template<typename Char>
- struct XpressiveModifiedSubExpression
- : proto::binary_expr<detail::modifier_tag, proto::_,
XpressiveGrammar<Char> >
- {};
+ template<typename Dummy>
+ struct case_<keeper_tag, Dummy>
+ : in_sequence<proto::trans::arg<proto::unary_expr<keeper_tag,
as_keeper<Grammar<Char> > > > >
+ {};
- template<typename Char>
- struct XpressiveComplementedCharacterLiteral
- : proto::or_<
-
proto::complement<proto::terminal<detail::not_literal_placeholder<Char> > >
- ,
proto::complement<proto::terminal<detail::not_literal_placeholder<char> > >
- >
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::comma, Dummy>
+ : in_sequence<as_list_set<ListSet<Char> > >
+ {};
- template<>
- struct XpressiveComplementedCharacterLiteral<char>
- :
proto::complement<proto::terminal<detail::not_literal_placeholder<char> > >
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::assign, Dummy>
+ : proto::or_<
+
proto::trans::compose<as_marker<proto::assign<basic_mark_tag, Grammar<Char> >
>, Grammar<Char> >
+ , in_sequence<as_list_set<ListSet<Char> > >
+ >
+ {};
- template<typename Char>
- struct XpressiveComplementedExpression
- : proto::and_<
- proto::complement<proto::_>
- , proto::or_<
-
proto::complement<proto::terminal<detail::posix_charset_placeholder> >
- ,
proto::complement<proto::terminal<detail::logical_newline_placeholder> >
- , XpressiveComplementedCharacterLiteral<Char>
- , proto::complement<XpressiveSet<Char> >
- , proto::complement<XpressiveLookAroundAssertion<Char> >
- >
- >
- {};
+ template<typename Dummy>
+ struct case_<proto::tag::subscript, Dummy>
+ : proto::or_<
+
in_sequence<proto::trans::right<proto::subscript<set_initializer_type,
as_set<Grammar<Char> > > > >
+ ,
proto::trans::compose<as_action<proto::subscript<Grammar<Char>, proto::_> >,
Grammar<Char> >
+ >
+ {};
+ };
- template<typename Char>
- struct XpressiveAction
- : proto::subscript< XpressiveGrammar<Char>, proto::_ >
- {};
+ } // namespace detail
+ ///////////////////////////////////////////////////////////////////////////
+ // Grammar
template<typename Char>
- struct XpressiveTerminal
- : proto::or_<
- proto::and_<
- proto::terminal<proto::_>
- , proto::if_<detail::is_xpressive_terminal<Char,
proto::result_of::arg<mpl::_> > >
- >
- , XpressiveComplementedExpression<Char>
- , XpressiveTaggedSubExpression<Char>
- , XpressiveLookAroundAssertion<Char>
- , XpressiveModifiedSubExpression<Char>
- , XpressiveIndependentSubExpression<Char>
- , XpressiveSet<Char>
- , XpressiveAction<Char>
- >
+ struct Grammar
+ : proto::switch_<detail::Cases<Char> >
{};
- template<typename Char>
- struct XpressiveQuantified
- : proto::and_<
- proto::unary_expr<proto::_, XpressiveGrammar<Char> >
- , proto::or_<
- proto::unary_star< proto::_ >
- , proto::unary_plus< proto::_ >
- , proto::logical_not< proto::_ >
- , proto::if_<detail::is_generic_repeat<proto::tag_of<mpl::_> > >
- >
- >
+ ///////////////////////////////////////////////////////////////////////////
+ // INVALID_REGULAR_EXPRESSION
+ struct INVALID_REGULAR_EXPRESSION
+ : mpl::false_
{};
- template<typename Char>
- struct XpressiveGrammar
- : proto::or_<
- proto::right_shift< XpressiveGrammar<Char>, XpressiveGrammar<Char>
>
- , proto::bitwise_or< XpressiveGrammar<Char>, XpressiveGrammar<Char> >
- , proto::unary_minus< XpressiveQuantified<Char> >
- , XpressiveQuantified<Char>
- , XpressiveTerminal<Char>
- >
+ ///////////////////////////////////////////////////////////////////////////
+ // is_valid_regex
+ template<typename Expr, typename Char>
+ struct is_valid_regex
+ : proto::matches<Expr, Grammar<Char> >
{};
-}}
+}} // namespace boost::xpressive
#endif
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/boost-cvs