mirror of
https://github.com/boostorg/regex.git
synced 2025-07-19 07:12:07 +02:00
Moved static stables into the function bodies to fix a gcc on MacOS X and IMB compiler bug.
Fixed config system for dll builds - the default linkage option is now static linking. Fixed makefiles - dll builds now work. Added Misc fixes for the example programs. [SVN r19044]
This commit is contained in:
@ -376,12 +376,6 @@ private:
|
||||
// the first repeat being examined (top of linked list):
|
||||
repeater_count<BidiIterator> rep_obj;
|
||||
|
||||
// table of functions to match states:
|
||||
static const matcher_proc_type s_match_vtable[];
|
||||
// table of functions to search for matching attempt start:
|
||||
static const matcher_proc_type s_find_vtable[];
|
||||
|
||||
|
||||
#ifdef BOOST_REGEX_NON_RECURSIVE
|
||||
//
|
||||
// additional members for non-recursive version:
|
||||
@ -423,8 +417,6 @@ private:
|
||||
bool m_recursive_result;
|
||||
// how many memory blocks have we used up?:
|
||||
unsigned used_block_count;
|
||||
// table of pointers to unwind proceedures:
|
||||
static const unwind_proc_type s_unwind_table[];
|
||||
#endif
|
||||
|
||||
// these operations aren't allowed, so are declared private:
|
||||
|
@ -145,6 +145,17 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match()
|
||||
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find()
|
||||
{
|
||||
static matcher_proc_type const s_find_vtable[] =
|
||||
{
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_any,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_word,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_line,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_buf,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_prefix,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
|
||||
};
|
||||
|
||||
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||
__try{
|
||||
#endif
|
||||
@ -772,62 +783,6 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
||||
typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::matcher_proc_type const
|
||||
perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_match_vtable[] =
|
||||
{
|
||||
(&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark),
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_literal,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_start_line,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_end_line,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_wild,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_match,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_boundary,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_within_word,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_start,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_start,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_backref,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_jump,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_combining,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_soft_buffer_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_restart_continue,
|
||||
#if 0
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
|
||||
#else
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300)
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast,
|
||||
#else
|
||||
(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow),
|
||||
#endif
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat,
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
||||
typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::matcher_proc_type const
|
||||
perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_find_vtable[] =
|
||||
{
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_any,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_word,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_line,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_buf,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_prefix,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
|
||||
};
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
} // namespace boost
|
||||
|
@ -117,6 +117,36 @@ struct saved_single_repeat : public saved_state
|
||||
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_all_states()
|
||||
{
|
||||
static matcher_proc_type const s_match_vtable[] =
|
||||
{
|
||||
(&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark),
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_literal,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_start_line,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_end_line,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_wild,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_match,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_boundary,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_within_word,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_start,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_start,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_backref,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_jump,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_combining,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_soft_buffer_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_restart_continue,
|
||||
(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow),
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat,
|
||||
};
|
||||
|
||||
push_recursion_stopper();
|
||||
do{
|
||||
while(pstate)
|
||||
@ -707,6 +737,24 @@ unwinding does in the recursive implementation.
|
||||
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind(bool have_match)
|
||||
{
|
||||
static unwind_proc_type const s_unwind_table[] =
|
||||
{
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_paren,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_recursion_stopper,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_assertion,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_alt,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_repeater_counter,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_extra_block,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_greedy_single_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_slow_dot_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_fast_dot_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_char_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_short_set_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_long_set_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_non_greedy_repeat,
|
||||
};
|
||||
|
||||
m_recursive_result = have_match;
|
||||
unwind_proc_type unwinder;
|
||||
bool cont;
|
||||
@ -1182,27 +1230,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_non_greed
|
||||
return r;
|
||||
}
|
||||
|
||||
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
||||
typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_proc_type const
|
||||
perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_unwind_table[] =
|
||||
{
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_paren,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_recursion_stopper,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_assertion,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_alt,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_repeater_counter,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_extra_block,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_greedy_single_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_slow_dot_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_fast_dot_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_char_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_short_set_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_long_set_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_non_greedy_repeat,
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
|
@ -51,6 +51,36 @@ public:
|
||||
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_all_states()
|
||||
{
|
||||
static matcher_proc_type const s_match_vtable[] =
|
||||
{
|
||||
(&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark),
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_literal,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_start_line,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_end_line,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_wild,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_match,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_boundary,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_within_word,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_start,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_start,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_backref,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_jump,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_combining,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_soft_buffer_end,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_restart_continue,
|
||||
(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow),
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat,
|
||||
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat,
|
||||
};
|
||||
|
||||
if(state_count > max_state_count)
|
||||
raise_error(traits_inst, REG_ESPACE);
|
||||
while(pstate)
|
||||
|
@ -103,7 +103,6 @@ inline bool regex_search(const std::basic_string<wchar_t>& s,
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
template <class BidiIterator, class charT, class traits, class Allocator2>
|
||||
bool regex_search(BidiIterator first, BidiIterator last,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
@ -118,6 +117,8 @@ bool regex_search(BidiIterator first, BidiIterator last,
|
||||
return matcher.find();
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template <class charT, class traits, class Allocator2>
|
||||
inline bool regex_search(const charT* str,
|
||||
const reg_expression<charT, traits, Allocator2>& e,
|
||||
|
@ -25,10 +25,21 @@
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
//
|
||||
// Borland C++ Builder 6, and Visual C++ 6,
|
||||
// can't cope with the array template constructor
|
||||
// so we have a template member that will accept any type as
|
||||
// argument, and then assert that is really is an array:
|
||||
//
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
template <class BidirectionalIterator,
|
||||
template <class BidirectionalIterator,
|
||||
class charT,
|
||||
class traits,
|
||||
class Allocator>
|
||||
@ -50,13 +61,29 @@ public:
|
||||
: end(last), pre(p), flags(f){ subs.push_back(sub); }
|
||||
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
|
||||
: end(last), pre(p), subs(v), flags(f){}
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template <class T>
|
||||
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f)
|
||||
: end(last), pre(p), flags(f)
|
||||
{
|
||||
// assert that T really is an array:
|
||||
BOOST_STATIC_ASSERT(::boost::is_array<T>::value);
|
||||
const std::size_t array_size = sizeof(T) / sizeof(submatches[0]);
|
||||
for(std::size_t i = 0; i < array_size; ++i)
|
||||
{
|
||||
subs.push_back(submatches[i]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
template <std::size_t CN>
|
||||
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f)
|
||||
: end(last), pre(p), flags(f)
|
||||
{
|
||||
{
|
||||
for(std::size_t i = 0; i < CN; ++i)
|
||||
subs.push_back(submatches[i]);
|
||||
{
|
||||
subs.push_back(submatches[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -110,7 +137,7 @@ public:
|
||||
else if((last_end != end) && (subs[0] == -1))
|
||||
{
|
||||
N =-1;
|
||||
result =value_type(last_end, end);
|
||||
result = value_type(last_end, end);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -150,9 +177,19 @@ public:
|
||||
if(!pdata->init(a))
|
||||
pdata.reset();
|
||||
}
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|
||||
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template <class T>
|
||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
const T& submatches, match_flag_type m = match_default)
|
||||
: pdata(new impl(&re, b, submatches, m))
|
||||
{
|
||||
if(!pdata->init(a))
|
||||
pdata.reset();
|
||||
}
|
||||
#else
|
||||
template <std::size_t N>
|
||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
|
||||
const int (&submatches)[N], match_flag_type m = match_default)
|
||||
: pdata(new impl(&re, b, submatches, m))
|
||||
{
|
||||
|
Reference in New Issue
Block a user