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 0bbfe42d295efb432ba53afb3993533f89ee4495 Author: lopex <[email protected]> Date: Thu Feb 1 12:24:32 2018 +0100 look behind fixes --- src/org/joni/Analyser.java | 8 ++++++-- src/org/joni/Matcher.java | 8 +++++++- test/org/joni/test/TestU8.java | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/org/joni/Analyser.java b/src/org/joni/Analyser.java index 467fc46..d5ce220 100644 --- a/src/org/joni/Analyser.java +++ b/src/org/joni/Analyser.java @@ -2311,10 +2311,14 @@ final class Analyser extends Parser { regex.anchor = opt.anchor.leftAnchor & (AnchorType.BEGIN_BUF | AnchorType.BEGIN_POSITION | AnchorType.ANYCHAR_STAR | - AnchorType.ANYCHAR_STAR_ML); + AnchorType.ANYCHAR_STAR_ML | + AnchorType.LOOK_BEHIND); + + if ((opt.anchor.leftAnchor & (AnchorType.LOOK_BEHIND | AnchorType.PREC_READ_NOT)) != 0) regex.anchor &= ~AnchorType.ANYCHAR_STAR_ML; regex.anchor |= opt.anchor.rightAnchor & (AnchorType.END_BUF | - AnchorType.SEMI_END_BUF); + AnchorType.SEMI_END_BUF | + AnchorType.PREC_READ_NOT); if ((regex.anchor & (AnchorType.END_BUF | AnchorType.SEMI_END_BUF)) != 0) { regex.anchorDmin = opt.length.min; diff --git a/src/org/joni/Matcher.java b/src/org/joni/Matcher.java index 5d63442..c4226fd 100644 --- a/src/org/joni/Matcher.java +++ b/src/org/joni/Matcher.java @@ -433,10 +433,16 @@ public abstract class Matcher extends IntHolder { if (matchCheck(origRange, s, prev)) return match(s); prev = s; s += enc.length(bytes, s, end); + + if ((regex.anchor & (AnchorType.LOOK_BEHIND | AnchorType.PREC_READ_NOT)) == 0) { + 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/TestU8.java b/test/org/joni/test/TestU8.java index 539e3d1..90d34d2 100755 --- a/test/org/joni/test/TestU8.java +++ b/test/org/joni/test/TestU8.java @@ -326,5 +326,9 @@ public class TestU8 extends Test { ns("[^a\\x{80}]", "a", Option.CR_7_BIT); ns("(\\2)(\\1)", ""); + + x2s("(?<=fo).*", "foo", 2, 3); + x2s("(?m)(?<=fo).*", "foo", 2, 3); + x2s("(?m)(?<=fo).+", "foo", 2, 3); } } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

