|
|
|
@ -30,17 +30,21 @@
|
|
|
|
|
|
|
|
|
|
using namespace KJS;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_PCRE2POSIX
|
|
|
|
|
RegExp::UTF8SupportState RegExp::utf8Support = RegExp::Unknown;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
RegExp::RegExp(const UString &p, int f)
|
|
|
|
|
: pat(p), flgs(f), m_notEmpty(false), valid(true), buffer(0), originalPos(0)
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_PCRE2POSIX
|
|
|
|
|
// Determine whether libpcre has unicode support if need be..
|
|
|
|
|
if (utf8Support == Unknown) {
|
|
|
|
|
uint32_t supported;
|
|
|
|
|
pcre2_config(PCRE2_CONFIG_COMPILED_WIDTHS, (void*)&supported);
|
|
|
|
|
utf8Support = (supported & 0x0001) ? Supported : Unsupported;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
nrSubPatterns = 0; // determined in match() with POSIX regex.
|
|
|
|
|
|
|
|
|
@ -276,9 +280,11 @@ void RegExp::prepareMatch(const UString &s)
|
|
|
|
|
{
|
|
|
|
|
delete[] originalPos; // Just to be sure..
|
|
|
|
|
delete[] buffer;
|
|
|
|
|
#ifdef HAVE_PCRE2POSIX
|
|
|
|
|
if (utf8Support == Supported)
|
|
|
|
|
prepareUtf8(s);
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
prepareASCII(s);
|
|
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
|