Skip to main content

CFEngine grammar for tree-sitter

Project description

Tree sitter grammar for CFEngine policy language

This tree-sitter grammar parses CFEngine policy language and turns it into an abstract syntax tree. It is used to provide syntax highlighting in the Zed editor, via this extension:

https://github.com/olehermanse/zed-cfengine

The grammar currently supports all major features of the language, including:

  • Bundle blocks
  • Body blocks
  • Promise type definition blocks
  • Promise types, class guards, promises, stakeholders (promisees)
  • Macros
  • Function calls
  • Lists, strings, expansions (with $() and @())

Todos

  • Using the grammar for linting / syntax checking (language server)
  • Highlighting inside strings and comments
  • Recognizing when there is JSON inside policy
  • Class guards which are quoted strings
  • Using the grammar for code indentation
  • Using the grammar for extensions to other editors

Before contributing for the first time, it's recommended to go through the tree-sitter tutorial for getting familiar with how everything works:

https://tree-sitter.github.io/tree-sitter/creating-parsers

Inspired by Lars Erik Wik's initial implementation available here:

https://github.com/larsewi/tree-sitter-cfengine

Run containerized tests locally:

docker build --tag tree-sitter-cfengine .

Making changes

After making changes to grammar.js, run the the commands below to generate, build, and test:

tree-sitter generate && tree-sitter build && tree-sitter test

In tree-sitter projects, it is normal to commit the files generated / edited by the tree-sitter tooling. Once it is working and tests are passing, commit the changes (including src/ folder with generated files).

Updating dependencies

npm update --save && cargo update && uv sync --upgrade

Creating a new release

Creating a release in GitHub will not work. To create a new release, you need to make a commit and tag locally, and push it. First ensure you have a clean git repo without any uncommitted changes. Then, run the releas script:

bash release.sh 1.2.3

GitHub Actions will start when a tag is pushed, and the action will create the "Release" in GitHub, as well as pypi, npm, and crates.io:

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_cfengine-1.1.9.tar.gz (16.3 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_cfengine-1.1.9-cp39-abi3-win_arm64.whl (14.7 kB view details)

Uploaded CPython 3.9+Windows ARM64

tree_sitter_cfengine-1.1.9-cp39-abi3-win_amd64.whl (15.9 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_cfengine-1.1.9-cp39-abi3-musllinux_1_2_x86_64.whl (25.0 kB view details)

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

tree_sitter_cfengine-1.1.9-cp39-abi3-musllinux_1_2_aarch64.whl (26.0 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_cfengine-1.1.9-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (26.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

tree_sitter_cfengine-1.1.9-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (25.3 kB view details)

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

tree_sitter_cfengine-1.1.9-cp39-abi3-macosx_11_0_arm64.whl (13.5 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

tree_sitter_cfengine-1.1.9-cp39-abi3-macosx_10_9_x86_64.whl (12.9 kB view details)

Uploaded CPython 3.9+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_cfengine-1.1.9.tar.gz.

File metadata

  • Download URL: tree_sitter_cfengine-1.1.9.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tree_sitter_cfengine-1.1.9.tar.gz
Algorithm Hash digest
SHA256 b6b9520d25e3dc2933a32015b89531f3c5647fb0a90f2ced9fe5c51467807475
MD5 ed4e970827dc760222ba73c76b412d82
BLAKE2b-256 8c404f2cffb41077bbc5565a5e7096c172eba1cff3ff040595b2a7c6c72c1bf1

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.9-cp39-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.9-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 b4b5081eb47e83fd809e6a93f114ba11a30f4e7a8594edf2c9cf0df19f8d5d19
MD5 1a9698d495f8cb4d0cad998ab6f391ce
BLAKE2b-256 8b46fd759a788253f86bb6107f6b8597f1ad1a4389137009fd03458a4c431cff

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.9-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.9-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 dd7b1dff104a3d5ff61208c06d094d4445d796aa04c2fc03458822e1f3b21413
MD5 04d93977034cb9413ee056336bee30b8
BLAKE2b-256 e9d447b568f84f0779f4143ee95cb64a6af599b5a08b4a95f7a58f0635b7f769

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.9-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.9-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 da1e7c71a40ce5c402eb5f71f22027e12a3c783f11133eeb3506c2df43655608
MD5 019edb422969f37a48729d73f0f3f1f5
BLAKE2b-256 b6a2ad444009eb0ba0194dd2fc4a681d24373af7271c099de1bd931820ede45d

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.9-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.9-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 1afea7581dfd8b0256b2cfcb55708600cafb13355e6ed103f01bd900ed2fb6af
MD5 acfd5a175f19969d3ae4ff36c839c011
BLAKE2b-256 28888dd7f90cf9f96095f85d012fa3a3bb87719415793e7b895a71104af99857

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.9-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.9-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 125f32836d861e578e6f68c8093461e38ab242f87ba3c7310e19757c3eb461f5
MD5 abd9479d5cc4b5fffd5ee277feb379a8
BLAKE2b-256 ab5250ab7b7adbc1d98abaaf4d8b42614fad24be1466bb6bd0b7608b08c84bad

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.9-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.9-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 c7134d861ad3573eead6626ae81fac47b02105116d881af964f6ddc993bfe5ce
MD5 1e6b0b610c5b9084852752d5111fd696
BLAKE2b-256 18d09a1df447f4b5881f41ae8dfd58942d1b0d9ff664d0a513bdd82e803f2dfb

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.9-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.9-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7337a410fdd9222b948d1f2fc76c0f8d276fcc8b7edf446ba142f1e4c32d260e
MD5 f213b39beffebf146c9c47325c400828
BLAKE2b-256 51d5b2d5bb948c25002b7b377887637c6e15e94d6137f57cc44b70eb57936018

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.9-cp39-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.9-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9fd808f2e0511701af68b025f1d13b489c36916070a4fd33dce11c1a696cb966
MD5 2ee750174717b65cb565f9a101f08064
BLAKE2b-256 d86c3cb3ca8b2743071711d58af83af9c98b70b4b0b091e628f0ca695367ae11

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