7#include <private/qv4mm_p.h>
14 JSC::RegExpFlags
jscFlags = JSC::NoFlags;
16 jscFlags =
static_cast<JSC::RegExpFlags
>(
flags | JSC::FlagGlobal);
18 jscFlags =
static_cast<JSC::RegExpFlags
>(
flags | JSC::FlagIgnoreCase);
20 jscFlags =
static_cast<JSC::RegExpFlags
>(
flags | JSC::FlagMultiline);
22 jscFlags =
static_cast<JSC::RegExpFlags
>(
flags | JSC::FlagUnicode);
24 jscFlags =
static_cast<JSC::RegExpFlags
>(
flags | JSC::FlagSticky);
32 re->d()->cache =
nullptr;
41 return JSC::Yarr::offsetNoMatch;
43 WTF::String
s(
string);
46 static const uint offsetJITFail = std::numeric_limits<unsigned>::max() - 1;
48 if (
priv->hasValidJITCode()) {
49 uint ret = JSC::Yarr::offsetNoMatch;
50#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
53 (
int*)matchOffsets,
buffer, 8192).start);
56 (
int*)matchOffsets).start);
58 if (
ret != offsetJITFail)
62 if (!
priv->byteCode) {
63 JSC::Yarr::ErrorCode
error = JSC::Yarr::ErrorCode::NoError;
70 priv->byteCode = JSC::Yarr::byteCompile(
72 priv->internalClass->engine->bumperPointerAllocator).release();
77 return JSC::Yarr::interpret(
byteCode(),
s.characters16(),
string.size(),
start, matchOffsets);
84 int matchedLength = matched.
size();
86 int tailPos =
position + matchedLength;
88 for (
int i = 0;
i < replacement.
size(); ++
i) {
90 if (seenDollar >= 0) {
91 if (
ch.unicode() ==
'$') {
93 }
else if (
ch.unicode() ==
'&') {
95 }
else if (
ch.unicode() ==
'`') {
97 }
else if (
ch.unicode() ==
'\'') {
99 }
else if (
ch.unicode() >=
'0' &&
ch.unicode() <=
'9') {
100 int n =
ch.unicode() -
'0';
101 if (
i + 1 < replacement.
size()) {
102 ch = replacement.
at(
i + 1);
103 if (
ch.unicode() >=
'0' &&
ch.unicode() <=
'9') {
104 n =
n*10 + (
ch.unicode() -
'0');
108 if (
n > 0 &&
n <= nCaptures) {
113 for (
int j = seenDollar;
j <=
i; ++
j)
179 JSC::Yarr::ErrorCode
error = JSC::Yarr::ErrorCode::NoError;
181 if (
error != JSC::Yarr::ErrorCode::NoError)
183 subPatternCount = yarrPattern.m_numSubpatterns;
185 if (!yarrPattern.m_containsBackreferences &&
engine->canJIT()) {
186 jitCode =
new JSC::Yarr::YarrCodeBlock;
187 JSC::VM *vm =
static_cast<JSC::VM *
>(
engine);
188 JSC::Yarr::jitCompile(yarrPattern, JSC::Yarr::Char16, vm, *jitCode);
193 if (hasValidJITCode()) {
197 byteCode = JSC::Yarr::byteCompile(yarrPattern, internalClass->engine->bumperPointerAllocator).release();
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
iterator Iterator
Qt-style synonym for QHash::iterator.
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
void set(ExecutionEngine *engine, const Value &value)
QCache< int, Employee > cache
[0]
QSet< QString >::iterator it
\qmltype Particle \inqmlmodule QtQuick.Particles
DBusConnection const char DBusError * error
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static JSC::RegExpFlags jscFlags(uint flags)
#define DEFINE_MANAGED_VTABLE(classname)
\inmodule QtCore \reentrant
QString flagsAsString() const
static QString getSubstitution(const QString &matched, const QString &str, int position, const Value *captures, int nCaptures, const QString &replacement)
static Heap::RegExp * create(ExecutionEngine *engine, const QString &pattern, uint flags=CompiledData::RegExp::RegExp_NoFlags)
JSC::Yarr::BytecodePattern * byteCode()
uint match(const QString &string, int start, uint *matchOffsets)
QString toQString() const
QML_NEARLY_ALWAYS_INLINE String * stringValue() const