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

Uploaded CPython 3.10+Windows x86-64

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 (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.2-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.2-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.2.tar.gz.

File metadata

  • Download URL: tree_sitter_toon-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 04ec3f22c22ca6df9b091ec5467946176e37e6865b62f70b12ceff726a51b25f
MD5 5a4a03c18be10c2b7b6e99c8e21b112b
BLAKE2b-256 3c42e2d3c1394082ab1aa20427fd0c80da685bb7c5c4eebd39f6f5d4c8e60190

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 eb59a9c7e1a31a697347e44d62f4fbd50a2ea70180f71a174721b0557e181205
MD5 7d958c1853c1024f8bf8fead39d819c0
BLAKE2b-256 4c04503f6dd7ea14bf98493cfa172ebe0126961b323158629cb600722a8452b3

See more details on using hashes here.

File details

Details for the file 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.

File metadata

File hashes

Hashes for 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
Algorithm Hash digest
SHA256 c04aef71b7ba168c7b37ee438f6c7e9a4111a37bc68df31ad950c7df691c534c
MD5 0bc28f21f034a4f4de3b7b10eef37bbe
BLAKE2b-256 cb333b92bdbb24d9fb3ffb6f66c8f652af9926bbf190dce4bc548b8d5f56ebb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c24c6728f66552e76d482a6faa168c9f07eb46fd90774e8592664d49a806337b
MD5 2ca4bfd948555a5eb6a230eacc2da594
BLAKE2b-256 06628c5712ae90240de4cac446a2eabcfbfc73102a9c1657f64ec96edbfb9957

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.1.2-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c27acd17735d3a3bff915d6537565a92860d337808b697afe87720e60d2df9c1
MD5 aa8cd3f50a3008215c8641c5c9ff67ad
BLAKE2b-256 61b73ecae84dafb7d4ab77cd8729e80250e87374afca9668b4d0e74c90b8e660

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