# tree-sitter-cylc
[![CI][ci]](https://github.com/elliotfontaine/tree-sitter-cylc/actions/workflows/ci.yml)
[![pypi][pypi]](https://pypi.org/project/tree-sitter-python/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
A [Tree-Sitter](https://github.com/tree-sitter/tree-sitter) grammar for [Cylc](https://github.com/cylc/cylc-flow)'s workflow configurations.
<!-- <p align="center">
<img src="https://raw.githubusercontent.com/cylc/cylc-admin/master/docs/img/cylc-logo.svg" width="150" alt="Cylc Logo">
<img src="https://tree-sitter.github.io/tree-sitter/assets/images/tree-sitter-small.png" width="50" alt="Tree-Sitter Logo">
</p> -->
[ci]: https://img.shields.io/github/actions/workflow/status/elliotfontaine/tree-sitter-cylc/ci.yml?logo=github&label=CI
[pypi]: https://img.shields.io/pypi/v/tree-sitter-cylc?logo=pypi&logoColor=ffd242
## References
- [The `.cylc` File Format](https://cylc.github.io/cylc-doc/stable/html/reference/config/file-format.html#file-format)
- [Workflow Configuration](https://cylc.github.io/cylc-doc/stable/html/reference/config/workflow.html)
- [Global Configuration](https://cylc.github.io/cylc-doc/stable/html/reference/config/global.html)
## Syntax Highlighting
As a grammar, tree-sitter-cylc can be used to generate syntax highlighting for Cylc files in text editors that support Tree-Sitter. [`/queries/highlights.scm`](/queries/highlights.scm) and [`/queries/injections.scm`](/queries/injections.scm) can be used as a template to write queries for your target editor.
#### Supported Editors :
- [Zed](https://zed.dev/) — ✅[`zed-cylc`](https://github.com/elliotfontaine/zed-cylc)
- [Neovim](https://neovim.io/)
- [Helix](https://helix-editor.com/)
- [Lapce](https://lapce.dev/)
- [Pulsar](https://pulsar-edit.dev/)
- [GNU Emacs (≥ 29.1)](https://www.gnu.org/software/emacs/)
## Python Bindings
tree-sitter-cylc is available as a package on [PyPi](https://pypi.org/project/tree-sitter-python/). You can install it through pip:
```sh
pip install tree-sitter tree-sitter-cylc
```
You can then use the **tree_sitter_cylc** module to parse Cylc files from Python:
```py
import tree_sitter_cylc as tscylc
from tree_sitter import Language, Parser
CYLC_LANGUAGE = Language(tscylc.language())
parser = Parser(CYLC_LANGUAGE)
source_code = str(
"""
[runtime]
[[task_1]]
script = echo "Hello, World!"
"""
)
tree = parser.parse(bytes(source_code, "utf8"))
root_node = tree.root_node
runtime_section = root_node.children[0]
task_section = runtime_section.children[3]
setting = task_section.children[3]
value = setting.child_by_field_name("value")
assert root_node.type == "workflow_configuration"
assert root_node.start_point == (0, 0)
assert root_node.end_point == (4, 0)
assert runtime_section.type == "runtime_section"
assert task_section.type == "task_section"
assert setting.type == "setting"
assert value.type == "unquoted_string"
```
See [Tree-Sitter's Python bindings](https://github.com/tree-sitter/py-tree-sitter?tab=readme-ov-file#usage) documentation for more information.
## Contributing
Contributions and bug reports are welcome! Please submit a pull request or file an issue on the [GitHub repository](https://github.com/elliotfontaine/zed-cylc).
## License
[MIT](LICENSE)
Raw data
{
"_id": null,
"home_page": null,
"name": "tree-sitter-cylc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "incremental, parsing, tree-sitter, cylc",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/6f/de/100b74804d2162c00d6b1122c0591030ce20fc8f509a3daf7fc37829346e/tree_sitter_cylc-0.2.0.tar.gz",
"platform": null,
"description": "# tree-sitter-cylc\n\n[![CI][ci]](https://github.com/elliotfontaine/tree-sitter-cylc/actions/workflows/ci.yml)\n[![pypi][pypi]](https://pypi.org/project/tree-sitter-python/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\nA [Tree-Sitter](https://github.com/tree-sitter/tree-sitter) grammar for [Cylc](https://github.com/cylc/cylc-flow)'s workflow configurations.\n\n<!-- <p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/cylc/cylc-admin/master/docs/img/cylc-logo.svg\" width=\"150\" alt=\"Cylc Logo\">\n <img src=\"https://tree-sitter.github.io/tree-sitter/assets/images/tree-sitter-small.png\" width=\"50\" alt=\"Tree-Sitter Logo\">\n</p> -->\n\n[ci]: https://img.shields.io/github/actions/workflow/status/elliotfontaine/tree-sitter-cylc/ci.yml?logo=github&label=CI\n[pypi]: https://img.shields.io/pypi/v/tree-sitter-cylc?logo=pypi&logoColor=ffd242\n\n## References\n\n- [The `.cylc` File Format](https://cylc.github.io/cylc-doc/stable/html/reference/config/file-format.html#file-format)\n- [Workflow Configuration](https://cylc.github.io/cylc-doc/stable/html/reference/config/workflow.html)\n- [Global Configuration](https://cylc.github.io/cylc-doc/stable/html/reference/config/global.html)\n\n## Syntax Highlighting\n\nAs a grammar, tree-sitter-cylc can be used to generate syntax highlighting for Cylc files in text editors that support Tree-Sitter. [`/queries/highlights.scm`](/queries/highlights.scm) and [`/queries/injections.scm`](/queries/injections.scm) can be used as a template to write queries for your target editor.\n\n#### Supported Editors :\n\n- [Zed](https://zed.dev/) \u2014 \u2705[`zed-cylc`](https://github.com/elliotfontaine/zed-cylc)\n- [Neovim](https://neovim.io/)\n- [Helix](https://helix-editor.com/)\n- [Lapce](https://lapce.dev/)\n- [Pulsar](https://pulsar-edit.dev/)\n- [GNU Emacs (\u2265 29.1)](https://www.gnu.org/software/emacs/)\n\n## Python Bindings\n\ntree-sitter-cylc is available as a package on [PyPi](https://pypi.org/project/tree-sitter-python/). You can install it through pip:\n\n```sh\npip install tree-sitter tree-sitter-cylc\n```\n\nYou can then use the **tree_sitter_cylc** module to parse Cylc files from Python:\n\n```py\nimport tree_sitter_cylc as tscylc\nfrom tree_sitter import Language, Parser\n\nCYLC_LANGUAGE = Language(tscylc.language())\nparser = Parser(CYLC_LANGUAGE)\n\nsource_code = str(\n \"\"\"\n[runtime]\n [[task_1]]\n script = echo \"Hello, World!\"\n\"\"\"\n)\n\ntree = parser.parse(bytes(source_code, \"utf8\"))\n\nroot_node = tree.root_node\nruntime_section = root_node.children[0]\ntask_section = runtime_section.children[3]\nsetting = task_section.children[3]\nvalue = setting.child_by_field_name(\"value\")\n\nassert root_node.type == \"workflow_configuration\"\nassert root_node.start_point == (0, 0)\nassert root_node.end_point == (4, 0)\nassert runtime_section.type == \"runtime_section\"\nassert task_section.type == \"task_section\"\nassert setting.type == \"setting\"\nassert value.type == \"unquoted_string\"\n```\n\nSee [Tree-Sitter's Python bindings](https://github.com/tree-sitter/py-tree-sitter?tab=readme-ov-file#usage) documentation for more information.\n\n## Contributing\n\nContributions and bug reports are welcome! Please submit a pull request or file an issue on the [GitHub repository](https://github.com/elliotfontaine/zed-cylc).\n\n## License\n\n[MIT](LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Cylc grammar for tree-sitter",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/elliotfontaine/tree-sitter-cylc"
},
"split_keywords": [
"incremental",
" parsing",
" tree-sitter",
" cylc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8688e42685b124ae3b5649b2af637fbe5d567ae6ba2938a469d502eccc2b661a",
"md5": "b89cf3ff43c583ed7b4130aee9258b6f",
"sha256": "c8e0b05b16219c737231d600d2d4ad6829fa91a063fdf90495044f0aeb433acd"
},
"downloads": -1,
"filename": "tree_sitter_cylc-0.2.0-cp39-abi3-macosx_10_9_x86_64.whl",
"has_sig": false,
"md5_digest": "b89cf3ff43c583ed7b4130aee9258b6f",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 29447,
"upload_time": "2024-10-02T21:04:58",
"upload_time_iso_8601": "2024-10-02T21:04:58.909648Z",
"url": "https://files.pythonhosted.org/packages/86/88/e42685b124ae3b5649b2af637fbe5d567ae6ba2938a469d502eccc2b661a/tree_sitter_cylc-0.2.0-cp39-abi3-macosx_10_9_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8697d961ab06b17c84557ca65d8edd1cd7a8d337d4c7a33e35b7912c9e1d2d59",
"md5": "846ac85032654138f4de87ddbfebc0f7",
"sha256": "839a44eba8353fce551378773cfc55833bbc02bd956f5ce99aa8cfeff79eccf6"
},
"downloads": -1,
"filename": "tree_sitter_cylc-0.2.0-cp39-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "846ac85032654138f4de87ddbfebc0f7",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 27983,
"upload_time": "2024-10-02T21:05:00",
"upload_time_iso_8601": "2024-10-02T21:05:00.725622Z",
"url": "https://files.pythonhosted.org/packages/86/97/d961ab06b17c84557ca65d8edd1cd7a8d337d4c7a33e35b7912c9e1d2d59/tree_sitter_cylc-0.2.0-cp39-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c932859fb738d45b0b477e42f2e3d7d53444d132c34960a204ee9a3774eb7d6b",
"md5": "54586ea0a106307fb6adf6f0b5e0b4fa",
"sha256": "74526ec91b02f55409d8869d176cbedaa6b9ac3533ad4b03c0c54efdc02f0d87"
},
"downloads": -1,
"filename": "tree_sitter_cylc-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "54586ea0a106307fb6adf6f0b5e0b4fa",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 55238,
"upload_time": "2024-10-02T21:05:01",
"upload_time_iso_8601": "2024-10-02T21:05:01.554739Z",
"url": "https://files.pythonhosted.org/packages/c9/32/859fb738d45b0b477e42f2e3d7d53444d132c34960a204ee9a3774eb7d6b/tree_sitter_cylc-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "357a1daf75ce01599bd7612304bf891c6badf04be0334310395f3ddae6ca68aa",
"md5": "96c148e5064f0b2290de14410a45140e",
"sha256": "19f8faf76a7afb26628541d3de5257f2cb1aa878dcdc581d67900bdfaf1cca19"
},
"downloads": -1,
"filename": "tree_sitter_cylc-0.2.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "96c148e5064f0b2290de14410a45140e",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 53125,
"upload_time": "2024-10-02T21:05:02",
"upload_time_iso_8601": "2024-10-02T21:05:02.777782Z",
"url": "https://files.pythonhosted.org/packages/35/7a/1daf75ce01599bd7612304bf891c6badf04be0334310395f3ddae6ca68aa/tree_sitter_cylc-0.2.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e76aca0dc42810d1ba577bca97cd0847ec4a50692d5148d1ed09940e97191b1b",
"md5": "cc59be3b0e50203a7928849f0f51fd3e",
"sha256": "c12126f478820a78643d44a5697cbdc51098be4a41fc6e52a82712b4e2b29d33"
},
"downloads": -1,
"filename": "tree_sitter_cylc-0.2.0-cp39-abi3-musllinux_1_2_aarch64.whl",
"has_sig": false,
"md5_digest": "cc59be3b0e50203a7928849f0f51fd3e",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 55456,
"upload_time": "2024-10-02T21:05:03",
"upload_time_iso_8601": "2024-10-02T21:05:03.648602Z",
"url": "https://files.pythonhosted.org/packages/e7/6a/ca0dc42810d1ba577bca97cd0847ec4a50692d5148d1ed09940e97191b1b/tree_sitter_cylc-0.2.0-cp39-abi3-musllinux_1_2_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "32fa7758a15aa724ef6b9cd0ab008891a2fa9feaff8d762a07c7fce164ec8605",
"md5": "c72f890939304666604082e6aa4342e4",
"sha256": "42c7902c24e1cb2d81edcd41c4c4122556123fa29074b97fda7d005d4b3b92a9"
},
"downloads": -1,
"filename": "tree_sitter_cylc-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "c72f890939304666604082e6aa4342e4",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 52623,
"upload_time": "2024-10-02T21:05:05",
"upload_time_iso_8601": "2024-10-02T21:05:05.228942Z",
"url": "https://files.pythonhosted.org/packages/32/fa/7758a15aa724ef6b9cd0ab008891a2fa9feaff8d762a07c7fce164ec8605/tree_sitter_cylc-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "584c46a2811b0864b177cef96fbbc6277dab5c53967e151e273ecb780fc2636d",
"md5": "43bb010fe0d7f61dbdc05f9370b546a5",
"sha256": "a66a192015d55b1bdb458be844f5847a15c42d26bdf66e7ae05d73d37db3431e"
},
"downloads": -1,
"filename": "tree_sitter_cylc-0.2.0-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "43bb010fe0d7f61dbdc05f9370b546a5",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 27137,
"upload_time": "2024-10-02T21:05:06",
"upload_time_iso_8601": "2024-10-02T21:05:06.614189Z",
"url": "https://files.pythonhosted.org/packages/58/4c/46a2811b0864b177cef96fbbc6277dab5c53967e151e273ecb780fc2636d/tree_sitter_cylc-0.2.0-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7da3213b3677c3f37f9348011577cc6edf542ca3a92266fe9a9359e11a69534e",
"md5": "ab3906ef5bd740e4f1aaf42ba7a899ef",
"sha256": "79cc41ca16ec59ee50550d72da61ddf1a3fca2387ad2c41115ac5b148864c4a4"
},
"downloads": -1,
"filename": "tree_sitter_cylc-0.2.0-cp39-abi3-win_arm64.whl",
"has_sig": false,
"md5_digest": "ab3906ef5bd740e4f1aaf42ba7a899ef",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 25546,
"upload_time": "2024-10-02T21:05:07",
"upload_time_iso_8601": "2024-10-02T21:05:07.420296Z",
"url": "https://files.pythonhosted.org/packages/7d/a3/213b3677c3f37f9348011577cc6edf542ca3a92266fe9a9359e11a69534e/tree_sitter_cylc-0.2.0-cp39-abi3-win_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6fde100b74804d2162c00d6b1122c0591030ce20fc8f509a3daf7fc37829346e",
"md5": "2f7f69576bc3ea7ea8a655a0d4938256",
"sha256": "5594d833ea0e78d9e9f06d71a92bb62f33f369d4c94369e962f0b0c95d57b249"
},
"downloads": -1,
"filename": "tree_sitter_cylc-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "2f7f69576bc3ea7ea8a655a0d4938256",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 29845,
"upload_time": "2024-10-02T21:05:08",
"upload_time_iso_8601": "2024-10-02T21:05:08.252204Z",
"url": "https://files.pythonhosted.org/packages/6f/de/100b74804d2162c00d6b1122c0591030ce20fc8f509a3daf7fc37829346e/tree_sitter_cylc-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-02 21:05:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "elliotfontaine",
"github_project": "tree-sitter-cylc",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tree-sitter-cylc"
}