forked from boostorg/regex
Added possessive modifiers ++ *+ ?+ {}+.
Added support for \v and \h as character classes as per Perl-5.10. [SVN r52558]
This commit is contained in:
@ -394,7 +394,9 @@ enum
|
||||
char_class_graph=char_class_alnum|char_class_punct,
|
||||
char_class_blank=1<<9,
|
||||
char_class_word=1<<10,
|
||||
char_class_unicode=1<<11
|
||||
char_class_unicode=1<<11,
|
||||
char_class_horizontal_space=1<<12,
|
||||
char_class_vertical_space=1<<13
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -413,6 +415,8 @@ public:
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_blank = 1u << 24);
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_word = 1u << 25);
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 1u << 26);
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 1u << 27);
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 1u << 28);
|
||||
#endif
|
||||
|
||||
typedef std::basic_string<charT> string_type;
|
||||
@ -477,6 +481,10 @@ template <class charT>
|
||||
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_word;
|
||||
template <class charT>
|
||||
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_unicode;
|
||||
template <class charT>
|
||||
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_vertical;
|
||||
template <class charT>
|
||||
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_horizontal;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -688,18 +696,20 @@ void cpp_regex_traits_implementation<charT>::init()
|
||||
// Custom class names:
|
||||
//
|
||||
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
|
||||
static const char_class_type masks[14] =
|
||||
static const char_class_type masks[16] =
|
||||
{
|
||||
std::ctype<charT>::alnum,
|
||||
std::ctype<charT>::alpha,
|
||||
std::ctype<charT>::cntrl,
|
||||
std::ctype<charT>::digit,
|
||||
std::ctype<charT>::graph,
|
||||
cpp_regex_traits_implementation<charT>::mask_horizontal,
|
||||
std::ctype<charT>::lower,
|
||||
std::ctype<charT>::print,
|
||||
std::ctype<charT>::punct,
|
||||
std::ctype<charT>::space,
|
||||
std::ctype<charT>::upper,
|
||||
cpp_regex_traits_implementation<charT>::mask_vertical,
|
||||
std::ctype<charT>::xdigit,
|
||||
cpp_regex_traits_implementation<charT>::mask_blank,
|
||||
cpp_regex_traits_implementation<charT>::mask_word,
|
||||
@ -713,11 +723,13 @@ void cpp_regex_traits_implementation<charT>::init()
|
||||
::boost::re_detail::char_class_cntrl,
|
||||
::boost::re_detail::char_class_digit,
|
||||
::boost::re_detail::char_class_graph,
|
||||
::boost::re_detail::char_class_horizontal_space,
|
||||
::boost::re_detail::char_class_lower,
|
||||
::boost::re_detail::char_class_print,
|
||||
::boost::re_detail::char_class_punct,
|
||||
::boost::re_detail::char_class_space,
|
||||
::boost::re_detail::char_class_upper,
|
||||
::boost::re_detail::char_class_vertical_space,
|
||||
::boost::re_detail::char_class_xdigit,
|
||||
::boost::re_detail::char_class_blank,
|
||||
::boost::re_detail::char_class_word,
|
||||
@ -744,7 +756,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
cpp_regex_traits_implementation<charT>::lookup_classname_imp(const charT* p1, const charT* p2) const
|
||||
{
|
||||
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
|
||||
static const char_class_type masks[20] =
|
||||
static const char_class_type masks[22] =
|
||||
{
|
||||
0,
|
||||
std::ctype<char>::alnum,
|
||||
@ -754,6 +766,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
std::ctype<char>::digit,
|
||||
std::ctype<char>::digit,
|
||||
std::ctype<char>::graph,
|
||||
cpp_regex_traits_implementation<charT>::mask_horizontal,
|
||||
std::ctype<char>::lower,
|
||||
std::ctype<char>::lower,
|
||||
std::ctype<char>::print,
|
||||
@ -763,12 +776,13 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
std::ctype<char>::upper,
|
||||
cpp_regex_traits_implementation<charT>::mask_unicode,
|
||||
std::ctype<char>::upper,
|
||||
cpp_regex_traits_implementation<charT>::mask_vertical,
|
||||
std::ctype<char>::alnum | cpp_regex_traits_implementation<charT>::mask_word,
|
||||
std::ctype<char>::alnum | cpp_regex_traits_implementation<charT>::mask_word,
|
||||
std::ctype<char>::xdigit,
|
||||
};
|
||||
#else
|
||||
static const char_class_type masks[20] =
|
||||
static const char_class_type masks[22] =
|
||||
{
|
||||
0,
|
||||
::boost::re_detail::char_class_alnum,
|
||||
@ -778,6 +792,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
::boost::re_detail::char_class_digit,
|
||||
::boost::re_detail::char_class_digit,
|
||||
::boost::re_detail::char_class_graph,
|
||||
::boost::re_detail::char_class_horizontal_space,
|
||||
::boost::re_detail::char_class_lower,
|
||||
::boost::re_detail::char_class_lower,
|
||||
::boost::re_detail::char_class_print,
|
||||
@ -787,6 +802,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
::boost::re_detail::char_class_upper,
|
||||
::boost::re_detail::char_class_unicode,
|
||||
::boost::re_detail::char_class_upper,
|
||||
::boost::re_detail::char_class_vertical_space,
|
||||
::boost::re_detail::char_class_alnum | ::boost::re_detail::char_class_word,
|
||||
::boost::re_detail::char_class_alnum | ::boost::re_detail::char_class_word,
|
||||
::boost::re_detail::char_class_xdigit,
|
||||
@ -820,7 +836,9 @@ bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_t
|
||||
|| ((mask & ::boost::re_detail::char_class_xdigit) && (m_pctype->is(std::ctype<charT>::xdigit, c)))
|
||||
|| ((mask & ::boost::re_detail::char_class_blank) && (m_pctype->is(std::ctype<charT>::space, c)) && !::boost::re_detail::is_separator(c))
|
||||
|| ((mask & ::boost::re_detail::char_class_word) && (c == '_'))
|
||||
|| ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c));
|
||||
|| ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c))
|
||||
|| ((mask & ::boost::re_detail::char_class_vertical) && (is_separator(c) || (c == '\v')))
|
||||
|| ((mask & ::boost::re_detail::char_class_horizontal) && m_pctype->is(std::ctype<charT>::space, c) && !(is_separator(c) || (c == '\v')));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -930,6 +948,12 @@ public:
|
||||
&& m_pimpl->m_pctype->is(std::ctype<charT>::space, c)
|
||||
&& !re_detail::is_separator(c))
|
||||
return true;
|
||||
else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_vertical)
|
||||
&& (::boost::re_detail::is_separator(c) || (c == '\v')))
|
||||
return true;
|
||||
else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_horizontal)
|
||||
&& this->isctype(c, std::ctype<charT>::space) && !this->isctype(c, re_detail::cpp_regex_traits_implementation<charT>::mask_vertical))
|
||||
return true;
|
||||
return false;
|
||||
#else
|
||||
return m_pimpl->isctype(c, f);
|
||||
|
Reference in New Issue
Block a user