Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit c62a6eb

Browse files
committed
feat: add API for 'ts_query_is_pattern_non_local'
1 parent 07cc916 commit c62a6eb

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

android-tree-sitter/src/main/cpp/ts_query.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ Java_com_itsaky_androidide_treesitter_TSQuery_00024Native_patternRooted(
8989
return (jboolean)ts_query_is_pattern_rooted((TSQuery*)query, pattern);
9090
}
9191

92+
extern "C" JNIEXPORT jboolean JNICALL
93+
Java_com_itsaky_androidide_treesitter_TSQuery_00024Native_patternNonLocal(
94+
JNIEnv* env, jclass self, jlong query, jint pattern_index) {
95+
return (jboolean)ts_query_is_pattern_non_local((TSQuery*)query,
96+
pattern_index);
97+
}
98+
9299
extern "C" JNIEXPORT jboolean JNICALL
93100
Java_com_itsaky_androidide_treesitter_TSQuery_00024Native_patternGuaranteedAtStep(
94101
JNIEnv* env, jclass self, jlong query, jint offset) {

android-tree-sitter/src/main/java/com/itsaky/androidide/treesitter/TSQuery.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ public boolean isPatternRooted(int pattern) {
9898
return Native.patternRooted(this.pointer, pattern);
9999
}
100100

101+
public boolean isPatternNonLocal(int pattern) {
102+
validatePatternIndex(pattern);
103+
return Native.patternNonLocal(this.pointer, pattern);
104+
}
105+
101106
public boolean isPatternGuaranteedAtStep(int offset) {
102107
return Native.patternGuaranteedAtStep(this.pointer, offset);
103108
}
@@ -139,7 +144,9 @@ private static class Native {
139144

140145
public static native boolean patternRooted(long query, int pattern);
141146

142-
public static native boolean patternGuaranteedAtStep(long query, int offset);
147+
public static native boolean patternNonLocal(long query, int pattern);
148+
149+
public static native boolean patternGuaranteedAtStep(long query, int byteOffset);
143150

144151
public static native String captureNameForId(long query, int id);
145152

0 commit comments

Comments
 (0)