[jruby-joni] 103/194: sync PREC_READ_NOT

Hideki Yamane henrich at moszumanska.debian.org
Thu Feb 1 12:04:31 UTC 2018


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 7031382a6f23f558f3c0c1710244583efb83ad08
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date:   Thu Jan 4 18:14:10 2018 +0100

    sync PREC_READ_NOT
---
 src/org/joni/Analyser.java      | 4 ++--
 src/org/joni/OptAnchorInfo.java | 6 +++++-
 test/org/joni/test/TestU8.java  | 2 ++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/org/joni/Analyser.java b/src/org/joni/Analyser.java
index b267e85..115b229 100644
--- a/src/org/joni/Analyser.java
+++ b/src/org/joni/Analyser.java
@@ -2118,6 +2118,8 @@ final class Analyser extends Parser {
             case AnchorType.END_BUF:
             case AnchorType.SEMI_END_BUF:
             case AnchorType.END_LINE:
+            case AnchorType.LOOK_BEHIND:        /* just for (?<=x).* */
+            case AnchorType.PREC_READ_NOT:      /* just for (?!x).* */
                 opt.anchor.add(an.type);
                 break;
 
@@ -2133,8 +2135,6 @@ final class Analyser extends Parser {
                 if (nopt.map.value > 0) opt.map.copy(nopt.map);
                 break;
 
-            case AnchorType.PREC_READ_NOT:
-            case AnchorType.LOOK_BEHIND:    /* Sorry, I can't make use of it. */
             case AnchorType.LOOK_BEHIND_NOT:
                 break;
 
diff --git a/src/org/joni/OptAnchorInfo.java b/src/org/joni/OptAnchorInfo.java
index 202ba81..8cc924a 100644
--- a/src/org/joni/OptAnchorInfo.java
+++ b/src/org/joni/OptAnchorInfo.java
@@ -39,7 +39,11 @@ final class OptAnchorInfo implements AnchorType {
         if (leftLength == 0) leftAnchor |= right.leftAnchor;
 
         rightAnchor = right.rightAnchor;
-        if (rightLength == 0) rightAnchor |= left.rightAnchor;
+        if (rightLength == 0) {
+            rightAnchor |= left.rightAnchor;
+        } else {
+            rightAnchor |= left.rightAnchor & AnchorType.PREC_READ_NOT;
+        }
     }
 
     boolean isSet(int anchor) {
diff --git a/test/org/joni/test/TestU8.java b/test/org/joni/test/TestU8.java
index 3ec6385..aea994e 100755
--- a/test/org/joni/test/TestU8.java
+++ b/test/org/joni/test/TestU8.java
@@ -280,6 +280,8 @@ public class TestU8 extends Test {
         x2s("c.*\\b", "abc", 2, 3); // Onigmo #96
         x2s("abc.*\\b", "abc", 0, 3);
         x2s("\\b.*abc.*\\b", "abc", 0, 3);
+        x2s("(?!a).*b", "ab", 1, 2);
+        x2s("(?!^a).*b", "ab", 1, 2);
 
         super.test();
     }

-- 
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