mirror of
https://github.com/boostorg/regex.git
synced 2025-07-29 03:57:27 +02:00
Remove external template instantiation.
This commit is contained in:
@ -124,10 +124,8 @@ alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ;
|
|||||||
SOURCES =
|
SOURCES =
|
||||||
c_regex_traits.cpp
|
c_regex_traits.cpp
|
||||||
cpp_regex_traits.cpp
|
cpp_regex_traits.cpp
|
||||||
cregex.cpp
|
|
||||||
fileiter.cpp
|
fileiter.cpp
|
||||||
icu.cpp
|
icu.cpp
|
||||||
instances.cpp
|
|
||||||
posix_api.cpp
|
posix_api.cpp
|
||||||
regex.cpp
|
regex.cpp
|
||||||
regex_debug.cpp
|
regex_debug.cpp
|
||||||
@ -137,8 +135,6 @@ SOURCES =
|
|||||||
w32_regex_traits.cpp
|
w32_regex_traits.cpp
|
||||||
wc_regex_traits.cpp
|
wc_regex_traits.cpp
|
||||||
wide_posix_api.cpp
|
wide_posix_api.cpp
|
||||||
winstances.cpp
|
|
||||||
usinstances.cpp ;
|
|
||||||
|
|
||||||
|
|
||||||
lib boost_regex : ../src/$(SOURCES) icu_options
|
lib boost_regex : ../src/$(SOURCES) icu_options
|
||||||
|
@ -103,43 +103,6 @@
|
|||||||
# define BOOST_REGEX_BUGGY_CTYPE_FACET
|
# define BOOST_REGEX_BUGGY_CTYPE_FACET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Intel C++ before 8.0 ends up with unresolved externals unless we turn off
|
|
||||||
* extern template support:
|
|
||||||
*/
|
|
||||||
#if defined(BOOST_INTEL) && defined(__cplusplus) && (BOOST_INTEL <= 800)
|
|
||||||
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Visual C++ doesn't support external templates with C++ extensions turned off:
|
|
||||||
*/
|
|
||||||
#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
|
|
||||||
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Oracle compiler in C++11 mode doesn't like external templates for some reason:
|
|
||||||
*/
|
|
||||||
#ifdef __SUNPRO_CC
|
|
||||||
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Shared regex lib will crash without this, frankly it looks a lot like a gcc bug:
|
|
||||||
*/
|
|
||||||
#if defined(__MINGW32__)
|
|
||||||
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Clang fails to export template instances with -fvisibility=hidden, see
|
|
||||||
* https://github.com/boostorg/regex/issues/49
|
|
||||||
*/
|
|
||||||
#ifdef __clang__
|
|
||||||
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
#endif
|
|
||||||
#ifdef __CYGWIN__
|
|
||||||
/* We get multiply defined symbols without this: */
|
|
||||||
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there isn't good enough wide character support then there will
|
* If there isn't good enough wide character support then there will
|
||||||
* be no wide character regular expressions:
|
* be no wide character regular expressions:
|
||||||
@ -198,52 +161,6 @@
|
|||||||
# define BOOST_REGEX_NO_W32
|
# define BOOST_REGEX_NO_W32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
*
|
|
||||||
* Wide character workarounds:
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* define BOOST_REGEX_HAS_OTHER_WCHAR_T when wchar_t is a native type, but the users
|
|
||||||
* code may be built with wchar_t as unsigned short: basically when we're building
|
|
||||||
* with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions
|
|
||||||
* of the non-inline functions in the library, so that users can still link to the lib,
|
|
||||||
* irrespective of whether their own code is built with /Zc:wchar_t.
|
|
||||||
* Note that this does NOT WORK with VC10 and VC14 when the C++ locale is in effect as
|
|
||||||
* the locale's <unsigned short> facets simply do not compile in that case.
|
|
||||||
* As we default to the C++ locale when compiling for the windows runtime we
|
|
||||||
* skip in this case aswell.
|
|
||||||
*/
|
|
||||||
#if defined(__cplusplus) && \
|
|
||||||
(defined(BOOST_MSVC) || defined(__ICL)) && \
|
|
||||||
!defined(BOOST_NO_INTRINSIC_WCHAR_T) && \
|
|
||||||
defined(BOOST_WINDOWS) && \
|
|
||||||
!defined(__SGI_STL_PORT) && \
|
|
||||||
!defined(_STLPORT_VERSION) && \
|
|
||||||
!defined(BOOST_RWSTD_VER) && \
|
|
||||||
((_MSC_VER < 1600) || !defined(BOOST_REGEX_USE_CPP_LOCALE)) && \
|
|
||||||
!BOOST_PLAT_WINDOWS_RUNTIME
|
|
||||||
# define BOOST_REGEX_HAS_OTHER_WCHAR_T
|
|
||||||
# ifdef BOOST_MSVC
|
|
||||||
# pragma warning(push)
|
|
||||||
# pragma warning(disable : 4251)
|
|
||||||
#if BOOST_MSVC < 1700
|
|
||||||
# pragma warning(disable : 4231)
|
|
||||||
#endif
|
|
||||||
# if BOOST_MSVC < 1600
|
|
||||||
# pragma warning(disable : 4660)
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
|
|
||||||
# include <string>
|
|
||||||
extern template class __declspec(dllimport) std::basic_string<unsigned short>;
|
|
||||||
# endif
|
|
||||||
# ifdef BOOST_MSVC
|
|
||||||
# pragma warning(pop)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
@ -506,6 +423,3 @@ BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info();
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,24 +215,6 @@ private:
|
|||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
//
|
|
||||||
// template instances:
|
|
||||||
//
|
|
||||||
#define BOOST_REGEX_CHAR_T UChar32
|
|
||||||
#undef BOOST_REGEX_TRAITS_T
|
|
||||||
#define BOOST_REGEX_TRAITS_T , icu_regex_traits
|
|
||||||
#define BOOST_REGEX_ICU_INSTANCES
|
|
||||||
#ifdef BOOST_REGEX_ICU_INSTANTIATE
|
|
||||||
# define BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#include <boost/regex/v4/instances.hpp>
|
|
||||||
#undef BOOST_REGEX_CHAR_T
|
|
||||||
#undef BOOST_REGEX_TRAITS_T
|
|
||||||
#undef BOOST_REGEX_ICU_INSTANCES
|
|
||||||
#ifdef BOOST_REGEX_INSTANTIATE
|
|
||||||
# undef BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
|
|
||||||
// types:
|
// types:
|
||||||
|
@ -1,236 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright (c) 1998-2002
|
|
||||||
* John Maddock
|
|
||||||
*
|
|
||||||
* Use, modification and distribution are subject to the
|
|
||||||
* Boost Software License, Version 1.0. (See accompanying file
|
|
||||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LOCATION: see http://www.boost.org for most recent version.
|
|
||||||
* FILE instances.cpp
|
|
||||||
* VERSION see <boost/version.hpp>
|
|
||||||
* DESCRIPTION: Defines those template instances that are placed in the
|
|
||||||
* library rather than in the users object files.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//
|
|
||||||
// note no include guard, we may include this multiple times:
|
|
||||||
//
|
|
||||||
#ifndef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
|
|
||||||
namespace boost{
|
|
||||||
|
|
||||||
//
|
|
||||||
// this header can be included multiple times, each time with
|
|
||||||
// a different character type, BOOST_REGEX_CHAR_T must be defined
|
|
||||||
// first:
|
|
||||||
//
|
|
||||||
#ifndef BOOST_REGEX_CHAR_T
|
|
||||||
# error "BOOST_REGEX_CHAR_T not defined"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BOOST_REGEX_TRAITS_T
|
|
||||||
# define BOOST_REGEX_TRAITS_T , boost::regex_traits<BOOST_REGEX_CHAR_T >
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
|
||||||
// what follows is compiler specific:
|
|
||||||
//
|
|
||||||
|
|
||||||
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC < 0x600)
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
|
||||||
# include BOOST_ABI_PREFIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifndef BOOST_REGEX_INSTANTIATE
|
|
||||||
# pragma option push -Jgx
|
|
||||||
# endif
|
|
||||||
|
|
||||||
template class BOOST_REGEX_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;
|
|
||||||
template class BOOST_REGEX_DECL match_results< const BOOST_REGEX_CHAR_T* >;
|
|
||||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
|
||||||
template class BOOST_REGEX_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifndef BOOST_REGEX_INSTANTIATE
|
|
||||||
# pragma option pop
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
|
||||||
# include BOOST_ABI_SUFFIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(BOOST_MSVC) || defined(__ICL)
|
|
||||||
|
|
||||||
# ifndef BOOST_REGEX_INSTANTIATE
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define template __extension__ extern template
|
|
||||||
# else
|
|
||||||
# if BOOST_MSVC > 1310
|
|
||||||
# define BOOST_REGEX_TEMPLATE_DECL
|
|
||||||
# endif
|
|
||||||
# define template extern template
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifndef BOOST_REGEX_TEMPLATE_DECL
|
|
||||||
# define BOOST_REGEX_TEMPLATE_DECL BOOST_REGEX_DECL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifdef BOOST_MSVC
|
|
||||||
# pragma warning(push)
|
|
||||||
# pragma warning(disable : 4251)
|
|
||||||
#if BOOST_MSVC < 1700
|
|
||||||
# pragma warning(disable : 4231)
|
|
||||||
#endif
|
|
||||||
# if BOOST_MSVC < 1600
|
|
||||||
# pragma warning(disable : 4660)
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;
|
|
||||||
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL match_results< const BOOST_REGEX_CHAR_T* >;
|
|
||||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >;
|
|
||||||
#endif
|
|
||||||
#if !(defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB <= 1))\
|
|
||||||
&& !(defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION <= 800))\
|
|
||||||
&& !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))\
|
|
||||||
&& !defined(BOOST_REGEX_ICU_INSTANCES)
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >;
|
|
||||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_matcher< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
# ifdef BOOST_MSVC
|
|
||||||
# pragma warning(pop)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef template
|
|
||||||
# undef template
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#undef BOOST_REGEX_TEMPLATE_DECL
|
|
||||||
|
|
||||||
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE)
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
|
||||||
# pragma clang diagnostic push
|
|
||||||
# if defined(__APPLE_CC__)
|
|
||||||
# if (__clang_major__ > 6)
|
|
||||||
# pragma clang diagnostic ignored "-Wkeyword-macro"
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# if (__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ > 5))
|
|
||||||
# pragma clang diagnostic ignored "-Wkeyword-macro"
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifndef BOOST_REGEX_INSTANTIATE
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define template __extension__ extern template
|
|
||||||
# else
|
|
||||||
# define template extern template
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_REGEX_ICU_INSTANCES)
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
std::locale cpp_regex_traits_base<BOOST_REGEX_CHAR_T>::imbue(const std::locale& l);
|
|
||||||
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::transform_primary(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::transform(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::lookup_collatename(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
void cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::init();
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::char_class_type
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::lookup_classname_imp(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
|
|
||||||
#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
bool cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::isctype(const BOOST_REGEX_CHAR_T c, char_class_type mask) const;
|
|
||||||
#endif
|
|
||||||
} // namespace
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
boost::intmax_t cpp_regex_traits<BOOST_REGEX_CHAR_T>::toi(const BOOST_REGEX_CHAR_T*& first, const BOOST_REGEX_CHAR_T* last, int radix)const;
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
std::string cpp_regex_traits<BOOST_REGEX_CHAR_T>::catalog_name(const std::string& name);
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
std::string& cpp_regex_traits<BOOST_REGEX_CHAR_T>::get_catalog_name_inst();
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
std::string cpp_regex_traits<BOOST_REGEX_CHAR_T>::get_catalog_name();
|
|
||||||
#ifdef BOOST_HAS_THREADS
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
static_mutex& cpp_regex_traits<BOOST_REGEX_CHAR_T>::get_mutex_inst();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template BOOST_REGEX_DECL basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >&
|
|
||||||
basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >::do_assign(
|
|
||||||
const BOOST_REGEX_CHAR_T* p1,
|
|
||||||
const BOOST_REGEX_CHAR_T* p2,
|
|
||||||
flag_type f);
|
|
||||||
template BOOST_REGEX_DECL basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >::locale_type BOOST_REGEX_CALL
|
|
||||||
basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >::imbue(locale_type l);
|
|
||||||
|
|
||||||
template BOOST_REGEX_DECL void BOOST_REGEX_CALL
|
|
||||||
match_results<const BOOST_REGEX_CHAR_T*>::maybe_assign(
|
|
||||||
const match_results<const BOOST_REGEX_CHAR_T*>& m);
|
|
||||||
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
template BOOST_REGEX_DECL void perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >::construct_init(
|
|
||||||
const basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >& e, match_flag_type f);
|
|
||||||
template BOOST_REGEX_DECL bool perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >::match();
|
|
||||||
template BOOST_REGEX_DECL bool perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >::find();
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) \
|
|
||||||
&& !defined(BOOST_REGEX_ICU_INSTANCES)\
|
|
||||||
&& !defined(__SGI_STL_PORT)\
|
|
||||||
&& !defined(_STLPORT_VERSION)
|
|
||||||
// std:basic_string<>::const_iterator instances as well:
|
|
||||||
template BOOST_REGEX_DECL void BOOST_REGEX_CALL
|
|
||||||
match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>::maybe_assign(
|
|
||||||
const match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>& m);
|
|
||||||
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
template BOOST_REGEX_DECL void perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::construct_init(
|
|
||||||
const basic_regex<BOOST_REGEX_CHAR_T>& e, match_flag_type f);
|
|
||||||
template BOOST_REGEX_DECL bool perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::match();
|
|
||||||
template BOOST_REGEX_DECL bool perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::find();
|
|
||||||
} // namespace
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifdef template
|
|
||||||
# undef template
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
#endif // BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -87,42 +87,6 @@
|
|||||||
#ifndef BOOST_REGEX_MATCHER_HPP
|
#ifndef BOOST_REGEX_MATCHER_HPP
|
||||||
#include <boost/regex/v4/perl_matcher.hpp>
|
#include <boost/regex/v4/perl_matcher.hpp>
|
||||||
#endif
|
#endif
|
||||||
//
|
|
||||||
// template instances:
|
|
||||||
//
|
|
||||||
#define BOOST_REGEX_CHAR_T char
|
|
||||||
#ifdef BOOST_REGEX_NARROW_INSTANTIATE
|
|
||||||
# define BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#include <boost/regex/v4/instances.hpp>
|
|
||||||
#undef BOOST_REGEX_CHAR_T
|
|
||||||
#ifdef BOOST_REGEX_INSTANTIATE
|
|
||||||
# undef BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BOOST_NO_WREGEX
|
|
||||||
#define BOOST_REGEX_CHAR_T wchar_t
|
|
||||||
#ifdef BOOST_REGEX_WIDE_INSTANTIATE
|
|
||||||
# define BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#include <boost/regex/v4/instances.hpp>
|
|
||||||
#undef BOOST_REGEX_CHAR_T
|
|
||||||
#ifdef BOOST_REGEX_INSTANTIATE
|
|
||||||
# undef BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(BOOST_NO_WREGEX) && defined(BOOST_REGEX_HAS_OTHER_WCHAR_T)
|
|
||||||
#define BOOST_REGEX_CHAR_T unsigned short
|
|
||||||
#ifdef BOOST_REGEX_US_INSTANTIATE
|
|
||||||
# define BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#include <boost/regex/v4/instances.hpp>
|
|
||||||
#undef BOOST_REGEX_CHAR_T
|
|
||||||
#ifdef BOOST_REGEX_INSTANTIATE
|
|
||||||
# undef BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
|
@ -200,131 +200,5 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
|
|||||||
} /* namespace */
|
} /* namespace */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
/*
|
|
||||||
* C++ high level wrapper goes here:
|
|
||||||
*/
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
namespace boost{
|
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable: 4103)
|
|
||||||
#endif
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
|
||||||
# include BOOST_ABI_PREFIX
|
|
||||||
#endif
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class RegEx;
|
|
||||||
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
|
|
||||||
class RegExData;
|
|
||||||
struct pred1;
|
|
||||||
struct pred2;
|
|
||||||
struct pred3;
|
|
||||||
struct pred4;
|
|
||||||
|
|
||||||
} /* namespace BOOST_REGEX_DETAIL_NS */
|
|
||||||
|
|
||||||
#if (defined(BOOST_MSVC) || defined(BOOST_BORLANDC)) && !defined(BOOST_DISABLE_WIN32)
|
|
||||||
typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
|
|
||||||
typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression);
|
|
||||||
typedef bool (__cdecl *FindFilesCallback)(const char* file);
|
|
||||||
#else
|
|
||||||
typedef bool (*GrepCallback)(const RegEx& expression);
|
|
||||||
typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression);
|
|
||||||
typedef bool (*FindFilesCallback)(const char* file);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class BOOST_REGEX_DECL RegEx
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
BOOST_REGEX_DETAIL_NS::RegExData* pdata;
|
|
||||||
public:
|
|
||||||
RegEx();
|
|
||||||
RegEx(const RegEx& o);
|
|
||||||
~RegEx();
|
|
||||||
explicit RegEx(const char* c, bool icase = false);
|
|
||||||
explicit RegEx(const std::string& s, bool icase = false);
|
|
||||||
RegEx& operator=(const RegEx& o);
|
|
||||||
RegEx& operator=(const char* p);
|
|
||||||
RegEx& operator=(const std::string& s){ return this->operator=(s.c_str()); }
|
|
||||||
unsigned int SetExpression(const char* p, bool icase = false);
|
|
||||||
unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
|
|
||||||
std::string Expression()const;
|
|
||||||
unsigned int error_code()const;
|
|
||||||
/*
|
|
||||||
* now matching operators:
|
|
||||||
*/
|
|
||||||
bool Match(const char* p, match_flag_type flags = match_default);
|
|
||||||
bool Match(const std::string& s, match_flag_type flags = match_default) { return Match(s.c_str(), flags); }
|
|
||||||
bool Search(const char* p, match_flag_type flags = match_default);
|
|
||||||
bool Search(const std::string& s, match_flag_type flags = match_default) { return Search(s.c_str(), flags); }
|
|
||||||
unsigned int Grep(GrepCallback cb, const char* p, match_flag_type flags = match_default);
|
|
||||||
unsigned int Grep(GrepCallback cb, const std::string& s, match_flag_type flags = match_default) { return Grep(cb, s.c_str(), flags); }
|
|
||||||
unsigned int Grep(std::vector<std::string>& v, const char* p, match_flag_type flags = match_default);
|
|
||||||
unsigned int Grep(std::vector<std::string>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
|
|
||||||
unsigned int Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags = match_default);
|
|
||||||
unsigned int Grep(std::vector<std::size_t>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
|
|
||||||
unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); }
|
|
||||||
unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
|
|
||||||
unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return FindFiles(cb, files.c_str(), recurse, flags); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string Merge(const std::string& in, const std::string& fmt,
|
|
||||||
bool copy = true, match_flag_type flags = match_default);
|
|
||||||
std::string Merge(const char* in, const char* fmt,
|
|
||||||
bool copy = true, match_flag_type flags = match_default);
|
|
||||||
|
|
||||||
std::size_t Split(std::vector<std::string>& v, std::string& s, match_flag_type flags = match_default, unsigned max_count = ~0);
|
|
||||||
/*
|
|
||||||
* now operators for returning what matched in more detail:
|
|
||||||
*/
|
|
||||||
std::size_t Position(int i = 0)const;
|
|
||||||
std::size_t Length(int i = 0)const;
|
|
||||||
bool Matched(int i = 0)const;
|
|
||||||
std::size_t Marks()const;
|
|
||||||
std::string What(int i = 0)const;
|
|
||||||
std::string operator[](int i)const { return What(i); }
|
|
||||||
|
|
||||||
static const std::size_t npos;
|
|
||||||
|
|
||||||
friend struct BOOST_REGEX_DETAIL_NS::pred1;
|
|
||||||
friend struct BOOST_REGEX_DETAIL_NS::pred2;
|
|
||||||
friend struct BOOST_REGEX_DETAIL_NS::pred3;
|
|
||||||
friend struct BOOST_REGEX_DETAIL_NS::pred4;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable: 4103)
|
|
||||||
#endif
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
|
||||||
# include BOOST_ABI_SUFFIX
|
|
||||||
#endif
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} /* namespace boost */
|
|
||||||
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* include guard */
|
#endif /* include guard */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,236 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright (c) 1998-2002
|
|
||||||
* John Maddock
|
|
||||||
*
|
|
||||||
* Use, modification and distribution are subject to the
|
|
||||||
* Boost Software License, Version 1.0. (See accompanying file
|
|
||||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LOCATION: see http://www.boost.org for most recent version.
|
|
||||||
* FILE instances.cpp
|
|
||||||
* VERSION see <boost/version.hpp>
|
|
||||||
* DESCRIPTION: Defines those template instances that are placed in the
|
|
||||||
* library rather than in the users object files.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//
|
|
||||||
// note no include guard, we may include this multiple times:
|
|
||||||
//
|
|
||||||
#ifndef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
|
|
||||||
namespace boost{
|
|
||||||
|
|
||||||
//
|
|
||||||
// this header can be included multiple times, each time with
|
|
||||||
// a different character type, BOOST_REGEX_CHAR_T must be defined
|
|
||||||
// first:
|
|
||||||
//
|
|
||||||
#ifndef BOOST_REGEX_CHAR_T
|
|
||||||
# error "BOOST_REGEX_CHAR_T not defined"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BOOST_REGEX_TRAITS_T
|
|
||||||
# define BOOST_REGEX_TRAITS_T , boost::regex_traits<BOOST_REGEX_CHAR_T >
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
|
||||||
// what follows is compiler specific:
|
|
||||||
//
|
|
||||||
|
|
||||||
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC < 0x600)
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
|
||||||
# include BOOST_ABI_PREFIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifndef BOOST_REGEX_INSTANTIATE
|
|
||||||
# pragma option push -Jgx
|
|
||||||
# endif
|
|
||||||
|
|
||||||
template class BOOST_REGEX_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;
|
|
||||||
template class BOOST_REGEX_DECL match_results< const BOOST_REGEX_CHAR_T* >;
|
|
||||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
|
||||||
template class BOOST_REGEX_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifndef BOOST_REGEX_INSTANTIATE
|
|
||||||
# pragma option pop
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
|
||||||
# include BOOST_ABI_SUFFIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(BOOST_MSVC) || defined(__ICL)
|
|
||||||
|
|
||||||
# ifndef BOOST_REGEX_INSTANTIATE
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define template __extension__ extern template
|
|
||||||
# else
|
|
||||||
# if BOOST_MSVC > 1310
|
|
||||||
# define BOOST_REGEX_TEMPLATE_DECL
|
|
||||||
# endif
|
|
||||||
# define template extern template
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifndef BOOST_REGEX_TEMPLATE_DECL
|
|
||||||
# define BOOST_REGEX_TEMPLATE_DECL BOOST_REGEX_DECL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifdef BOOST_MSVC
|
|
||||||
# pragma warning(push)
|
|
||||||
# pragma warning(disable : 4251)
|
|
||||||
#if BOOST_MSVC < 1700
|
|
||||||
# pragma warning(disable : 4231)
|
|
||||||
#endif
|
|
||||||
# if BOOST_MSVC < 1600
|
|
||||||
# pragma warning(disable : 4660)
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;
|
|
||||||
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL match_results< const BOOST_REGEX_CHAR_T* >;
|
|
||||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >;
|
|
||||||
#endif
|
|
||||||
#if !(defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB <= 1))\
|
|
||||||
&& !(defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION <= 800))\
|
|
||||||
&& !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))\
|
|
||||||
&& !defined(BOOST_REGEX_ICU_INSTANCES)
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >;
|
|
||||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
|
||||||
template class BOOST_REGEX_TEMPLATE_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_matcher< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
# ifdef BOOST_MSVC
|
|
||||||
# pragma warning(pop)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef template
|
|
||||||
# undef template
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#undef BOOST_REGEX_TEMPLATE_DECL
|
|
||||||
|
|
||||||
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE)
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
|
||||||
# pragma clang diagnostic push
|
|
||||||
# if defined(__APPLE_CC__)
|
|
||||||
# if (__clang_major__ > 6)
|
|
||||||
# pragma clang diagnostic ignored "-Wkeyword-macro"
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# if (__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ > 5))
|
|
||||||
# pragma clang diagnostic ignored "-Wkeyword-macro"
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifndef BOOST_REGEX_INSTANTIATE
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define template __extension__ extern template
|
|
||||||
# else
|
|
||||||
# define template extern template
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_REGEX_ICU_INSTANCES)
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
std::locale cpp_regex_traits_base<BOOST_REGEX_CHAR_T>::imbue(const std::locale& l);
|
|
||||||
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::transform_primary(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::transform(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::lookup_collatename(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
void cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::init();
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::char_class_type
|
|
||||||
cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::lookup_classname_imp(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
|
|
||||||
#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
bool cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::isctype(const BOOST_REGEX_CHAR_T c, char_class_type mask) const;
|
|
||||||
#endif
|
|
||||||
} // namespace
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
boost::intmax_t cpp_regex_traits<BOOST_REGEX_CHAR_T>::toi(const BOOST_REGEX_CHAR_T*& first, const BOOST_REGEX_CHAR_T* last, int radix)const;
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
std::string cpp_regex_traits<BOOST_REGEX_CHAR_T>::catalog_name(const std::string& name);
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
std::string& cpp_regex_traits<BOOST_REGEX_CHAR_T>::get_catalog_name_inst();
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
std::string cpp_regex_traits<BOOST_REGEX_CHAR_T>::get_catalog_name();
|
|
||||||
#ifdef BOOST_HAS_THREADS
|
|
||||||
template BOOST_REGEX_DECL
|
|
||||||
static_mutex& cpp_regex_traits<BOOST_REGEX_CHAR_T>::get_mutex_inst();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template BOOST_REGEX_DECL basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >&
|
|
||||||
basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >::do_assign(
|
|
||||||
const BOOST_REGEX_CHAR_T* p1,
|
|
||||||
const BOOST_REGEX_CHAR_T* p2,
|
|
||||||
flag_type f);
|
|
||||||
template BOOST_REGEX_DECL basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >::locale_type BOOST_REGEX_CALL
|
|
||||||
basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >::imbue(locale_type l);
|
|
||||||
|
|
||||||
template BOOST_REGEX_DECL void BOOST_REGEX_CALL
|
|
||||||
match_results<const BOOST_REGEX_CHAR_T*>::maybe_assign(
|
|
||||||
const match_results<const BOOST_REGEX_CHAR_T*>& m);
|
|
||||||
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
template BOOST_REGEX_DECL void perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >::construct_init(
|
|
||||||
const basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >& e, match_flag_type f);
|
|
||||||
template BOOST_REGEX_DECL bool perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >::match();
|
|
||||||
template BOOST_REGEX_DECL bool perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >::find();
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) \
|
|
||||||
&& !defined(BOOST_REGEX_ICU_INSTANCES)\
|
|
||||||
&& !defined(__SGI_STL_PORT)\
|
|
||||||
&& !defined(_STLPORT_VERSION)
|
|
||||||
// std:basic_string<>::const_iterator instances as well:
|
|
||||||
template BOOST_REGEX_DECL void BOOST_REGEX_CALL
|
|
||||||
match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>::maybe_assign(
|
|
||||||
const match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>& m);
|
|
||||||
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
template BOOST_REGEX_DECL void perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::construct_init(
|
|
||||||
const basic_regex<BOOST_REGEX_CHAR_T>& e, match_flag_type f);
|
|
||||||
template BOOST_REGEX_DECL bool perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::match();
|
|
||||||
template BOOST_REGEX_DECL bool perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::find();
|
|
||||||
} // namespace
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifdef template
|
|
||||||
# undef template
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
#endif // BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -87,43 +87,6 @@
|
|||||||
#ifndef BOOST_REGEX_MATCHER_HPP
|
#ifndef BOOST_REGEX_MATCHER_HPP
|
||||||
#include <boost/regex/v5/perl_matcher.hpp>
|
#include <boost/regex/v5/perl_matcher.hpp>
|
||||||
#endif
|
#endif
|
||||||
//
|
|
||||||
// template instances:
|
|
||||||
//
|
|
||||||
#define BOOST_REGEX_CHAR_T char
|
|
||||||
#ifdef BOOST_REGEX_NARROW_INSTANTIATE
|
|
||||||
# define BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#include <boost/regex/v5/instances.hpp>
|
|
||||||
#undef BOOST_REGEX_CHAR_T
|
|
||||||
#ifdef BOOST_REGEX_INSTANTIATE
|
|
||||||
# undef BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BOOST_NO_WREGEX
|
|
||||||
#define BOOST_REGEX_CHAR_T wchar_t
|
|
||||||
#ifdef BOOST_REGEX_WIDE_INSTANTIATE
|
|
||||||
# define BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#include <boost/regex/v5/instances.hpp>
|
|
||||||
#undef BOOST_REGEX_CHAR_T
|
|
||||||
#ifdef BOOST_REGEX_INSTANTIATE
|
|
||||||
# undef BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(BOOST_NO_WREGEX) && defined(BOOST_REGEX_HAS_OTHER_WCHAR_T)
|
|
||||||
#define BOOST_REGEX_CHAR_T unsigned short
|
|
||||||
#ifdef BOOST_REGEX_US_INSTANTIATE
|
|
||||||
# define BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#include <boost/regex/v5/instances.hpp>
|
|
||||||
#undef BOOST_REGEX_CHAR_T
|
|
||||||
#ifdef BOOST_REGEX_INSTANTIATE
|
|
||||||
# undef BOOST_REGEX_INSTANTIATE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
#ifdef BOOST_REGEX_NO_FWD
|
#ifdef BOOST_REGEX_NO_FWD
|
||||||
|
651
src/cregex.cpp
651
src/cregex.cpp
@ -1,651 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright (c) 1998-2002
|
|
||||||
* John Maddock
|
|
||||||
*
|
|
||||||
* Use, modification and distribution are subject to the
|
|
||||||
* Boost Software License, Version 1.0. (See accompanying file
|
|
||||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LOCATION: see http://www.boost.org for most recent version.
|
|
||||||
* FILE: cregex.cpp
|
|
||||||
* VERSION: see <boost/version.hpp>
|
|
||||||
* DESCRIPTION: Implements high level class boost::RexEx
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define BOOST_REGEX_SOURCE
|
|
||||||
|
|
||||||
#include <boost/regex.hpp>
|
|
||||||
#include <boost/cregex.hpp>
|
|
||||||
#if !defined(BOOST_NO_STD_STRING)
|
|
||||||
#include <cstdio>
|
|
||||||
#include <list>
|
|
||||||
#include <map>
|
|
||||||
#include <boost/regex/v4/fileiter.hpp>
|
|
||||||
typedef boost::match_flag_type match_flag_type;
|
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
#pragma warning(disable:4309)
|
|
||||||
#endif
|
|
||||||
#ifdef BOOST_INTEL
|
|
||||||
#pragma warning(disable:981 383)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost{
|
|
||||||
|
|
||||||
#ifdef BOOST_BORLANDC
|
|
||||||
#if BOOST_BORLANDC < 0x530
|
|
||||||
//
|
|
||||||
// we need to instantiate the vector classes we use
|
|
||||||
// since declaring a reference to type doesn't seem to
|
|
||||||
// do the job...
|
|
||||||
std::vector<std::size_t> inst1;
|
|
||||||
std::vector<std::string> inst2;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace{
|
|
||||||
|
|
||||||
template <class iterator>
|
|
||||||
std::string to_string(iterator i, iterator j)
|
|
||||||
{
|
|
||||||
std::string s;
|
|
||||||
while(i != j)
|
|
||||||
{
|
|
||||||
s.append(1, *i);
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string to_string(const char* i, const char* j)
|
|
||||||
{
|
|
||||||
return std::string(i, j);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
# pragma warning(push)
|
|
||||||
#pragma warning(disable:26812)
|
|
||||||
#endif
|
|
||||||
class RegExData
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum type
|
|
||||||
{
|
|
||||||
type_pc,
|
|
||||||
type_pf,
|
|
||||||
type_copy
|
|
||||||
};
|
|
||||||
regex e;
|
|
||||||
cmatch m;
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
match_results<mapfile::iterator> fm;
|
|
||||||
#endif
|
|
||||||
type t;
|
|
||||||
const char* pbase;
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
mapfile::iterator fbase;
|
|
||||||
#endif
|
|
||||||
std::map<int, std::string, std::less<int> > strings;
|
|
||||||
std::map<int, std::ptrdiff_t, std::less<int> > positions;
|
|
||||||
void update();
|
|
||||||
void clean();
|
|
||||||
RegExData() : e(), m(),
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
fm(),
|
|
||||||
#endif
|
|
||||||
t(type_copy), pbase(0),
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
fbase(),
|
|
||||||
#endif
|
|
||||||
strings(), positions() {}
|
|
||||||
};
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
# pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void RegExData::update()
|
|
||||||
{
|
|
||||||
strings.erase(strings.begin(), strings.end());
|
|
||||||
positions.erase(positions.begin(), positions.end());
|
|
||||||
if(t == type_pc)
|
|
||||||
{
|
|
||||||
for(unsigned int i = 0; i < m.size(); ++i)
|
|
||||||
{
|
|
||||||
if(m[i].matched) strings[i] = std::string(m[i].first, m[i].second);
|
|
||||||
positions[i] = m[i].matched ? m[i].first - pbase : -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(unsigned int i = 0; i < fm.size(); ++i)
|
|
||||||
{
|
|
||||||
if(fm[i].matched) strings[i] = to_string(fm[i].first, fm[i].second);
|
|
||||||
positions[i] = fm[i].matched ? fm[i].first - fbase : -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
t = type_copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RegExData::clean()
|
|
||||||
{
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
fbase = mapfile::iterator();
|
|
||||||
fm = match_results<mapfile::iterator>();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
RegEx::RegEx()
|
|
||||||
{
|
|
||||||
pdata = new BOOST_REGEX_DETAIL_NS::RegExData();
|
|
||||||
}
|
|
||||||
|
|
||||||
RegEx::RegEx(const RegEx& o)
|
|
||||||
{
|
|
||||||
pdata = new BOOST_REGEX_DETAIL_NS::RegExData(*(o.pdata));
|
|
||||||
}
|
|
||||||
|
|
||||||
RegEx::~RegEx()
|
|
||||||
{
|
|
||||||
delete pdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegEx::RegEx(const char* c, bool icase)
|
|
||||||
{
|
|
||||||
pdata = new BOOST_REGEX_DETAIL_NS::RegExData();
|
|
||||||
SetExpression(c, icase);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegEx::RegEx(const std::string& s, bool icase)
|
|
||||||
{
|
|
||||||
pdata = new BOOST_REGEX_DETAIL_NS::RegExData();
|
|
||||||
SetExpression(s.c_str(), icase);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegEx& RegEx::operator=(const RegEx& o)
|
|
||||||
{
|
|
||||||
*pdata = *(o.pdata);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegEx& RegEx::operator=(const char* p)
|
|
||||||
{
|
|
||||||
SetExpression(p, false);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int RegEx::SetExpression(const char* p, bool icase)
|
|
||||||
{
|
|
||||||
boost::uint_fast32_t f = icase ? regex::normal | regex::icase : regex::normal;
|
|
||||||
return pdata->e.set_expression(p, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int RegEx::error_code()const
|
|
||||||
{
|
|
||||||
return pdata->e.error_code();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string RegEx::Expression()const
|
|
||||||
{
|
|
||||||
return pdata->e.expression();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// now matching operators:
|
|
||||||
//
|
|
||||||
bool RegEx::Match(const char* p, match_flag_type flags)
|
|
||||||
{
|
|
||||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
|
||||||
pdata->pbase = p;
|
|
||||||
const char* end = p;
|
|
||||||
while(*end)++end;
|
|
||||||
|
|
||||||
if(regex_match(p, end, pdata->m, pdata->e, flags))
|
|
||||||
{
|
|
||||||
pdata->update();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RegEx::Search(const char* p, match_flag_type flags)
|
|
||||||
{
|
|
||||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
|
||||||
pdata->pbase = p;
|
|
||||||
const char* end = p;
|
|
||||||
while(*end)++end;
|
|
||||||
|
|
||||||
if(regex_search(p, end, pdata->m, pdata->e, flags))
|
|
||||||
{
|
|
||||||
pdata->update();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
struct pred1
|
|
||||||
{
|
|
||||||
GrepCallback cb;
|
|
||||||
RegEx* pe;
|
|
||||||
pred1(GrepCallback c, RegEx* i) : cb(c), pe(i) {}
|
|
||||||
bool operator()(const cmatch& m)
|
|
||||||
{
|
|
||||||
pe->pdata->m = m;
|
|
||||||
return cb(*pe);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
unsigned int RegEx::Grep(GrepCallback cb, const char* p, match_flag_type flags)
|
|
||||||
{
|
|
||||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
|
||||||
pdata->pbase = p;
|
|
||||||
const char* end = p;
|
|
||||||
while(*end)++end;
|
|
||||||
|
|
||||||
unsigned int result = regex_grep(BOOST_REGEX_DETAIL_NS::pred1(cb, this), p, end, pdata->e, flags);
|
|
||||||
if(result)
|
|
||||||
pdata->update();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
struct pred2
|
|
||||||
{
|
|
||||||
std::vector<std::string>& v;
|
|
||||||
RegEx* pe;
|
|
||||||
pred2(std::vector<std::string>& o, RegEx* e) : v(o), pe(e) {}
|
|
||||||
bool operator()(const cmatch& m)
|
|
||||||
{
|
|
||||||
pe->pdata->m = m;
|
|
||||||
v.push_back(std::string(m[0].first, m[0].second));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
pred2& operator=(const pred2&);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int RegEx::Grep(std::vector<std::string>& v, const char* p, match_flag_type flags)
|
|
||||||
{
|
|
||||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
|
||||||
pdata->pbase = p;
|
|
||||||
const char* end = p;
|
|
||||||
while(*end)++end;
|
|
||||||
|
|
||||||
unsigned int result = regex_grep(BOOST_REGEX_DETAIL_NS::pred2(v, this), p, end, pdata->e, flags);
|
|
||||||
if(result)
|
|
||||||
pdata->update();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
struct pred3
|
|
||||||
{
|
|
||||||
std::vector<std::size_t>& v;
|
|
||||||
const char* base;
|
|
||||||
RegEx* pe;
|
|
||||||
pred3(std::vector<std::size_t>& o, const char* pb, RegEx* p) : v(o), base(pb), pe(p) {}
|
|
||||||
bool operator()(const cmatch& m)
|
|
||||||
{
|
|
||||||
pe->pdata->m = m;
|
|
||||||
v.push_back(static_cast<std::size_t>(m[0].first - base));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
pred3& operator=(const pred3&);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
unsigned int RegEx::Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags)
|
|
||||||
{
|
|
||||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pc;
|
|
||||||
pdata->pbase = p;
|
|
||||||
const char* end = p;
|
|
||||||
while(*end)++end;
|
|
||||||
|
|
||||||
unsigned int result = regex_grep(BOOST_REGEX_DETAIL_NS::pred3(v, p, this), p, end, pdata->e, flags);
|
|
||||||
if(result)
|
|
||||||
pdata->update();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS{
|
|
||||||
struct pred4
|
|
||||||
{
|
|
||||||
GrepFileCallback cb;
|
|
||||||
RegEx* pe;
|
|
||||||
const char* file;
|
|
||||||
bool ok;
|
|
||||||
pred4(GrepFileCallback c, RegEx* i, const char* f) : cb(c), pe(i), file(f), ok(true) {}
|
|
||||||
bool operator()(const match_results<mapfile::iterator>& m)
|
|
||||||
{
|
|
||||||
pe->pdata->t = RegExData::type_pf;
|
|
||||||
pe->pdata->fm = m;
|
|
||||||
pe->pdata->update();
|
|
||||||
ok = cb(file, *pe);
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
namespace{
|
|
||||||
void BuildFileList(std::list<std::string>* pl, const char* files, bool recurse)
|
|
||||||
{
|
|
||||||
file_iterator start(files);
|
|
||||||
file_iterator end;
|
|
||||||
if(recurse)
|
|
||||||
{
|
|
||||||
// go through sub directories:
|
|
||||||
char buf[MAX_PATH];
|
|
||||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(buf, MAX_PATH, start.root()));
|
|
||||||
if(*buf == 0)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcpy_s(buf, MAX_PATH, "."));
|
|
||||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
|
|
||||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, "*"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
|
|
||||||
BOOST_REGEX_DETAIL_NS::overflow_error_if_not_zero(BOOST_REGEX_DETAIL_NS::strcat_s(buf, MAX_PATH, "*"));
|
|
||||||
}
|
|
||||||
directory_iterator dstart(buf);
|
|
||||||
directory_iterator dend;
|
|
||||||
|
|
||||||
// now get the file mask bit of "files":
|
|
||||||
const char* ptr = files;
|
|
||||||
while(*ptr) ++ptr;
|
|
||||||
while((ptr != files) && (*ptr != *directory_iterator::separator()) && (*ptr != '/'))--ptr;
|
|
||||||
if(ptr != files) ++ptr;
|
|
||||||
|
|
||||||
while(dstart != dend)
|
|
||||||
{
|
|
||||||
// Verify that sprintf will not overflow:
|
|
||||||
if(std::strlen(dstart.path()) + std::strlen(directory_iterator::separator()) + std::strlen(ptr) >= MAX_PATH)
|
|
||||||
{
|
|
||||||
// Oops overflow, skip this item:
|
|
||||||
++dstart;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
|
||||||
int r = (::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
|
|
||||||
#else
|
|
||||||
int r = (std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
|
|
||||||
#endif
|
|
||||||
if(r < 0)
|
|
||||||
{
|
|
||||||
// sprintf failed, skip this item:
|
|
||||||
++dstart;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
BuildFileList(pl, buf, recurse);
|
|
||||||
++dstart;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while(start != end)
|
|
||||||
{
|
|
||||||
pl->push_back(*start);
|
|
||||||
++start;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int RegEx::GrepFiles(GrepFileCallback cb, const char* files, bool recurse, match_flag_type flags)
|
|
||||||
{
|
|
||||||
unsigned int result = 0;
|
|
||||||
std::list<std::string> file_list;
|
|
||||||
BuildFileList(&file_list, files, recurse);
|
|
||||||
std::list<std::string>::iterator start, end;
|
|
||||||
start = file_list.begin();
|
|
||||||
end = file_list.end();
|
|
||||||
|
|
||||||
while(start != end)
|
|
||||||
{
|
|
||||||
mapfile map((*start).c_str());
|
|
||||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pf;
|
|
||||||
pdata->fbase = map.begin();
|
|
||||||
BOOST_REGEX_DETAIL_NS::pred4 pred(cb, this, (*start).c_str());
|
|
||||||
int r = regex_grep(pred, map.begin(), map.end(), pdata->e, flags);
|
|
||||||
result += r;
|
|
||||||
++start;
|
|
||||||
pdata->clean();
|
|
||||||
if(!pred.ok)
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int RegEx::FindFiles(FindFilesCallback cb, const char* files, bool recurse, match_flag_type flags)
|
|
||||||
{
|
|
||||||
unsigned int result = 0;
|
|
||||||
std::list<std::string> file_list;
|
|
||||||
BuildFileList(&file_list, files, recurse);
|
|
||||||
std::list<std::string>::iterator start, end;
|
|
||||||
start = file_list.begin();
|
|
||||||
end = file_list.end();
|
|
||||||
|
|
||||||
while(start != end)
|
|
||||||
{
|
|
||||||
mapfile map((*start).c_str());
|
|
||||||
pdata->t = BOOST_REGEX_DETAIL_NS::RegExData::type_pf;
|
|
||||||
pdata->fbase = map.begin();
|
|
||||||
|
|
||||||
if(regex_search(map.begin(), map.end(), pdata->fm, pdata->e, flags))
|
|
||||||
{
|
|
||||||
++result;
|
|
||||||
if(!cb((*start).c_str()))
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
//pdata->update();
|
|
||||||
++start;
|
|
||||||
//pdata->clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BOOST_REGEX_V3
|
|
||||||
#define regex_replace regex_merge
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string RegEx::Merge(const std::string& in, const std::string& fmt,
|
|
||||||
bool copy, match_flag_type flags)
|
|
||||||
{
|
|
||||||
std::string result;
|
|
||||||
BOOST_REGEX_DETAIL_NS::string_out_iterator<std::string> i(result);
|
|
||||||
if(!copy) flags |= format_no_copy;
|
|
||||||
regex_replace(i, in.begin(), in.end(), pdata->e, fmt.c_str(), flags);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string RegEx::Merge(const char* in, const char* fmt,
|
|
||||||
bool copy, match_flag_type flags)
|
|
||||||
{
|
|
||||||
std::string result;
|
|
||||||
if(!copy) flags |= format_no_copy;
|
|
||||||
BOOST_REGEX_DETAIL_NS::string_out_iterator<std::string> i(result);
|
|
||||||
regex_replace(i, in, in + std::strlen(in), pdata->e, fmt, flags);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t RegEx::Split(std::vector<std::string>& v,
|
|
||||||
std::string& s,
|
|
||||||
match_flag_type flags,
|
|
||||||
unsigned max_count)
|
|
||||||
{
|
|
||||||
return regex_split(std::back_inserter(v), s, pdata->e, flags, max_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// now operators for returning what matched in more detail:
|
|
||||||
//
|
|
||||||
std::size_t RegEx::Position(int i)const
|
|
||||||
{
|
|
||||||
switch(pdata->t)
|
|
||||||
{
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
|
|
||||||
return pdata->m[i].matched ? pdata->m[i].first - pdata->pbase : RegEx::npos;
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
return pdata->fm[i].matched ? pdata->fm[i].first - pdata->fbase : RegEx::npos;
|
|
||||||
#endif
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
|
|
||||||
{
|
|
||||||
std::map<int, std::ptrdiff_t, std::less<int> >::iterator pos = pdata->positions.find(i);
|
|
||||||
if(pos == pdata->positions.end())
|
|
||||||
return RegEx::npos;
|
|
||||||
return (*pos).second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RegEx::npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t RegEx::Marks()const
|
|
||||||
{
|
|
||||||
return pdata->e.mark_count();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::size_t RegEx::Length(int i)const
|
|
||||||
{
|
|
||||||
switch(pdata->t)
|
|
||||||
{
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
|
|
||||||
return pdata->m[i].matched ? pdata->m[i].second - pdata->m[i].first : RegEx::npos;
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
return pdata->fm[i].matched ? pdata->fm[i].second - pdata->fm[i].first : RegEx::npos;
|
|
||||||
#endif
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
|
|
||||||
{
|
|
||||||
std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
|
|
||||||
if(pos == pdata->strings.end())
|
|
||||||
return RegEx::npos;
|
|
||||||
return (*pos).second.size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RegEx::npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RegEx::Matched(int i)const
|
|
||||||
{
|
|
||||||
switch(pdata->t)
|
|
||||||
{
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
|
|
||||||
return pdata->m[i].matched;
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
|
|
||||||
#ifndef BOOST_REGEX_NO_FILEITER
|
|
||||||
return pdata->fm[i].matched;
|
|
||||||
#endif
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
|
|
||||||
{
|
|
||||||
std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
|
|
||||||
if(pos == pdata->strings.end())
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string RegEx::What(int i)const
|
|
||||||
{
|
|
||||||
std::string result;
|
|
||||||
switch(pdata->t)
|
|
||||||
{
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pc:
|
|
||||||
if(pdata->m[i].matched)
|
|
||||||
result.assign(pdata->m[i].first, pdata->m[i].second);
|
|
||||||
break;
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_pf:
|
|
||||||
if(pdata->m[i].matched)
|
|
||||||
result.assign(to_string(pdata->m[i].first, pdata->m[i].second));
|
|
||||||
break;
|
|
||||||
case BOOST_REGEX_DETAIL_NS::RegExData::type_copy:
|
|
||||||
{
|
|
||||||
std::map<int, std::string, std::less<int> >::iterator pos = pdata->strings.find(i);
|
|
||||||
if(pos != pdata->strings.end())
|
|
||||||
result = (*pos).second;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::size_t RegEx::npos = ~static_cast<std::size_t>(0);
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x550) && (BOOST_BORLANDC <= 0x551) && !defined(_RWSTD_COMPILE_INSTANTIATE)
|
|
||||||
//
|
|
||||||
// this is an ugly hack to work around an ugly problem:
|
|
||||||
// by default this file will produce unresolved externals during
|
|
||||||
// linking unless _RWSTD_COMPILE_INSTANTIATE is defined (Borland bug).
|
|
||||||
// However if _RWSTD_COMPILE_INSTANTIATE is defined then we get separate
|
|
||||||
// copies of basic_string's static data in the RTL and this DLL, this messes
|
|
||||||
// with basic_string's memory management and results in run-time crashes,
|
|
||||||
// Oh sweet joy of Catch 22....
|
|
||||||
//
|
|
||||||
namespace std{
|
|
||||||
template<> template<>
|
|
||||||
basic_string<char>& BOOST_REGEX_DECL
|
|
||||||
basic_string<char>::replace<const char*>(char* f1, char* f2, const char* i1, const char* i2)
|
|
||||||
{
|
|
||||||
unsigned insert_pos = f1 - begin();
|
|
||||||
unsigned remove_len = f2 - f1;
|
|
||||||
unsigned insert_len = i2 - i1;
|
|
||||||
unsigned org_size = size();
|
|
||||||
if(insert_len > remove_len)
|
|
||||||
{
|
|
||||||
append(insert_len-remove_len, ' ');
|
|
||||||
std::copy_backward(begin() + insert_pos + remove_len, begin() + org_size, end());
|
|
||||||
std::copy(i1, i2, begin() + insert_pos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::copy(begin() + insert_pos + remove_len, begin() + org_size, begin() + insert_pos + insert_len);
|
|
||||||
std::copy(i1, i2, begin() + insert_pos);
|
|
||||||
erase(size() + insert_len - remove_len);
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
template<> template<>
|
|
||||||
basic_string<wchar_t>& BOOST_REGEX_DECL
|
|
||||||
basic_string<wchar_t>::replace<const wchar_t*>(wchar_t* f1, wchar_t* f2, const wchar_t* i1, const wchar_t* i2)
|
|
||||||
{
|
|
||||||
unsigned insert_pos = f1 - begin();
|
|
||||||
unsigned remove_len = f2 - f1;
|
|
||||||
unsigned insert_len = i2 - i1;
|
|
||||||
unsigned org_size = size();
|
|
||||||
if(insert_len > remove_len)
|
|
||||||
{
|
|
||||||
append(insert_len-remove_len, ' ');
|
|
||||||
std::copy_backward(begin() + insert_pos + remove_len, begin() + org_size, end());
|
|
||||||
std::copy(i1, i2, begin() + insert_pos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::copy(begin() + insert_pos + remove_len, begin() + org_size, begin() + insert_pos + insert_len);
|
|
||||||
std::copy(i1, i2, begin() + insert_pos);
|
|
||||||
erase(size() + insert_len - remove_len);
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
} // namespace std
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -131,76 +131,6 @@ void test_deprecated(const char&, const test_regex_search_tag&)
|
|||||||
// clean up whatever:
|
// clean up whatever:
|
||||||
boost::regfreeA(&re);
|
boost::regfreeA(&re);
|
||||||
|
|
||||||
//
|
|
||||||
// now try the RegEx class:
|
|
||||||
//
|
|
||||||
if(test_info<char>::syntax_options() & ~boost::regex::icase)
|
|
||||||
return;
|
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
|
||||||
try
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
boost::RegEx e(expression, (test_info<char>::syntax_options() & boost::regex::icase) != 0);
|
|
||||||
if(e.error_code())
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << e.error_code(), char);
|
|
||||||
}
|
|
||||||
if(e.Search(search_text, test_info<char>::match_options()))
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while(results[i*2] != -2)
|
|
||||||
{
|
|
||||||
if(e.Matched(i))
|
|
||||||
{
|
|
||||||
if(results[2*i] != static_cast<int>(e.Position(i)))
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Mismatch in start of subexpression " << i << " found with the RegEx class (found " << e.Position(i) << " expected " << results[2*i] << ").", char);
|
|
||||||
}
|
|
||||||
if(results[2*i+1] != static_cast<int>(e.Position(i) + e.Length(i)))
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Mismatch in end of subexpression " << i << " found with the RegEx class (found " << e.Position(i) + e.Length(i) << " expected " << results[2*i+1] << ").", char);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(results[2*i] >= 0)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Mismatch in start of subexpression " << i << " found with the RegEx class (found " << e.Position(i) << " expected " << results[2*i] << ").", char);
|
|
||||||
}
|
|
||||||
if(results[2*i+1] >= 0)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Mismatch in end of subexpression " << i << " found with the RegEx class (found " << e.Position(i) + e.Length(i) << " expected " << results[2*i+1] << ").", char);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(results[0] >= 0)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" was not found with class RegEx.", char);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
|
||||||
catch(const boost::bad_expression& r)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Expression did not compile with RegEx class: " << r.what(), char);
|
|
||||||
}
|
|
||||||
catch(const std::runtime_error& r)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Unexpected std::runtime_error : " << r.what(), char);
|
|
||||||
}
|
|
||||||
catch(const std::exception& r)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Unexpected std::exception: " << r.what(), char);
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
BOOST_REGEX_TEST_ERROR("Unexpected exception of unknown type", char);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_deprecated(const wchar_t&, const test_regex_search_tag&)
|
void test_deprecated(const wchar_t&, const test_regex_search_tag&)
|
||||||
@ -300,46 +230,6 @@ void test_deprecated(const char&, const test_invalid_regex_tag&)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// now try the RegEx class:
|
|
||||||
//
|
|
||||||
if(test_info<char>::syntax_options() & ~boost::regex::icase)
|
|
||||||
return;
|
|
||||||
bool have_catch = false;
|
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
|
||||||
try
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
boost::RegEx e(expression, (test_info<char>::syntax_options() & boost::regex::icase) != 0);
|
|
||||||
if(e.error_code())
|
|
||||||
have_catch = true;
|
|
||||||
}
|
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
|
||||||
catch(const boost::bad_expression&)
|
|
||||||
{
|
|
||||||
have_catch = true;
|
|
||||||
}
|
|
||||||
catch(const std::runtime_error& r)
|
|
||||||
{
|
|
||||||
have_catch = true;
|
|
||||||
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << r.what(), char);
|
|
||||||
}
|
|
||||||
catch(const std::exception& r)
|
|
||||||
{
|
|
||||||
have_catch = true;
|
|
||||||
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << r.what(), char);
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
have_catch = true;
|
|
||||||
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but got an exception of unknown type instead", char);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(!have_catch)
|
|
||||||
{
|
|
||||||
// oops expected exception was not thrown:
|
|
||||||
BOOST_REGEX_TEST_ERROR("Expected an exception, but didn't find one.", char);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_deprecated(const wchar_t&, const test_invalid_regex_tag&)
|
void test_deprecated(const wchar_t&, const test_invalid_regex_tag&)
|
||||||
|
Reference in New Issue
Block a user