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 80b585ac33b7d130417c37824ace70f55b9f42b9
Author: lopex <l...@gazeta.pl>
Date:   Wed Jan 10 10:13:30 2018 +0100

    StringNode cleanup
---
 src/org/joni/Parser.java         | 12 ++----------
 src/org/joni/ast/StringNode.java | 37 +++++++++++++++----------------------
 2 files changed, 17 insertions(+), 32 deletions(-)

diff --git a/src/org/joni/Parser.java b/src/org/joni/Parser.java
index 702fceb..75ea153 100644
--- a/src/org/joni/Parser.java
+++ b/src/org/joni/Parser.java
@@ -1288,12 +1288,9 @@ class Parser extends Lexer {
 
     private Node parseExpTkRawByte(boolean group) {
         // tk_raw_byte:
-
-        // important: we don't use 0xff mask here neither in the compiler
-        // (in the template string) so we won't have to mask target
-        // strings when comparing against them in the matcher
-        StringNode node = new StringNode((byte)token.getC());
+        StringNode node = new StringNode();
         node.setRaw();
+        node.cat((byte)token.getC());
 
         int len = 1;
         while (true) {
@@ -1310,13 +1307,8 @@ class Parser extends Lexer {
             if (token.type != TokenType.RAW_BYTE) {
                 /* Don't use this, it is wrong for little endian encodings. */
                 // USE_PAD_TO_SHORT_BYTE_CHAR ...
-
                 newValueException(ERR_TOO_SHORT_MULTI_BYTE_STRING);
             }
-
-            // important: we don't use 0xff mask here neither in the compiler
-            // (in the template string) so we won't have to mask target
-            // strings when comparing against them in the matcher
             node.cat((byte)token.getC());
             len++;
         } // while
diff --git a/src/org/joni/ast/StringNode.java b/src/org/joni/ast/StringNode.java
index d75d074..e1dae1f 100644
--- a/src/org/joni/ast/StringNode.java
+++ b/src/org/joni/ast/StringNode.java
@@ -31,7 +31,6 @@ public final class StringNode extends Node implements 
StringType {
     public byte[]bytes;
     public int p;
     public int end;
-
     public int flag;
 
     public StringNode() {
@@ -47,11 +46,6 @@ public final class StringNode extends Node implements 
StringType {
         setShared();
     }
 
-    public StringNode(byte c) {
-        this();
-        bytes[end++] = c;
-    }
-
     /* Ensure there is ahead bytes available in node's buffer
      * (assumes that the node is not shared)
      */
@@ -85,21 +79,6 @@ public final class StringNode extends Node implements 
StringType {
         return "String";
     }
 
-    @Override
-    public String toString(int level) {
-        StringBuilder value = new StringBuilder();
-        value.append("\n  bytes: '");
-        for (int i=p; i<end; i++) {
-            if ((bytes[i] & 0xff) >= 0x20 && (bytes[i] & 0xff) < 0x7f) {
-                value.append((char)bytes[i]);
-            } else {
-                value.append(String.format("[0x%02x]", bytes[i]));
-            }
-        }
-        value.append("'");
-        return value.toString();
-    }
-
     public int length() {
         return end - p;
     }
@@ -110,7 +89,6 @@ public final class StringNode extends Node implements 
StringType {
 
     public StringNode splitLastChar(Encoding enc) {
         StringNode n = null;
-
         if (end > p) {
             int prev = enc.prevCharHead(bytes, p, end, end);
             if (prev != -1 && prev > p) { /* can be split */
@@ -206,4 +184,19 @@ public final class StringNode extends Node implements 
StringType {
     public boolean isShared() {
         return (flag & NSTR_SHARED) != 0;
     }
+
+    @Override
+    public String toString(int level) {
+        StringBuilder value = new StringBuilder();
+        value.append("\n  bytes: '");
+        for (int i=p; i<end; i++) {
+            if ((bytes[i] & 0xff) >= 0x20 && (bytes[i] & 0xff) < 0x7f) {
+                value.append((char)bytes[i]);
+            } else {
+                value.append(String.format("[0x%02x]", bytes[i]));
+            }
+        }
+        value.append("'");
+        return value.toString();
+    }
 }

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

_______________________________________________
pkg-java-commits mailing list
pkg-java-comm...@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to