Skip to content

Commit

Permalink
Vendor org.joni dependency to avoid conflicts with other installed ve…
Browse files Browse the repository at this point in the history
…rsions
  • Loading branch information
zevlee authored Sep 27, 2023
1 parent c91ce64 commit 2ef96aa
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 31 deletions.
1 change: 1 addition & 0 deletions plugins/org.brainwy.liclipsetext.editor/.classpath
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="libs/joni-2.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/sac-1.3.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
Expand Down
6 changes: 3 additions & 3 deletions plugins/org.brainwy.liclipsetext.editor/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.expressions;bundle-version="3.5.100",
org.eclipse.ui.genericeditor;bundle-version="1.0.0";resolution:=optional,
com.google.gson;bundle-version="2.2.4",
org.jcodings;bundle-version="1.0.18",
org.joni;bundle-version="2.1.11"
org.jcodings;bundle-version="1.0.18"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Export-Package: com.eclipsesource.json,
Expand Down Expand Up @@ -78,5 +77,6 @@ Export-Package: com.eclipsesource.json,
org.brainwy.liclipsetext.editor.views.languages,
org.brainwy.liclipsetext.editor.views.partitioning
Bundle-ClassPath: .,
libs/sac-1.3.jar
libs/sac-1.3.jar,
libs/joni-2.2.1.jar
Automatic-Module-Name: org.brainwy.liclipsetext.editor
3 changes: 2 additions & 1 deletion plugins/org.brainwy.liclipsetext.editor/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ bin.includes = META-INF/,\
icons/,\
css/,\
libs/,\
libs/sac-1.3.jar
libs/sac-1.3.jar,\
libs/joni-2.2.1.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -64,42 +64,42 @@ public int getNumRegions() {
if (region == null) {
return 0;
}
return region.numRegs;
return region.getNumRegs();
}

public int getStrBeginPos(int groupId) {
if (groupId == 0) {
return bytes.getCharPosFromBytesPos(matcher.getBegin());
}
if (groupId >= region.beg.length) {
if (groupId >= region.getNumRegs()) {
return -1;
}
return bytes.getCharPosFromBytesPos(region.beg[groupId]);
return bytes.getCharPosFromBytesPos(region.getBeg(groupId));
}

public int getStrEndPos(int groupId) {
if (groupId == 0) {
return bytes.getCharPosFromBytesPos(matcher.getEnd());
}
return bytes.getCharPosFromBytesPos(region.end[groupId] - 1) + 1;
return bytes.getCharPosFromBytesPos(region.getEnd(groupId) - 1) + 1;
}

public int getBytesBeginPos(int groupId) {
if (groupId == 0) {
return matcher.getBegin();
}
return region.beg[groupId];
return region.getBeg(groupId);
}

public int getBytesEndPos(int groupId) {
if (groupId == 0) {
return matcher.getEnd();
}
return region.end[groupId];
return region.getEnd(groupId);
}

public boolean hasGroup(int groupId) {
return region.numRegs >= groupId && region.beg[groupId] >= 0;
return region.getNumRegs() >= groupId && region.getBeg(groupId) >= 0;
}

public String getStrPosContents(int groupId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015-2017 Angelo ZERR.
* Copyright (c) 2015-2017 Angelo ZERR.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -11,52 +11,52 @@
* Initial license: MIT
*
* Contributors:
* - GitHub Inc.: Initial code, written in JavaScript, licensed under MIT license
* - Angelo Zerr <angelo.zerr@gmail.com> - translation and adaptation to Java
* - GitHub Inc.: Initial code, written in JavaScript, licensed under MIT license
* - Angelo Zerr <angelo.zerr@gmail.com> - translation and adaptation to Java
*/

package org.eclipse.tm4e.core.internal.oniguruma;

import org.joni.Region;

public class OnigResult {
/**
* @see <a href="https://github.com/atom/node-oniguruma/blob/master/src/onig-result.cc">
* github.com/atom/node-oniguruma/blob/master/src/onig-result.cc</a>
*/
final class OnigResult {

private int indexInScanner;
private final Region region;

public OnigResult(Region region, int indexInScanner) {
OnigResult(final Region region, final int indexInScanner) {
this.region = region;
this.indexInScanner = indexInScanner;
}

public int getIndex() {
int getIndex() {
return indexInScanner;
}

public void setIndex(int index) {
this.indexInScanner = index;
void setIndex(final int index) {
indexInScanner = index;
}

public int locationAt(int index) {
int bytes = region.beg[index];
int locationAt(final int index) {
final int bytes = region.getBeg(index);
if (bytes > 0) {
return bytes;
} else {
return 0;
}
return 0;
}

public int count() {
return region.numRegs;
int count() {
return region.getNumRegs();
}

public int lengthAt(int index) {
int bytes = region.end[index] - region.beg[index];
int lengthAt(final int index) {
final int bytes = region.getEnd(index) - region.getBeg(index);
if (bytes > 0) {
return bytes;
} else {
return 0;
}
return 0;
}

}

0 comments on commit 2ef96aa

Please sign in to comment.