Skip to main content

TOON (Token-Oriented Object Notation) grammar for tree-sitter

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_toon-0.1.1.tar.gz (38.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_toon-0.1.1-cp310-abi3-win_amd64.whl (32.5 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_toon-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (72.3 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_toon-0.1.1-cp310-abi3-macosx_11_0_arm64.whl (33.6 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_toon-0.1.1-cp310-abi3-macosx_10_9_x86_64.whl (34.6 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_toon-0.1.1.tar.gz.

File metadata

  • Download URL: tree_sitter_toon-0.1.1.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tree_sitter_toon-0.1.1.tar.gz
Algorithm Hash digest
SHA256 75290978f1a3ca98b2750379265c7372ae81f758bcd3e2d7cc304038a7e438ae
MD5 e6bf38c4060717df6028759584b0c2b1
BLAKE2b-256 35da2ca6c5efd230ce4f1f5d757b72a2f7523e102691737f569c0b221f91b4d9

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.1.1-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3330ecd9639e8eae3bf66ba31bad154fff9c64882e3fe6351a688ab30267a591
MD5 f66f623f033e02c81c4f9c8e9bccfbe8
BLAKE2b-256 ddf15238f5d14917c32e93e9ffee61d28207a1d4cb11da16d70b9d6d1a08a845

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f991902393ce2ee807d06378eadf29143f78887025c989b6baf11ed81f1d4b8
MD5 10f8f8032e8e6235ee77f346d4195243
BLAKE2b-256 3f0ee073d46cce54610f7c1d205ec5fd78a2dece60a2b526c6c3798505a3a647

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.1.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dbdb86cfbfb6c9022df44d4ab88bbbcb19c69a3118839716748fcddbea3905cd
MD5 d76acae4bbef46b39dc0e3c4ce65681d
BLAKE2b-256 e0119c0686d2bae044d02ce795f70e9472071a17768242a026d98599cd44452f

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.1.1-cp310-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.1-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d69274bdc0e91c8223f21742d9ed7a36f058e2670e8c4b7be523c1d13d758a41
MD5 034b2399aea0e73997cf7b1f7b22ed4e
BLAKE2b-256 f9ba3282cdadb94c8f5bf992dbf2a18976dea6beafe9024fbe838ee9b681648f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page