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.7.tar.gz (35.5 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.7-cp310-abi3-win_amd64.whl (29.4 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_toon-0.0.7-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (45.0 kB view details)

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

tree_sitter_toon-0.0.7-cp310-abi3-macosx_11_0_arm64.whl (27.3 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_toon-0.0.7-cp310-abi3-macosx_10_9_x86_64.whl (26.7 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tree_sitter_toon-0.0.7.tar.gz
  • Upload date:
  • Size: 35.5 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.7.tar.gz
Algorithm Hash digest
SHA256 36b95b785243ed244618d5cdd715b0877af9415202147c84426af751c3a6ce0d
MD5 dc8cf87d72909b43084a43ad7a4f604a
BLAKE2b-256 077ae851bef70a6359d1916c74e0cd4b3e60c8c62bfba6f6d3b0258b4eafd00e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.7-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0252f74d9bb552c1564630a79fc9b3968c340c959d5a13d718d17c6d7bbd701c
MD5 852e3f3ff15f9b342aeac7c6f6c19702
BLAKE2b-256 91055d9a67b03784cd252d0885bebd9e9776a06f4d2e837e0ba381b6772ddea0

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.0.7-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.7-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b62d96d8371fad8f4a40b36e7e9681bf3859ea504d4a40d291277c09344e3d8
MD5 34993f4a7d86ba461582f32b8e0c1878
BLAKE2b-256 d2365376055db17b12b404c1b27afbb3f51bf00ec0e79a209bc821289324ac98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.7-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43579a3482a2179caec8a337579d4911fc4200e13a0023cacf7034816c4e7aa7
MD5 d4312de07916788c888cfdc3ff23e82f
BLAKE2b-256 fcdb8750c4ac8314873ed842e67fb313138ac13a70b93fb7717db9db704781f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.7-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ce339c877d6fea8a2152cfb402b437a6c09dc370543faf4672c7913a67b82017
MD5 f6a882cd6d632467a2e2d76ec4755942
BLAKE2b-256 37225d9a05b0fe5a0e30ecac81f70181a8783de2a316553c7a34665735fbbc19

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