[jruby-joni] 88/194: 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 2a6d88fe27ddcb20d338948cd94bfd1aa329c5df
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date: Tue Jan 2 20:15:40 2018 +0100
make AnyCharNode a singleton
---
src/org/joni/Parser.java | 11 ++++-------
src/org/joni/ast/AnyCharNode.java | 7 ++++---
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/org/joni/Parser.java b/src/org/joni/Parser.java
index 02d6bd0..6885ae7 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 = new AnyCharNode();
+ node = AnyCharNode.INSTANCE;
break;
case ANYCHAR_ANYTIME:
@@ -1201,10 +1201,9 @@ 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(any);
+ enclose.setTarget(AnyCharNode.INSTANCE);
alt = ConsAltNode.newAltNode(enclose, null);
@@ -1227,10 +1226,9 @@ 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(any);
+ enclose.setTarget(AnyCharNode.INSTANCE);
alt = ConsAltNode.newAltNode(enclose, null);
}
@@ -1489,9 +1487,8 @@ class Parser extends Lexer {
}
private Node parseAnycharAnytime() {
- Node node = new AnyCharNode();
QuantifierNode qn = new QuantifierNode(0, QuantifierNode.REPEAT_INFINITE, false);
- qn.setTarget(node);
+ qn.setTarget(AnyCharNode.INSTANCE);
return qn;
}
diff --git a/src/org/joni/ast/AnyCharNode.java b/src/org/joni/ast/AnyCharNode.java
index 33f43c8..f859eec 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 {
- public AnyCharNode(){
+ private AnyCharNode(){
super(CANY);
}
@@ -31,7 +31,8 @@ public final class AnyCharNode extends Node {
@Override
public String toString(int level) {
- String value = "";
- return value;
+ return "";
}
+
+ 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