diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/libs/regex | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/libs/regex')
11 files changed, 87 insertions, 49 deletions
diff --git a/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp index da960eb..6466bc4 100644 --- a/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp +++ b/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp @@ -122,7 +122,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=1<<12, + char_class_vertical=1<<13 }; c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_classname(const char* p1, const char* p2) @@ -137,6 +139,7 @@ c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::loo char_class_digit, char_class_digit, char_class_graph, + char_class_horizontal, char_class_lower, char_class_lower, char_class_print, @@ -146,6 +149,7 @@ c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::loo char_class_upper, char_class_unicode, char_class_upper, + char_class_vertical, char_class_alnum | char_class_word, char_class_alnum | char_class_word, char_class_xdigit, @@ -176,7 +180,9 @@ bool BOOST_REGEX_CALL c_regex_traits<char>::isctype(char c, char_class_type mask || ((mask & char_class_punct) && (std::ispunct)(static_cast<unsigned char>(c))) || ((mask & char_class_xdigit) && (std::isxdigit)(static_cast<unsigned char>(c))) || ((mask & char_class_blank) && (std::isspace)(static_cast<unsigned char>(c)) && !::boost::re_detail::is_separator(c)) - || ((mask & char_class_word) && (c == '_')); + || ((mask & char_class_word) && (c == '_')) + || ((mask & char_class_vertical) && (::boost::re_detail::is_separator(c) || (c == '\v'))) + || ((mask & char_class_horizontal) && (std::isspace)(static_cast<unsigned char>(c)) && !::boost::re_detail::is_separator(c) && (c != '\v')); } c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_collatename(const char* p1, const char* p2) diff --git a/3rdParty/Boost/src/libs/regex/src/cpp_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/cpp_regex_traits.cpp index 9ed66be..1d24cc1 100644 --- a/3rdParty/Boost/src/libs/regex/src/cpp_regex_traits.cpp +++ b/3rdParty/Boost/src/libs/regex/src/cpp_regex_traits.cpp @@ -42,7 +42,7 @@ void cpp_regex_traits_char_layer<char>::init() std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1); #endif std::string cat_name(cpp_regex_traits<char>::get_catalog_name()); - if(cat_name.size()) + if(cat_name.size() && (m_pmessages != 0)) { cat = this->m_pmessages->open( cat_name, diff --git a/3rdParty/Boost/src/libs/regex/src/cregex.cpp b/3rdParty/Boost/src/libs/regex/src/cregex.cpp index fb12373..f67d371 100644 --- a/3rdParty/Boost/src/libs/regex/src/cregex.cpp +++ b/3rdParty/Boost/src/libs/regex/src/cregex.cpp @@ -563,11 +563,7 @@ std::string RegEx::What(int i)const return result; } -#ifdef BOOST_HAS_LONG_LONG -const std::size_t RegEx::npos = static_cast<std::size_t>(~0ULL); -#else -const std::size_t RegEx::npos = static_cast<std::size_t>(~0UL); -#endif +const std::size_t RegEx::npos = ~static_cast<std::size_t>(0); } // namespace boost diff --git a/3rdParty/Boost/src/libs/regex/src/fileiter.cpp b/3rdParty/Boost/src/libs/regex/src/fileiter.cpp index 7d9c7f8..ff1d111 100644 --- a/3rdParty/Boost/src/libs/regex/src/fileiter.cpp +++ b/3rdParty/Boost/src/libs/regex/src/fileiter.cpp @@ -258,11 +258,22 @@ void mapfile::lock(pointer* node)const *p = 0; *(reinterpret_cast<int*>(*node)) = 1; } - std::fseek(hfile, (node - _first) * buf_size, SEEK_SET); - if(node == _last - 1) - std::fread(*node + sizeof(int), _size % buf_size, 1, hfile); - else - std::fread(*node + sizeof(int), buf_size, 1, hfile); + + std::size_t read_size = 0; + int read_pos = std::fseek(hfile, (node - _first) * buf_size, SEEK_SET); + + if(0 == read_pos && node == _last - 1) + read_size = std::fread(*node + sizeof(int), _size % buf_size, 1, hfile); + else + read_size = std::fread(*node + sizeof(int), buf_size, 1, hfile); +#ifndef BOOST_NO_EXCEPTIONS + if((read_size == 0) || (std::ferror(hfile))) + { + throw std::runtime_error("Unable to read file."); + } +#else + BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0)); +#endif } else { diff --git a/3rdParty/Boost/src/libs/regex/src/icu.cpp b/3rdParty/Boost/src/libs/regex/src/icu.cpp index e06c317..a815e91 100644 --- a/3rdParty/Boost/src/libs/regex/src/icu.cpp +++ b/3rdParty/Boost/src/libs/regex/src/icu.cpp @@ -101,6 +101,8 @@ const icu_regex_traits::char_class_type icu_regex_traits::mask_underscore = icu_ const icu_regex_traits::char_class_type icu_regex_traits::mask_unicode = icu_regex_traits::char_class_type(1) << offset_unicode; const icu_regex_traits::char_class_type icu_regex_traits::mask_any = icu_regex_traits::char_class_type(1) << offset_any; const icu_regex_traits::char_class_type icu_regex_traits::mask_ascii = icu_regex_traits::char_class_type(1) << offset_ascii; +const icu_regex_traits::char_class_type icu_regex_traits::mask_horizontal = icu_regex_traits::char_class_type(1) << offset_horizontal; +const icu_regex_traits::char_class_type icu_regex_traits::mask_vertical = icu_regex_traits::char_class_type(1) << offset_vertical; icu_regex_traits::char_class_type icu_regex_traits::lookup_icu_mask(const ::UChar32* p1, const ::UChar32* p2) { @@ -370,6 +372,7 @@ icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_ U_GC_ND_MASK, U_GC_ND_MASK, (0x3FFFFFFFu) & ~(U_GC_CC_MASK | U_GC_CF_MASK | U_GC_CS_MASK | U_GC_CN_MASK | U_GC_Z_MASK), + mask_horizontal, U_GC_LL_MASK, U_GC_LL_MASK, ~(U_GC_C_MASK), @@ -379,6 +382,7 @@ icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_ U_GC_LU_MASK, mask_unicode, U_GC_LU_MASK, + mask_vertical, char_class_type(U_GC_L_MASK | U_GC_ND_MASK | U_GC_MN_MASK) | mask_underscore, char_class_type(U_GC_L_MASK | U_GC_ND_MASK | U_GC_MN_MASK) | mask_underscore, char_class_type(U_GC_ND_MASK) | mask_xdigit, @@ -487,6 +491,10 @@ bool icu_regex_traits::isctype(char_type c, char_class_type f) const return true; if(((f & mask_ascii) != 0) && (c <= 0x7F)) return true; + if(((f & mask_vertical) != 0) && (::boost::re_detail::is_separator(c) || (c == static_cast<char_type>('\v')) || (m == U_GC_ZL_MASK) || (m == U_GC_ZP_MASK))) + return true; + if(((f & mask_horizontal) != 0) && !::boost::re_detail::is_separator(c) && u_isspace(c) && (c != static_cast<char_type>('\v'))) + return true; return false; } diff --git a/3rdParty/Boost/src/libs/regex/src/posix_api.cpp b/3rdParty/Boost/src/libs/regex/src/posix_api.cpp index 1564ced..37ed422 100644 --- a/3rdParty/Boost/src/libs/regex/src/posix_api.cpp +++ b/3rdParty/Boost/src/libs/regex/src/posix_api.cpp @@ -58,6 +58,7 @@ const char* names[] = { "REG_EMPTY", "REG_ECOMPLEXITY", "REG_ESTACK", + "REG_E_PERL", "REG_E_UNKNOWN", }; } // namespace diff --git a/3rdParty/Boost/src/libs/regex/src/regex_traits_defaults.cpp b/3rdParty/Boost/src/libs/regex/src/regex_traits_defaults.cpp index 8f76c09..31b7918 100644 --- a/3rdParty/Boost/src/libs/regex/src/regex_traits_defaults.cpp +++ b/3rdParty/Boost/src/libs/regex/src/regex_traits_defaults.cpp @@ -100,6 +100,9 @@ BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants "p", "P", "N", + "g", + "K", + "R", }; return ((n >= (sizeof(messages) / sizeof(messages[1]))) ? "" : messages[n]); @@ -108,30 +111,31 @@ BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n) { static const char* const s_default_error_messages[] = { - "Success", /* REG_NOERROR */ - "No match", /* REG_NOMATCH */ - "Invalid regular expression", /* REG_BADPAT */ - "Invalid collation character", /* REG_ECOLLATE */ - "Invalid character class name", /* REG_ECTYPE */ - "Invalid or trailing backslash", /* REG_EESCAPE */ - "Invalid back reference", /* REG_ESUBREG */ - "Unmatched [ or [^", /* REG_EBRACK */ - "Unmatched ( or \\(", /* REG_EPAREN */ - "Unmatched { or \\{", /* REG_EBRACE */ - "Invalid content of repeat range", /* REG_BADBR */ - "Invalid range end", /* REG_ERANGE */ - "Memory exhausted", /* REG_ESPACE */ - "Invalid preceding regular expression", /* REG_BADRPT */ - "Premature end of regular expression", /* REG_EEND */ - "Regular expression too big", /* REG_ESIZE */ - "Unmatched ) or \\)", /* REG_ERPAREN */ - "Empty expression", /* REG_EMPTY */ - "Complexity requirements exceeded", /* REG_ECOMPLEXITY */ - "Out of stack space", /* REG_ESTACK */ - "Unknown error", /* REG_E_UNKNOWN */ - "", - "", - "", + "Success", /* REG_NOERROR 0 error_ok */ + "No match", /* REG_NOMATCH 1 error_no_match */ + "Invalid regular expression.", /* REG_BADPAT 2 error_bad_pattern */ + "Invalid collation character.", /* REG_ECOLLATE 3 error_collate */ + "Invalid character class name, collating name, or character range.", /* REG_ECTYPE 4 error_ctype */ + "Invalid or unterminated escape sequence.", /* REG_EESCAPE 5 error_escape */ + "Invalid back reference: specified capturing group does not exist.", /* REG_ESUBREG 6 error_backref */ + "Unmatched [ or [^ in character class declaration.", /* REG_EBRACK 7 error_brack */ + "Unmatched marking parenthesis ( or \\(.", /* REG_EPAREN 8 error_paren */ + "Unmatched quantified repeat operator { or \\{.", /* REG_EBRACE 9 error_brace */ + "Invalid content of repeat range.", /* REG_BADBR 10 error_badbrace */ + "Invalid range end in character class", /* REG_ERANGE 11 error_range */ + "Out of memory.", /* REG_ESPACE 12 error_space NOT USED */ + "Invalid preceding regular expression prior to repetition operator.", /* REG_BADRPT 13 error_badrepeat */ + "Premature end of regular expression", /* REG_EEND 14 error_end NOT USED */ + "Regular expression is too large.", /* REG_ESIZE 15 error_size NOT USED */ + "Unmatched ) or \\)", /* REG_ERPAREN 16 error_right_paren NOT USED */ + "Empty regular expression.", /* REG_EMPTY 17 error_empty */ + "The complexity of matching the regular expression exceeded predefined bounds. " + "Try refactoring the regular expression to make each choice made by the state machine unambiguous. " + "This exception is thrown to prevent \"eternal\" matches that take an " + "indefinite period time to locate.", /* REG_ECOMPLEXITY 18 error_complexity */ + "Ran out of stack space trying to match the regular expression.", /* REG_ESTACK 19 error_stack */ + "Invalid or unterminated Perl (?...) sequence.", /* REG_E_PERL 20 error_perl */ + "Unknown error.", /* REG_E_UNKNOWN 21 error_unknown */ }; return (n > ::boost::regex_constants::error_unknown) ? s_default_error_messages[ ::boost::regex_constants::error_unknown] : s_default_error_messages[n]; @@ -375,14 +379,14 @@ BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_defaul regex_constants::escape_type_not_class, /*H*/ regex_constants::escape_type_not_class, /*I*/ regex_constants::escape_type_not_class, /*J*/ - regex_constants::escape_type_not_class, /*K*/ + regex_constants::escape_type_reset_start_mark, /*K*/ regex_constants::escape_type_not_class, /*L*/ regex_constants::escape_type_not_class, /*M*/ regex_constants::escape_type_named_char, /*N*/ regex_constants::escape_type_not_class, /*O*/ regex_constants::escape_type_not_property, /*P*/ regex_constants::escape_type_Q, /*Q*/ - regex_constants::escape_type_not_class, /*R*/ + regex_constants::escape_type_line_ending, /*R*/ regex_constants::escape_type_not_class, /*S*/ regex_constants::escape_type_not_class, /*T*/ regex_constants::escape_type_not_class, /*U*/ @@ -403,11 +407,11 @@ BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_defaul regex_constants::escape_type_class, /*d*/ regex_constants::escape_type_e, /*e*/ regex_constants::escape_type_control_f, /*f*/ - regex_constants::escape_type_class, /*g*/ + regex_constants::escape_type_extended_backref, /*g*/ regex_constants::escape_type_class, /*h*/ regex_constants::escape_type_class, /*i*/ regex_constants::escape_type_class, /*j*/ - regex_constants::escape_type_class, /*k*/ + regex_constants::escape_type_extended_backref, /*k*/ regex_constants::escape_type_class, /*l*/ regex_constants::escape_type_class, /*m*/ regex_constants::escape_type_control_n, /*n*/ @@ -534,7 +538,7 @@ BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_synta regex_constants::syntax_dollar, /*$*/ regex_constants::syntax_char, /*%*/ regex_constants::syntax_char, /*&*/ - regex_constants::syntax_char, /*'*/ + regex_constants::escape_type_end_buffer, /*'*/ regex_constants::syntax_open_mark, /*(*/ regex_constants::syntax_close_mark, /*)*/ regex_constants::syntax_star, /***/ diff --git a/3rdParty/Boost/src/libs/regex/src/static_mutex.cpp b/3rdParty/Boost/src/libs/regex/src/static_mutex.cpp index cef7678..d14feb1 100644 --- a/3rdParty/Boost/src/libs/regex/src/static_mutex.cpp +++ b/3rdParty/Boost/src/libs/regex/src/static_mutex.cpp @@ -124,7 +124,7 @@ void scoped_static_mutex_lock::unlock() boost::recursive_mutex* static_mutex::m_pmutex = 0; boost::once_flag static_mutex::m_once = BOOST_ONCE_INIT; -extern "C" BOOST_REGEX_DECL void free_static_mutex() +extern "C" BOOST_REGEX_DECL void boost_regex_free_static_mutex() { delete static_mutex::m_pmutex; static_mutex::m_pmutex = 0; @@ -133,7 +133,7 @@ extern "C" BOOST_REGEX_DECL void free_static_mutex() void static_mutex::init() { m_pmutex = new boost::recursive_mutex(); - int r = atexit(free_static_mutex); + int r = atexit(boost_regex_free_static_mutex); BOOST_ASSERT(0 == r); } @@ -157,7 +157,7 @@ void scoped_static_mutex_lock::lock() { boost::call_once(static_mutex::m_once,&static_mutex::init); if(0 == m_plock) - m_plock = new boost::recursive_mutex::scoped_lock(*static_mutex::m_pmutex, false); + m_plock = new boost::recursive_mutex::scoped_lock(*static_mutex::m_pmutex, boost::defer_lock); m_plock->lock(); m_have_lock = true; } diff --git a/3rdParty/Boost/src/libs/regex/src/usinstances.cpp b/3rdParty/Boost/src/libs/regex/src/usinstances.cpp index 5665366..44ebd28 100644 --- a/3rdParty/Boost/src/libs/regex/src/usinstances.cpp +++ b/3rdParty/Boost/src/libs/regex/src/usinstances.cpp @@ -17,13 +17,17 @@ */ #define BOOST_REGEX_SOURCE +#ifdef _MSC_VER +#pragma warning(disable:4506) // 'no definition for inline function' +#endif #include <boost/detail/workaround.hpp> #include <memory> #include <string> #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \ - && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)) + && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\ + && BOOST_WORKAROUND(BOOST_MSVC, <1600) // // This is a horrible workaround, but without declaring these symbols extern we get // duplicate symbol errors when linking if the application is built without diff --git a/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp index 3640f29..fb622b5 100644 --- a/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp +++ b/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp @@ -24,7 +24,8 @@ #include <string> #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \ - && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)) + && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\ + && BOOST_WORKAROUND(BOOST_MSVC, <1600) // // This is a horrible workaround, but without declaring these symbols extern we get // duplicate symbol errors when linking if the application is built without @@ -161,7 +162,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=1<<12, + char_class_vertical=1<<13 }; c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_classname(const wchar_t* p1, const wchar_t* p2) @@ -176,6 +179,7 @@ c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<wchar_t char_class_digit, char_class_digit, char_class_graph, + char_class_horizontal, char_class_lower, char_class_lower, char_class_print, @@ -185,6 +189,7 @@ c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<wchar_t char_class_upper, char_class_unicode, char_class_upper, + char_class_vertical, char_class_alnum | char_class_word, char_class_alnum | char_class_word, char_class_xdigit, @@ -216,7 +221,9 @@ bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::isctype(wchar_t c, char_class_typ || ((mask & char_class_xdigit) && (std::iswxdigit)(c)) || ((mask & char_class_blank) && (std::iswspace)(c) && !::boost::re_detail::is_separator(c)) || ((mask & char_class_word) && (c == '_')) - || ((mask & char_class_unicode) && (c & ~static_cast<wchar_t>(0xff))); + || ((mask & char_class_unicode) && (c & ~static_cast<wchar_t>(0xff))) + || ((mask & char_class_vertical) && (::boost::re_detail::is_separator(c) || (c == L'\v'))) + || ((mask & char_class_horizontal) && (std::iswspace)(c) && !::boost::re_detail::is_separator(c) && (c != L'\v')); } c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_collatename(const wchar_t* p1, const wchar_t* p2) diff --git a/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp b/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp index c8a9190..bdb7580 100644 --- a/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp +++ b/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp @@ -65,6 +65,7 @@ const wchar_t* wnames[] = { L"REG_EMPTY", L"REG_ECOMPLEXITY", L"REG_ESTACK", + L"REG_E_PERL", L"REG_E_UNKNOWN", }; } |