[jruby-joni] 39/223: Fix for not working numbered backreferences with \k syntax.

Hideki Yamane henrich at moszumanska.debian.org
Mon Nov 16 11:21:43 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 2bb03ce626172bd4b4a8a638ec8e79813ddbde59
Author: Marcin Mielżyński <lopx at gazeta.pl>
Date:   Thu Oct 30 00:59:30 2008 +0000

    Fix for not working numbered backreferences with \k syntax.
    
    git-svn-id: http://svn.codehaus.org/jruby/joni/trunk@7949 961051c9-f516-0410-bf72-c9f7e237a7b7
---
 src/org/joni/Lexer.java       | 13 ++++++-------
 test/org/joni/test/TestA.java |  2 ++
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/org/joni/Lexer.java b/src/org/joni/Lexer.java
index cd3dad6..172132f 100644
--- a/src/org/joni/Lexer.java
+++ b/src/org/joni/Lexer.java
@@ -1059,14 +1059,13 @@ class Lexer extends ScannerSupport {
                                     if (backNum <= 0) newValueException(ERR_INVALID_BACKREF);
                                 }
                                 
-                                if (syntax.strictCheckBackref()) {
-                                    if (backNum > env.numMem ||
-                                        env.memNodes == null) newValueException(ERR_INVALID_BACKREF);
-                                    token.type = TokenType.BACKREF;
-                                    token.setBackrefByName(false);
-                                    token.setBackrefNum(1);
-                                    token.setBackrefRef1(backNum);
+                                if (syntax.strictCheckBackref() && (backNum > env.numMem || env.memNodes == null)) {
+                                    newValueException(ERR_INVALID_BACKREF);
                                 }
+                                token.type = TokenType.BACKREF;
+                                token.setBackrefByName(false);
+                                token.setBackrefNum(1);
+                                token.setBackrefRef1(backNum);
                             } else {
                                 NameEntry e = env.reg.nameToGroupNumbers(bytes, last, nameEnd);
                                 if (e == null) newValueException(ERR_UNDEFINED_NAME_REFERENCE, last, nameEnd);
diff --git a/test/org/joni/test/TestA.java b/test/org/joni/test/TestA.java
index 2a64370..bc3ebf5 100644
--- a/test/org/joni/test/TestA.java
+++ b/test/org/joni/test/TestA.java
@@ -471,6 +471,8 @@ public class TestA extends Test {
         x3s(pat, str, 7, 10, 3, Option.EXTEND);
         x3s(pat, str, 5, 21, 4, Option.EXTEND);
         x3s(pat, str, 21, 27, 5, Option.EXTEND);
+
+        x2s("(a)b\\k<1>", "aba", 0, 3);
     }
     
     public static void main(String[] args) throws Throwable{

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