This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  48f4880a3d252fa8fd86896d55c88ee90a3a04af (commit)
       via  a31c85da5ed82d913eeb71ebbbd4d51af4625380 (commit)
      from  d5dcfed6747cda9f835988bd3d02ec4b4864fc54 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=48f4880a3d252fa8fd86896d55c88ee90a3a04af
commit 48f4880a3d252fa8fd86896d55c88ee90a3a04af
Merge: d5dcfed a31c85d
Author:     Gregor Jasny <gja...@googlemail.com>
AuthorDate: Mon Nov 30 16:06:58 2015 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Mon Nov 30 16:06:58 2015 -0500

    Merge topic 'regex-explorer' into next
    
    a31c85da fixup! cmake-gui: Add regex explorer window


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a31c85da5ed82d913eeb71ebbbd4d51af4625380
commit a31c85da5ed82d913eeb71ebbbd4d51af4625380
Author:     Gregor Jasny <gja...@googlemail.com>
AuthorDate: Mon Nov 30 22:02:44 2015 +0100
Commit:     Gregor Jasny <gja...@googlemail.com>
CommitDate: Mon Nov 30 22:02:44 2015 +0100

    fixup! cmake-gui: Add regex explorer window

diff --git a/Source/QtDialog/RegexExplorer.cxx 
b/Source/QtDialog/RegexExplorer.cxx
index 04fb5fb..b583d70 100644
--- a/Source/QtDialog/RegexExplorer.cxx
+++ b/Source/QtDialog/RegexExplorer.cxx
@@ -41,7 +41,9 @@ void RegexExplorer::on_regularExpression_textChanged(const 
QString& text)
 #else
   m_regex = text.toStdString();
 #endif
-  bool validExpression = m_regexParser.compile(m_regex);
+
+  bool validExpression =
+    stripEscapes(m_regex) && m_regexParser.compile(m_regex);
   if(!validExpression)
     {
     m_regexParser.set_invalid();
@@ -115,3 +117,50 @@ void RegexExplorer::clearMatch()
   match0->clear();
   matchN->clear();
 }
+
+bool RegexExplorer::stripEscapes(std::string& source)
+{
+  const char* in = source.c_str();
+
+  std::string result;
+  result.reserve(source.size());
+
+  for(char inc = *in; inc != '\0'; inc = *++in)
+    {
+    if(inc == '\\')
+      {
+      char nextc = in[1];
+      if(nextc == 't')
+        {
+        result.append(1, '\t');
+        in++;
+        }
+      else if(nextc == 'n')
+        {
+        result.append(1, '\n');
+        in++;
+        }
+      else if(nextc == 't')
+        {
+        result.append(1, '\t');
+        in++;
+        }
+      else if(isalnum(nextc) || nextc == '\0')
+        {
+        return false;
+        }
+      else
+        {
+        result.append(1, nextc);
+        in++;
+        }
+      }
+    else
+      {
+        result.append(1, inc);
+      }
+    }
+
+    source = result;
+    return true;
+}
diff --git a/Source/QtDialog/RegexExplorer.h b/Source/QtDialog/RegexExplorer.h
index b758a08..2ac9c3e 100644
--- a/Source/QtDialog/RegexExplorer.h
+++ b/Source/QtDialog/RegexExplorer.h
@@ -35,6 +35,7 @@ private slots:
 
 private:
   static void setStatusColor(QWidget* widget, bool successful);
+  static bool stripEscapes(std::string& regex);
 
   void clearMatch();
 

-----------------------------------------------------------------------

Summary of changes:
 Source/QtDialog/RegexExplorer.cxx |   51 ++++++++++++++++++++++++++++++++++++-
 Source/QtDialog/RegexExplorer.h   |    1 +
 2 files changed, 51 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to