[jruby-joni] 79/223: org.joni.ast.ConsAltNode cannot be cast to org.joni.ast.StringNode issue
Hideki Yamane
henrich at moszumanska.debian.org
Mon Nov 16 11:21:51 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 eaa1ef7b270e29a5f2dea676a2ed25c719ba7926
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date: Tue Feb 14 00:19:29 2012 +0100
org.joni.ast.ConsAltNode cannot be cast to org.joni.ast.StringNode issue
---
src/org/joni/Analyser.java | 10 +++++-----
src/org/joni/ast/QuantifierNode.java | 4 ++--
src/org/joni/ast/StringNode.java | 2 +-
test/org/joni/test/TestU8.java | 5 +++++
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/org/joni/Analyser.java b/src/org/joni/Analyser.java
index 6b23832..60218b2 100644
--- a/src/org/joni/Analyser.java
+++ b/src/org/joni/Analyser.java
@@ -1776,14 +1776,14 @@ final class Analyser extends Parser {
int len = sn.length();
if (len * qn.lower <= EXPAND_STRING_MAX_LENGTH) {
- StringNode str = qn.convertToString();
- // if (str.parent == null) root = str;
+ StringNode str = qn.convertToString(sn.flag);
int n = qn.lower;
- for (int i=0; i<n; i++) {
- str.cat(sn.bytes, sn.p, sn.end);
+ for (int i = 0; i < n; i++) {
+ str.cat(sn.bytes, sn.p, sn.end);
}
+ break; /* break case NT_QTFR: */
}
- break; /* break case NT_QTFR: */
+
}
}
if (Config.USE_OP_PUSH_OR_JUMP_EXACT) {
diff --git a/src/org/joni/ast/QuantifierNode.java b/src/org/joni/ast/QuantifierNode.java
index 90fab29..8ec53cb 100644
--- a/src/org/joni/ast/QuantifierNode.java
+++ b/src/org/joni/ast/QuantifierNode.java
@@ -69,9 +69,9 @@ public final class QuantifierNode extends StateNode {
tgt.parent = this;
}
- public StringNode convertToString() {
+ public StringNode convertToString(int flag) {
StringNode sn = new StringNode();
- sn.flag = ((StringNode)target).flag;
+ sn.flag = flag;
sn.swap(this);
return sn;
}
diff --git a/src/org/joni/ast/StringNode.java b/src/org/joni/ast/StringNode.java
index 1b419a3..4429d20 100644
--- a/src/org/joni/ast/StringNode.java
+++ b/src/org/joni/ast/StringNode.java
@@ -31,7 +31,7 @@ public final class StringNode extends Node implements StringType {
public int p;
public int end;
- int flag;
+ public int flag;
public StringNode() {
this.bytes = new byte[NODE_STR_BUF_SIZE];
diff --git a/test/org/joni/test/TestU8.java b/test/org/joni/test/TestU8.java
index b3d550c..fe18d22 100644
--- a/test/org/joni/test/TestU8.java
+++ b/test/org/joni/test/TestU8.java
@@ -44,6 +44,11 @@ public class TestU8 extends Test {
public void test() {
xx("^\\d\\d\\d-".getBytes(), new byte []{-30, -126, -84, 48, 45}, 0, 0, 0, true);
+ x2s("x{2}", "xx", 0, 2, Option.IGNORECASE);
+ x2s("x{2}", "XX", 0, 2, Option.IGNORECASE);
+ x2s("x{3}", "XxX", 0, 3, Option.IGNORECASE);
+ ns("x{2}", "x", Option.IGNORECASE);
+ ns("x{2}", "X", Option.IGNORECASE);
}
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