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.0.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.0-cp310-abi3-win_amd64.whl (32.4 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_toon-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (71.9 kB view details)

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

tree_sitter_toon-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (33.5 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_toon-0.1.0-cp310-abi3-macosx_10_9_x86_64.whl (34.5 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tree_sitter_toon-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 dd6458897549f5862570f9ce46fe0ae7d15218d444155054f6fcf6fe908b2b0e
MD5 e2de0c0fc7417779e1ab7b122a6091c6
BLAKE2b-256 f8c2b507ead2ced093714149f5df2dbb0bb9c5746eaf01225635344639629c62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f62493af81a1b6f03c0347561eee924e2503e4fef4ed4569af4038d08bb03b60
MD5 035761ce67683a3733082b091b30eb48
BLAKE2b-256 cd5cf272b6311cb7f2fda429ee35bac66dcafd008ddf7ad749a1b1b74f758b2f

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.1.0-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.0-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ad0719b690712273d07028ccae7a1e645e49aeda066d57759c962a8787422b24
MD5 f21ae016bc3b72722210154b4afd879f
BLAKE2b-256 add917f6f05fff3f2e93c578f584b05e04be57a8001acbe61e27423aecec5004

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a871413ebec200b7682c81c4c8fc7a1ac28ac06e8c48ea07d8cf7267f22ac2be
MD5 5aa2403af9da9e74f615198765165a28
BLAKE2b-256 096453254f7851595d1ed312c75d4f9b2137a662ff9e45964a33fb019a678487

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.0-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f893525ef166262e30c6750bfb10d2ec50684cb1fbe7e98d5160cb128f469cf7
MD5 bc181b866176e80cae054129d09d0e23
BLAKE2b-256 f636043f1db33bf7b3a9f22a66d7f4dbfb9d70bf18f1484b8565659d87444df8

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