Skip to content
Commits on Source (63)
language: java
jdk:
- openjdk9
<?xml version="1.0" ?>
<project name="Joni" default="build">
<property name="src.dir" value="src" />
<property name="bin.dir" value="target/classes" />
<property name="dist.dir" value="target" />
<property name="jar.name" value="joni.jar" />
<target name="clean">
<delete dir="${bin.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="compile">
<mkdir dir="${bin.dir}" />
<javac srcdir="${src.dir}" destdir="${bin.dir}"/>
</target>
<target name="build" depends="compile">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/${jar.name}" manifest="MANIFEST.MF">
<fileset dir="${bin.dir}" />
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Built-Date" value="${buildDate}" />
<attribute name="Built-Time" value="${buildTime}" />
</manifest>
</jar>
</target>
</project>
jruby-joni (2.1.23-1) UNRELEASED; urgency=medium
* New upstream release
-- Hideki Yamane <henrich@debian.org> Tue, 02 Oct 2018 19:59:01 +0900
jruby-joni (2.1.21-1) unstable; urgency=medium
* New upstream release
* debian/control
- Adjust Build-Dependency version
- set Standards-Version: 4.2.1 with no change
* debian/patches
- drop build.xml-jcoding.patch due to drop build.xml in upstream
-- Hideki Yamane <henrich@debian.org> Tue, 02 Oct 2018 19:50:49 +0900
jruby-joni (2.1.18-1) unstable; urgency=medium
* New upstream release
......
......@@ -9,11 +9,11 @@ Build-Depends:
debhelper (>= 11),
default-jdk
Build-Depends-Indep:
junit4,
libasm-java (>= 5.0.3),
libjcodings-java (>= 1.0.28),
junit4 (>= 4.12),
libasm-java (>= 6.2.1),
libjcodings-java (>= 1.0.40),
maven-debian-helper (>= 2.0)
Standards-Version: 4.2.0
Standards-Version: 4.2.1
Vcs-Git: https://salsa.debian.org/java-team/jruby-joni.git
Vcs-Browser: https://salsa.debian.org/java-team/jruby-joni
Homepage: https://github.com/jruby/joni/
......
......@@ -6,8 +6,6 @@ Subject: add class-path: for jcodings
MANIFEST.MF | 1 +
1 file changed, 1 insertion(+)
diff --git a/MANIFEST.MF b/MANIFEST.MF
index 0dfec5c..4ce7319 100644
--- a/MANIFEST.MF
+++ b/MANIFEST.MF
@@ -1,2 +1,3 @@
......
From: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Date: Sat, 6 Jun 2015 13:05:17 +0900
Subject: build.xml-jcoding
===================================================================
---
build.xml | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/build.xml b/build.xml
index 04a54ef..b06feb8 100644
--- a/build.xml
+++ b/build.xml
@@ -14,7 +14,12 @@
<target name="compile">
<mkdir dir="${bin.dir}" />
- <javac srcdir="${src.dir}" destdir="${bin.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${bin.dir}">
+ <classpath>
+ <pathelement location="/usr/share/java/jcodings.jar" />
+ <pathelement location="/usr/share/java/asm.jar" />
+ </classpath>
+ </javac>
</target>
<target name="build" depends="compile">
@@ -32,6 +37,8 @@
<attribute name="Built-By" value="${user.name}" />
<attribute name="Built-Date" value="${buildDate}" />
<attribute name="Built-Time" value="${buildTime}" />
+ <attribute name="Class-Path" value="/usr/share/java/jcodings.jar
+ /usr/share/java/asm.jar" />
</manifest>
</jar>
build.xml-jcoding.patch
0003-add-class-path-for-jcodings.patch
......@@ -4,7 +4,7 @@
<groupId>org.jruby.joni</groupId>
<artifactId>joni</artifactId>
<packaging>jar</packaging>
<version>2.1.18</version>
<version>2.1.23</version>
<name>Joni</name>
<description>
Java port of Oniguruma: http://www.geocities.jp/kosako3/oniguruma
......@@ -66,7 +66,7 @@
<dependency>
<groupId>org.jruby.jcodings</groupId>
<artifactId>jcodings</artifactId>
<version>1.0.30</version>
<version>1.0.40</version>
</dependency>
<dependency>
<groupId>junit</groupId>
......@@ -77,7 +77,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.3</version>
<version>6.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
......@@ -95,16 +95,24 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.8.0</version>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<source>1.7</source>
<target>1.7</target>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<version>2.22.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
......@@ -115,40 +123,6 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<configuration>
<show>private</show>
<nohelp>true</nohelp>
<additionalparam>-Xdoclint:none</additionalparam>
<quiet>true</quiet>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
......@@ -204,6 +178,62 @@
</plugins>
</build>
</profile>
</profiles>
<profile>
<id>release-on-9</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile9</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<includes>
<include>module-info.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<additionalJOption>-Xdoclint:none</additionalJOption>
<additionalOptions>-html5</additionalOptions>
<quiet>true</quiet>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
open module org.jruby.joni {
exports org.joni;
exports org.joni.constants;
exports org.joni.exception;
requires org.jruby.jcodings;
requires org.objectweb.asm;
}
\ No newline at end of file
......@@ -48,11 +48,11 @@ import org.joni.ast.ListNode;
import org.joni.ast.Node;
import org.joni.ast.QuantifierNode;
import org.joni.ast.StringNode;
import org.joni.constants.AnchorType;
import org.joni.constants.EncloseType;
import org.joni.constants.NodeType;
import org.joni.constants.StackPopLevel;
import org.joni.constants.TargetInfo;
import org.joni.constants.internal.AnchorType;
import org.joni.constants.internal.EncloseType;
import org.joni.constants.internal.NodeType;
import org.joni.constants.internal.StackPopLevel;
import org.joni.constants.internal.TargetInfo;
final class Analyser extends Parser {
......
......@@ -36,12 +36,12 @@ import org.joni.ast.EncloseNode;
import org.joni.ast.Node;
import org.joni.ast.QuantifierNode;
import org.joni.ast.StringNode;
import org.joni.constants.AnchorType;
import org.joni.constants.EncloseType;
import org.joni.constants.NodeType;
import org.joni.constants.OPCode;
import org.joni.constants.OPSize;
import org.joni.constants.TargetInfo;
import org.joni.constants.internal.AnchorType;
import org.joni.constants.internal.EncloseType;
import org.joni.constants.internal.NodeType;
import org.joni.constants.internal.OPCode;
import org.joni.constants.internal.OPSize;
import org.joni.constants.internal.TargetInfo;
final class ArrayCompiler extends Compiler {
private int[]code;
......
......@@ -22,7 +22,7 @@ package org.joni;
import java.io.FileOutputStream;
import java.io.IOException;
import org.joni.constants.AsmConstants;
import org.joni.constants.internal.AsmConstants;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
......
......@@ -31,8 +31,8 @@ import static org.joni.Option.isPosixRegion;
import org.jcodings.CodeRange;
import org.jcodings.Encoding;
import org.jcodings.IntHolder;
import org.joni.constants.OPCode;
import org.joni.constants.OPSize;
import org.joni.constants.internal.OPCode;
import org.joni.constants.internal.OPSize;
import org.joni.exception.ErrorMessages;
import org.joni.exception.InternalException;
......@@ -151,32 +151,6 @@ class ByteCodeMachine extends StackMachine {
return true;
}
private void debugMatchBegin() {
Config.log.println("match_at: " + "str: " + str + ", end: " + end + ", start: " + sstart + ", sprev: " + sprev);
Config.log.println("size: " + (end - str) + ", start offset: " + (sstart - str));
}
private void debugMatchLoop() {
Config.log.printf("%4d", (s - str)).print("> \"");
int q, i;
for (i = 0, q = s; i < 7 && q < end && s >= 0; i++) {
int len = enc.length(bytes, q, end);
while (len-- > 0) {
if (q < end) {
Config.log.print(new String(bytes, q++, 1));
}
}
}
String str = q < end ? "...\"" : "\"";
q += str.length();
Config.log.print(str);
for (i = 0; i < 20 - (q - s); i++)
Config.log.print(" ");
StringBuilder sb = new StringBuilder();
new ByteCodePrinter(regex).compiledByteCodeToString(sb, ip);
Config.log.println(sb.toString());
}
protected final int matchAt(int _range, int _sstart, int _sprev, boolean interrupt) throws InterruptedException {
range = _range;
sstart = _sstart;
......@@ -333,7 +307,7 @@ class ByteCodeMachine extends StackMachine {
Thread currentThread = Thread.currentThread();
final int[]code = this.code;
while (true) {
if ((!interrupt && interrupted) ||
if (interrupted ||
(interrupt && interruptCheckCounter++ % INTERRUPT_CHECK_EVERY == 0 && currentThread.isInterrupted())) {
currentThread.interrupted();
throw new InterruptedException();
......@@ -391,8 +365,8 @@ class ByteCodeMachine extends StackMachine {
case OPCode.BEGIN_BUF: opBeginBuf(); continue;
case OPCode.END_BUF: opEndBuf(); continue;
case OPCode.BEGIN_LINE: opBeginLine(); continue;
case OPCode.END_LINE: opEndLine(); continue;
case OPCode.BEGIN_LINE: opBeginLineSb(); continue;
case OPCode.END_LINE: opEndLineSb(); continue;
case OPCode.SEMI_END_BUF: opSemiEndBuf(); continue;
case OPCode.BEGIN_POSITION: opBeginPosition(); continue;
......@@ -1269,6 +1243,16 @@ class ByteCodeMachine extends StackMachine {
opFail();
}
private void opBeginLineSb() {
if (s == str) {
if (isNotBol(msaOptions)) opFail();
return;
} else if (bytes[sprev] == Encoding.NEW_LINE && s != end) {
return;
}
opFail();
}
private void opEndLine() {
if (s == end) {
if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) {
......@@ -1286,6 +1270,23 @@ class ByteCodeMachine extends StackMachine {
opFail();
}
private void opEndLineSb() {
if (s == end) {
if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) {
if (str == end || bytes[sprev] != Encoding.NEW_LINE) {
if (isNotEol(msaOptions)) opFail();
}
return;
} else {
if (isNotEol(msaOptions)) opFail();
return;
}
} else if (bytes[s] == Encoding.NEW_LINE || (Config.USE_CRNL_AS_LINE_TERMINATOR && enc.isMbcCrnl(bytes, s, end))) {
return;
}
opFail();
}
private void opSemiEndBuf() {
if (s == end) {
if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) {
......@@ -1929,4 +1930,30 @@ class ByteCodeMachine extends StackMachine {
private int finish() {
return bestLen;
}
private void debugMatchBegin() {
Config.log.println("match_at: " + "str: " + str + ", end: " + end + ", start: " + sstart + ", sprev: " + sprev);
Config.log.println("size: " + (end - str) + ", start offset: " + (sstart - str));
}
private void debugMatchLoop() {
Config.log.printf("%4d", (s - str)).print("> \"");
int q, i;
for (i = 0, q = s; i < 7 && q < end && s >= 0; i++) {
int len = enc.length(bytes, q, end);
while (len-- > 0) {
if (q < end) {
Config.log.print(new String(bytes, q++, 1));
}
}
}
String str = q < end ? "...\"" : "\"";
q += str.length();
Config.log.print(str);
for (i = 0; i < 20 - (q - s); i++)
Config.log.print(" ");
StringBuilder sb = new StringBuilder();
new ByteCodePrinter(regex).compiledByteCodeToString(sb, ip);
Config.log.println(sb.toString());
}
}
......@@ -20,9 +20,9 @@
package org.joni;
import org.jcodings.Encoding;
import org.joni.constants.Arguments;
import org.joni.constants.OPCode;
import org.joni.constants.OPSize;
import org.joni.constants.internal.Arguments;
import org.joni.constants.internal.OPCode;
import org.joni.constants.internal.OPSize;
import org.joni.exception.InternalException;
class ByteCodePrinter {
......
......@@ -30,7 +30,7 @@ import org.joni.ast.EncloseNode;
import org.joni.ast.Node;
import org.joni.ast.QuantifierNode;
import org.joni.ast.StringNode;
import org.joni.constants.NodeType;
import org.joni.constants.internal.NodeType;
import org.joni.exception.ErrorMessages;
import org.joni.exception.InternalException;
import org.joni.exception.SyntaxException;
......
......@@ -42,8 +42,10 @@ public interface Config extends org.jcodings.Config {
final boolean USE_VARIABLE_META_CHARS = true;
final boolean USE_WORD_BEGIN_END = true; /* "\<": word-begin, "\>": word-end */
final boolean USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE = true;
final boolean USE_SUNDAY_QUICK_SEARCH = true;
final boolean USE_CEC = false;
final boolean USE_DYNAMIC_OPTION = false;
final boolean USE_INT_MAP_BACKWARD = false;
final int NREGION = 10;
final int MAX_BACKREF_NUM = 1000;
......
......@@ -29,9 +29,9 @@ import org.jcodings.constants.CharacterType;
import org.jcodings.exception.CharacterPropertyException;
import org.jcodings.exception.EncodingError;
import org.joni.ast.QuantifierNode;
import org.joni.constants.AnchorType;
import org.joni.constants.MetaChar;
import org.joni.constants.TokenType;
import org.joni.constants.internal.AnchorType;
import org.joni.constants.internal.TokenType;
import org.joni.exception.ErrorMessages;
class Lexer extends ScannerSupport {
......
......@@ -26,7 +26,7 @@ import org.jcodings.Encoding;
import org.jcodings.IntHolder;
import org.jcodings.constants.CharacterType;
import org.jcodings.specific.ASCIIEncoding;
import org.joni.constants.AnchorType;
import org.joni.constants.internal.AnchorType;
public abstract class Matcher extends IntHolder {
public static final int FAILED = -1;
......@@ -133,7 +133,8 @@ public abstract class Matcher extends IntHolder {
}
retry:while (true) {
p = regex.searchAlgorithm.search(this, bytes, p, end, range);
if (Config.DEBUG_SEARCH) debugSearch(regex.forward.getName(), p, end, range);
p = regex.forward.search(this, bytes, p, end, range);
if (p != -1 && p < range) {
if (p - regex.dMin < s) {
......@@ -219,7 +220,7 @@ public abstract class Matcher extends IntHolder {
int p = s;
retry:while (true) {
p = regex.searchAlgorithm.searchBackward(this, bytes, range, adjrange, end, p, s, range);
p = regex.backward.search(this, bytes, range, adjrange, end, p, s, range);
if (p != -1) {
if (regex.subAnchor != 0) {
......@@ -407,7 +408,7 @@ public abstract class Matcher extends IntHolder {
prev = 0; // -1
}
if (regex.searchAlgorithm != SearchAlgorithm.NONE) {
if (regex.forward != null) {
int schRange = range;
if (regex.dMax != 0) {
if (regex.dMax == MinMaxLen.INFINITE_DISTANCE) {
......@@ -471,7 +472,7 @@ public abstract class Matcher extends IntHolder {
}
}
if (regex.searchAlgorithm != SearchAlgorithm.NONE) {
if (regex.backward != null) {
int adjrange;
if (range < end) {
adjrange = enc.leftAdjustCharHead(bytes, str, range, end);
......@@ -612,4 +613,9 @@ public abstract class Matcher extends IntHolder {
", high: " + (high - str));
}
}
static void debugSearch(String name, int textP, int textEnd, int textRange) {
Config.log.println(name + ": text: " + textP + ", text_end: " + textEnd + ", text_range: " + textRange);
}
}
......@@ -19,7 +19,7 @@
*/
package org.joni;
import org.joni.constants.AnchorType;
import org.joni.constants.internal.AnchorType;
final class OptAnchorInfo implements AnchorType {
int leftAnchor;
......
......@@ -45,10 +45,10 @@ import org.joni.ast.EncloseNode;
import org.joni.ast.Node;
import org.joni.ast.QuantifierNode;
import org.joni.ast.StringNode;
import org.joni.constants.AnchorType;
import org.joni.constants.EncloseType;
import org.joni.constants.NodeType;
import org.joni.constants.TokenType;
import org.joni.constants.internal.AnchorType;
import org.joni.constants.internal.EncloseType;
import org.joni.constants.internal.NodeType;
import org.joni.constants.internal.TokenType;
class Parser extends Lexer {
protected int returnCode; // return code used by parser methods (they itself return parsed nodes)
......