Update of /cvsroot/boost/boost/boost/xpressive/detail/dynamic
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29904/detail/dynamic
Modified Files:
parser_enum.hpp parser_traits.hpp
Log Message:
add support for dynamic regex grammars
Index: parser_enum.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/dynamic/parser_enum.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- parser_enum.hpp 4 Mar 2007 18:07:03 -0000 1.2
+++ parser_enum.hpp 5 Mar 2007 02:56:28 -0000 1.3
@@ -46,7 +46,9 @@
token_negative_lookbehind, // ?<!
token_independent_sub_expression, // ?>
token_comment, // ?#
- token_recurse_self, // ?R
+ token_recurse, // ?R
+ token_rule_assign, // ?$[name]=
+ token_rule_ref, // ?$[name]
token_assert_begin_sequence, // \A
token_assert_end_sequence, // \Z
Index: parser_traits.hpp
===================================================================
RCS file:
/cvsroot/boost/boost/boost/xpressive/detail/dynamic/parser_traits.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- parser_traits.hpp 4 Mar 2007 18:07:03 -0000 1.5
+++ parser_traits.hpp 5 Mar 2007 02:56:28 -0000 1.6
@@ -46,8 +46,10 @@
: traits_(traits)
, flags_(regex_constants::ECMAScript)
, space_(lookup_classname(traits_, "space"))
+ , alnum_(lookup_classname(traits_, "alnum"))
{
BOOST_ASSERT(0 != this->space_);
+ BOOST_ASSERT(0 != this->alnum_);
}
///////////////////////////////////////////////////////////////////////////////
@@ -82,6 +84,7 @@
{
locale_type oldloc = this->traits().imbue(loc);
this->space_ = lookup_classname(this->traits(), "space");
+ this->alnum_ = lookup_classname(this->traits(), "alnum");
BOOST_ASSERT(0 != this->space_);
return oldloc;
}
@@ -211,7 +214,7 @@
///////////////////////////////////////////////////////////////////////////
// get_group_type
- regex_constants::compiler_token_type get_group_type(iterator_type &begin,
iterator_type end)
+ regex_constants::compiler_token_type get_group_type(iterator_type &begin,
iterator_type end, std::string &name)
{
using namespace regex_constants;
if(this->eat_ws_(begin, end) != end && BOOST_XPR_CHAR_(char_type, '?')
== *begin)
@@ -226,7 +229,22 @@
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_self;
+ case BOOST_XPR_CHAR_(char_type, 'R'): ++begin; return
token_recurse;
+ case BOOST_XPR_CHAR_(char_type, '$'):
+ this->eat_ws_(++begin, end);
+ for( name.clear(); begin != end &&
this->traits().isctype(*begin, this->alnum_); ++begin)
+ {
+ name.push_back(*begin);
+ }
+ this->eat_ws_(begin, end);
+ detail::ensure(begin != end && !name.empty(), 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");
@@ -396,6 +414,7 @@
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
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs