Skip to content

Commit 38241d4

Browse files
committed
Rename .read_fn, .seek_fn -> .read, .seek
1 parent f6da44f commit 38241d4

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

include/tree_sitter/runtime.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ typedef enum {
1919

2020
typedef struct {
2121
void *payload;
22-
const char *(*read_fn)(void *payload, size_t *bytes_read);
23-
int (*seek_fn)(void *payload, size_t character, size_t byte);
22+
const char *(*read)(void *payload, size_t *bytes_read);
23+
int (*seek)(void *payload, size_t character_index, size_t byte_index);
2424
TSInputEncoding encoding;
2525
} TSInput;
2626

spec/helpers/spy_input.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ TSInput SpyInput::input() {
6363
TSInput result;
6464
result.payload = this;
6565
result.encoding = encoding;
66-
result.seek_fn = seek;
67-
result.read_fn = read;
66+
result.seek = seek;
67+
result.read = read;
6868
return result;
6969
}
7070

spec/runtime/document_spec.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ describe("Document", [&]() {
6969
it("allows the input to be retrieved later", [&]() {
7070
ts_document_set_input(doc, spy_input->input());
7171
AssertThat(ts_document_input(doc).payload, Equals<void *>(spy_input));
72-
AssertThat(ts_document_input(doc).read_fn, Equals(spy_input->input().read_fn));
73-
AssertThat(ts_document_input(doc).seek_fn, Equals(spy_input->input().seek_fn));
72+
AssertThat(ts_document_input(doc).read, Equals(spy_input->input().read));
73+
AssertThat(ts_document_input(doc).seek, Equals(spy_input->input().seek));
7474
});
7575

7676
it("does not assume that the document's text has changed", [&]() {

src/runtime/document.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void ts_document_edit(TSDocument *self, TSInputEdit edit) {
9090
}
9191

9292
int ts_document_parse(TSDocument *self) {
93-
if (!self->input.read_fn || !self->parser.language)
93+
if (!self->input.read || !self->parser.language)
9494
return -1;
9595

9696
TSTree *reusable_tree = self->valid ? self->tree : NULL;

src/runtime/lexer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ static void ts_lexer__get_chunk(TSLexer *self) {
2424
TSInput input = self->input;
2525
if (!self->chunk ||
2626
self->current_position.bytes != self->chunk_start + self->chunk_size)
27-
input.seek_fn(input.payload, self->current_position.chars,
27+
input.seek(input.payload, self->current_position.chars,
2828
self->current_position.bytes);
2929

3030
self->chunk_start = self->current_position.bytes;
31-
self->chunk = input.read_fn(input.payload, &self->chunk_size);
31+
self->chunk = input.read(input.payload, &self->chunk_size);
3232
if (!self->chunk_size)
3333
self->chunk = empty_chunk;
3434
}

src/runtime/string_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ TSInput ts_string_input_make(const char *string) {
3636
input->length = strlen(string);
3737
return (TSInput){
3838
.payload = input,
39-
.read_fn = ts_string_input_read,
40-
.seek_fn = ts_string_input_seek,
39+
.read = ts_string_input_read,
40+
.seek = ts_string_input_seek,
4141
.encoding = TSInputEncodingUTF8,
4242
};
4343

0 commit comments

Comments
 (0)