forked from boostorg/regex
Compare commits
6 Commits
overflow_f
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
09a8e172bd | |||
34762f91fb | |||
644e41ba31 | |||
51fe53f437 | |||
6d4dd63cba | |||
686a939498 |
@ -9,6 +9,8 @@ lib boost_regex : ../src/$(SOURCES).cpp
|
||||
<sysinclude>$(BOOST_ROOT)
|
||||
<define>BOOST_REGEX_NO_LIB=1
|
||||
<define>BOOST_REGEX_STATIC_LINK=1
|
||||
std::facet-support
|
||||
|
||||
:
|
||||
debug release
|
||||
;
|
||||
|
@ -21,6 +21,7 @@ rule regex-test-run ( sources + : input * )
|
||||
<define>BOOST_REGEX_NO_LIB=1
|
||||
<define>BOOST_REGEX_STATIC_LINK=1
|
||||
<threading>multi
|
||||
std::facet-support
|
||||
: # test name
|
||||
] ;
|
||||
}
|
||||
|
@ -125,8 +125,10 @@
|
||||
// If there isn't good enough wide character support then there will
|
||||
// be no wide character regular expressions:
|
||||
//
|
||||
#if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING)) && !defined(BOOST_NO_WREGEX)
|
||||
# define BOOST_NO_WREGEX
|
||||
#if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING))
|
||||
# if !defined(BOOST_NO_WREGEX)
|
||||
# define BOOST_NO_WREGEX
|
||||
# endif
|
||||
#else
|
||||
# if defined(__sgi) && defined(__SGI_STL_PORT)
|
||||
// STLPort on IRIX is misconfigured: <cwctype> does not compile
|
||||
@ -645,3 +647,4 @@ inline void pointer_construct(T* p, const T& t)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1990,6 +1990,8 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_re
|
||||
{
|
||||
case re_detail::syntax_element_startmark:
|
||||
case re_detail::syntax_element_endmark:
|
||||
if(static_cast<const re_detail::re_brace*>(dat)->index == -2)
|
||||
return regbase::restart_any;
|
||||
return probe_restart(dat->next.p);
|
||||
case re_detail::syntax_element_start_line:
|
||||
return regbase::restart_line;
|
||||
@ -2018,7 +2020,7 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_le
|
||||
if((leading_lit) && (static_cast<re_detail::re_literal*>(dat)->length > 2))
|
||||
{
|
||||
// we can do a literal search for the leading literal string
|
||||
// using Knuth-Morris-Pratt (or whatever), and only then check for
|
||||
// using Knuth-Morris-Pratt (or whatever), and only then check for
|
||||
// matches. We need a decent length string though to make it
|
||||
// worth while.
|
||||
_leading_string = reinterpret_cast<charT*>(reinterpret_cast<char*>(dat) + sizeof(re_detail::re_literal));
|
||||
@ -2066,10 +2068,14 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_le
|
||||
case re_detail::syntax_element_rep:
|
||||
if((len == 0) && (1 == fixup_leading_rep(dat->next.p, static_cast<re_detail::re_repeat*>(dat)->alt.p) ))
|
||||
{
|
||||
static_cast<re_detail::re_repeat*>(dat)->leading = true;
|
||||
static_cast<re_detail::re_repeat*>(dat)->leading = leading_lit;
|
||||
return len;
|
||||
}
|
||||
return len;
|
||||
case re_detail::syntax_element_startmark:
|
||||
if(static_cast<const re_detail::re_brace*>(dat)->index == -2)
|
||||
return 0;
|
||||
// fall through:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -2115,3 +2121,4 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fail(unsigned in
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -56,8 +56,10 @@ inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
|
||||
{ return s.compare(p); }
|
||||
inline int string_compare(const std::string& s, const char* p)
|
||||
{ return std::strcmp(s.c_str(), p); }
|
||||
# ifndef BOOST_NO_WREGEX
|
||||
inline int string_compare(const std::wstring& s, const wchar_t* p)
|
||||
{ return std::wcscmp(s.c_str(), p); }
|
||||
# endif
|
||||
# define STR_COMP(s,p) string_compare(s,p)
|
||||
#endif
|
||||
|
||||
@ -753,6 +755,15 @@ bool query_match_aux(iterator first,
|
||||
start_loop[cur_acc] = first;
|
||||
continue;
|
||||
}
|
||||
else if((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->min)
|
||||
{
|
||||
// the repeat was null, and we haven't gone round min times yet,
|
||||
// since all subsequent repeats will be null as well, just update
|
||||
// our repeat count and skip out.
|
||||
accumulators[cur_acc] = static_cast<const re_repeat*>(ptr)->min;
|
||||
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
|
||||
continue;
|
||||
}
|
||||
goto failure;
|
||||
}
|
||||
// see if we can skip the repeat:
|
||||
@ -809,6 +820,15 @@ bool query_match_aux(iterator first,
|
||||
start_loop[cur_acc] = first;
|
||||
continue;
|
||||
}
|
||||
else if((first == start_loop[cur_acc]) && accumulators[cur_acc] && ((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->min))
|
||||
{
|
||||
// the repeat was null, and we haven't gone round min times yet,
|
||||
// since all subsequent repeats will be null as well, just update
|
||||
// our repeat count and skip out.
|
||||
accumulators[cur_acc] = static_cast<const re_repeat*>(ptr)->min;
|
||||
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if we get here then neither option is allowed so fail:
|
||||
goto failure;
|
||||
@ -826,7 +846,7 @@ bool query_match_aux(iterator first,
|
||||
if(flags & match_not_eob)
|
||||
goto failure;
|
||||
iterator p(first);
|
||||
while((p != last) && traits_inst.is_separator(traits_inst.translate(*first, icase)))++p;
|
||||
while((p != last) && traits_inst.is_separator(traits_inst.translate(*p, icase)))++p;
|
||||
if(p != last)
|
||||
goto failure;
|
||||
ptr = ptr->next.p;
|
||||
@ -958,6 +978,12 @@ bool query_match_aux(iterator first,
|
||||
goto failure;
|
||||
ptr = ptr->next.p;
|
||||
continue;
|
||||
case syntax_element_backref:
|
||||
if(temp_match[static_cast<const re_brace*>(ptr)->index].first
|
||||
!= temp_match[static_cast<const re_brace*>(ptr)->index].second)
|
||||
goto failure;
|
||||
ptr = ptr->next.p;
|
||||
continue;
|
||||
default:
|
||||
goto failure;
|
||||
}
|
||||
|
@ -514,9 +514,9 @@ void BOOST_REGEX_CALL c_traits_base::do_update_ctype()
|
||||
if(std::isxdigit(i))
|
||||
class_map[i] |= char_class_xdigit;
|
||||
}
|
||||
class_map['_'] |= char_class_underscore;
|
||||
class_map[' '] |= char_class_blank;
|
||||
class_map['\t'] |= char_class_blank;
|
||||
class_map[(unsigned char)'_'] |= char_class_underscore;
|
||||
class_map[(unsigned char)' '] |= char_class_blank;
|
||||
class_map[(unsigned char)'\t'] |= char_class_blank;
|
||||
for(i = 0; i < map_size; ++i)
|
||||
{
|
||||
lower_case_map[i] = (char)std::tolower(i);
|
||||
|
@ -241,7 +241,7 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
|
||||
#endif
|
||||
for(std::size_t j = 0; j < s.size(); ++j)
|
||||
{
|
||||
syntax_map[s[j]] = (unsigned char)(i);
|
||||
syntax_map[(unsigned char)s[j]] = (unsigned char)(i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,8 +254,9 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
|
||||
// STLport users as well (gcc3.1+STLport5), so enable the
|
||||
// workaround for all STLport users...
|
||||
//
|
||||
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
#if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && !defined(BOOST_MSVC)
|
||||
using namespace std;
|
||||
using stlport::isspace;
|
||||
# define BOOST_REGEX_STD
|
||||
#else
|
||||
# define BOOST_REGEX_STD std::
|
||||
@ -878,3 +879,4 @@ std::size_t BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::strwiden(wchar_t *s1, st
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@ template test
|
||||
: <define>BOOST_REGEX_NO_LIB=1 # requirements
|
||||
<define>BOOST_REGEX_STATIC_LINK=1
|
||||
<threading>multi
|
||||
std::facet-support
|
||||
;
|
||||
|
||||
template regression
|
||||
|
Reference in New Issue
Block a user