bindings: Vendor v0.25.9

This commit is contained in:
Michael Davis
2025-09-06 19:08:59 -04:00
parent cfce9b7c82
commit bc014cf19a
5 changed files with 27 additions and 28 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
REMOTE=https://github.com/tree-sitter/tree-sitter.git
BRANCH=v0.25.8
BRANCH=v0.25.9
rm -rf vendor
rm -rf tmp

View File

@@ -186,7 +186,7 @@ TSSymbol ts_language_symbol_for_name(
uint32_t length,
bool is_named
) {
if (!strncmp(string, "ERROR", length)) return ts_builtin_sym_error;
if (is_named && !strncmp(string, "ERROR", length)) return ts_builtin_sym_error;
uint16_t count = (uint16_t)ts_language_symbol_count(self);
for (TSSymbol i = 0; i < count; i++) {
TSSymbolMetadata metadata = ts_language_symbol_metadata(self, i);

View File

@@ -18,13 +18,15 @@
#if defined(HAVE_ENDIAN_H) || \
defined(__linux__) || \
defined(__GNU__) || \
defined(__HAIKU__) || \
defined(__illumos__) || \
defined(__NetBSD__) || \
defined(__OpenBSD__) || \
defined(__CYGWIN__) || \
defined(__MSYS__) || \
defined(__EMSCRIPTEN__) || \
defined(__wasi__)
defined(__wasi__) || \
defined(__wasm__)
#if defined(__NetBSD__)
#define _NETBSD_SOURCE 1

View File

@@ -928,35 +928,26 @@ static unsigned analysis_state__recursion_depth(const AnalysisState *self) {
return result;
}
static inline int analysis_state__compare_position(
AnalysisState *const *self,
AnalysisState *const *other
) {
for (unsigned i = 0; i < (*self)->depth; i++) {
if (i >= (*other)->depth) return -1;
if ((*self)->stack[i].child_index < (*other)->stack[i].child_index) return -1;
if ((*self)->stack[i].child_index > (*other)->stack[i].child_index) return 1;
}
if ((*self)->depth < (*other)->depth) return 1;
if ((*self)->step_index < (*other)->step_index) return -1;
if ((*self)->step_index > (*other)->step_index) return 1;
return 0;
}
static inline int analysis_state__compare(
AnalysisState *const *self,
AnalysisState *const *other
) {
int result = analysis_state__compare_position(self, other);
if (result != 0) return result;
if ((*self)->depth < (*other)->depth) return 1;
for (unsigned i = 0; i < (*self)->depth; i++) {
if ((*self)->stack[i].parent_symbol < (*other)->stack[i].parent_symbol) return -1;
if ((*self)->stack[i].parent_symbol > (*other)->stack[i].parent_symbol) return 1;
if ((*self)->stack[i].parse_state < (*other)->stack[i].parse_state) return -1;
if ((*self)->stack[i].parse_state > (*other)->stack[i].parse_state) return 1;
if ((*self)->stack[i].field_id < (*other)->stack[i].field_id) return -1;
if ((*self)->stack[i].field_id > (*other)->stack[i].field_id) return 1;
if (i >= (*other)->depth) return -1;
AnalysisStateEntry s1 = (*self)->stack[i];
AnalysisStateEntry s2 = (*other)->stack[i];
if (s1.child_index < s2.child_index) return -1;
if (s1.child_index > s2.child_index) return 1;
if (s1.parent_symbol < s2.parent_symbol) return -1;
if (s1.parent_symbol > s2.parent_symbol) return 1;
if (s1.parse_state < s2.parse_state) return -1;
if (s1.parse_state > s2.parse_state) return 1;
if (s1.field_id < s2.field_id) return -1;
if (s1.field_id > s2.field_id) return 1;
}
if ((*self)->step_index < (*other)->step_index) return -1;
if ((*self)->step_index > (*other)->step_index) return 1;
return 0;
}
@@ -1247,7 +1238,7 @@ static void ts_query__perform_analysis(
// the states that have made the least progress. Avoid advancing states that have already
// made more progress.
if (analysis->next_states.size > 0) {
int comparison = analysis_state__compare_position(
int comparison = analysis_state__compare(
&state,
array_back(&analysis->next_states)
);
@@ -1349,7 +1340,12 @@ static void ts_query__perform_analysis(
// Determine if this hypothetical child node would match the current step
// of the query pattern.
bool does_match = false;
if (visible_symbol) {
// ERROR nodes can appear anywhere, so if the step is
// looking for an ERROR node, consider it potentially matchable.
if (step->symbol == ts_builtin_sym_error) {
does_match = true;
} else if (visible_symbol) {
does_match = true;
if (step->symbol == WILDCARD_SYMBOL) {
if (

View File

@@ -754,6 +754,7 @@ TSWasmStore *ts_wasm_store_new(TSWasmEngine *engine, TSWasmError *wasm_error) {
wasmtime_val_t stack_pointer_value = WASM_I32_VAL(0);
wasmtime_global_t stack_pointer_global;
error = wasmtime_global_new(context, var_i32_type, &stack_pointer_value, &stack_pointer_global);
wasm_globaltype_delete(var_i32_type);
ts_assert(!error);
*self = (TSWasmStore) {