mirror of
https://github.com/boostorg/regex.git
synced 2025-07-15 13:26:38 +02:00
Hopefully fixed some minor bugs:
added missing typesnames. Changed iterator to Iterator to hopefully keep aCC happy. [SVN r14020]
This commit is contained in:
@ -636,6 +636,7 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::move_offsets(re_
|
|||||||
template <class charT, class traits, class Allocator>
|
template <class charT, class traits, class Allocator>
|
||||||
re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot)
|
re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot)
|
||||||
{
|
{
|
||||||
|
typedef typename re_detail::is_byte<charT>::width_type width_type;
|
||||||
re_detail::jstack<traits_string_type, Allocator> singles(64, data.allocator());
|
re_detail::jstack<traits_string_type, Allocator> singles(64, data.allocator());
|
||||||
re_detail::jstack<traits_string_type, Allocator> ranges(64, data.allocator());
|
re_detail::jstack<traits_string_type, Allocator> ranges(64, data.allocator());
|
||||||
re_detail::jstack<boost::uint_fast32_t, Allocator> classes(64, data.allocator());
|
re_detail::jstack<boost::uint_fast32_t, Allocator> classes(64, data.allocator());
|
||||||
@ -646,7 +647,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
|
|||||||
data.align();
|
data.align();
|
||||||
dat->next.i = data.size();
|
dat->next.i = data.size();
|
||||||
}
|
}
|
||||||
return compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::is_byte<charT>::width_type());
|
return compile_set_aux(singles, ranges, classes, equivalents, isnot, width_type());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class charT, class traits, class Allocator>
|
template <class charT, class traits, class Allocator>
|
||||||
@ -953,11 +954,13 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
|
|||||||
if(!done)
|
if(!done)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
typedef typename re_detail::is_byte<charT>::width_type width_type;
|
||||||
|
|
||||||
re_detail::re_syntax_base* result;
|
re_detail::re_syntax_base* result;
|
||||||
if(has_digraphs)
|
if(has_digraphs)
|
||||||
result = compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::_wide_type());
|
result = compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::_wide_type());
|
||||||
else
|
else
|
||||||
result = compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::is_byte<charT>::width_type());
|
result = compile_set_aux(singles, ranges, classes, equivalents, isnot, width_type());
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// delayed throw:
|
// delayed throw:
|
||||||
if((result == 0) && (_flags & regbase::use_except))
|
if((result == 0) && (_flags & regbase::use_except))
|
||||||
|
@ -140,9 +140,9 @@ namespace{
|
|||||||
// is sent to an OutputIterator,
|
// is sent to an OutputIterator,
|
||||||
// _reg_format_aux does the actual work:
|
// _reg_format_aux does the actual work:
|
||||||
//
|
//
|
||||||
template <class OutputIterator, class iterator, class Allocator, class charT, class traits_type>
|
template <class OutputIterator, class Iterator, class Allocator, class charT, class traits_type>
|
||||||
OutputIterator BOOST_REGEX_CALL _reg_format_aux(OutputIterator out,
|
OutputIterator BOOST_REGEX_CALL _reg_format_aux(OutputIterator out,
|
||||||
const match_results<iterator, Allocator>& m,
|
const match_results<Iterator, Allocator>& m,
|
||||||
const charT*& fmt,
|
const charT*& fmt,
|
||||||
unsigned flags, const traits_type& traits_inst)
|
unsigned flags, const traits_type& traits_inst)
|
||||||
{
|
{
|
||||||
@ -175,25 +175,25 @@ OutputIterator BOOST_REGEX_CALL _reg_format_aux(OutputIterator out,
|
|||||||
switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
|
switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
|
||||||
{
|
{
|
||||||
case traits_type::syntax_start_buffer:
|
case traits_type::syntax_start_buffer:
|
||||||
oi_assign(&out, re_copy_out(out, iterator(m[-1].first), iterator(m[-1].second)));
|
oi_assign(&out, re_copy_out(out, Iterator(m[-1].first), Iterator(m[-1].second)));
|
||||||
++fmt;
|
++fmt;
|
||||||
continue;
|
continue;
|
||||||
case traits_type::syntax_end_buffer:
|
case traits_type::syntax_end_buffer:
|
||||||
oi_assign(&out, re_copy_out(out, iterator(m[-2].first), iterator(m[-2].second)));
|
oi_assign(&out, re_copy_out(out, Iterator(m[-2].first), Iterator(m[-2].second)));
|
||||||
++fmt;
|
++fmt;
|
||||||
continue;
|
continue;
|
||||||
case traits_type::syntax_digit:
|
case traits_type::syntax_digit:
|
||||||
{
|
{
|
||||||
expand_sub:
|
expand_sub:
|
||||||
unsigned int index = traits_inst.toi(fmt, fmt_end, 10);
|
unsigned int index = traits_inst.toi(fmt, fmt_end, 10);
|
||||||
oi_assign(&out, re_copy_out(out, iterator(m[index].first), iterator(m[index].second)));
|
oi_assign(&out, re_copy_out(out, Iterator(m[index].first), Iterator(m[index].second)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// anything else:
|
// anything else:
|
||||||
if(*fmt == '&')
|
if(*fmt == '&')
|
||||||
{
|
{
|
||||||
oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second)));
|
oi_assign(&out, re_copy_out(out, Iterator(m[0].first), Iterator(m[0].second)));
|
||||||
++fmt;
|
++fmt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -415,7 +415,7 @@ expand_sub:
|
|||||||
default_opt:
|
default_opt:
|
||||||
if((flags & format_sed) && (*fmt == '&'))
|
if((flags & format_sed) && (*fmt == '&'))
|
||||||
{
|
{
|
||||||
oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second)));
|
oi_assign(&out, re_copy_out(out, Iterator(m[0].first), Iterator(m[0].second)));
|
||||||
++fmt;
|
++fmt;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -448,25 +448,25 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class OutputIterator, class iterator, class charT, class Allocator, class traits_type>
|
template <class OutputIterator, class Iterator, class charT, class Allocator, class traits_type>
|
||||||
class merge_out_predicate
|
class merge_out_predicate
|
||||||
{
|
{
|
||||||
OutputIterator* out;
|
OutputIterator* out;
|
||||||
iterator* last;
|
Iterator* last;
|
||||||
const charT* fmt;
|
const charT* fmt;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
const traits_type* pt;
|
const traits_type* pt;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
merge_out_predicate(OutputIterator& o, iterator& pi, const charT* f, unsigned format_flags, const traits_type& p)
|
merge_out_predicate(OutputIterator& o, Iterator& pi, const charT* f, unsigned format_flags, const traits_type& p)
|
||||||
: out(&o), last(&pi), fmt(f), flags(format_flags), pt(&p){}
|
: out(&o), last(&pi), fmt(f), flags(format_flags), pt(&p){}
|
||||||
|
|
||||||
~merge_out_predicate() {}
|
~merge_out_predicate() {}
|
||||||
bool BOOST_REGEX_CALL operator()(const boost::match_results<iterator, Allocator>& m)
|
bool BOOST_REGEX_CALL operator()(const boost::match_results<Iterator, Allocator>& m)
|
||||||
{
|
{
|
||||||
const charT* f = fmt;
|
const charT* f = fmt;
|
||||||
if(0 == (flags & format_no_copy))
|
if(0 == (flags & format_no_copy))
|
||||||
oi_assign(out, re_copy_out(*out, iterator(m[-1].first), iterator(m[-1].second)));
|
oi_assign(out, re_copy_out(*out, Iterator(m[-1].first), Iterator(m[-1].second)));
|
||||||
oi_assign(out, _reg_format_aux(*out, m, f, flags, *pt));
|
oi_assign(out, _reg_format_aux(*out, m, f, flags, *pt));
|
||||||
*last = m[-2].first;
|
*last = m[-2].first;
|
||||||
return flags & format_first_only ? false : true;
|
return flags & format_first_only ? false : true;
|
||||||
@ -475,9 +475,9 @@ public:
|
|||||||
|
|
||||||
} // namespace re_detail
|
} // namespace re_detail
|
||||||
|
|
||||||
template <class OutputIterator, class iterator, class Allocator, class charT>
|
template <class OutputIterator, class Iterator, class Allocator, class charT>
|
||||||
OutputIterator regex_format(OutputIterator out,
|
OutputIterator regex_format(OutputIterator out,
|
||||||
const match_results<iterator, Allocator>& m,
|
const match_results<Iterator, Allocator>& m,
|
||||||
const charT* fmt,
|
const charT* fmt,
|
||||||
unsigned flags = 0
|
unsigned flags = 0
|
||||||
)
|
)
|
||||||
@ -486,9 +486,9 @@ OutputIterator regex_format(OutputIterator out,
|
|||||||
return re_detail::_reg_format_aux(out, m, fmt, flags, t);
|
return re_detail::_reg_format_aux(out, m, fmt, flags, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class OutputIterator, class iterator, class Allocator, class charT>
|
template <class OutputIterator, class Iterator, class Allocator, class charT>
|
||||||
OutputIterator regex_format(OutputIterator out,
|
OutputIterator regex_format(OutputIterator out,
|
||||||
const match_results<iterator, Allocator>& m,
|
const match_results<Iterator, Allocator>& m,
|
||||||
const std::basic_string<charT>& fmt,
|
const std::basic_string<charT>& fmt,
|
||||||
unsigned flags = 0
|
unsigned flags = 0
|
||||||
)
|
)
|
||||||
@ -498,8 +498,8 @@ OutputIterator regex_format(OutputIterator out,
|
|||||||
return re_detail::_reg_format_aux(out, m, start, flags, t);
|
return re_detail::_reg_format_aux(out, m, start, flags, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class iterator, class Allocator, class charT>
|
template <class Iterator, class Allocator, class charT>
|
||||||
std::basic_string<charT> regex_format(const match_results<iterator, Allocator>& m, const charT* fmt, unsigned flags = 0)
|
std::basic_string<charT> regex_format(const match_results<Iterator, Allocator>& m, const charT* fmt, unsigned flags = 0)
|
||||||
{
|
{
|
||||||
std::basic_string<charT> result;
|
std::basic_string<charT> result;
|
||||||
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||||
@ -507,8 +507,8 @@ std::basic_string<charT> regex_format(const match_results<iterator, Allocator>&
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class iterator, class Allocator, class charT>
|
template <class Iterator, class Allocator, class charT>
|
||||||
std::basic_string<charT> regex_format(const match_results<iterator, Allocator>& m, const std::basic_string<charT>& fmt, unsigned flags = 0)
|
std::basic_string<charT> regex_format(const match_results<Iterator, Allocator>& m, const std::basic_string<charT>& fmt, unsigned flags = 0)
|
||||||
{
|
{
|
||||||
std::basic_string<charT> result;
|
std::basic_string<charT> result;
|
||||||
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||||
@ -516,24 +516,24 @@ std::basic_string<charT> regex_format(const match_results<iterator, Allocator>&
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class OutputIterator, class iterator, class traits, class Allocator, class charT>
|
template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
|
||||||
OutputIterator regex_merge(OutputIterator out,
|
OutputIterator regex_merge(OutputIterator out,
|
||||||
iterator first,
|
Iterator first,
|
||||||
iterator last,
|
Iterator last,
|
||||||
const reg_expression<charT, traits, Allocator>& e,
|
const reg_expression<charT, traits, Allocator>& e,
|
||||||
const charT* fmt,
|
const charT* fmt,
|
||||||
unsigned int flags = match_default)
|
unsigned int flags = match_default)
|
||||||
{
|
{
|
||||||
iterator l = first;
|
Iterator l = first;
|
||||||
re_detail::merge_out_predicate<OutputIterator, iterator, charT, Allocator, traits> oi(out, l, fmt, flags, e.get_traits());
|
re_detail::merge_out_predicate<OutputIterator, Iterator, charT, Allocator, traits> oi(out, l, fmt, flags, e.get_traits());
|
||||||
regex_grep(oi, first, last, e, flags);
|
regex_grep(oi, first, last, e, flags);
|
||||||
return (flags & format_no_copy) ? out : re_detail::re_copy_out(out, l, last);
|
return (flags & format_no_copy) ? out : re_detail::re_copy_out(out, l, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class OutputIterator, class iterator, class traits, class Allocator, class charT>
|
template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
|
||||||
inline OutputIterator regex_merge(OutputIterator out,
|
inline OutputIterator regex_merge(OutputIterator out,
|
||||||
iterator first,
|
Iterator first,
|
||||||
iterator last,
|
Iterator last,
|
||||||
const reg_expression<charT, traits, Allocator>& e,
|
const reg_expression<charT, traits, Allocator>& e,
|
||||||
const std::basic_string<charT>& fmt,
|
const std::basic_string<charT>& fmt,
|
||||||
unsigned int flags = match_default)
|
unsigned int flags = match_default)
|
||||||
|
Reference in New Issue
Block a user