From e153234e10077a19b13c8ef79b359ced459e63c4 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 1 Dec 2005 15:00:34 +0000 Subject: [PATCH] More cleanups [SVN r31860] --- include/boost/regex/icu.hpp | 298 +++++++++--------- include/boost/regex/v4/basic_regex_parser.hpp | 126 ++++---- 2 files changed, 212 insertions(+), 212 deletions(-) diff --git a/include/boost/regex/icu.hpp b/include/boost/regex/icu.hpp index 059b7b16..64fad5d6 100644 --- a/include/boost/regex/icu.hpp +++ b/include/boost/regex/icu.hpp @@ -3,8 +3,8 @@ * Copyright (c) 2004 * John Maddock * - * Use, modification and distribution are subject to the - * Boost Software License, Version 1.0. (See accompanying file + * Use, modification and distribution are 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) * */ @@ -32,7 +32,7 @@ namespace boost{ namespace re_detail{ -// +// // Implementation details: // class BOOST_REGEX_DECL icu_regex_traits_implementation @@ -237,9 +237,9 @@ namespace re_detail{ #if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) template -inline u32regex do_make_u32regex(InputIterator i, - InputIterator j, - boost::regex_constants::syntax_option_type opt, +inline u32regex do_make_u32regex(InputIterator i, + InputIterator j, + boost::regex_constants::syntax_option_type opt, const boost::mpl::int_<1>*) { typedef boost::u8_to_u32_iterator conv_type; @@ -247,9 +247,9 @@ inline u32regex do_make_u32regex(InputIterator i, } template -inline u32regex do_make_u32regex(InputIterator i, - InputIterator j, - boost::regex_constants::syntax_option_type opt, +inline u32regex do_make_u32regex(InputIterator i, + InputIterator j, + boost::regex_constants::syntax_option_type opt, const boost::mpl::int_<2>*) { typedef boost::u16_to_u32_iterator conv_type; @@ -257,18 +257,18 @@ inline u32regex do_make_u32regex(InputIterator i, } template -inline u32regex do_make_u32regex(InputIterator i, - InputIterator j, - boost::regex_constants::syntax_option_type opt, +inline u32regex do_make_u32regex(InputIterator i, + InputIterator j, + boost::regex_constants::syntax_option_type opt, const boost::mpl::int_<4>*) { return u32regex(i, j, opt); } #else template -inline u32regex do_make_u32regex(InputIterator i, - InputIterator j, - boost::regex_constants::syntax_option_type opt, +inline u32regex do_make_u32regex(InputIterator i, + InputIterator j, + boost::regex_constants::syntax_option_type opt, const boost::mpl::int_<1>*) { typedef boost::u8_to_u32_iterator conv_type; @@ -277,8 +277,8 @@ inline u32regex do_make_u32regex(InputIterator i, conv_type a(i), b(j); while(a != b) { - v.push_back(*a); - ++a; + v.push_back(*a); + ++a; } if(v.size()) return u32regex(&*v.begin(), v.size(), opt); @@ -286,9 +286,9 @@ inline u32regex do_make_u32regex(InputIterator i, } template -inline u32regex do_make_u32regex(InputIterator i, - InputIterator j, - boost::regex_constants::syntax_option_type opt, +inline u32regex do_make_u32regex(InputIterator i, + InputIterator j, + boost::regex_constants::syntax_option_type opt, const boost::mpl::int_<2>*) { typedef boost::u16_to_u32_iterator conv_type; @@ -297,8 +297,8 @@ inline u32regex do_make_u32regex(InputIterator i, conv_type a(i), b(j); while(a != b) { - v.push_back(*a); - ++a; + v.push_back(*a); + ++a; } if(v.size()) return u32regex(&*v.begin(), v.size(), opt); @@ -306,17 +306,17 @@ inline u32regex do_make_u32regex(InputIterator i, } template -inline u32regex do_make_u32regex(InputIterator i, - InputIterator j, - boost::regex_constants::syntax_option_type opt, +inline u32regex do_make_u32regex(InputIterator i, + InputIterator j, + boost::regex_constants::syntax_option_type opt, const boost::mpl::int_<4>*) { typedef std::vector vector_type; vector_type v; while(i != j) { - v.push_back((UCHAR32)(*i)); - ++a; + v.push_back((UCHAR32)(*i)); + ++a; } if(v.size()) return u32regex(&*v.begin(), v.size(), opt); @@ -329,8 +329,8 @@ inline u32regex do_make_u32regex(InputIterator i, // Construction from an iterator pair: // template -inline u32regex make_u32regex(InputIterator i, - InputIterator j, +inline u32regex make_u32regex(InputIterator i, + InputIterator j, boost::regex_constants::syntax_option_type opt) { return re_detail::do_make_u32regex(i, j, opt, static_cast const*>(0)); @@ -398,18 +398,18 @@ void copy_results(MR1& out, MR2 const& in) } template -inline bool do_regex_match(BidiIterator first, BidiIterator last, - match_results& m, - const u32regex& e, +inline bool do_regex_match(BidiIterator first, BidiIterator last, + match_results& m, + const u32regex& e, match_flag_type flags, boost::mpl::int_<4> const*) { return ::boost::regex_match(first, last, m, e, flags); } template -bool do_regex_match(BidiIterator first, BidiIterator last, - match_results& m, - const u32regex& e, +bool do_regex_match(BidiIterator first, BidiIterator last, + match_results& m, + const u32regex& e, match_flag_type flags, boost::mpl::int_<2> const*) { @@ -423,9 +423,9 @@ bool do_regex_match(BidiIterator first, BidiIterator last, return result; } template -bool do_regex_match(BidiIterator first, BidiIterator last, - match_results& m, - const u32regex& e, +bool do_regex_match(BidiIterator first, BidiIterator last, + match_results& m, + const u32regex& e, match_flag_type flags, boost::mpl::int_<1> const*) { @@ -441,62 +441,62 @@ bool do_regex_match(BidiIterator first, BidiIterator last, } // namespace re_detail template -inline bool u32regex_match(BidiIterator first, BidiIterator last, - match_results& m, - const u32regex& e, +inline bool u32regex_match(BidiIterator first, BidiIterator last, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_match(first, last, m, e, flags, static_cast const*>(0)); } -inline bool u32regex_match(const UChar* p, - match_results& m, - const u32regex& e, +inline bool u32regex_match(const UChar* p, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast const*>(0)); } #if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) -inline bool u32regex_match(const wchar_t* p, - match_results& m, - const u32regex& e, +inline bool u32regex_match(const wchar_t* p, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_match(p, p+std::wcslen(p), m, e, flags, static_cast const*>(0)); } #endif -inline bool u32regex_match(const char* p, - match_results& m, - const u32regex& e, +inline bool u32regex_match(const char* p, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_match(p, p+std::strlen(p), m, e, flags, static_cast const*>(0)); } -inline bool u32regex_match(const unsigned char* p, - match_results& m, - const u32regex& e, +inline bool u32regex_match(const unsigned char* p, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_match(p, p+std::strlen((const char*)p), m, e, flags, static_cast const*>(0)); } -inline bool u32regex_match(const std::string& s, - match_results& m, - const u32regex& e, +inline bool u32regex_match(const std::string& s, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast const*>(0)); } #ifndef BOOST_NO_STD_WSTRING -inline bool u32regex_match(const std::wstring& s, - match_results& m, - const u32regex& e, +inline bool u32regex_match(const std::wstring& s, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast const*>(0)); } #endif -inline bool u32regex_match(const UnicodeString& s, - match_results& m, - const u32regex& e, +inline bool u32regex_match(const UnicodeString& s, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_match(s.getBuffer(), s.getBuffer() + s.length(), m, e, flags, static_cast const*>(0)); @@ -505,61 +505,61 @@ inline bool u32regex_match(const UnicodeString& s, // regex_match overloads that do not return what matched: // template -inline bool u32regex_match(BidiIterator first, BidiIterator last, - const u32regex& e, +inline bool u32regex_match(BidiIterator first, BidiIterator last, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_match(first, last, m, e, flags, static_cast const*>(0)); } -inline bool u32regex_match(const UChar* p, - const u32regex& e, +inline bool u32regex_match(const UChar* p, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast const*>(0)); } #if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) -inline bool u32regex_match(const wchar_t* p, - const u32regex& e, +inline bool u32regex_match(const wchar_t* p, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_match(p, p+std::wcslen(p), m, e, flags, static_cast const*>(0)); } #endif -inline bool u32regex_match(const char* p, - const u32regex& e, +inline bool u32regex_match(const char* p, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_match(p, p+std::strlen(p), m, e, flags, static_cast const*>(0)); } -inline bool u32regex_match(const unsigned char* p, - const u32regex& e, +inline bool u32regex_match(const unsigned char* p, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_match(p, p+std::strlen((const char*)p), m, e, flags, static_cast const*>(0)); } -inline bool u32regex_match(const std::string& s, - const u32regex& e, +inline bool u32regex_match(const std::string& s, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast const*>(0)); } #ifndef BOOST_NO_STD_WSTRING -inline bool u32regex_match(const std::wstring& s, - const u32regex& e, +inline bool u32regex_match(const std::wstring& s, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast const*>(0)); } #endif -inline bool u32regex_match(const UnicodeString& s, - const u32regex& e, +inline bool u32regex_match(const UnicodeString& s, + const u32regex& e, match_flag_type flags = match_default) { match_results m; @@ -571,9 +571,9 @@ inline bool u32regex_match(const UnicodeString& s, // namespace re_detail{ template -inline bool do_regex_search(BidiIterator first, BidiIterator last, - match_results& m, - const u32regex& e, +inline bool do_regex_search(BidiIterator first, BidiIterator last, + match_results& m, + const u32regex& e, match_flag_type flags, BidiIterator base, boost::mpl::int_<4> const*) @@ -581,9 +581,9 @@ inline bool do_regex_search(BidiIterator first, BidiIterator last, return ::boost::regex_search(first, last, m, e, flags, base); } template -bool do_regex_search(BidiIterator first, BidiIterator last, - match_results& m, - const u32regex& e, +bool do_regex_search(BidiIterator first, BidiIterator last, + match_results& m, + const u32regex& e, match_flag_type flags, BidiIterator base, boost::mpl::int_<2> const*) @@ -598,9 +598,9 @@ bool do_regex_search(BidiIterator first, BidiIterator last, return result; } template -bool do_regex_search(BidiIterator first, BidiIterator last, - match_results& m, - const u32regex& e, +bool do_regex_search(BidiIterator first, BidiIterator last, + match_results& m, + const u32regex& e, match_flag_type flags, BidiIterator base, boost::mpl::int_<1> const*) @@ -617,131 +617,131 @@ bool do_regex_search(BidiIterator first, BidiIterator last, } template -inline bool u32regex_search(BidiIterator first, BidiIterator last, - match_results& m, - const u32regex& e, +inline bool u32regex_search(BidiIterator first, BidiIterator last, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_search(first, last, m, e, flags, first, static_cast const*>(0)); } template -inline bool u32regex_search(BidiIterator first, BidiIterator last, - match_results& m, - const u32regex& e, +inline bool u32regex_search(BidiIterator first, BidiIterator last, + match_results& m, + const u32regex& e, match_flag_type flags, BidiIterator base) { return re_detail::do_regex_search(first, last, m, e, flags, base, static_cast const*>(0)); } -inline bool u32regex_search(const UChar* p, - match_results& m, - const u32regex& e, +inline bool u32regex_search(const UChar* p, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast const*>(0)); } #if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) -inline bool u32regex_search(const wchar_t* p, - match_results& m, - const u32regex& e, +inline bool u32regex_search(const wchar_t* p, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_search(p, p+std::wcslen(p), m, e, flags, p, static_cast const*>(0)); } #endif -inline bool u32regex_search(const char* p, - match_results& m, - const u32regex& e, +inline bool u32regex_search(const char* p, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_search(p, p+std::strlen(p), m, e, flags, p, static_cast const*>(0)); } -inline bool u32regex_search(const unsigned char* p, - match_results& m, - const u32regex& e, +inline bool u32regex_search(const unsigned char* p, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_search(p, p+std::strlen((const char*)p), m, e, flags, p, static_cast const*>(0)); } -inline bool u32regex_search(const std::string& s, - match_results& m, - const u32regex& e, +inline bool u32regex_search(const std::string& s, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast const*>(0)); } #ifndef BOOST_NO_STD_WSTRING -inline bool u32regex_search(const std::wstring& s, - match_results& m, - const u32regex& e, +inline bool u32regex_search(const std::wstring& s, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast const*>(0)); } #endif -inline bool u32regex_search(const UnicodeString& s, - match_results& m, - const u32regex& e, +inline bool u32regex_search(const UnicodeString& s, + match_results& m, + const u32regex& e, match_flag_type flags = match_default) { return re_detail::do_regex_search(s.getBuffer(), s.getBuffer() + s.length(), m, e, flags, s.getBuffer(), static_cast const*>(0)); } template -inline bool u32regex_search(BidiIterator first, BidiIterator last, - const u32regex& e, +inline bool u32regex_search(BidiIterator first, BidiIterator last, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_search(first, last, m, e, flags, first, static_cast const*>(0)); } -inline bool u32regex_search(const UChar* p, - const u32regex& e, +inline bool u32regex_search(const UChar* p, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast const*>(0)); } #if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) -inline bool u32regex_search(const wchar_t* p, - const u32regex& e, +inline bool u32regex_search(const wchar_t* p, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_search(p, p+std::wcslen(p), m, e, flags, p, static_cast const*>(0)); } #endif -inline bool u32regex_search(const char* p, - const u32regex& e, +inline bool u32regex_search(const char* p, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_search(p, p+std::strlen(p), m, e, flags, p, static_cast const*>(0)); } -inline bool u32regex_search(const unsigned char* p, - const u32regex& e, +inline bool u32regex_search(const unsigned char* p, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_search(p, p+std::strlen((const char*)p), m, e, flags, p, static_cast const*>(0)); } -inline bool u32regex_search(const std::string& s, - const u32regex& e, +inline bool u32regex_search(const std::string& s, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast const*>(0)); } #ifndef BOOST_NO_STD_WSTRING -inline bool u32regex_search(const std::wstring& s, - const u32regex& e, +inline bool u32regex_search(const std::wstring& s, + const u32regex& e, match_flag_type flags = match_default) { match_results m; return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast const*>(0)); } #endif -inline bool u32regex_search(const UnicodeString& s, - const u32regex& e, +inline bool u32regex_search(const UnicodeString& s, + const u32regex& e, match_flag_type flags = match_default) { match_results m; @@ -807,8 +807,8 @@ inline utf8_output_iterator make_utf32_out(OutputIterator o, mpl template OutputIterator do_regex_replace(OutputIterator out, std::pair const& in, - const u32regex& e, - const std::pair& fmt, + const u32regex& e, + const std::pair& fmt, match_flag_type flags ) { @@ -822,7 +822,7 @@ OutputIterator do_regex_replace(OutputIterator out, while(pos != fmt.second) f.push_back(*pos++); #endif - + regex_iterator i(in.first, in.second, e, flags); regex_iterator j; if(i == j) @@ -836,7 +836,7 @@ OutputIterator do_regex_replace(OutputIterator out, while(i != j) { if(!(flags & regex_constants::format_no_copy)) - out = re_detail::copy(i->prefix().first, i->prefix().second, out); + out = re_detail::copy(i->prefix().first, i->prefix().second, out); if(f.size()) out = ::boost::re_detail::regex_format_imp(out, *i, &*f.begin(), &*f.begin() + f.size(), flags, e.get_traits()); else @@ -872,15 +872,15 @@ template inline OutputIterator u32regex_replace(OutputIterator out, BidirectionalIterator first, BidirectionalIterator last, - const u32regex& e, - const charT* fmt, + const u32regex& e, + const charT* fmt, match_flag_type flags = match_default) { return re_detail::extract_output_base #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) #endif - ( + ( re_detail::do_regex_replace( re_detail::make_utf32_out(out, static_cast const*>(0)), re_detail::make_utf32_seq(first, last, static_cast const*>(0)), @@ -894,7 +894,7 @@ template inline OutputIterator u32regex_replace(OutputIterator out, Iterator first, Iterator last, - const u32regex& e, + const u32regex& e, const std::basic_string& fmt, match_flag_type flags = match_default) { @@ -902,7 +902,7 @@ inline OutputIterator u32regex_replace(OutputIterator out, #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) #endif - ( + ( re_detail::do_regex_replace( re_detail::make_utf32_out(out, static_cast const*>(0)), re_detail::make_utf32_seq(first, last, static_cast const*>(0)), @@ -916,7 +916,7 @@ template inline OutputIterator u32regex_replace(OutputIterator out, Iterator first, Iterator last, - const u32regex& e, + const u32regex& e, const UnicodeString& fmt, match_flag_type flags = match_default) { @@ -924,7 +924,7 @@ inline OutputIterator u32regex_replace(OutputIterator out, #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) #endif - ( + ( re_detail::do_regex_replace( re_detail::make_utf32_out(out, static_cast const*>(0)), re_detail::make_utf32_seq(first, last, static_cast const*>(0)), @@ -936,7 +936,7 @@ inline OutputIterator u32regex_replace(OutputIterator out, template std::basic_string u32regex_replace(const std::basic_string& s, - const u32regex& e, + const u32regex& e, const charT* fmt, match_flag_type flags = match_default) { @@ -948,7 +948,7 @@ std::basic_string u32regex_replace(const std::basic_string& s, template std::basic_string u32regex_replace(const std::basic_string& s, - const u32regex& e, + const u32regex& e, const std::basic_string& fmt, match_flag_type flags = match_default) { @@ -968,10 +968,10 @@ public: unicode_string_out_iterator& operator++() { return *this; } unicode_string_out_iterator& operator++(int) { return *this; } unicode_string_out_iterator& operator*() { return *this; } - unicode_string_out_iterator& operator=(UChar v) - { - *out += v; - return *this; + unicode_string_out_iterator& operator=(UChar v) + { + *out += v; + return *this; } typedef std::ptrdiff_t difference_type; typedef UChar value_type; @@ -983,7 +983,7 @@ public: } inline UnicodeString u32regex_replace(const UnicodeString& s, - const u32regex& e, + const u32regex& e, const UChar* fmt, match_flag_type flags = match_default) { @@ -994,7 +994,7 @@ inline UnicodeString u32regex_replace(const UnicodeString& s, } inline UnicodeString u32regex_replace(const UnicodeString& s, - const u32regex& e, + const u32regex& e, const UnicodeString& fmt, match_flag_type flags = match_default) { diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index b5cd2794..41ec0f33 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -3,8 +3,8 @@ * Copyright (c) 2004 * John Maddock * - * Use, modification and distribution are subject to the - * Boost Software License, Version 1.0. (See accompanying file + * Use, modification and distribution are 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) * */ @@ -291,7 +291,7 @@ bool basic_regex_parser::parse_extended() // If we have a mod_x flag set, then skip until // we get to a newline character: // - if((this->flags() + if((this->flags() & (regbase::no_perl_ex|regbase::mod_x)) == regbase::mod_x) { @@ -315,8 +315,8 @@ bool basic_regex_parser::parse_literal() // append this as a literal provided it's not a space character // or the perl option regbase::mod_x is not set: if( - ((this->flags() - & (regbase::main_option_type|regbase::mod_x|regbase::no_perl_ex)) + ((this->flags() + & (regbase::main_option_type|regbase::mod_x|regbase::no_perl_ex)) != regbase::mod_x) || !this->m_traits.isctype(*m_position, this->m_mask_space)) this->append_literal(*m_position); @@ -698,8 +698,8 @@ bool basic_regex_parser::parse_match_any() ++m_position; static_cast( this->append_state(syntax_element_wild, sizeof(re_dot)) - )->mask = static_cast(this->flags() & regbase::no_mod_s - ? re_detail::force_not_newline + )->mask = static_cast(this->flags() & regbase::no_mod_s + ? re_detail::force_not_newline : this->flags() & regbase::mod_s ? re_detail::force_newline : re_detail::dont_care); return true; @@ -710,10 +710,10 @@ bool basic_regex_parser::parse_repeat(std::size_t low, std::size_ { bool greedy = true; std::size_t insert_point; - // + // // when we get to here we may have a non-greedy ? mark still to come: // - if((m_position != m_end) + if((m_position != m_end) && ( (0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) || ((regbase::basic_syntax_group|regbase::emacs_ex) == (this->flags() & (regbase::main_option_type | regbase::emacs_ex))) @@ -909,7 +909,7 @@ bool basic_regex_parser::parse_alt() } ++m_position; // - // we need to append a trailing jump: + // we need to append a trailing jump: // re_syntax_base* pj = this->append_state(re_detail::syntax_element_jump, sizeof(re_jump)); std::ptrdiff_t jump_offset = this->getoffset(pj); @@ -995,7 +995,7 @@ bool basic_regex_parser::parse_set() return true; case regex_constants::syntax_escape: { - // + // // look ahead and see if this is a character class shortcut // \d \w \s etc... // @@ -1061,7 +1061,7 @@ bool basic_regex_parser::parse_inner_set(basic_char_setflags() & (regbase::main_option_type | regbase::no_char_classes)) + if((this->flags() & (regbase::main_option_type | regbase::no_char_classes)) == (regbase::basic_syntax_group | regbase::no_char_classes)) { --m_position; @@ -1081,8 +1081,8 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_colon)) + while((m_position != m_end) + && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_colon)) ++m_position; const charT* name_last = m_position; if(m_end == m_position) @@ -1090,7 +1090,7 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_brack, m_position - m_base); @@ -1113,18 +1113,18 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) + if( (m_position != m_end) + && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set)) { - if(this->m_traits.escape_syntax_type(*name_first) + if(this->m_traits.escape_syntax_type(*name_first) == regex_constants::escape_type_left_word) { ++m_position; this->append_state(syntax_element_word_start); return false; } - if(this->m_traits.escape_syntax_type(*name_first) + if(this->m_traits.escape_syntax_type(*name_first) == regex_constants::escape_type_right_word) { ++m_position; @@ -1158,8 +1158,8 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_equal)) + while((m_position != m_end) + && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)) ++m_position; const charT* name_last = m_position; if(m_end == m_position) @@ -1167,7 +1167,7 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_brack, m_position - m_base); @@ -1220,17 +1220,17 @@ void basic_regex_parser::parse_set_literal(basic_char_setm_traits.syntax_type(*m_position) == regex_constants::syntax_dash) { - if(m_end == ++m_position) - { - fail(regex_constants::error_brack, m_position - m_base); - return; - } - if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set) - { + if(m_end == ++m_position) + { + fail(regex_constants::error_brack, m_position - m_base); + return; + } + if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set) + { // trailing - : --m_position; return; - } + } fail(regex_constants::error_range, m_position - m_base); return; } @@ -1297,8 +1297,8 @@ digraph basic_regex_parser::get_next_set_literal(basic_cha fail(regex_constants::error_collate, name_first - m_base); return result; } - while((m_position != m_end) - && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot)) + while((m_position != m_end) + && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot)) ++m_position; const charT* name_last = m_position; if(m_end == m_position) @@ -1306,7 +1306,7 @@ digraph basic_regex_parser::get_next_set_literal(basic_cha fail(regex_constants::error_collate, name_first - m_base); return result; } - if((m_end == ++m_position) + if((m_end == ++m_position) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_collate, name_first - m_base); @@ -1462,7 +1462,7 @@ charT basic_regex_parser::unescape_character() return result; } val = this->m_traits.toi(m_position, m_position + len, 8); - if(val < 0) + if(val < 0) { fail(regex_constants::error_escape, m_position - m_base); return result; @@ -1556,14 +1556,14 @@ bool basic_regex_parser::parse_QE() const charT* end; do { - while((m_position != m_end) + while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape)) ++m_position; if(m_position == m_end) { // a \Q...\E sequence may terminate with the end of the expression: end = m_position; - break; + break; } if(++m_position == m_end) // skip the escape { @@ -1608,9 +1608,9 @@ bool basic_regex_parser::parse_perl_extension() // if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_hash) { - while((m_position != m_end) + while((m_position != m_end) && (this->m_traits.syntax_type(*m_position++) != regex_constants::syntax_close_mark)) - {} + {} return true; } // @@ -1908,44 +1908,44 @@ bool basic_regex_parser::add_emacs_code(bool negate) char_set.add_class(this->m_word_mask); break; case '_': - char_set.add_single(digraph(charT('$'))); - char_set.add_single(digraph(charT('&'))); - char_set.add_single(digraph(charT('*'))); - char_set.add_single(digraph(charT('+'))); - char_set.add_single(digraph(charT('-'))); - char_set.add_single(digraph(charT('_'))); - char_set.add_single(digraph(charT('<'))); - char_set.add_single(digraph(charT('>'))); + char_set.add_single(digraph(charT('$'))); + char_set.add_single(digraph(charT('&'))); + char_set.add_single(digraph(charT('*'))); + char_set.add_single(digraph(charT('+'))); + char_set.add_single(digraph(charT('-'))); + char_set.add_single(digraph(charT('_'))); + char_set.add_single(digraph(charT('<'))); + char_set.add_single(digraph(charT('>'))); break; case '.': char_set.add_class(this->m_traits.lookup_classname(s_punct, s_punct+5)); break; case '(': - char_set.add_single(digraph(charT('('))); - char_set.add_single(digraph(charT('['))); - char_set.add_single(digraph(charT('{'))); + char_set.add_single(digraph(charT('('))); + char_set.add_single(digraph(charT('['))); + char_set.add_single(digraph(charT('{'))); break; case ')': - char_set.add_single(digraph(charT(')'))); - char_set.add_single(digraph(charT(']'))); - char_set.add_single(digraph(charT('}'))); + char_set.add_single(digraph(charT(')'))); + char_set.add_single(digraph(charT(']'))); + char_set.add_single(digraph(charT('}'))); break; case '"': - char_set.add_single(digraph(charT('"'))); - char_set.add_single(digraph(charT('\''))); - char_set.add_single(digraph(charT('`'))); + char_set.add_single(digraph(charT('"'))); + char_set.add_single(digraph(charT('\''))); + char_set.add_single(digraph(charT('`'))); break; case '\'': - char_set.add_single(digraph(charT('\''))); - char_set.add_single(digraph(charT(','))); - char_set.add_single(digraph(charT('#'))); + char_set.add_single(digraph(charT('\''))); + char_set.add_single(digraph(charT(','))); + char_set.add_single(digraph(charT('#'))); break; case '<': - char_set.add_single(digraph(charT(';'))); + char_set.add_single(digraph(charT(';'))); break; case '>': - char_set.add_single(digraph(charT('\n'))); - char_set.add_single(digraph(charT('\f'))); + char_set.add_single(digraph(charT('\n'))); + char_set.add_single(digraph(charT('\f'))); break; default: fail(regex_constants::error_ctype, m_position - m_base); @@ -2038,7 +2038,7 @@ template bool basic_regex_parser::unwind_alts(std::ptrdiff_t last_paren_start) { // - // If we didn't actually add any states after the last + // If we didn't actually add any states after the last // alternative then that's an error: // if((this->m_alt_insert_point == static_cast(this->m_pdata->m_data.size())) @@ -2047,7 +2047,7 @@ bool basic_regex_parser::unwind_alts(std::ptrdiff_t last_paren_st fail(regex_constants::error_empty, this->m_position - this->m_base); return false; } - // + // // Fix up our alternatives: // while(m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start))