Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions _automation/treesitter_updater/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import (
)

// Constants for the Tree Sitter version and download URL
const sitterVersion = "0.22.5"
const sitterURL = "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v" + sitterVersion + ".tar.gz"
const (
sitterVersion = "0.25.9"
sitterURL = "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v" + sitterVersion + ".tar.gz"
)

func main() {
// Get the current working directory
Expand All @@ -40,6 +42,7 @@ func main() {
copyFiles(filepath.Join(parentPath, "lib", "src"), filepath.Join(currentDir, "tmpts"), "*.c")
copyFiles(filepath.Join(parentPath, "lib", "src"), filepath.Join(currentDir, "tmpts"), "*.h")
copyFiles(filepath.Join(parentPath, "lib", "src", "unicode"), filepath.Join(currentDir, "tmpts"), "*.h")
copyFiles(filepath.Join(parentPath, "lib", "src", "portable"), filepath.Join(currentDir, "tmpts"), "*.h")

// Remove the original extracted directory
err = os.RemoveAll(parentPath)
Expand Down Expand Up @@ -125,7 +128,7 @@ func copyFile(src, dst string) error {
}

// Write the file to destination
err = ioutil.WriteFile(dst, input, 0644)
err = ioutil.WriteFile(dst, input, 0o644)
if err != nil {
return err
}
Expand Down Expand Up @@ -154,6 +157,7 @@ func modifyIncludePaths(path string) error {
// Modify the content and write back
modifiedContent := strings.ReplaceAll(string(content), `"tree_sitter/`, `"`)
modifiedContent = strings.ReplaceAll(modifiedContent, `"unicode/`, `"`)
modifiedContent = strings.ReplaceAll(modifiedContent, `"portable/`, `"`)
return os.WriteFile(filePath, []byte(modifiedContent), info.Mode())
})
}
Expand Down Expand Up @@ -196,7 +200,7 @@ func downloadAndExtractSitter(url, version string) error {
// Create directories and files as needed
switch header.Typeflag {
case tar.TypeDir:
if err := os.MkdirAll(target, 0755); err != nil {
if err := os.MkdirAll(target, 0o755); err != nil {
return err
}
case tar.TypeReg:
Expand Down Expand Up @@ -230,7 +234,6 @@ func cleanup(path string) {
}
return nil
})

if err != nil {
// Handle the error
}
Expand Down
8 changes: 4 additions & 4 deletions alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ extern "C" {
#define TS_PUBLIC __attribute__((visibility("default")))
#endif

TS_PUBLIC extern void *(*ts_current_malloc)(size_t);
TS_PUBLIC extern void *(*ts_current_calloc)(size_t, size_t);
TS_PUBLIC extern void *(*ts_current_realloc)(void *, size_t);
TS_PUBLIC extern void (*ts_current_free)(void *);
TS_PUBLIC extern void *(*ts_current_malloc)(size_t size);
TS_PUBLIC extern void *(*ts_current_calloc)(size_t count, size_t size);
TS_PUBLIC extern void *(*ts_current_realloc)(void *ptr, size_t size);
TS_PUBLIC extern void (*ts_current_free)(void *ptr);

// Allow clients to override allocation functions
#ifndef ts_malloc
Expand Down
Loading
Loading