groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleit...@apache.org
Subject groovy git commit: GROOVY-8042 groovyConsole gets confused with a slashy string with an escaped forward slash (closes #568)
Date Wed, 28 Jun 2017 03:55:38 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 5492f9391 -> 85af40b3e


GROOVY-8042 groovyConsole gets confused with a slashy string with an escaped forward slash
(closes #568)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/85af40b3
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/85af40b3
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/85af40b3

Branch: refs/heads/master
Commit: 85af40b3e3932b7bae5ea6133a59a23e11255902
Parents: 5492f93
Author: dkhamitov <khamitov.dm@gmail.com>
Authored: Tue Jun 27 01:12:30 2017 +0300
Committer: John Wagenleitner <jwagenleitner@apache.org>
Committed: Tue Jun 27 19:38:18 2017 -0700

----------------------------------------------------------------------
 .../src/main/groovy/groovy/ui/text/GroovyFilter.java    |  2 +-
 .../test/groovy/groovy/ui/text/GroovyFilterTests.groovy | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/85af40b3/subprojects/groovy-console/src/main/groovy/groovy/ui/text/GroovyFilter.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/GroovyFilter.java b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/GroovyFilter.java
index ae3af3f..96e1eb3 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/text/GroovyFilter.java
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/text/GroovyFilter.java
@@ -57,7 +57,7 @@ public class GroovyFilter extends StructuredSyntaxDocumentFilter {
     public static final String SINGLE_QUOTES =
             "(?ms:'{3}(?!'{1,3}).*?(?:'{3}|\\z))|(?:'{1}.*?(?:'|\\z))";
 
-    public static final String SLASHY_QUOTES = "(?:/[^/*].*?/|(?ms:\\$/.*?(?:/\\$|\\z)))";
+    public static final String SLASHY_QUOTES = "(?:/[^/*].*?(?<!\\\\)/|(?ms:\\$/.*?(?:/\\$|\\z)))";
 
     public static final String DIGIT = "DIGIT";
     public static final String DECIMAL_INTEGER_LITERAL = "(?:0|[1-9](?:[_0-9]*[0-9])?)[lL]?";

http://git-wip-us.apache.org/repos/asf/groovy/blob/85af40b3/subprojects/groovy-console/src/test/groovy/groovy/ui/text/GroovyFilterTests.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/src/test/groovy/groovy/ui/text/GroovyFilterTests.groovy
b/subprojects/groovy-console/src/test/groovy/groovy/ui/text/GroovyFilterTests.groovy
index b2e254b..7085053 100644
--- a/subprojects/groovy-console/src/test/groovy/groovy/ui/text/GroovyFilterTests.groovy
+++ b/subprojects/groovy-console/src/test/groovy/groovy/ui/text/GroovyFilterTests.groovy
@@ -130,4 +130,16 @@ class GroovyFilterTests extends GroovyTestCase {
         '''"""
         assert multilineTripleSingleQuotes ==~ GroovyFilter.SINGLE_QUOTES
     }
+
+    void testSlashyQuotes() {
+        assert '/foo/' ==~ GroovyFilter.SLASHY_QUOTES
+        assert '/foo\\//' ==~ GroovyFilter.SLASHY_QUOTES
+        assert '/foo\\/bar\\//' ==~ GroovyFilter.SLASHY_QUOTES
+        assert '/foo\\/bar\\\\/\\//' ==~ GroovyFilter.SLASHY_QUOTES
+
+        assert '$/foo$/' ==~ GroovyFilter.SLASHY_QUOTES
+        assert '$/foo\nbar$/' ==~ GroovyFilter.SLASHY_QUOTES
+        assert '$/foo\n/bar//$/' ==~ GroovyFilter.SLASHY_QUOTES
+        assert '$/foo\n/bar//\n$/' ==~ GroovyFilter.SLASHY_QUOTES
+    }
 }


Mime
View raw message