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.9.tar.gz (37.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.0.9-cp310-abi3-win_amd64.whl (31.7 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_toon-0.0.9-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (68.8 kB view details)

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

tree_sitter_toon-0.0.9-cp310-abi3-macosx_11_0_arm64.whl (31.8 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_toon-0.0.9-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.9.tar.gz.

File metadata

  • Download URL: tree_sitter_toon-0.0.9.tar.gz
  • Upload date:
  • Size: 37.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.0.9.tar.gz
Algorithm Hash digest
SHA256 8c46e6b97121ed9195597cc02bca4c4500d53a1119fe11679b5e6cfbeadbfe00
MD5 26ca99e32cc682a9681cab30ad0e65e2
BLAKE2b-256 54c641159f266301fc8a61a3e1da960f3df53362def38f903c43ccd7f44eac88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.9-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f23a6fafc2f17c7c5742660ba939e99bc14b669d2b82d6f460778b5cb4df89f0
MD5 8d72d8be2ffd10abed3c505260afba85
BLAKE2b-256 c957269350f3407cb8828992e0b5be9e1a6c88f52fb43402b1516e5dcf3f450c

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.0.9-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.9-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 90f30c27feaaf062d2d8854f70953608b271b079b1831ebdea3e3008750b1e5f
MD5 1359436ff88ff1b8ce317054d09be2dc
BLAKE2b-256 1b2462a021d1dfe4b42d9633122e7bf3ee655db18d0d1cca0f5d02cbfbbaa99c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.9-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb53b036435e35f4453c7141e0efa8083b8d3c97eb0cf51ddd1bad953bcb592f
MD5 4abba8b5a3e913f38d799c9cf88065cd
BLAKE2b-256 ae07f559be7bdaa50ad6434a0cd444dfb9eba84073522f15bafcf80d5e52ec80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.9-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 711cb9d0494b9bd27d52d712280470865be3b7f258641d50b7b542803ccf96c6
MD5 db5865814cc3735919ab1f91564c0164
BLAKE2b-256 80bf1521f496494d31e2140df4b71e252a62d1e0c99775713f710528e3277657

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