[jruby-joni] 90/194: Revert "make AnyCharNode a singleton"

Hideki Yamane henrich at moszumanska.debian.org
Thu Feb 1 12:04:30 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 7ed293baac2c5b04453fe3f008a676566560c0ec
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date:   Tue Jan 2 21:28:40 2018 +0100

    Revert "make AnyCharNode a singleton"
    
    This reverts commit 2a6d88fe27ddcb20d338948cd94bfd1aa329c5df.
---
 src/org/joni/Parser.java          | 11 +++++++----
 src/org/joni/ast/AnyCharNode.java |  7 +++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/org/joni/Parser.java b/src/org/joni/Parser.java
index 6885ae7..02d6bd0 100644
--- a/src/org/joni/Parser.java
+++ b/src/org/joni/Parser.java
@@ -826,7 +826,7 @@ class Parser extends Lexer {
             break;
 
         case ANYCHAR:
-            node = AnyCharNode.INSTANCE;
+            node = new AnyCharNode();
             break;
 
         case ANYCHAR_ANYTIME:
@@ -1201,9 +1201,10 @@ class Parser extends Lexer {
             list = ConsAltNode.newListNode(qn, list);
 
             /* PerlSyntax: (?s:.), RubySyntax: (?m:.) */
+            AnyCharNode any = new AnyCharNode();
             int option = bsOnOff(env.option, Option.MULTILINE, false);
             EncloseNode enclose = EncloseNode.newOption(option);
-            enclose.setTarget(AnyCharNode.INSTANCE);
+            enclose.setTarget(any);
 
             alt = ConsAltNode.newAltNode(enclose, null);
 
@@ -1226,9 +1227,10 @@ class Parser extends Lexer {
             alt = ConsAltNode.newAltNode(list, alt);
         } else {
             /* PerlSyntax: (?s:.), RubySyntax: (?m:.) */
+            AnyCharNode any = new AnyCharNode();
             int option = bsOnOff(env.option, Option.MULTILINE, false);
             EncloseNode enclose = EncloseNode.newOption(option);
-            enclose.setTarget(AnyCharNode.INSTANCE);
+            enclose.setTarget(any);
             alt = ConsAltNode.newAltNode(enclose, null);
         }
 
@@ -1487,8 +1489,9 @@ class Parser extends Lexer {
     }
 
     private Node parseAnycharAnytime() {
+        Node node = new AnyCharNode();
         QuantifierNode qn = new QuantifierNode(0, QuantifierNode.REPEAT_INFINITE, false);
-        qn.setTarget(AnyCharNode.INSTANCE);
+        qn.setTarget(node);
         return qn;
     }
 
diff --git a/src/org/joni/ast/AnyCharNode.java b/src/org/joni/ast/AnyCharNode.java
index f859eec..33f43c8 100644
--- a/src/org/joni/ast/AnyCharNode.java
+++ b/src/org/joni/ast/AnyCharNode.java
@@ -20,7 +20,7 @@
 package org.joni.ast;
 
 public final class AnyCharNode extends Node {
-    private AnyCharNode(){
+    public AnyCharNode(){
         super(CANY);
     }
 
@@ -31,8 +31,7 @@ public final class AnyCharNode extends Node {
 
     @Override
     public String toString(int level) {
-        return "";
+        String value = "";
+        return value;
     }
-
-    public static final AnyCharNode INSTANCE = new AnyCharNode();
 }

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