Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65145 - trunk/boost/regex/v4
From: john_at_[hidden]
Date: 2010-08-31 07:25:58


Author: johnmaddock
Date: 2010-08-31 07:25:56 EDT (Tue, 31 Aug 2010)
New Revision: 65145
URL: http://svn.boost.org/trac/boost/changeset/65145

Log:
In Perl mode then "something+++" should be an error.
Add the necessary error handling.
Fixes #4608.
Text files modified:
   trunk/boost/regex/v4/basic_regex_parser.hpp | 15 +++++++++++++++
   1 files changed, 15 insertions(+), 0 deletions(-)

Modified: trunk/boost/regex/v4/basic_regex_parser.hpp
==============================================================================
--- trunk/boost/regex/v4/basic_regex_parser.hpp (original)
+++ trunk/boost/regex/v4/basic_regex_parser.hpp 2010-08-31 07:25:56 EDT (Tue, 31 Aug 2010)
@@ -1003,6 +1003,21 @@
    //
    if(pocessive)
    {
+ if(m_position != m_end)
+ {
+ //
+ // Check for illegal following quantifier, we have to do this here, because
+ // the extra states we insert below circumvents are usual error checking :-(
+ //
+ switch(this->m_traits.syntax_type(*m_position))
+ {
+ case regex_constants::syntax_star:
+ case regex_constants::syntax_plus:
+ case regex_constants::syntax_question:
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ }
       re_brace* pb = static_cast<re_brace*>(this->insert_state(insert_point, syntax_element_startmark, sizeof(re_brace)));
       pb->index = -3;
       pb->icase = this->flags() & regbase::icase;


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