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

Uploaded CPython 3.10+Windows x86-64

tree_sitter_toon-0.0.8-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl (52.0 kB view details)

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

tree_sitter_toon-0.0.8-cp310-abi3-macosx_11_0_arm64.whl (27.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_toon-0.0.8-cp310-abi3-macosx_10_9_x86_64.whl (27.5 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tree_sitter_toon-0.0.8.tar.gz
  • Upload date:
  • Size: 35.7 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.8.tar.gz
Algorithm Hash digest
SHA256 e9b4ae3aea805734ec823c4c449c9348ca857f78a0aa973690b6988adafaad79
MD5 59521099cd1ac0462f441ecee67e9a5d
BLAKE2b-256 0dbb9818cd48493b45033b9ac0c044e2b9462d627202ac27e073541e28ab9a69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.8-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 974a4f7af00d1d422b0074b54090c66231ef7b20e6b9390034d1ad2500127741
MD5 27696f330da82b764c1c9a72b6ba1683
BLAKE2b-256 6ca8b325bacbef63f66d75631b8cb3f74802278b863cfa4167784a4621f7a30d

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.0.8-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.8-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c0d55d333367bc40d175fc0dd515c6c0bee3ea8426594f904733e4d6ad13f5b9
MD5 6c0123a2d33d1b260a7bffb4e3edb79e
BLAKE2b-256 a3dc8dc7167ae1ba9f5b8ee21fe92aded65a9faae49b92eea5abb911133c7e93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.8-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7edc458d5fa801da40947a78174c4457416e70443ea5fe42174fe393f4e1f83d
MD5 3e9e06fbf022d84ecab9e236276a329f
BLAKE2b-256 b74166914bf1f512d4f004ebbe7e0d2cb298db5d771c5b53b7e8b51565c7eaf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.8-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88f6c494eae202f395cc0f9f4173fc0a72b3f7eddc03fdd6bf12d05bb866e4cf
MD5 7308513d6be092165277667676f0103b
BLAKE2b-256 f35455e4ef121d81a139db3cb5d7c6a5cb21ec233ad65aa5d103734b86418d75

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