aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexp.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-07 22:27:23 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-10 14:16:12 +0000
commit886d463061ba34802bf844133396e3706d6912a4 (patch)
tree066b86b99f71388acb07ef1a4e8fc4bb4331ceb2 /src/qml/jsruntime/qv4regexp.cpp
parent18d2f78437d28987297148b63b99ceed6313a78a (diff)
Enable unicode regular expressions
Add support for the 'u' flag for regular expressions. Change-Id: I409054eaa9c50183619752d14f2638f5a38c0ea7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4regexp.cpp')
-rw-r--r--src/qml/jsruntime/qv4regexp.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp
index 89fd9fc233..e562482395 100644
--- a/src/qml/jsruntime/qv4regexp.cpp
+++ b/src/qml/jsruntime/qv4regexp.cpp
@@ -70,7 +70,7 @@ uint RegExp::match(const QString &string, int start, uint *matchOffsets)
return JSC::Yarr::interpret(byteCode(), s.characters16(), string.length(), start, matchOffsets);
}
-Heap::RegExp *RegExp::create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline, bool global)
+Heap::RegExp *RegExp::create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline, bool global, bool unicode)
{
RegExpCacheKey key(pattern, ignoreCase, multiline, global);
@@ -83,7 +83,7 @@ Heap::RegExp *RegExp::create(ExecutionEngine* engine, const QString& pattern, bo
return result->d();
Scope scope(engine);
- Scoped<RegExp> result(scope, engine->memoryManager->alloc<RegExp>(engine, pattern, ignoreCase, multiline, global));
+ Scoped<RegExp> result(scope, engine->memoryManager->alloc<RegExp>(engine, pattern, ignoreCase, multiline, global, unicode));
result->d()->cache = cache;
cachedValue.set(engine, result);
@@ -91,12 +91,13 @@ Heap::RegExp *RegExp::create(ExecutionEngine* engine, const QString& pattern, bo
return result->d();
}
-void Heap::RegExp::init(ExecutionEngine *engine, const QString &pattern, bool ignoreCase, bool multiline, bool global)
+void Heap::RegExp::init(ExecutionEngine *engine, const QString &pattern, bool ignoreCase, bool multiline, bool global, bool unicode)
{
Base::init();
this->pattern = new QString(pattern);
this->ignoreCase = ignoreCase;
this->multiLine = multiline;
+ this->unicode = unicode;
this->global = global;
valid = false;
@@ -109,6 +110,8 @@ void Heap::RegExp::init(ExecutionEngine *engine, const QString &pattern, bool ig
flags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagMultiline);
if (global)
flags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagGlobal);
+ if (unicode)
+ flags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagUnicode);
JSC::Yarr::YarrPattern yarrPattern(WTF::String(pattern), flags, error);
if (error != JSC::Yarr::ErrorCode::NoError)