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

Uploaded CPython 3.10+Windows x86-64

tree_sitter_toon-0.0.5-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.5-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.5-cp310-abi3-macosx_10_9_x86_64.whl (26.8 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tree_sitter_toon-0.0.5.tar.gz
  • Upload date:
  • Size: 35.6 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.5.tar.gz
Algorithm Hash digest
SHA256 77034b92ada8fe370230e49a670124200a3f67a6765babcd87f220752ff19c6a
MD5 f4f72c4121bafa25e2a43c910545b86a
BLAKE2b-256 ce59874f2a99201d9fe4d628e7f9df2d514e0b141834b39e28125429d9e3c1f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.5-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 35446590461fde2368b10ef51255a938ed48f9b279d91a04df2c17de3489fe85
MD5 022fff7bcde1d5eca244c9596cacdd9e
BLAKE2b-256 f5bf4cbf90015838ddfe391ec2276d40fd2c7dccc81de92c4c999d51f523165b

See more details on using hashes here.

File details

Details for the file tree_sitter_toon-0.0.5-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.5-cp310-abi3-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 72550992d1efdd86d9f1ac4a9e6577f1978684c952b9aa448868f68960532b90
MD5 b68f04fccbdec02ba1e8803c2602af7b
BLAKE2b-256 afbd5e1d06b1206e9a47e974213664b6dd7940f0186fa53b539a58aab196ec18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a149c0400c18e731e8af1806d4289b07147b6ccc4c4a23ff8a6e546e83e8d92f
MD5 4a51211b3d881e7322b469c7c7c4c803
BLAKE2b-256 a480199f63c49abe0065445ae94c40e1a372457c499fd612cf621c379689295a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_toon-0.0.5-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 419f5ee7612f5c538fe4a472f6d3f043700a8a3caf45ff57e1f141ea4dcb44ba
MD5 fb7d94758d39d70a2774b111ba18a014
BLAKE2b-256 3c0e49d224a0492f869fb9a10735c0b25709e661e3319828aaf03a2e1970bdf3

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