OSDN Git Service

throw JSC error when the regexp is multi-line
authorIvailo Monev <xakepa10@gmail.com>
Sun, 12 Jun 2022 19:58:11 +0000 (22:58 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 12 Jun 2022 19:58:11 +0000 (22:58 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/3rdparty/javascriptcore/runtime/RegExp.cpp

index 471e4e4..d167d8e 100644 (file)
@@ -90,10 +90,14 @@ void RegExp::compile()
     m_constructionError.clear();
     m_numSubpatterns = 0;
 
+    if (multiline()) {
+        m_constructionError = "Multi-line not implemented";
+        return;
+    }
     Qt::CaseSensitivity regexOptions = Qt::CaseSensitive;
-    if (ignoreCase())
+    if (ignoreCase()) {
         regexOptions = Qt::CaseInsensitive;
-
+    }
     m_regExp = QRegExp(QString(m_pattern), regexOptions);
     if (!m_regExp.isValid()) {
         m_constructionError = m_regExp.errorString().toLatin1();
@@ -114,11 +118,6 @@ int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
 
     if (isValid()) {
         const QString qstring(s);
-#if 0
-        if (multiline()) {
-            // TODO: split lines and match
-        }
-#endif
         const bool didmatch = (m_regExp.indexIn(qstring, startOffset) != -1);
 
         if (!didmatch) {