Thanks for contributing to tree-sitter-objectscript.
tree-sitterCLI>=0.26.6- Node.js
22and npm>=10(nvm use) - Rust toolchain (
cargo) - Python
>=3.9 - Optional: Go and Swift toolchains for binding tests
objectscript/: playground/snippet grammarudl/:.clsgrammarcore/: routine/statement grammarexpr/: expression grammarobjectscript_routine/: routine-file grammar for.mac,.rtn,.inc,.int
Grammar graph:
objectscript_expr -> objectscript_core -> objectscript_udl -> objectscript
objectscript_expr -> objectscript_core -> objectscript_routine
Run from the grammar directory you are changing:
tree-sitter generate
tree-sitter test
tree-sitter buildFor playground work:
tree-sitter build --wasm
tree-sitter playgroundIf you modify an upstream grammar (expr or core), regenerate and retest downstream grammars (udl, objectscript, objectscript_routine).
One-time setup after cloning:
make installhooksWhat this does:
- Sets
core.hooksPathto.githooks - Installs and enables the repository
pre-commithook
Verify hook setup:
git config --get core.hooksPath
ls -l .githooks/pre-commitExpected:
core.hooksPathprints.githooks.githooks/pre-commitis executable
Hook behavior:
- On commit, the
pre-commithook:- Replaces
objectscript/test/corpuswith files fromcore/test/corpus,udl/test/corpus, andobjectscript_routine/test/corpus. - Refreshes
objectscript/test/corpustrees withtree-sitter t --update. - Removes
objectscript/test/corpus/invalid.txt. - Runs
python3 scripts/sync_queries.pyand stages synchronized canonical query files. - Runs
npm run lint -- --fix, thennpm run lint. - Runs
tree-sitter testinobjectscript,udl,core,expr, andobjectscript_routine. - Runs
make formatquery,make lintquery, andmake checkquery.
- Replaces
Query composition rules:
expr/queries: source layercore/queries:highlights.scm:expr + core localindents.scm:core localinjections.scm:core local
udl/queries:highlights.scm:expr + core + udl localindents.scm:core + udl localinjections.scm:core + udl local
objectscript/queries:highlights.scm:expr + core + udl + objectscript localindents.scm:core + objectscript localinjections.scm:core + udl + objectscript local
objectscript_routine/queries:highlights.scm:expr + core + routine localindents.scm:core + routine localinjections.scm:core + routine local
scripts/sync_queries.py only manages highlights.scm, indents.scm, and
injections.scm. studio-highlights.scm files are intentionally excluded from
query sync and from Python query-copy verification.
Manual query commands:
make syncqueries
make queryRun from repository root.
- Rust (UDL crate + staged routine/playground crates):
cargo test --lib --package tree-sitter-objectscript
./scripts/rust_routine_crate.sh stage /tmp/tsroutine
cp objectscript_routine/queries/studio-highlights.scm /tmp/tsroutine/objectscript_routine/queries/
cargo build --manifest-path /tmp/tsroutine/Cargo.toml
./scripts/rust_playground_crate.sh stage /tmp/tsplayground
cp objectscript/queries/studio-highlights.scm /tmp/tsplayground/objectscript/queries/
cargo build --manifest-path /tmp/tsplayground/Cargo.tomlThe root Cargo.toml only covers the published UDL crate
(tree-sitter-objectscript). The routine and playground crates are staged from
their template directories before building or publishing. Their current Rust
templates include STUDIO_HIGHLIGHTS_QUERY, so local staged builds need the
matching studio-highlights.scm copied into the staged query directory until
the staging scripts are updated to do that automatically.
- Python:
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -U pip setuptools wheel pytest tree-sitter
python3 setup.py build_ext --inplace
PYTHONPATH=$PWD/bindings/python python3 -m pytest -q bindings/python/tests/test_binding.py- Node:
nvm use
npm ci
npm testUse nvm use first so your shell switches to the repository version from .nvmrc.
- Go:
go test ./bindings/go/...- Swift:
swift test- C:
make test- Keep generated parser/query artifacts in sync with grammar changes.
- Add or update corpus tests for behavior changes.
- Prefer Conventional Commits for commit messages.
- Open PRs against this repository and include a concise change summary.
Report bugs and feature requests via GitHub Issues.