mirror of
https://github.com/boostorg/regex.git
synced 2025-07-29 12:07:28 +02:00
Add module support and tests. (#174)
This commit is contained in:
103
module/regex.cxx
Normal file
103
module/regex.cxx
Normal file
@ -0,0 +1,103 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#if __has_include(<unicode/utypes.h>)
|
||||
|
||||
#if !defined(BOOST_REGEX_WITH_ICU)
|
||||
|
||||
#if defined(_MSC_FULL_VER)
|
||||
#pragma message "ICU headers are available but building the Regex module with ICU support is turned OFF. Build with BOOST_REGEX_WITH_ICU=1 to turn it on, or BOOST_REGEX_WITH_ICU=0 to disable this message"
|
||||
#else
|
||||
# warning "ICU headers are available but building the Regex module with ICU support is turned OFF. Build with BOOST_REGEX_WITH_ICU=1 to turn it on, or BOOST_REGEX_WITH_ICU=0 to disable this message"
|
||||
#endif
|
||||
|
||||
#elif BOOST_REGEX_WITH_ICU
|
||||
# define BOOST_REGEX_HAS_ICU_HEADERS
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && __has_include(<windows.h>)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <climits>
|
||||
#include <cctype>
|
||||
#include <cstddef>
|
||||
#include <cwctype>
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <locale>
|
||||
#include <type_traits>
|
||||
#include <ios>
|
||||
#include <istream>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <new>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
#include <limits>
|
||||
#include <cstdint>
|
||||
#include <sstream>
|
||||
#include <ios>
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
#include <mutex>
|
||||
#endif
|
||||
#include <cwctype>
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <cwchar>
|
||||
#include <cwctype>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_REGEX_HAS_ICU_HEADERS
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uchar.h>
|
||||
#include <unicode/coll.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_REGEX_AS_MODULE
|
||||
#define BOOST_REGEX_STANDALONE
|
||||
#define BOOST_REGEX_MODULE_EXPORT export
|
||||
|
||||
export module boost.regex;
|
||||
|
||||
#if defined(BOOST_REGEX_USE_STD_MODULE)
|
||||
import std;
|
||||
#elif defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_FULL_VER
|
||||
#pragma warning(disable:5244)
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview"
|
||||
#endif
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#ifdef BOOST_REGEX_HAS_ICU_HEADERS
|
||||
#include <boost/regex/icu.hpp>
|
||||
#endif
|
11
module/regex_cfind.cpp
Normal file
11
module/regex_cfind.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
module boost.regex;
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_find(perl_matcher<const char*, match_results<const char*>::allocator_type, regex::traits_type>& m)
|
||||
{
|
||||
return m.find();
|
||||
}
|
||||
|
||||
}
|
11
module/regex_cmatch.cpp
Normal file
11
module/regex_cmatch.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
module boost.regex;
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_match(perl_matcher<const char*, match_results<const char*>::allocator_type, regex::traits_type>& m)
|
||||
{
|
||||
return m.match();
|
||||
}
|
||||
|
||||
}
|
30
module/regex_create_char.cpp
Normal file
30
module/regex_create_char.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_DETAIL_NS
|
||||
#define BOOST_REGEX_DETAIL_NS re_detail_600
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::detail {
|
||||
|
||||
std::shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<char, basic_regex<char>::traits_type> >
|
||||
create_implemenation(const char* p1, const char* p2, basic_regex<char>::flag_type f, std::shared_ptr<boost::regex_traits_wrapper<basic_regex<char>::traits_type> > ptraits)
|
||||
{
|
||||
return create_implemenation<char, basic_regex<char>::flag_type, basic_regex<char>::traits_type>(p1, p2, f, ptraits);
|
||||
}
|
||||
|
||||
}
|
30
module/regex_create_wchar_t.cpp
Normal file
30
module/regex_create_wchar_t.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_DETAIL_NS
|
||||
#define BOOST_REGEX_DETAIL_NS re_detail_600
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::detail {
|
||||
|
||||
std::shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<wchar_t, basic_regex<wchar_t>::traits_type> >
|
||||
create_implemenation(const wchar_t* p1, const wchar_t* p2, basic_regex<wchar_t>::flag_type f, std::shared_ptr<boost::regex_traits_wrapper<basic_regex<wchar_t>::traits_type> > ptraits)
|
||||
{
|
||||
return create_implemenation<wchar_t, basic_regex<wchar_t>::flag_type, basic_regex<wchar_t>::traits_type>(p1, p2, f, ptraits);
|
||||
}
|
||||
|
||||
}
|
25
module/regex_nc_sfind.cpp
Normal file
25
module/regex_nc_sfind.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_find(perl_matcher<std::string::iterator, match_results<std::string::iterator>::allocator_type, regex::traits_type>& m)
|
||||
{
|
||||
return m.find();
|
||||
}
|
||||
|
||||
}
|
25
module/regex_nc_smatch.cpp
Normal file
25
module/regex_nc_smatch.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_match(perl_matcher<std::string::iterator, match_results<std::string::iterator>::allocator_type, regex::traits_type>& m)
|
||||
{
|
||||
return m.match();
|
||||
}
|
||||
|
||||
}
|
25
module/regex_nc_wsfind.cpp
Normal file
25
module/regex_nc_wsfind.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_find(perl_matcher<std::wstring::iterator, match_results<std::wstring::iterator>::allocator_type, wregex::traits_type>& m)
|
||||
{
|
||||
return m.find();
|
||||
}
|
||||
|
||||
}
|
25
module/regex_nc_wsmatch.cpp
Normal file
25
module/regex_nc_wsmatch.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_match(perl_matcher<std::wstring::iterator, match_results<std::wstring::iterator>::allocator_type, wregex::traits_type>& m)
|
||||
{
|
||||
return m.match();
|
||||
}
|
||||
|
||||
}
|
25
module/regex_sfind.cpp
Normal file
25
module/regex_sfind.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_find(perl_matcher<std::string::const_iterator, match_results<std::string::const_iterator>::allocator_type, regex::traits_type>& m)
|
||||
{
|
||||
return m.find();
|
||||
}
|
||||
|
||||
}
|
25
module/regex_smatch.cpp
Normal file
25
module/regex_smatch.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_match(perl_matcher<std::string::const_iterator, match_results<std::string::const_iterator>::allocator_type, regex::traits_type>& m)
|
||||
{
|
||||
return m.match();
|
||||
}
|
||||
|
||||
}
|
11
module/regex_wcfind.cpp
Normal file
11
module/regex_wcfind.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
module boost.regex;
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_find(perl_matcher<const wchar_t*, match_results<const wchar_t*>::allocator_type, wregex::traits_type>& m)
|
||||
{
|
||||
return m.find();
|
||||
}
|
||||
|
||||
}
|
11
module/regex_wcmatch.cpp
Normal file
11
module/regex_wcmatch.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
module boost.regex;
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_match(perl_matcher<const wchar_t*, match_results<const wchar_t*>::allocator_type, wregex::traits_type>& m)
|
||||
{
|
||||
return m.match();
|
||||
}
|
||||
|
||||
}
|
25
module/regex_wsfind.cpp
Normal file
25
module/regex_wsfind.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_find(perl_matcher<std::wstring::const_iterator, match_results<std::wstring::const_iterator>::allocator_type, wregex::traits_type>& m)
|
||||
{
|
||||
return m.find();
|
||||
}
|
||||
|
||||
}
|
25
module/regex_wsmatch.cpp
Normal file
25
module/regex_wsmatch.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
module;
|
||||
|
||||
#if defined(__cpp_lib_modules) || (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 193833135))
|
||||
#define BOOST_REGEX_USE_STD_MODULE
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && !defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
module boost.regex;
|
||||
|
||||
#if !defined(BOOST_REGEX_USE_STD_MODULE) && defined(MSVC_EXPERIMENTAL_STD_MODULE)
|
||||
import std.core;
|
||||
#endif
|
||||
|
||||
namespace boost::re_detail_600 {
|
||||
|
||||
bool factory_match(perl_matcher<std::wstring::const_iterator, match_results<std::wstring::const_iterator>::allocator_type, wregex::traits_type>& m)
|
||||
{
|
||||
return m.match();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user