[jruby-joni] 72/194: backref node cleanup
Hideki Yamane
henrich at moszumanska.debian.org
Thu Feb 1 12:04:28 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 f3954358eb2a2ec716ad237a3c0b0b97ddb61a71
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date: Sat Dec 30 20:40:33 2017 +0100
backref node cleanup
---
src/org/joni/ast/BackRefNode.java | 46 ++++++++++++++++-----------------------
1 file changed, 19 insertions(+), 27 deletions(-)
diff --git a/src/org/joni/ast/BackRefNode.java b/src/org/joni/ast/BackRefNode.java
index 603cbe7..b434419 100644
--- a/src/org/joni/ast/BackRefNode.java
+++ b/src/org/joni/ast/BackRefNode.java
@@ -19,17 +19,14 @@
*/
package org.joni.ast;
+import org.joni.Config;
import org.joni.ScanEnvironment;
import org.joni.exception.ErrorMessages;
import org.joni.exception.ValueException;
public final class BackRefNode extends StateNode {
- //private static int NODE_BACKREFS_SIZE = 6;
-
- //int state;
public int backNum;
public int back[];
-
public int nestLevel;
public BackRefNode(int backNum, int[]backRefs, boolean byName, ScanEnvironment env) {
@@ -42,22 +39,34 @@ public final class BackRefNode extends StateNode {
break;
}
}
-
- back = new int[backNum];
- System.arraycopy(backRefs, 0, back, 0, backNum); // shall we really dup it ???
+ back = backRefs;
}
- // #ifdef USE_BACKREF_AT_LEVEL
public BackRefNode(int backNum, int[]backRefs, boolean byName, boolean existLevel, int nestLevel, ScanEnvironment env) {
this(backNum, backRefs, byName, env);
- if (existLevel) {
- //state |= NST_NEST_LEVEL;
+ if (Config.USE_BACKREF_WITH_LEVEL && existLevel) {
setNestLevel();
this.nestLevel = nestLevel;
}
}
+ public void renumber(int[]map) {
+ if (!isNameRef()) throw new ValueException(ErrorMessages.ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED);
+
+ int oldNum = backNum;
+
+ int pos = 0;
+ for (int i=0; i<oldNum; i++) {
+ int n = map[back[i]];
+ if (n > 0) {
+ back[pos] = n;
+ pos++;
+ }
+ }
+ backNum = pos;
+ }
+
@Override
public int getType() {
return BREF;
@@ -78,21 +87,4 @@ public final class BackRefNode extends StateNode {
value.append("\n nextLevel: " + nestLevel);
return value.toString();
}
-
- public void renumber(int[]map) {
- if (!isNameRef()) throw new ValueException(ErrorMessages.ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED);
-
- int oldNum = backNum;
-
- int pos = 0;
- for (int i=0; i<oldNum; i++) {
- int n = map[back[i]];
- if (n > 0) {
- back[pos] = n;
- pos++;
- }
- }
- backNum = pos;
- }
-
}
--
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