Skip to main content

Hujson grammar for tree-sitter

Project description

tree-sitter-hujson

A tree-sitter grammar for HuJSON (Human JSON) — also known as JWCC (JSON With Commas and Comments).

HuJSON is a strict superset of JSON that adds exactly two features:

  • C-style comments — line comments (//) and block comments (/* */)
  • Trailing commas — optional trailing comma after the last element in arrays and objects

All valid JSON is valid HuJSON. HuJSON intentionally rejects all other extensions (unquoted keys, hex literals, Infinity/NaN, single-quoted strings, etc.).

The grammar registers both the .hujson and .jwcc file extensions.

Provenance

Forked from tree-sitter/tree-sitter-json at commit 001c28d.

The only semantic change is the commaSep helper, which now allows an optional trailing comma:

function commaSep1(rule) {
  return seq(rule, repeat(seq(',', rule)), optional(','));
}

The upstream grammar already supported comments, so no further changes were needed.

Consumers

  • Zed — via the ggfevans/zed-hujson extension
  • Neovim / Helix — usable directly via the standard tree-sitter grammar interface

Development

Prerequisites

  • Node.js 18+
  • tree-sitter-cli (npm install -g tree-sitter-cli)

Build & test

tree-sitter generate
tree-sitter test

The corpus suite covers literals, objects, arrays, comments, trailing commas, degenerate inputs (empty/whitespace/BOM/unicode/deeply nested), and invalid inputs (the strictness-preserving rejections).

Releasing

Releases are tag-driven. Bump the version in every manifest at once with scripts/bump-version.sh X.Y.Z, add a matching ## [X.Y.Z] entry to CHANGELOG.md, then push a vX.Y.Z tag. The Release workflow creates the GitHub Release and publishes the bindings.

Registry publishing degrades gracefully — each publish job runs only when its credential is configured, otherwise it is skipped (the GitHub Release always succeeds):

Registry Enable by configuring
npm repo secret NPM_TOKEN
crates.io repo secret CARGO_REGISTRY_TOKEN
PyPI repo variable PYPI_TRUSTED_PUBLISHER = true (after setting up a PyPI trusted publisher for this repo + release.yml; uses OIDC, no token)

To publish a registry you enabled after a tag was already cut, re-run the Release workflow for that tag — the now-present credential flips its job on.

Licence

MIT — matches the upstream tree-sitter-json licence.

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_hujson-0.2.3.tar.gz (9.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_hujson-0.2.3-cp38-abi3-win_amd64.whl (12.7 kB view details)

Uploaded CPython 3.8+Windows x86-64

tree_sitter_hujson-0.2.3-cp38-abi3-win32.whl (12.6 kB view details)

Uploaded CPython 3.8+Windows x86

tree_sitter_hujson-0.2.3-cp38-abi3-musllinux_1_2_x86_64.whl (18.4 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

tree_sitter_hujson-0.2.3-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (18.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_hujson-0.2.3-cp38-abi3-macosx_11_0_arm64.whl (11.1 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file tree_sitter_hujson-0.2.3.tar.gz.

File metadata

  • Download URL: tree_sitter_hujson-0.2.3.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tree_sitter_hujson-0.2.3.tar.gz
Algorithm Hash digest
SHA256 33a865a57781c470f516e75a03387cfb3379d899f35ec56315524bb64ccae54b
MD5 50930e5669b2026f04d8fc8a7a6a52aa
BLAKE2b-256 fdd4f041ffcce3ce8065bef67b6dd250b2dbd7cba9d86d123286e279925da60c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_hujson-0.2.3.tar.gz:

Publisher: release.yml on ggfevans/tree-sitter-hujson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_hujson-0.2.3-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_hujson-0.2.3-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 06cd092c7849212a4f158db8e6d7bf3149259be8c0c05f8f786406d4c7c429fd
MD5 8e43cb685876cf006085fdc5d335e8df
BLAKE2b-256 a6864f91e8a6d988aa92985e8cc078ab9a327ce0260642b29c4515b2601ad2c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_hujson-0.2.3-cp38-abi3-win_amd64.whl:

Publisher: release.yml on ggfevans/tree-sitter-hujson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_hujson-0.2.3-cp38-abi3-win32.whl.

File metadata

File hashes

Hashes for tree_sitter_hujson-0.2.3-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 433d8e2b9d6df4cb437646744e48f0dda815c55ee8735fb1093f4d12cc29c648
MD5 c2d54a15c2c985de0363dcaa05c4e08b
BLAKE2b-256 10dc52ce24b244baa5e095fcd0190d5ebcb115f5ebc412b03ac28f55e624d8c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_hujson-0.2.3-cp38-abi3-win32.whl:

Publisher: release.yml on ggfevans/tree-sitter-hujson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_hujson-0.2.3-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_hujson-0.2.3-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 101fa1bba3b9a3e1f4804136e21bbfce8ca67247ebdb44fc92e3deac98c1c2cc
MD5 fd17354850dccccf02b7c396de89d9e2
BLAKE2b-256 f3da3061a1859743352d25c4b976c2631617304b04021df1a61f1ddd28426569

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_hujson-0.2.3-cp38-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on ggfevans/tree-sitter-hujson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_hujson-0.2.3-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_hujson-0.2.3-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 b7eb655bc9605e9f735111291e526f8e76db0a901f74f91c113c5c86d4fe9379
MD5 2d927b23b85e8c6005e49f21824ac95b
BLAKE2b-256 bd5492b0330b9789997bc5b4382683f45187b6e5945f1fbf41d1cbf18b89bbdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_hujson-0.2.3-cp38-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl:

Publisher: release.yml on ggfevans/tree-sitter-hujson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_hujson-0.2.3-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_hujson-0.2.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6604a2d2d7bb1d48af5f5338ecbb771e02f84e28e76b09d8796d346d5e9f07b0
MD5 96a3a91eba8fd315075c99fea4db0234
BLAKE2b-256 8f83cc1c8284cd598a6457b584d9e1b54b42113b50a385f9ac22b78c22082d63

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_hujson-0.2.3-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on ggfevans/tree-sitter-hujson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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