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.12.tar.gz (16.8 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.12-cp39-abi3-win_arm64.whl (14.8 kB view details)

Uploaded CPython 3.9+Windows ARM64

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

Uploaded CPython 3.9+Windows x86-64

tree_sitter_cfengine-1.1.12-cp39-abi3-musllinux_1_2_x86_64.whl (23.9 kB view details)

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

tree_sitter_cfengine-1.1.12-cp39-abi3-musllinux_1_2_aarch64.whl (25.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_cfengine-1.1.12-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (26.5 kB view details)

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

tree_sitter_cfengine-1.1.12-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (24.1 kB view details)

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

tree_sitter_cfengine-1.1.12-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.12-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.12.tar.gz.

File metadata

  • Download URL: tree_sitter_cfengine-1.1.12.tar.gz
  • Upload date:
  • Size: 16.8 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.12.tar.gz
Algorithm Hash digest
SHA256 98a0524acb41988a18dce91f915c61248e979dfe227ee86e45bf81f00816dde2
MD5 5d64520e5890a2aa68a03e2335d74f83
BLAKE2b-256 b6826c587bacd4983ceb767afb8f38c99a281e09f1ad0bc8128ecf3d0000535d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.12-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 1d883df6aaae4882080c247cbc0f2b756f94bf731ca9886d1573931561251dc8
MD5 b7a66dc976410c048b48ac2eabad424d
BLAKE2b-256 e0baa2cff11544e136d78a5f2a62edac9ed7fc3e77a51d8c712a61882b606c1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.12-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f6fc2b06fb9484c6775e21171d162e21dec1645ad3e9be6a389294e108b75f4b
MD5 55bf0033ec8b87fdd247d8eac296e5c4
BLAKE2b-256 2bf5afa98aa454a0cf0ea9215c0f853fdbbb332ee627582b1f979747ed14b850

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.12-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1bf058a38376ab0673ec13faa8cbd9e83e062b7cab633cddd4a2ebca59f2598e
MD5 23e6364f7fe9a962083d66124105710b
BLAKE2b-256 6e044ca7634e95bd165ed4390595d38bd8ca0fd773b62fdc81fff0133fab39aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.12-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 3d0f1552d3ae3ac0926b214a2f7d3d3ab1b7cbc80d8c2e0188cd088d50de1677
MD5 50dce9531760b47d3d4495fbabd2bb1b
BLAKE2b-256 7eb2129a14ea4df6dd6d2ca916dd374c35456cc6fbd93356cdc9d3ccd707810b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.12-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7ee214229b47943d040e1f417c1e90fba13b0cde42447dab9ea8e5b8fa835e6d
MD5 8dbe97bad9a34f3243dcba377f18e9cd
BLAKE2b-256 fef63a333a3642fc361245ae759ce5cd47ad2b1794ae8f3b5495447b6c6abbc6

See more details on using hashes here.

File details

Details for the file tree_sitter_cfengine-1.1.12-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.12-cp39-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 6c63ddb5ca3e493a3ebc2e4ff6a3d0f881ec4455ca465bee274ebf2df409e2d1
MD5 6aed556f47a495dfafb18f5e29af47d7
BLAKE2b-256 6bb24dd66177c89863e88806fbd1d3fd90f049c415e2ff0d514290a14e21b7f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.12-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7d8e251ab24f5fec347d32c4aa469f76354060625d2b1d977daa525a60f22d0d
MD5 d635b18582c09e8f32641f5c7ff31907
BLAKE2b-256 7134ee8e71c7b055a6c72d0426193407a95fa266f76b72b44ef74e2e87b672be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_cfengine-1.1.12-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 439a686b5c42059b215460d9f00b403a18cf8885230616db6245c5316a17a291
MD5 c06d0515714738102c75f66fb92b2733
BLAKE2b-256 d4cfebd9d6c01251c7072ddb2c5ddedc012984cd058bdcdd5c7d523ab0463a9f

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