Metadata-Version: 2.4
Name: tree-sitter-toolang
Version: 0.0.5
Summary: Toolang grammar for tree-sitter
Author: Brice Yan
License-Expression: MIT
Project-URL: Homepage, https://github.com/openhat-ai/tree-sitter-toolang
Project-URL: Repository, https://github.com/openhat-ai/tree-sitter-toolang
Project-URL: Issues, https://github.com/openhat-ai/tree-sitter-toolang/issues
Keywords: incremental,parsing,toolang,tree-sitter
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: C
Classifier: Topic :: Software Development :: Compilers
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: core
Requires-Dist: tree-sitter~=0.25; extra == "core"
Provides-Extra: tests
Requires-Dist: pytest>=8; extra == "tests"
Requires-Dist: tree-sitter~=0.25; extra == "tests"
Dynamic: license-file

# tree-sitter-toolang

Tree-sitter grammar for Toolang.

This repository publishes:

- the npm grammar package `tree-sitter-toolang`
- the Python extension package `tree-sitter-toolang`
- the Rust crate `tree-sitter-toolang`

## Install

### Python

```bash
python -m pip install tree-sitter-toolang tree-sitter
```

```python
import tree_sitter_toolang
from tree_sitter import Language, Parser

language = Language(tree_sitter_toolang.language())
parser = Parser(language)
tree = parser.parse(b"use skill a/b\n")
```

The Python package also exposes packaged query strings:
`HIGHLIGHTS_QUERY`, `INJECTIONS_QUERY`, `INDENTS_QUERY`, `OUTLINE_QUERY`, and
`TAGS_QUERY`.

### Tree-sitter CLI

Install `tree-sitter-toolang` or clone this repository, then make sure the
directory that contains `tree-sitter-toolang` is listed in your Tree-sitter
`parser-directories`.

```bash
tree-sitter init-config
tree-sitter dump-languages
tree-sitter parse path/to/file.too
tree-sitter highlight path/to/file.too
tree-sitter tags path/to/file.too
```

Installing the npm package alone does not make `tree-sitter dump-languages`
discover Toolang automatically. The package must still live under one of the
configured `parser-directories`, or the grammar path must be provided
explicitly.

### Rust

```toml
[dependencies]
tree-sitter = "0.25"
tree-sitter-toolang = "0.0.5"
```

```rust
let language = tree_sitter::Language::new(tree_sitter_toolang::LANGUAGE);
```

## Development

Edit:

- `grammar.js`
- `queries/*.scm`
- `test/corpus/*.txt`

Regenerate and test:

```bash
npm install
npm run generate
npm test
npm run test:cli
npm run build:wasm
cargo test
python -m pip install -e .[tests]
pytest tests
```

## Publishing

Trusted publishers are configured in GitHub Actions with
[release.yml](.github/workflows/release.yml).

Verify the npm package locally:

```bash
npm publish --dry-run
```

Verify the Python distributions locally:

```bash
python -m pip install --upgrade pip build twine
python -m build
python -m twine check dist/*
```

Verify the Rust crate:

```bash
cargo publish --dry-run
```

Release checklist:

1. Bump the version in `package.json`, `pyproject.toml`, and `Cargo.toml`.
2. Confirm CI is green.
3. Push the version commit to `main`.
4. Create and push a matching tag such as `v0.0.6`.
5. GitHub Actions publishes npm and PyPI automatically.
6. Optionally publish the Rust crate to crates.io.

The release workflow skips npm or PyPI if that version already exists on the
registry. The git tag must match the package version.
