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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tree_sitter_cfengine-1.1.11.tar.gz.
File metadata
- Download URL: tree_sitter_cfengine-1.1.11.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03d335c8ba549859e0e96a454949f246800e85d200c0ac9561af8c4b3b773b76
|
|
| MD5 |
620f2df2651b9509eb1e3741ec8c2149
|
|
| BLAKE2b-256 |
6686a9507198ac34c8ed2abbd340200546c4f1b05da1db455c8a79713c072709
|
File details
Details for the file tree_sitter_cfengine-1.1.11-cp39-abi3-win_arm64.whl.
File metadata
- Download URL: tree_sitter_cfengine-1.1.11-cp39-abi3-win_arm64.whl
- Upload date:
- Size: 14.8 kB
- Tags: CPython 3.9+, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80e82b9659b74f49095b4f26e256b58953da86dfbf586998f9972a852ee59c16
|
|
| MD5 |
c0ad4a02bd48b4408327f6f21076f1d1
|
|
| BLAKE2b-256 |
ec88c2c9e36e560d1c2494ba8afe3c51aa7df574bd3e5391dacdf4904aa0abe6
|
File details
Details for the file tree_sitter_cfengine-1.1.11-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: tree_sitter_cfengine-1.1.11-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 16.0 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37e16ee62cf4b38d86263cb6306313cf0d5542902e4ad770194e08af58e120a5
|
|
| MD5 |
74968a89d09b7296182fcb0250cd91f6
|
|
| BLAKE2b-256 |
51c144df84907633eb1ed12228268b785b0da98483e2b0314b7d1a4efcbf545c
|
File details
Details for the file tree_sitter_cfengine-1.1.11-cp39-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: tree_sitter_cfengine-1.1.11-cp39-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 23.8 kB
- Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97bcacccca21bd15db9a4e87a31e55aab5c1755d3c1d90f9304ac40d5d256a02
|
|
| MD5 |
a9645e660c2d42d584613fce0c248aaa
|
|
| BLAKE2b-256 |
c4eb20b4bfd677e6831ad4cdef6cb0ca494fdae546e86ab253a361e6277df2c7
|
File details
Details for the file tree_sitter_cfengine-1.1.11-cp39-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: tree_sitter_cfengine-1.1.11-cp39-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 25.5 kB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
505d3f6a7c683bbbe650b2a259cce2dfbd6d1d5d602da4d0077ce0de0cbb9188
|
|
| MD5 |
bb6b5ef0e41ba58c8b7c70108bbf46ad
|
|
| BLAKE2b-256 |
f1840023af45bc76d654e51e3a538120dc30284f6dfd78cbefd9d72366aaca91
|
File details
Details for the file tree_sitter_cfengine-1.1.11-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: tree_sitter_cfengine-1.1.11-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 26.4 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70ccdeb54db00a51f1501ac4d49583c53d9530f8bd6eaa5ffa5fd386d5db3c4c
|
|
| MD5 |
eaccb7a362a2605cf3afaaa1a2e2b220
|
|
| BLAKE2b-256 |
910d3c176aaf2028dbe47024fb0cc6009a3349976ceff06a969593b2925cb45b
|
File details
Details for the file tree_sitter_cfengine-1.1.11-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.
File metadata
- Download URL: tree_sitter_cfengine-1.1.11-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
- Upload date:
- Size: 24.0 kB
- Tags: CPython 3.9+, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e36cdc08ea1b37f39e4061fa8261ffd7e46144b16a0f6fe02b4b27dfb1aee33d
|
|
| MD5 |
cbf00627d65b6a32438c0d368e339950
|
|
| BLAKE2b-256 |
fedb8743511c594a01e325711ef2e8fb6324d32b7c7a9c5c9f7a2a146b8f72fa
|
File details
Details for the file tree_sitter_cfengine-1.1.11-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: tree_sitter_cfengine-1.1.11-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.6 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2568a43dabafdceb7d2eb8277f380898fa6f2cfc5118a8f6fffa8e999158bd2
|
|
| MD5 |
93c91225b24e9b54c9c41daa3c9a048e
|
|
| BLAKE2b-256 |
9b2d76a80aabfe18e27b7cc3e80946b3c7b0a60f2f65deb3ba81d5df8392c7b2
|
File details
Details for the file tree_sitter_cfengine-1.1.11-cp39-abi3-macosx_10_9_x86_64.whl.
File metadata
- Download URL: tree_sitter_cfengine-1.1.11-cp39-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 13.0 kB
- Tags: CPython 3.9+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcb878977f5d6d09768cb5e69b293b1f47dadfe50155724d0032deddf92f76c9
|
|
| MD5 |
01b47241e571ec6b3fed3d39970cd5bb
|
|
| BLAKE2b-256 |
71633d0bd0cf595b59131e18087be89381f64f3d17e5ddcaf93c3e36cdabdd1b
|