scripts

command
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

This script automates fetching and setting up Tree-sitter grammars for a Go project. It is a necessary workaround for `go mod vendor`, which fails to include the required C source files.

The script performs three main steps:

1. **Fetch Runtimes:** Downloads the `go-tree-sitter` Go wrapper and the core `tree-sitter` C library, arranging them into a single, CGO-compatible package.

2. **Apply CGO Fixes:** To prevent common build errors, it performs two critical fixes:

  • Deletes `lib.c` (a unity build file) to avoid "multiple definition" linker errors.
  • Patches Go files to remove the corresponding `#include "lib.c"` line.

3. **Fetch Grammars:** It reads `grammars.yaml` and downloads each specified language grammar, extracting its C source (`src/`) and Go bindings (`bindings/go/`).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL