Update of /cvsroot/boost/boost/boost/xpressive
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19963/boost/xpressive
Modified Files:
basic_regex.hpp regex_primitives.hpp
Log Message:
switch xpressive from proto compilers to proto transforms
Index: basic_regex.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/basic_regex.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- basic_regex.hpp 13 Mar 2007 02:07:54 -0000 1.14
+++ basic_regex.hpp 15 Apr 2007 06:40:25 -0000 1.15
@@ -84,7 +84,8 @@
basic_regex(Expr const &expr)
: base_type()
{
- this->operator =(expr);
+ BOOST_XPRESSIVE_CHECK_REGEX(Expr, char_type);
+ this->compile_(expr, is_valid_regex<Expr, char_type>());
}
/// Construct from a static regular expression.
@@ -98,8 +99,8 @@
template<typename Expr>
basic_regex<BidiIter> &operator =(Expr const &expr)
{
- BOOST_XPRESSIVE_CHECK_GRAMMAR(Expr, char_type);
- detail::static_compile(expr, proto::arg(*this).get());
+ BOOST_XPRESSIVE_CHECK_REGEX(Expr, char_type);
+ this->compile_(expr, is_valid_regex<Expr, char_type>());
return *this;
}
@@ -178,6 +179,21 @@
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 &expr, mpl::false_)
+ {
+ }
+
/// INTERNAL ONLY
void dump_(std::ostream &sout) const;
};
Index: regex_primitives.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/regex_primitives.hpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- regex_primitives.hpp 27 Mar 2007 05:05:26 -0000 1.27
+++ regex_primitives.hpp 15 Apr 2007 06:40:25 -0000 1.28
@@ -18,10 +18,8 @@
#include <boost/xpressive/detail/core/icase.hpp>
#include <boost/xpressive/detail/core/matchers.hpp>
#include <boost/xpressive/detail/static/compile.hpp>
-#include <boost/xpressive/detail/static/grammar.hpp>
#include <boost/xpressive/detail/static/modifier.hpp>
#include <boost/xpressive/detail/utility/ignore_unused.hpp>
-#include <boost/xpressive/detail/static/productions/productions.hpp>
namespace boost { namespace xpressive { namespace detail
{
@@ -636,75 +634,6 @@
return mod;
}
-///////////////////////////////////////////////////////////////////////////////
-/// \brief For checking if an expression matches xpressive's grammar
-///
-/// validator\<\> can be used to see if a given expression is a valid
-/// xpressive regular expression. If it is, it will simply return it.
-/// If it isn't, it will cause a simple and short compile-time error.
-/// You may use it as follows:
-/// validator\<char\> validate;
-/// sregex rx = validate( _ << "oops" );
-///
-/// See also xpressive::validate and xpressive::wvalidate.
-///
-/// \param Char The character type of the regular expression.
-template<typename Char>
-struct validator
-{
-private:
- struct some_valid_expression
- : proto::extends<typename proto::terminal<Char>::type,
some_valid_expression>
- {
- template<typename Xpr>
- some_valid_expression(Xpr const &);
- };
-
- struct expression_does_not_match_xpressive_grammar
- : mpl::false_
- {};
-
-public:
- template<typename Xpr>
- typename mpl::if_
- <
- proto::matches<Xpr, XpressiveGrammar<Char> >
- , Xpr const &
- , some_valid_expression
- >::type operator ()(Xpr const &xpr) const
- {
- typedef typename mpl::if_
- <
- proto::matches<Xpr, XpressiveGrammar<Char> >
- , mpl::true_
- , expression_does_not_match_xpressive_grammar
- >::type does_expression_match_xpressive_grammar;
-
- BOOST_MPL_ASSERT((does_expression_match_xpressive_grammar));
- return xpr;
- }
-};
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief For checking if an expression matches xpressive's grammar
-///
-/// validate() can be used to see if a given expression is a valid narrow
-/// xpressive regular expression. If it is, it will simply return it.
-/// If it isn't, it will cause a simple and short compile-time error.
-/// You may use it as follows:
-/// sregex rx = validate( _ << "oops" );
-validator<char> const validate = {};
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief For checking if an expression matches xpressive's grammar
-///
-/// wvalidate() can be used to see if a given expression is a valid wide
-/// xpressive regular expression. If it is, it will simply return it.
-/// If it isn't, it will cause a simple and short compile-time error.
-/// You may use it as follows:
-/// wsregex rx = wvalidate( _ << L"oops" );
-validator<wchar_t> const wvalidate = {};
-
namespace detail
{
inline void ignore_unused_regex_primitives()
@@ -739,8 +668,6 @@
ignore_unused(s7);
ignore_unused(s8);
ignore_unused(s9);
- ignore_unused(validate);
- ignore_unused(wvalidate);
}
}
-------------------------------------------------------------------------
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