Skip to content

Commit c3ab640

Browse files
committed
Merge branch 'use-boost-override' of https://github.com/EugeneZelenko/regex into develop
Resolved Conflicts: include/boost/regex/v4/cpp_regex_traits.hpp src/wc_regex_traits.cpp
2 parents 01f6a67 + c9d3302 commit c3ab640

16 files changed

+65
-102
lines changed

include/boost/regex/icu.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ OutputIterator do_regex_replace(OutputIterator out,
894894
{
895895
if(!(flags & regex_constants::format_no_copy))
896896
out = BOOST_REGEX_DETAIL_NS::copy(i->prefix().first, i->prefix().second, out);
897-
if(f.size())
897+
if(!f.empty())
898898
out = ::boost::BOOST_REGEX_DETAIL_NS::regex_format_imp(out, *i, &*f.begin(), &*f.begin() + f.size(), flags, e.get_traits());
899899
else
900900
out = ::boost::BOOST_REGEX_DETAIL_NS::regex_format_imp(out, *i, static_cast<UChar32 const*>(0), static_cast<UChar32 const*>(0), flags, e.get_traits());

include/boost/regex/pattern_except.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include <boost/regex/config.hpp>
2424
#endif
2525

26-
#include <stdexcept>
2726
#include <cstddef>
27+
#include <stdexcept>
2828
#include <boost/regex/v4/error_type.hpp>
2929

3030
namespace boost{
@@ -52,7 +52,7 @@ class BOOST_REGEX_DECL regex_error : public std::runtime_error
5252
public:
5353
explicit regex_error(const std::string& s, regex_constants::error_type err = regex_constants::error_unknown, std::ptrdiff_t pos = 0);
5454
explicit regex_error(regex_constants::error_type err);
55-
~regex_error() BOOST_NOEXCEPT_OR_NOTHROW;
55+
~regex_error() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE;
5656
regex_constants::error_type code()const
5757
{ return m_error_code; }
5858
std::ptrdiff_t position()const
@@ -98,6 +98,3 @@ void raise_error(const traits& t, regex_constants::error_type code)
9898
} // namespace boost
9999

100100
#endif
101-
102-
103-

include/boost/regex/v4/basic_regex.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ class basic_regex : public regbase
416416
{
417417
typedef typename traits::string_type seq_type;
418418
seq_type a(arg_first, arg_last);
419-
if(a.size())
419+
if(!a.empty())
420420
assign(static_cast<const charT*>(&*a.begin()), static_cast<const charT*>(&*a.begin() + a.size()), f);
421421
else
422422
assign(static_cast<const charT*>(0), static_cast<const charT*>(0), f);
@@ -657,7 +657,7 @@ class basic_regex : public regbase
657657
//
658658
// out of line members;
659659
// these are the only members that mutate the basic_regex object,
660-
// and are designed to provide the strong exception guarentee
660+
// and are designed to provide the strong exception guarantee
661661
// (in the event of a throw, the state of the object remains unchanged).
662662
//
663663
template <class charT, class traits>
@@ -795,4 +795,3 @@ class reg_expression : public basic_regex<charT, traits>
795795
#endif
796796

797797
#endif
798-

include/boost/regex/v4/basic_regex_creator.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ class basic_regex_creator
246246
bool m_has_backrefs; // true if there are actually any backrefs
247247
indexed_bit_flag m_backrefs; // bitmask of permitted backrefs
248248
boost::uintmax_t m_bad_repeats; // bitmask of repeats we can't deduce a startmap for;
249-
bool m_has_recursions; // set when we have recursive expresisons to fixup
249+
bool m_has_recursions; // set when we have recursive expressions to fixup
250250
std::vector<unsigned char> m_recursion_checks; // notes which recursions we've followed while analysing this expression
251251
typename traits::char_class_type m_word_mask; // mask used to determine if a character is a word character
252252
typename traits::char_class_type m_mask_space; // mask used to determine if a character is a word character
@@ -450,9 +450,9 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
450450
charT a2[3] = { c2.first, c2.second, charT(0), };
451451
s1 = this->m_traits.transform(a1, (a1[1] ? a1+2 : a1+1));
452452
s2 = this->m_traits.transform(a2, (a2[1] ? a2+2 : a2+1));
453-
if(s1.size() == 0)
453+
if(s1.empty())
454454
s1 = string_type(1, charT(0));
455-
if(s2.size() == 0)
455+
if(s2.empty())
456456
s2 = string_type(1, charT(0));
457457
}
458458
else
@@ -954,7 +954,7 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
954954
}
955955

956956
// now work through our list, building all the maps as we go:
957-
while(v.size())
957+
while(!v.empty())
958958
{
959959
// Initialize m_recursion_checks if we need it:
960960
if(m_has_recursions)
@@ -1519,7 +1519,7 @@ template <class charT, class traits>
15191519
void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* state)
15201520
{
15211521
// enumerate our states, and see if we have a leading repeat
1522-
// for which failed search restarts can be optimised;
1522+
// for which failed search restarts can be optimized;
15231523
do
15241524
{
15251525
switch(state->type)
@@ -1576,7 +1576,6 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st
15761576
}while(state);
15771577
}
15781578

1579-
15801579
} // namespace BOOST_REGEX_DETAIL_NS
15811580

15821581
} // namespace boost
@@ -1597,4 +1596,3 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st
15971596
#endif
15981597

15991598
#endif
1600-

include/boost/regex/v4/basic_regex_parser.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2,
172172
m_parser_proc = &basic_regex_parser<charT, traits>::parse_literal;
173173
break;
174174
default:
175-
// Ooops, someone has managed to set more than one of the main option flags,
175+
// Oops, someone has managed to set more than one of the main option flags,
176176
// so this must be an error:
177177
fail(regex_constants::error_unknown, 0, "An invalid combination of regular expression syntax flags was used.");
178178
return;
@@ -981,7 +981,7 @@ template <class charT, class traits>
981981
bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_t high)
982982
{
983983
bool greedy = true;
984-
bool pocessive = false;
984+
bool possessive = false;
985985
std::size_t insert_point;
986986
//
987987
// when we get to here we may have a non-greedy ? mark still to come:
@@ -1005,12 +1005,12 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
10051005
greedy = false;
10061006
++m_position;
10071007
}
1008-
// for perl regexes only check for pocessive ++ repeats.
1008+
// for perl regexes only check for possessive ++ repeats.
10091009
if((m_position != m_end)
10101010
&& (0 == (this->flags() & regbase::main_option_type))
10111011
&& (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_plus))
10121012
{
1013-
pocessive = true;
1013+
possessive = true;
10141014
++m_position;
10151015
}
10161016
}
@@ -1082,10 +1082,10 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
10821082
rep = static_cast<re_repeat*>(this->getaddress(rep_off));
10831083
rep->alt.i = this->m_pdata->m_data.size() - rep_off;
10841084
//
1085-
// If the repeat is pocessive then bracket the repeat with a (?>...)
1085+
// If the repeat is possessive then bracket the repeat with a (?>...)
10861086
// independent sub-expression construct:
10871087
//
1088-
if(pocessive)
1088+
if(possessive)
10891089
{
10901090
if(m_position != m_end)
10911091
{
@@ -1542,7 +1542,7 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
15421542
fail(regex_constants::error_ctype, name_first - m_base);
15431543
return false;
15441544
}
1545-
if(negated == false)
1545+
if(!negated)
15461546
char_set.add_class(m);
15471547
else
15481548
char_set.add_negated_class(m);
@@ -1580,7 +1580,7 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
15801580
return false;
15811581
}
15821582
string_type m = this->m_traits.lookup_collatename(name_first, name_last);
1583-
if((0 == m.size()) || (m.size() > 2))
1583+
if(m.empty() || (m.size() > 2))
15841584
{
15851585
fail(regex_constants::error_collate, name_first - m_base);
15861586
return false;
@@ -3112,7 +3112,7 @@ bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_st
31123112
// alternative then that's an error:
31133113
//
31143114
if((this->m_alt_insert_point == static_cast<std::ptrdiff_t>(this->m_pdata->m_data.size()))
3115-
&& m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start)
3115+
&& (!m_alt_jumps.empty()) && (m_alt_jumps.back() > last_paren_start)
31163116
&&
31173117
!(
31183118
((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group)
@@ -3127,7 +3127,7 @@ bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_st
31273127
//
31283128
// Fix up our alternatives:
31293129
//
3130-
while(m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start))
3130+
while((!m_alt_jumps.empty()) && (m_alt_jumps.back() > last_paren_start))
31313131
{
31323132
//
31333133
// fix up the jump to point to the end of the states

include/boost/regex/v4/cpp_regex_traits.hpp

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
#include <boost/regex/pending/object_cache.hpp>
4242
#endif
4343

44-
#include <istream>
45-
#include <ios>
4644
#include <climits>
45+
#include <ios>
46+
#include <istream>
4747

4848
#ifdef BOOST_MSVC
4949
#pragma warning(push)
@@ -89,9 +89,9 @@ class parser_buf : public ::std::basic_streambuf<charT, traits>
8989
parser_buf() : base_type() { setbuf(0, 0); }
9090
const charT* getnext() { return this->gptr(); }
9191
protected:
92-
std::basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n);
93-
typename parser_buf<charT, traits>::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which);
94-
typename parser_buf<charT, traits>::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which);
92+
std::basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n) BOOST_OVERRIDE;
93+
typename parser_buf<charT, traits>::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which) BOOST_OVERRIDE;
94+
typename parser_buf<charT, traits>::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) BOOST_OVERRIDE;
9595
private:
9696
parser_buf& operator=(const parser_buf&);
9797
parser_buf(const parser_buf&);
@@ -225,7 +225,7 @@ std::locale cpp_regex_traits_base<charT>::imbue(const std::locale& l)
225225

226226
//
227227
// class cpp_regex_traits_char_layer:
228-
// implements methods that require specialisation for narrow characters:
228+
// implements methods that require specialization for narrow characters:
229229
//
230230
template <class charT>
231231
class cpp_regex_traits_char_layer : public cpp_regex_traits_base<charT>
@@ -281,7 +281,7 @@ void cpp_regex_traits_char_layer<charT>::init()
281281
typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
282282
#endif
283283
std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
284-
if(cat_name.size() && (this->m_pmessages != 0))
284+
if((!cat_name.empty()) && (this->m_pmessages != 0))
285285
{
286286
cat = this->m_pmessages->open(
287287
cat_name,
@@ -352,7 +352,7 @@ typename cpp_regex_traits_char_layer<charT>::string_type
352352
}
353353

354354
//
355-
// specialised version for narrow characters:
355+
// specialized version for narrow characters:
356356
//
357357
template <>
358358
class BOOST_REGEX_DECL cpp_regex_traits_char_layer<char> : public cpp_regex_traits_base<char>
@@ -566,7 +566,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
566566
#ifndef BOOST_NO_EXCEPTIONS
567567
}catch(...){}
568568
#endif
569-
while(result.size() && (charT(0) == *result.rbegin()))
569+
while((!result.empty()) && (charT(0) == *result.rbegin()))
570570
result.erase(result.size() - 1);
571571
if(result.empty())
572572
{
@@ -621,7 +621,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
621621
#else
622622
//
623623
// some implementations (Dinkumware) append unnecessary trailing \0's:
624-
while(result.size() && (charT(0) == *result.rbegin()))
624+
while((!result.empty()) && (charT(0) == *result.rbegin()))
625625
result.erase(result.size() - 1);
626626
#endif
627627
//
@@ -662,7 +662,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
662662
cpp_regex_traits_implementation<charT>::lookup_collatename(const charT* p1, const charT* p2) const
663663
{
664664
typedef typename std::map<string_type, string_type>::const_iterator iter_type;
665-
if(m_custom_collate_names.size())
665+
if(!m_custom_collate_names.empty())
666666
{
667667
iter_type pos = m_custom_collate_names.find(string_type(p1, p2));
668668
if(pos != m_custom_collate_names.end())
@@ -680,10 +680,10 @@ typename cpp_regex_traits_implementation<charT>::string_type
680680
name = lookup_default_collate_name(name);
681681
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
682682
&& !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0551)
683-
if(name.size())
683+
if(!name.empty())
684684
return string_type(name.begin(), name.end());
685685
#else
686-
if(name.size())
686+
if(!name.empty())
687687
{
688688
string_type result;
689689
typedef std::string::const_iterator iter;
@@ -709,7 +709,7 @@ void cpp_regex_traits_implementation<charT>::init()
709709
typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
710710
#endif
711711
std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
712-
if(cat_name.size() && (this->m_pmessages != 0))
712+
if((!cat_name.empty()) && (this->m_pmessages != 0))
713713
{
714714
cat = this->m_pmessages->open(
715715
cat_name,
@@ -796,7 +796,7 @@ void cpp_regex_traits_implementation<charT>::init()
796796
for(unsigned int j = 0; j <= 13; ++j)
797797
{
798798
string_type s(this->m_pmessages->get(cat, 0, j+300, null_string));
799-
if(s.size())
799+
if(!s.empty())
800800
this->m_custom_class_names[s] = masks[j];
801801
}
802802
}
@@ -864,7 +864,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
864864
::boost::BOOST_REGEX_DETAIL_NS::char_class_xdigit,
865865
};
866866
#endif
867-
if(m_custom_class_names.size())
867+
if(!m_custom_class_names.empty())
868868
{
869869
typedef typename std::map<std::basic_string<charT>, char_class_type>::const_iterator map_iter;
870870
map_iter pos = m_custom_class_names.find(string_type(p1, p2));
@@ -1129,7 +1129,6 @@ static_mutex& cpp_regex_traits<charT>::get_mutex_inst()
11291129
}
11301130
#endif
11311131

1132-
11331132
} // boost
11341133

11351134
#ifdef BOOST_MSVC
@@ -1150,5 +1149,3 @@ static_mutex& cpp_regex_traits<charT>::get_mutex_inst()
11501149
#endif
11511150

11521151
#endif
1153-
1154-

include/boost/regex/v4/perl_matcher.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ inline bool can_start(unsigned int c, const unsigned char* map, unsigned char ma
8888

8989
//
9090
// Unfortunately Rogue Waves standard library appears to have a bug
91-
// in std::basic_string::compare that results in eroneous answers
91+
// in std::basic_string::compare that results in erroneous answers
9292
// in some cases (tested with Borland C++ 5.1, Rogue Wave lib version
9393
// 0x020101) the test case was:
9494
// {39135,0} < {0xff,0}
@@ -375,7 +375,7 @@ class perl_matcher
375375
public:
376376
typedef typename traits::char_type char_type;
377377
typedef perl_matcher<BidiIterator, Allocator, traits> self_type;
378-
typedef bool (self_type::*matcher_proc_type)(void);
378+
typedef bool (self_type::*matcher_proc_type)();
379379
typedef std::size_t traits_size_type;
380380
typedef typename is_byte<char_type>::width_type width_type;
381381
typedef typename regex_iterator_traits<BidiIterator>::difference_type difference_type;
@@ -633,4 +633,3 @@ class perl_matcher
633633
#include <boost/regex/v4/perl_matcher_common.hpp>
634634

635635
#endif
636-

include/boost/regex/v4/perl_matcher_non_recursive.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
217217
bool successful_unwind = unwind(false);
218218
if((m_match_flags & match_partial) && (position == last) && (position != search_base))
219219
m_has_partial_match = true;
220-
if(false == successful_unwind)
220+
if(!successful_unwind)
221221
return m_recursive_result;
222222
}
223223
}
@@ -348,7 +348,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_repeater_count(i
348348
pmp = static_cast<saved_repeater<BidiIterator>*>(m_backup_state);
349349
--pmp;
350350
}
351-
(void) new (pmp)saved_repeater<BidiIterator>(i, s, position, this->recursion_stack.size() ? this->recursion_stack.back().idx : (INT_MIN + 3));
351+
(void) new (pmp)saved_repeater<BidiIterator>(i, s, position, this->recursion_stack.empty() ? (INT_MIN + 3) : this->recursion_stack.back().idx);
352352
m_backup_state = pmp;
353353
}
354354

@@ -705,7 +705,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow()
705705
std::size_t count = 0;
706706
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
707707
re_syntax_base* psingle = rep->next.p;
708-
// match compulsary repeats first:
708+
// match compulsory repeats first:
709709
while(count < rep->min)
710710
{
711711
pstate = psingle;
@@ -1224,7 +1224,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index,
12241224

12251225
/****************************************************************************
12261226
1227-
Unwind and associated proceedures follow, these perform what normal stack
1227+
Unwind and associated procedures follow, these perform what normal stack
12281228
unwinding does in the recursive implementation.
12291229
12301230
****************************************************************************/
@@ -1296,7 +1296,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_paren(bool have_match
12961296
{
12971297
saved_matched_paren<BidiIterator>* pmp = static_cast<saved_matched_paren<BidiIterator>*>(m_backup_state);
12981298
// restore previous values if no match was found:
1299-
if(have_match == false)
1299+
if(!have_match)
13001300
{
13011301
m_presult->set_first(pmp->sub.first, pmp->index, pmp->index == 0);
13021302
m_presult->set_second(pmp->sub.second, pmp->index, pmp->sub.matched, pmp->index == 0);
@@ -1944,5 +1944,3 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_parenthesis_push
19441944
#endif
19451945

19461946
#endif
1947-
1948-

0 commit comments

Comments
 (0)