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.10.tar.gz (16.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_cfengine-1.1.10-cp39-abi3-win_arm64.whl (14.8 kB view details)

Uploaded CPython 3.9+Windows ARM64

tree_sitter_cfengine-1.1.10-cp39-abi3-win_amd64.whl (16.0 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_cfengine-1.1.10-cp39-abi3-musllinux_1_2_x86_64.whl (25.2 kB view details)

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

tree_sitter_cfengine-1.1.10-cp39-abi3-musllinux_1_2_aarch64.whl (26.1 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_cfengine-1.1.10-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (26.9 kB view details)

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

tree_sitter_cfengine-1.1.10-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (25.4 kB view details)

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

tree_sitter_cfengine-1.1.10-cp39-abi3-macosx_11_0_arm64.whl (13.6 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

tree_sitter_cfengine-1.1.10-cp39-abi3-macosx_10_9_x86_64.whl (13.0 kB view details)

Uploaded CPython 3.9+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tree_sitter_cfengine-1.1.10.tar.gz
  • Upload date:
  • Size: 16.5 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.10.tar.gz
Algorithm Hash digest
SHA256 7047c413f6325d63bb55565571d93a83b438ef3a0046787d0b378d785be75687
MD5 b65f91d7fd8bfa3409dd61ccf5ee208e
BLAKE2b-256 7519022fbc48243e1766d783d94df10e89ee40bde52a16c25e7b9feaa4fea1bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.10-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 66ff72d9d0f92a9a734641b441bfb9ee6ff34c582dc3b1b2ac6846c1fc2d427a
MD5 61f292a3b2cc106e69ffc334fe4eb713
BLAKE2b-256 829faa21a2c6bcfaa94df20bd0f3043e7bf10526df6345562fb7b05b028c6a4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.10-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 054167f608ca71a99f955cdfa806094b8266e1c47219808097bb793f6d692c88
MD5 9a532948d4a815f34304446870b4bbcc
BLAKE2b-256 c3b30aee297041dcd4895eabcb4528e55912dbc52d5ddf8e483c143b4b2612e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.10-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 39b4cab0321a5fedcb6e3cf00bd5a97808df27d357465ea92439af70af690b90
MD5 acb987896302e7560dc52f0f9116e840
BLAKE2b-256 600b821560a38f44ac326ea0fc10e432c0105730598fe8b6408b096401153cb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.10-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 55a64eaa590bdb48748864f8fdf0c61d921996fc7c88f964f04c618288f6b35d
MD5 95b045f2fb4881a5c019683d14dddabc
BLAKE2b-256 1e1dd86a60531185a54372b844097bd1775e2b23191dc2610668b74609e178f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.10-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 56fcfe802e1138d594ad082903ca0c5e507b4a71228fe675481f109846289fda
MD5 458c36c40ae0c43b1741b2fde534871e
BLAKE2b-256 b60a2134943d59eff5e55ac3890809ddaaa4c6909173077d46775d7e869c5377

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.10-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.10-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 06a38b2837ca2456c5c7f518df5d64d0af6430a4d315ea8a374c07dba36c1d34
MD5 e0693f95c83592131e9b8e9557fcaf81
BLAKE2b-256 9f5a383e9900154e1f53023e7178009564f50301183696fb48be366b826cff70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.10-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f9be7f1aca84714a60ecd3cb141f03c1a86bac4e1893f96337d92021d3053dc1
MD5 3a4c081216444aae7c76fdfb6b08977e
BLAKE2b-256 3532a1632d22b5740765beef702746283e3fe5b31781e33e0ce50f4c7e7fe77b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.10-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 08bfee88922674058c1ba9b5611f62d5f8f745abf85a209e398a9987f5d8484c
MD5 aef5d1d2c3af4ea6cf84d6b32a72046e
BLAKE2b-256 aec546e76b6141f961c6822e2466e8940643cfb85acd37057bcf35d15eb93c2e

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