Skip to content

Commit 141725a

Browse files
Marcono1234ObserverOfTime
authored andcommitted
docs: extend Javadoc
1 parent 8bee4c6 commit 141725a

File tree

8 files changed

+19
-6
lines changed

8 files changed

+19
-6
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ These alternatives support older JDK versions or Android:
2626
- [tree-sitter/kotlin-tree-sitter](https://github.com/tree-sitter/kotlin-tree-sitter) (JDK 17+, Android SDK 23+, Kotlin 1.9)
2727
- [bonede/tree-sitter-ng](https://github.com/bonede/tree-sitter-ng) (JDK 8+)
2828
- [seart-group/java-tree-sitter](https://github.com/seart-group/java-tree-sitter) (JDK 11+)
29-
- [AndroidIDEOfficial/android-tree-sitter](https://github.com/AndroidIDEOfficial/android-tree-sitter) (Android SDK 21+)
3029

3130
[tree-sitter]: https://tree-sitter.github.io/tree-sitter/
3231
[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/java-tree-sitter/ci.yml?logo=github&label=CI

src/main/java/io/github/treesitter/jtreesitter/InputEncoding.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Charset charset() {
4040
* @param charset one of {@link StandardCharsets#UTF_8}, {@link StandardCharsets#UTF_16BE},
4141
* {@link StandardCharsets#UTF_16LE}, or {@link StandardCharsets#UTF_16} (native byte order).
4242
* @throws IllegalArgumentException If the character set is invalid.
43+
* @since 0.25.1
4344
*/
4445
@SuppressWarnings("SameParameterValue")
4546
public static @NonNull InputEncoding valueOf(@NonNull Charset charset) throws IllegalArgumentException {

src/main/java/io/github/treesitter/jtreesitter/Language.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ private static UnsatisfiedLinkError unresolved(String name) {
6767
* <strong>The {@linkplain Arena} used to load the language
6868
* must not be closed while the language is being used.</strong>
6969
*
70+
* @throws UnsatisfiedLinkError If the language symbol could not be found.
7071
* @throws RuntimeException If the language could not be loaded.
7172
* @since 0.23.1
7273
*/

src/main/java/io/github/treesitter/jtreesitter/LookaheadIterator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* <p>Lookahead iterators can be useful to generate suggestions and improve syntax error diagnostics.<br>
1818
* To get symbols valid in an {@index ERROR} node, use the lookahead iterator on its first leaf node state.<br>
1919
* For {@index MISSING} nodes, a lookahead iterator created on the previous non-extra leaf node may be appropriate.
20+
*
21+
* @see Language#lookaheadIterator(short)
2022
*/
2123
@NullMarked
2224
public final class LookaheadIterator implements AutoCloseable, Iterator<LookaheadIterator.Symbol> {

src/main/java/io/github/treesitter/jtreesitter/Parser.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public final class Parser implements AutoCloseable {
2626
* Creates a new instance with a {@code null} language.
2727
*
2828
* @apiNote Parsing cannot be performed while the language is {@code null}.
29+
* @see #setLanguage(Language)
2930
*/
3031
public Parser() {
3132
arena = Arena.ofShared();
@@ -400,6 +401,10 @@ public String toString() {
400401
public static final class Options {
401402
private final Predicate<State> progressCallback;
402403

404+
/**
405+
* @param progressCallback Called when parsing progress was made. Return {@code true} to cancel parsing,
406+
* {@code false} to continue parsing.
407+
*/
403408
public Options(Predicate<State> progressCallback) {
404409
this.progressCallback = progressCallback;
405410
}

src/main/java/io/github/treesitter/jtreesitter/QueryCursor.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public QueryCursor setMaxStartDepth(@Unsigned int maxStartDepth) {
102102
* than the specified range, but part of that node intersects with the range,
103103
* the entire match will be returned.
104104
*
105-
* @throws IllegalArgumentException If `endByte > startByte`.
105+
* @throws IllegalArgumentException If {@code endByte > startByte}.
106106
*/
107107
public QueryCursor setByteRange(@Unsigned int startByte, @Unsigned int endByte) throws IllegalArgumentException {
108108
if (!ts_query_cursor_set_byte_range(self, startByte, endByte)) {
@@ -123,7 +123,7 @@ public QueryCursor setByteRange(@Unsigned int startByte, @Unsigned int endByte)
123123
* than the specified range, but part of that node intersects with the range,
124124
* the entire match will be returned.
125125
*
126-
* @throws IllegalArgumentException If `endPoint > startPoint`.
126+
* @throws IllegalArgumentException If {@code endPoint > startPoint}.
127127
*/
128128
public QueryCursor setPointRange(Point startPoint, Point endPoint) throws IllegalArgumentException {
129129
try (var alloc = Arena.ofConfined()) {
@@ -293,7 +293,8 @@ public static class Options {
293293
private final @Nullable BiPredicate<QueryPredicate, QueryMatch> predicateCallback;
294294

295295
/**
296-
* @param progressCallback Progress handler.
296+
* @param progressCallback Progress handler. Return {@code true} to cancel query execution,
297+
* {@code false} to continue query execution.
297298
* @param predicateCallback Custom predicate handler.
298299
*/
299300
private Options(
@@ -304,7 +305,8 @@ private Options(
304305
}
305306

306307
/**
307-
* @param progressCallback Progress handler.
308+
* @param progressCallback Progress handler. Return {@code true} to cancel query execution,
309+
* {@code false} to continue query execution.
308310
*/
309311
public Options(Predicate<State> progressCallback) {
310312
this.progressCallback = progressCallback;

src/main/java/io/github/treesitter/jtreesitter/QueryMatch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.util.List;
88
import org.jspecify.annotations.NullMarked;
99

10-
/** A match that corresponds to a certain pattern in the query. */
10+
/** A match that corresponds to a certain pattern in a {@link Query}. */
1111
@NullMarked
1212
public record QueryMatch(@Unsigned int patternIndex, List<QueryCapture> captures) {
1313
/** Creates an instance of a QueryMatch record class. */

src/main/java/io/github/treesitter/jtreesitter/TreeCursor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
*
1515
* @apiNote The node the cursor was constructed with is considered the
1616
* root of the cursor, and the cursor cannot walk outside this node.
17+
*
18+
* @see Tree#walk()
19+
* @see Node#walk()
1720
*/
1821
@NullMarked
1922
public final class TreeCursor implements AutoCloseable, Cloneable {

0 commit comments

Comments
 (0)