Skip to content

Commit bc014cf

Browse files
committed
bindings: Vendor v0.25.9
1 parent cfce9b7 commit bc014cf

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

bindings/vendor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
REMOTE=https://github.com/tree-sitter/tree-sitter.git
4-
BRANCH=v0.25.8
4+
BRANCH=v0.25.9
55

66
rm -rf vendor
77
rm -rf tmp

bindings/vendor/src/language.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ TSSymbol ts_language_symbol_for_name(
186186
uint32_t length,
187187
bool is_named
188188
) {
189-
if (!strncmp(string, "ERROR", length)) return ts_builtin_sym_error;
189+
if (is_named && !strncmp(string, "ERROR", length)) return ts_builtin_sym_error;
190190
uint16_t count = (uint16_t)ts_language_symbol_count(self);
191191
for (TSSymbol i = 0; i < count; i++) {
192192
TSSymbolMetadata metadata = ts_language_symbol_metadata(self, i);

bindings/vendor/src/portable/endian.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
#if defined(HAVE_ENDIAN_H) || \
1919
defined(__linux__) || \
2020
defined(__GNU__) || \
21+
defined(__HAIKU__) || \
2122
defined(__illumos__) || \
2223
defined(__NetBSD__) || \
2324
defined(__OpenBSD__) || \
2425
defined(__CYGWIN__) || \
2526
defined(__MSYS__) || \
2627
defined(__EMSCRIPTEN__) || \
27-
defined(__wasi__)
28+
defined(__wasi__) || \
29+
defined(__wasm__)
2830

2931
#if defined(__NetBSD__)
3032
#define _NETBSD_SOURCE 1

bindings/vendor/src/query.c

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -928,38 +928,29 @@ static unsigned analysis_state__recursion_depth(const AnalysisState *self) {
928928
return result;
929929
}
930930

931-
static inline int analysis_state__compare_position(
931+
static inline int analysis_state__compare(
932932
AnalysisState *const *self,
933933
AnalysisState *const *other
934934
) {
935+
if ((*self)->depth < (*other)->depth) return 1;
935936
for (unsigned i = 0; i < (*self)->depth; i++) {
936937
if (i >= (*other)->depth) return -1;
937-
if ((*self)->stack[i].child_index < (*other)->stack[i].child_index) return -1;
938-
if ((*self)->stack[i].child_index > (*other)->stack[i].child_index) return 1;
938+
AnalysisStateEntry s1 = (*self)->stack[i];
939+
AnalysisStateEntry s2 = (*other)->stack[i];
940+
if (s1.child_index < s2.child_index) return -1;
941+
if (s1.child_index > s2.child_index) return 1;
942+
if (s1.parent_symbol < s2.parent_symbol) return -1;
943+
if (s1.parent_symbol > s2.parent_symbol) return 1;
944+
if (s1.parse_state < s2.parse_state) return -1;
945+
if (s1.parse_state > s2.parse_state) return 1;
946+
if (s1.field_id < s2.field_id) return -1;
947+
if (s1.field_id > s2.field_id) return 1;
939948
}
940-
if ((*self)->depth < (*other)->depth) return 1;
941949
if ((*self)->step_index < (*other)->step_index) return -1;
942950
if ((*self)->step_index > (*other)->step_index) return 1;
943951
return 0;
944952
}
945953

946-
static inline int analysis_state__compare(
947-
AnalysisState *const *self,
948-
AnalysisState *const *other
949-
) {
950-
int result = analysis_state__compare_position(self, other);
951-
if (result != 0) return result;
952-
for (unsigned i = 0; i < (*self)->depth; i++) {
953-
if ((*self)->stack[i].parent_symbol < (*other)->stack[i].parent_symbol) return -1;
954-
if ((*self)->stack[i].parent_symbol > (*other)->stack[i].parent_symbol) return 1;
955-
if ((*self)->stack[i].parse_state < (*other)->stack[i].parse_state) return -1;
956-
if ((*self)->stack[i].parse_state > (*other)->stack[i].parse_state) return 1;
957-
if ((*self)->stack[i].field_id < (*other)->stack[i].field_id) return -1;
958-
if ((*self)->stack[i].field_id > (*other)->stack[i].field_id) return 1;
959-
}
960-
return 0;
961-
}
962-
963954
static inline AnalysisStateEntry *analysis_state__top(AnalysisState *self) {
964955
if (self->depth == 0) {
965956
return &self->stack[0];
@@ -1247,7 +1238,7 @@ static void ts_query__perform_analysis(
12471238
// the states that have made the least progress. Avoid advancing states that have already
12481239
// made more progress.
12491240
if (analysis->next_states.size > 0) {
1250-
int comparison = analysis_state__compare_position(
1241+
int comparison = analysis_state__compare(
12511242
&state,
12521243
array_back(&analysis->next_states)
12531244
);
@@ -1349,7 +1340,12 @@ static void ts_query__perform_analysis(
13491340
// Determine if this hypothetical child node would match the current step
13501341
// of the query pattern.
13511342
bool does_match = false;
1352-
if (visible_symbol) {
1343+
1344+
// ERROR nodes can appear anywhere, so if the step is
1345+
// looking for an ERROR node, consider it potentially matchable.
1346+
if (step->symbol == ts_builtin_sym_error) {
1347+
does_match = true;
1348+
} else if (visible_symbol) {
13531349
does_match = true;
13541350
if (step->symbol == WILDCARD_SYMBOL) {
13551351
if (

bindings/vendor/src/wasm_store.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ TSWasmStore *ts_wasm_store_new(TSWasmEngine *engine, TSWasmError *wasm_error) {
754754
wasmtime_val_t stack_pointer_value = WASM_I32_VAL(0);
755755
wasmtime_global_t stack_pointer_global;
756756
error = wasmtime_global_new(context, var_i32_type, &stack_pointer_value, &stack_pointer_global);
757+
wasm_globaltype_delete(var_i32_type);
757758
ts_assert(!error);
758759

759760
*self = (TSWasmStore) {

0 commit comments

Comments
 (0)