diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-08-07 22:27:23 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-08-10 14:16:12 +0000 |
commit | 886d463061ba34802bf844133396e3706d6912a4 (patch) | |
tree | 066b86b99f71388acb07ef1a4e8fc4bb4331ceb2 /src/qml/compiler | |
parent | 18d2f78437d28987297148b63b99ceed6313a78a (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/compiler')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 5 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 3 | ||||
-rw-r--r-- | src/qml/compiler/qv4compiler.cpp | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 8e46ebf230..1c311267b9 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -152,13 +152,16 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) bool global = false; bool multiline = false; bool ignoreCase = false; + bool unicode = false; if (re->flags & CompiledData::RegExp::RegExp_Global) global = true; if (re->flags & CompiledData::RegExp::RegExp_IgnoreCase) ignoreCase = true; if (re->flags & CompiledData::RegExp::RegExp_Multiline) multiline = true; - runtimeRegularExpressions[i] = QV4::RegExp::create(engine, stringAt(re->stringIndex), ignoreCase, multiline, global); + if (re->flags & CompiledData::RegExp::RegExp_Unicode) + unicode = true; + runtimeRegularExpressions[i] = QV4::RegExp::create(engine, stringAt(re->stringIndex), ignoreCase, multiline, global, unicode); } if (data->lookupTableSize) { diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index e65c04ad69..f6face5f6e 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -139,7 +139,8 @@ struct RegExp enum Flags : unsigned int { RegExp_Global = 0x01, RegExp_IgnoreCase = 0x02, - RegExp_Multiline = 0x04 + RegExp_Multiline = 0x04, + RegExp_Unicode = 0x08 }; union { quint32 _dummy; diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index 4e902eca65..d7c7563315 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -178,6 +178,8 @@ int QV4::Compiler::JSUnitGenerator::registerRegExp(QQmlJS::AST::RegExpLiteral *r re.flags |= CompiledData::RegExp::RegExp_IgnoreCase; if (regexp->flags & QQmlJS::Lexer::RegExp_Multiline) re.flags |= CompiledData::RegExp::RegExp_Multiline; + if (regexp->flags & QQmlJS::Lexer::RegExp_Unicode) + re.flags |= CompiledData::RegExp::RegExp_Unicode; regexps.append(re); return regexps.size() - 1; |