Tree-Sitter TOON Grammar
A complete tree-sitter grammar implementation for TOON (Token-Oriented Object Notation) v2.0.
Installation
Python
pip install tree-sitter-toon
from tree_sitter import Parser
from tree_sitter_toon import language
parser = Parser(language())
tree = parser.parse(b"name: value")
Development
# Generate parser
tree-sitter generate
# Run tests
tree-sitter test
# Parse a file
tree-sitter parse example.toon
Status
✅ Production Ready
- 93.8% test pass rate (61/65 tests)
- All major TOON v2.0 features implemented
- Comprehensive test coverage
Features
- ✅ All primitive types (null, boolean, number, string)
- ✅ Unquoted strings with Unicode/emoji support
- ✅ Objects with indentation-based nesting
- ✅ Arrays: inline, tabular, and list formats
- ✅ All delimiters: comma, pipe, tab
- ✅ Headers with field lists
- ✅ Objects as list items
- ✅ Empty arrays
- ✅ Nested structures (tested to 5+ levels)
Documentation
- example.toon - Working demonstration file
Test Organization
test/corpus/
├── arrays/ - Array tests (inline, tabular, list, root)
├── objects/ - Object structure tests
├── delimiters/ - Delimiter-specific tests
├── primitives.txt - All primitive value types
└── mixed.txt - Complex combined scenarios
Example
name: TOON Parser
version: 2.0
unicode: Hello 世界 🎉
arrays:
inline[3]: a,b,c
empty[0]:
table[2]{id,name}:
1,Alice
2,Bob
users[2]:
- name: Alice
score: 100
- name: Bob
score: 200
nested:
data[2]: x,y
License
GPL-3.0-or-later
Links
Metadata
Release files for tree-sitter-toon 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tree_sitter_toon-0.1.2.tar.gz | 38.0 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tree_sitter_toon-0.1.2-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| tree_sitter_toon-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64, Linux glibc 2.5+ x86-64 | Details |
| tree_sitter_toon-0.1.2-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| tree_sitter_toon-0.1.2-cp310-abi3-macosx_10_9_x86_64.whl | CPython 3.10 | abi3 | macOS 10.9+ x86-64 | Details |
Total release size: 211.1 kB
Release files / tree_sitter_toon-0.1.2.tar.gz
| Download URL | tree_sitter_toon-0.1.2.tar.gz |
|---|---|
| Size | 38.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04ec3f22c22ca6df9b091ec5467946176e37e6865b62f70b12ceff726a51b25f
|
|
BLAKE2b-256 checksum How to use checksums |
3c42e2d3c1394082ab1aa20427fd0c80da685bb7c5c4eebd39f6f5d4c8e60190
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / tree_sitter_toon-0.1.2-cp310-abi3-win_amd64.whl
| Download URL | tree_sitter_toon-0.1.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 32.5 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
eb59a9c7e1a31a697347e44d62f4fbd50a2ea70180f71a174721b0557e181205
|
|
BLAKE2b-256 checksum How to use checksums |
4c04503f6dd7ea14bf98493cfa172ebe0126961b323158629cb600722a8452b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / tree_sitter_toon-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl
| Download URL | tree_sitter_toon-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 72.3 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c04aef71b7ba168c7b37ee438f6c7e9a4111a37bc68df31ad950c7df691c534c
|
|
BLAKE2b-256 checksum How to use checksums |
cb333b92bdbb24d9fb3ffb6f66c8f652af9926bbf190dce4bc548b8d5f56ebb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / tree_sitter_toon-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | tree_sitter_toon-0.1.2-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 33.6 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c24c6728f66552e76d482a6faa168c9f07eb46fd90774e8592664d49a806337b
|
|
BLAKE2b-256 checksum How to use checksums |
06628c5712ae90240de4cac446a2eabcfbfc73102a9c1657f64ec96edbfb9957
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / tree_sitter_toon-0.1.2-cp310-abi3-macosx_10_9_x86_64.whl
| Download URL | tree_sitter_toon-0.1.2-cp310-abi3-macosx_10_9_x86_64.whl |
|---|---|
| Size | 34.6 kB |
| Tags | CPython 3.10 abi3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
c27acd17735d3a3bff915d6537565a92860d337808b697afe87720e60d2df9c1
|
|
BLAKE2b-256 checksum How to use checksums |
61b73ecae84dafb7d4ab77cd8729e80250e87374afca9668b4d0e74c90b8e660
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|