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

  • IMPLEMENTATION_NOTES.md - Complete implementation documentation
  • TASK_COMPLETION.md - Recent work summary
  • 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.0.10.tar.gz (36.8 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.0.10-cp310-abi3-win_amd64.whl (31.6 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_toon-0.0.10-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (68.7 kB view details)

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

tree_sitter_toon-0.0.10-cp310-abi3-macosx_11_0_arm64.whl (31.6 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_toon-0.0.10-cp310-abi3-macosx_10_9_x86_64.whl (31.7 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tree_sitter_toon-0.0.10.tar.gz
  • Upload date:
  • Size: 36.8 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.0.10.tar.gz
Algorithm Hash digest
SHA256 34f2aff694e9f6d4378035327b44ab330da0567be06ae22ba2a38f8376cf8c11
MD5 21d494694fc35f8f949c880bb40bc609
BLAKE2b-256 a6f731e6c521f4d01409a93479d5b779634e8a02334874e25f6d2db5623fbb59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.10-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 293da3a0b3e919bd1ba25c27ae8ff0a465d082cc6e5ab859976c949c2cf15e5f
MD5 5a9eab2ff67a4e8405020a0f0977a74f
BLAKE2b-256 505fbe0692166e9a5ca08250a8d3ae2853fb284ddcaaa7320173e4de910cab17

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.0.10-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.0.10-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d423a46080ede712d4a571dca495e99d3707d9462359f6cb1441e82bd0a8810c
MD5 c9d7ce2cf23c9b0bb877efbcada55ff2
BLAKE2b-256 c11ac8db1d1cd0884d2649d6ce5465c4819e9a57b47d2b473321b541acdde9d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.10-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 84c3acb29ed0cfc26a653149a244afb1f0df3389d65c772280074cfa255de53f
MD5 b5c64b62c2980c39553cb8d1813ae087
BLAKE2b-256 e1ea2739886b631855cd5f887713798fdba929facfab2a9fd3eef46d5078bc89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.10-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c8f72d8947ff3056f9833a2f1ca8f7dfffbb6df2a530fd3dcfc4a3a3ff488723
MD5 776bd02d38271e1d8f3899a85deba553
BLAKE2b-256 332e5a358c0a1903284007d43528a4192898594581b966e9b9065562a5924aef

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