add bindings and fix documentation
This commit is contained in:
1 parent
0e8ef8e7a5
commit
53e1ee2036
34 files changed
+1472
-12
No files matched your search
@@ -11,6 +11,10 @@ npm run parser-generate # regenerate src/parser.c, grammar.json, node-types.js
|
||||
npm run parser-test # run the corpus tests
|
||||
npm run parser-build # build tree-sitter-django.wasm
|
||||
npm run playground # explore the grammar interactively
|
||||
npm install # also builds the Node binding, through node-gyp-build
|
||||
npm run binding-test # the Node binding's own test
|
||||
cargo test # the Rust binding
|
||||
make # the C library, and make clean to remove it
|
||||
|
||||
npx tree-sitter test -i "Cycle With As" # one test, by name regex
|
||||
npx tree-sitter test --file-name cycle.txt # one corpus file
|
||||
@@ -30,6 +34,27 @@ back, producing churn in both directions.
|
||||
`npm run lint` does not work: `eslint.config.mjs` was copied from a Next.js project and enables
|
||||
`@typescript-eslint` and `react-hooks` rules whose plugins aren't installed. Formatting is prettier's job.
|
||||
|
||||
### Bindings
|
||||
|
||||
`bindings/` and the manifests beside it — `binding.gyp`, `Cargo.toml`, `pyproject.toml`, `setup.py`,
|
||||
`go.mod`, `Package.swift`, `Makefile`, `CMakeLists.txt` — are generated by `tree-sitter init` from the
|
||||
`bindings` and `metadata` sections of `tree-sitter.json`, and `.gitattributes` marks them
|
||||
`linguist-generated`. Do not edit them by hand: change `tree-sitter.json` and regenerate.
|
||||
|
||||
`tree-sitter init --update` only rewrites what it considers outdated, and a changed `version` or
|
||||
`description` does not count, so the manifests keep the old values until they are deleted and `init` is run
|
||||
again. It leaves `README.md`, `package.json` and `.gitignore` alone, which is why the Node binding's
|
||||
`package.json` entries — `main`/`types`, the `.` export, `files`, `node-addon-api`, `node-gyp-build`, the
|
||||
`install` script and the optional `tree-sitter` peer — are maintained here rather than generated.
|
||||
|
||||
Every binding was built and run on macOS: `npm install` plus `npm run binding-test`, `cargo test`,
|
||||
`go test ./bindings/go/`, `pip install .` with a parse, `swift build`, and `make`. The Go binding needs a
|
||||
`go.sum`, which `go mod tidy` writes and which is committed with the rest.
|
||||
|
||||
`src/scanner.c` compiles without warnings, and should stay that way: cc and clang warn about `&&` within
|
||||
`||` (`-Wlogical-op-parentheses`), so a comparison chain written with both needs its `&&` groups
|
||||
parenthesized.
|
||||
|
||||
### Stale parser library
|
||||
|
||||
tree-sitter caches the compiled parser in `~/.cache/tree-sitter/lib/django.*`, and it has served a stale
|
||||
|
||||
Reference in new issue
Block a user