[jruby-joni] 75/279: don't skip non-ANYCHARs when .* fails to match.

Hideki Yamane henrich at moszumanska.debian.org
Mon Nov 16 11:26:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository jruby-joni.

commit 54364edb80ae078c35605f7df700af46799b6f7e
Author: Douglas Campos <qmx at qmx.me>
Date:   Tue Jan 25 00:47:57 2011 -0200

    don't skip non-ANYCHARs when .* fails to match.
    
    backported from ruby-19 at 28648
---
 src/org/joni/Matcher.java              |  5 -----
 test/org/joni/test/TestJoni.java       |  6 ++++++
 test/org/joni/test/TestLookBehind.java | 35 ++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/src/org/joni/Matcher.java b/src/org/joni/Matcher.java
index 1f0a1dd..45d022e 100644
--- a/src/org/joni/Matcher.java
+++ b/src/org/joni/Matcher.java
@@ -450,11 +450,6 @@ public abstract class Matcher extends IntHolder {
                             if (matchCheck(origRange, s, prev)) return match(s);
                             prev = s;
                             s += enc.length(bytes, s, end);
-                            
-                            while (!enc.isNewLine(bytes, prev, end) && s < range) {
-                                prev = s;
-                                s += enc.length(bytes, s, end);
-                            }
                         } while (s < range);
                         return mismatch();
                     }
diff --git a/test/org/joni/test/TestJoni.java b/test/org/joni/test/TestJoni.java
index f1cb9ec..5d7c256 100644
--- a/test/org/joni/test/TestJoni.java
+++ b/test/org/joni/test/TestJoni.java
@@ -8,12 +8,14 @@ public class TestJoni extends TestCase {
     private Test testc;
     private Test testu;
     private Test testnsu8;
+    private Test testLookBehind;
     
     protected void setUp() {
         testa = new TestA();
         testc = new TestC();
         testu = new TestU();
         testnsu8 = new TestNSU8();
+        testLookBehind = new TestLookBehind();
     }
     
     protected void tearDown() {
@@ -37,4 +39,8 @@ public class TestJoni extends TestCase {
         testJoniTest(testu);
         testJoniTest(testnsu8);
     }
+
+    public void testLookBehind() {
+    	testJoniTest(testLookBehind);
+    }
 }
diff --git a/test/org/joni/test/TestLookBehind.java b/test/org/joni/test/TestLookBehind.java
new file mode 100644
index 0000000..83ec6fe
--- /dev/null
+++ b/test/org/joni/test/TestLookBehind.java
@@ -0,0 +1,35 @@
+package org.joni.test;
+
+import org.jcodings.Encoding;
+import org.jcodings.specific.ASCIIEncoding;
+import org.joni.Option;
+import org.joni.Syntax;
+
+public class TestLookBehind extends Test {
+
+	public int option() {
+		return Option.DEFAULT;
+	}
+
+	public Encoding encoding() {
+		return ASCIIEncoding.INSTANCE;
+	}
+
+	public String testEncoding() {
+		return "iso-8859-1";
+	}
+
+	public Syntax syntax() {
+		return Syntax.DEFAULT;
+	}
+
+	@Override
+	public void test() {
+		x2s("(?<=a).*b", "aab", 1, 3);
+	}
+
+	public static void main(String[] args) throws Throwable {
+		new TestLookBehind().run();
+	}
+
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git



More information about the pkg-java-commits mailing list